Presentation is loading. Please wait.

Presentation is loading. Please wait.

Status – Week 252 Victor Moya. Summary Command Processor. Command Processor. Memory Controller. Memory Controller. Streamer. Streamer. Rasterizer. Rasterizer.

Similar presentations


Presentation on theme: "Status – Week 252 Victor Moya. Summary Command Processor. Command Processor. Memory Controller. Memory Controller. Streamer. Streamer. Rasterizer. Rasterizer."— Presentation transcript:

1 Status – Week 252 Victor Moya

2 Summary Command Processor. Command Processor. Memory Controller. Memory Controller. Streamer. Streamer. Rasterizer. Rasterizer. Vertex buffers in OpenGL. Vertex buffers in OpenGL. ARB_vertex_buffer_object. ARB_vertex_buffer_object. TraceDriver. TraceDriver.

3 Command Processor Memory Controller Streamer Vertex Shader CommProcMemoryWrite CommProcMemoryRead StreamerMemoryReq StreamerMemoryReadStreamerCrontrol StreamerState ShaderStateShaderCommand

4 Vertex Shader Command Processor CommShaderCommand CommShaderState Rasterizer (Fake) ShaderOutput ConsumerState RasterizerCommand RasterizerState

5 Memory Controller MemoryModule Rasterizer (Fake) RastMemoryRead RastMemoryRequest

6 Command Processor Stores all GPU state (debug?). Stores all GPU state (debug?). Receives data from AGP and sends it to the Memory Controller. Receives data from AGP and sends it to the Memory Controller. Receives state changes and sends them to the GPU units. Receives state changes and sends them to the GPU units. Receives commands and issues them to the GPU units. Receives commands and issues them to the GPU units.

7 Command Processor Missing some comunication code with the other units (shaders, rasterizer). Missing some comunication code with the other units (shaders, rasterizer). Missing commands to other units. Missing commands to other units. Missing code for some states. Missing code for some states. Missing AGP_READ and AGP_REG_READ (not useful right now). Missing AGP_READ and AGP_REG_READ (not useful right now).

8 Memory Controller Access to memory modules => Signal. Access to memory modules => Signal. To decide: number of transactions in process at the same time. To decide: number of transactions in process at the same time. Currently only one transaction at a time. Currently only one transaction at a time. Support multiple modules and multiple banks per module. Support multiple modules and multiple banks per module.

9 Streamer Two modes: Two modes: Streaming mode. Streaming mode. Index based streaming mode. Index based streaming mode. Streaming mode: Streaming mode: 1) get data for each active attribute. 1) get data for each active attribute. 2) store vertex input data in the FIFO. 2) store vertex input data in the FIFO. 3) send vertex input to a vertex shader. 3) send vertex input to a vertex shader. 4) repeat until end. 4) repeat until end.

10 Streamer Index based streaming mode: Index based streaming mode: 1) get index data. 1) get index data. 2) get vertex attribute data using index information. 2) get vertex attribute data using index information. 3) store vertex input in FIFO. 3) store vertex input in FIFO. 4) send vertex input to vertex shader. 4) send vertex input to vertex shader. 5) repeat until end. 5) repeat until end.

11 Streamer Accessing to attribute data in stream mode: Accessing to attribute data in stream mode: Direct access. Direct access. Double buffer (pipelined: read first, process first/read second, read first/process second). Double buffer (pipelined: read first, process first/read second, read first/process second). Accessing to attribute data in index mode: Accessing to attribute data in index mode: Attribute buffer could work like a cache? Attribute buffer could work like a cache? Number of attributes per ‘cache line’. Number of attributes per ‘cache line’. Replacement policy. Replacement policy.

12 Streamer from Memory Controller Attribute Buffers (16?) Vertex Input Vertex FIFO to Vertex Shader Index Buffer

13 Rasterizer Fake rasterizer. Fake rasterizer. Emulates: Emulates: Division by w. Division by w. Clipping. Clipping. Culling. Culling. Rasterization. Rasterization. Fragment and texturing. Fragment and texturing. OpenGL/GLUT wrapper. OpenGL/GLUT wrapper.

14 Rasterizer Setup OpenGL/GLUT: Setup OpenGL/GLUT: Window size and format. Window size and format. Rasterization settings: Rasterization settings: Projection mode. Projection mode. Clip planes. Clip planes. Textures. Textures. … Stores transformed vertexs. Stores transformed vertexs. Draws transformed vertexs (OpenGL). Draws transformed vertexs (OpenGL). Framebuffer swap. Framebuffer swap.

15 Vertex Arrays in OpenGL Array definition functions: Array definition functions: VertexPointer(int size, enum type, sizei stride, void *pointer). VertexPointer(int size, enum type, sizei stride, void *pointer). NormalPointer(enum type, sizei stride, void *pointer). NormalPointer(enum type, sizei stride, void *pointer). ColorPointer(int size, enum type, sizei stride, void *pointer). ColorPointer(int size, enum type, sizei stride, void *pointer). SecondaryColorPointer(int size, enum type, sizei stride, void *pointer). SecondaryColorPointer(int size, enum type, sizei stride, void *pointer). IndexPointer(enum type, sizei stride, void *pointer). IndexPointer(enum type, sizei stride, void *pointer). FogCoordPointer(enum type, sizei stride, void *pointer). FogCoordPointer(enum type, sizei stride, void *pointer). TexCoordPointer(int size, enum type, sizei stride, void *pointer). TexCoordPointer(int size, enum type, sizei stride, void *pointer). EdgeFlagPointer(sizei stride, void *pointer). EdgeFlagPointer(sizei stride, void *pointer). VertexAttribPointerARB(uint index, int size, enum type, boolean normalized, sizei stride, const void *pointer). VertexAttribPointerARB(uint index, int size, enum type, boolean normalized, sizei stride, const void *pointer). InterleavedArrays(enum format, sizei stride, void *pointer). InterleavedArrays(enum format, sizei stride, void *pointer).

16 Vertex Arrays in OpenGL Array drawing functions: Array drawing functions: DrawArrays(enum mode, int first, sizei count). DrawArrays(enum mode, int first, sizei count). MultiDrawArrays(enum mode, int *first, sizei *count, sizei primcount). MultiDrawArrays(enum mode, int *first, sizei *count, sizei primcount). DrawElements(enum mode, sizei count, enum type, void *indices). DrawElements(enum mode, sizei count, enum type, void *indices). MultiDrawElements(enum mode, sizei *count, enum type, void **indices, sizei primcount). MultiDrawElements(enum mode, sizei *count, enum type, void **indices, sizei primcount). DrawRangeElements(enum mode, uint start, unit end, sizei count, enum type, void *indices). DrawRangeElements(enum mode, uint start, unit end, sizei count, enum type, void *indices).

17 ARB_vertex_buffer_object BindBufferARB(enum target, uint buffer). BindBufferARB(enum target, uint buffer). DeleteBuffersARB(sizei n, const uint *buffers). DeleteBuffersARB(sizei n, const uint *buffers). GenBuffersARB(sizei n, uint *buffers). GenBuffersARB(sizei n, uint *buffers). boolean IsBufferARB(uint buffer). boolean IsBufferARB(uint buffer). BufferDataARB(enum target, sizeiptrARB size, const void *data, enum usage). BufferDataARB(enum target, sizeiptrARB size, const void *data, enum usage). BufferSubDataARB(enum target, intptrARB offset, sizeiptrARB size, const void *data). BufferSubDataARB(enum target, intptrARB offset, sizeiptrARB size, const void *data). GetBufferSubDataARB(enum target, intptrARB offset, sizeiptrARB size, void *data). GetBufferSubDataARB(enum target, intptrARB offset, sizeiptrARB size, void *data). void *MapBufferARB(enum target, enum access). void *MapBufferARB(enum target, enum access). boolean UnMapBufferARB(enum target). boolean UnMapBufferARB(enum target).

18 ARB_vertex_buffer_object target: target: ARRAY_BUFFER_ARB. ARRAY_BUFFER_ARB. ELEMENT_ARRAY_BUFFER_ARB. ELEMENT_ARRAY_BUFFER_ARB. usage: usage: STREAM_DRAW_ARB STREAM_DRAW_ARB STREAM_READ_ARB STREAM_READ_ARB STREAM_COPY_ARB STREAM_COPY_ARB STATIC_DRAW_ARB STATIC_DRAW_ARB STATIC_READ_ARB STATIC_READ_ARB STATIC_COPY_ARB STATIC_COPY_ARB DYNAMIC_DRAW_ARB DYNAMIC_DRAW_ARB DYNAMIC_READ_ARB DYNAMIC_READ_ARB DYNAMIC_COPY_ARB DYNAMIC_COPY_ARB

19 ARB_vertex_buffer_object access: access: READ_ONLY_ARB. READ_ONLY_ARB. WRITE_ONLY_ARB. WRITE_ONLY_ARB. READ_WRITE_ARB. READ_WRITE_ARB.

20 TraceDriver Translates driver traces to AGP Transactions for the Command Processor. Translates driver traces to AGP Transactions for the Command Processor. Uses TraceReader. Uses TraceReader. Interface: Interface: startTrace(). startTrace(). bool nextAGPTransaction(AGPTransaction *agpTrans). bool nextAGPTransaction(AGPTransaction *agpTrans).

21 TraceDriver OpenGL trace example: OpenGL trace example: wglChoosePixelFormat(0x460108C9,... wglDescribePixelFormat(0x460108C9,4,40,... wglChoosePixelFormat(0x460108C9,... wglDescribePixelFormat(0x460108C9,4,40,... wglSetPixelFormat(0x460108C9,4,... wglGetPixelFormat(0x460108C9) = 4 wglDescribePixelFormat(0x460108C9,4,40,... wglGetPixelFormat(0x460108C9) = 4 wglDescribePixelFormat(0x460108C9,1,0,) = 75 wglCreateContext(0x460108C9) = 0x10000 wglGetCurrentContext() = 0x0 wglGetCurrentDC() = 0x0 wglGetPixelFormat(0x460108C9) = 4 wglDescribePixelFormat(0x460108C9,4,40,...

22 TraceDriver GLX (X11) and wgl (win32) display and window initializations. GLX (X11) and wgl (win32) display and window initializations. Just ignore for now. Just ignore for now. Important information: Important information: pixel/framebuffer format. pixel/framebuffer format. But we can pass without it for now: But we can pass without it for now: assume 32bits RGBA (8 bits per component) standard fb format. assume 32bits RGBA (8 bits per component) standard fb format.

23 TraceDriver Example: Example: glClearColor(0.000000,0.000000,0.000000,0.000000)glShadeModel(GL_FLAT) wglGetCurrentContext() = 0x10000 wglGetCurrentDC() = 0x460108C9 glViewport(0,0,250,250)glMatrixMode(GL_PROJECTION)glLoadIdentity()glOrtho(-50.000000,50.000000,-50.000000,50.000000,-1.000000,1.000000)glMatrixMode(GL_MODELVIEW)glLoadIdentity()

24 TraceDriver glClearColor(0.000000,0.000000,0.000000,0.000000) glClearColor(0.000000,0.000000,0.000000,0.000000) AGP_REG_WRITE: GPU_COLOR_BUFFER_CLEAR, (u32bit?)0 AGP_REG_WRITE: GPU_COLOR_BUFFER_CLEAR, (u32bit?)0 glShadeModel(GL_FLAT) glShadeModel(GL_FLAT) AGP_REG_WRITE: GPU_INTERPOLATION, TRUE AGP_REG_WRITE: GPU_INTERPOLATION, TRUE wglGetCurrentContext() = 0x10000 wglGetCurrentContext() = 0x10000 wglGetCurrentDC() = 0x460108C9 ignore for now. ignore for now. glViewport(0,0,250,250) glViewport(0,0,250,250) AGP_REG_WRITE: GPU_VIEWPORT_INI_X, 0 AGP_REG_WRITE: GPU_VIEWPORT_INI_X, 0 AGP_REG_WRITE: GPU_VIEWPORT_INI_Y, 0 AGP_REG_WRITE: GPU_VIEWPORT_INI_Y, 0 AGP_REG_WRITE: GPU_VIEWPORT_HEIGHT AGP_REG_WRITE: GPU_VIEWPORT_HEIGHT AGP_REG_WRITE: GPU_VIEWPORT_WIDTH AGP_REG_WRITE: GPU_VIEWPORT_WIDTH

25 TraceDriver glMatrixMode(GL_PROJECTION) glMatrixMode(GL_PROJECTION) Driver internal state -> Current matrix is the projection matrix. Driver internal state -> Current matrix is the projection matrix. Changes to matrix state affect only to the internal projection matrix. Changes to matrix state affect only to the internal projection matrix. glLoadIdentity() glLoadIdentity() Driver internal state -> load current matrix with identity matrix. Driver internal state -> load current matrix with identity matrix. glOrtho(-50.000000,50.000000,-50.000000,50.000000,-1.000000,1.000000) glOrtho(-50.000000,50.000000,-50.000000,50.000000,-1.000000,1.000000) Selects orthogonal projection (?): Selects orthogonal projection (?): AGP_REG_WRITE: GPU_PROJECTION, ORTHOGONAL AGP_REG_WRITE: GPU_PROJECTION, ORTHOGONAL Creates and stores orthogonal projection matrix. Creates and stores orthogonal projection matrix.

26 TraceDriver glMatrixMode(GL_MODELVIEW) glMatrixMode(GL_MODELVIEW) Driver internal state -> Current matrix is the model view matrix. Driver internal state -> Current matrix is the model view matrix. Changes to matrix state affect only to the internal model view matrix. Changes to matrix state affect only to the internal model view matrix. glLoadIdentity() glLoadIdentity() Driver internal state -> load current matrix with identity matrix. Driver internal state -> load current matrix with identity matrix.

27 TraceDriver Example: Example: wglGetCurrentContext() = 0x10000 wglGetCurrentDC() = 0x460108C9 glClear(GL_COLOR_BUFFER_BIT)glPushMatrix()glRotatef(2.000000,0.000000,0.000000,1.000000)glColor3f(1.000000,1.000000,1.000000)glRectf(-25.000000,-25.000000,25.000000,25.000000)glPopMatrix() wglSwapBuffers(0x460108C9) = TRUE

28 TraceDriver wglGetCurrentContext() = 0x10000 wglGetCurrentContext() = 0x10000 wglGetCurrentDC() = 0x460108C9 Ignore for now. Ignore for now. glClear(GL_COLOR_BUFFER_BIT) glClear(GL_COLOR_BUFFER_BIT) AGP_COMMAND: GPU_CLEARCOLORBUFFER AGP_COMMAND: GPU_CLEARCOLORBUFFER glPushMatrix() glPushMatrix() Driver internal state -> push current matrix value in the state stack. Driver internal state -> push current matrix value in the state stack. glRotatef(2.000000,0.000000,0.000000,1.000000) glRotatef(2.000000,0.000000,0.000000,1.000000) Update (multiply?) the current with the calculated rotation matrix. Update (multiply?) the current with the calculated rotation matrix.

29 TraceDriver glColor3f(1.000000,1.000000,1.000000) glColor3f(1.000000,1.000000,1.000000) Driver internal state -> set current vertex color. Driver internal state -> set current vertex color. glRectf(-25.000000,-25.000000,25.000000,25.000000) glRectf(-25.000000,-25.000000,25.000000,25.000000) Not the best example but … a lot of work to do. Not the best example but … a lot of work to do. Set other clipping/rasterization/etc default state. Set other clipping/rasterization/etc default state. Create a vertex stream: two triangles (6 vertices) forming the rectangle using the default color as vertex color. Create a vertex stream: two triangles (6 vertices) forming the rectangle using the default color as vertex color. Send that vertex data to the GPU -> AGP_WRITE. Send that vertex data to the GPU -> AGP_WRITE. Set the Streamer -> AGP_REG_WRITE. Set the Streamer -> AGP_REG_WRITE. Set the Vertex Shaders -> AGP_REG_WRITE: Set the Vertex Shaders -> AGP_REG_WRITE: Set constant bank (matrices, light parameters, …). Set constant bank (matrices, light parameters, …). Select/build vertex program and set. Select/build vertex program and set. Start drawing: AGP_COMMAND: GPU_DRAW. Start drawing: AGP_COMMAND: GPU_DRAW.

30 TraceDriver glPopMatrix() glPopMatrix() Driver internal state change -> pop from the state stack the value for the current activ matrix. Driver internal state change -> pop from the state stack the value for the current activ matrix. wglSwapBuffers(0x460108C9) = TRUE wglSwapBuffers(0x460108C9) = TRUE Swap frontbuffer and backbuffer (display current frame). Swap frontbuffer and backbuffer (display current frame). AGP_COMMAND: GPU_SWAPBUFFERS AGP_COMMAND: GPU_SWAPBUFFERS


Download ppt "Status – Week 252 Victor Moya. Summary Command Processor. Command Processor. Memory Controller. Memory Controller. Streamer. Streamer. Rasterizer. Rasterizer."

Similar presentations


Ads by Google