1 / 30

Status – Week 252

Status – Week 252. Victor Moya. Summary. Command Processor. Memory Controller. Streamer. Rasterizer. Vertex buffers in OpenGL. ARB_vertex_buffer_object. TraceDriver. CommProcMemoryWrite. Command Processor. Memory Controller. CommProcMemoryRead. StreamerCrontrol. StreamerMemoryRead.

Download Presentation

Status – Week 252

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Status – Week 252 Victor Moya

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

  3. CommProcMemoryWrite Command Processor Memory Controller CommProcMemoryRead StreamerCrontrol StreamerMemoryRead StreamerState StreamerMemoryReq Streamer ShaderCommand ShaderState Vertex Shader

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

  5. MemoryModule Memory Controller RastMemoryRead RastMemoryRequest Rasterizer (Fake)

  6. Command Processor • Stores all GPU state (debug?). • Receives data from AGP and sends it to the Memory Controller. • Receives state changes and sends 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 commands to other units. • Missing code for some states. • Missing AGP_READ and AGP_REG_READ (not useful right now).

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

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

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

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

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

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

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

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

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

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

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

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

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

  21. TraceDriver • 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 wglGetPixelFormat(0x460108C9) = 4 wglDescribePixelFormat(0x460108C9,4,40, ...

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

  23. TraceDriver • 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) • AGP_REG_WRITE: GPU_COLOR_BUFFER_CLEAR, (u32bit?)0 • glShadeModel(GL_FLAT) • AGP_REG_WRITE: GPU_INTERPOLATION, TRUE • wglGetCurrentContext() = 0x10000 wglGetCurrentDC() = 0x460108C9 • ignore for now. • glViewport(0,0,250,250) • AGP_REG_WRITE: GPU_VIEWPORT_INI_X, 0 • AGP_REG_WRITE: GPU_VIEWPORT_INI_Y, 0 • AGP_REG_WRITE: GPU_VIEWPORT_HEIGHT • AGP_REG_WRITE: GPU_VIEWPORT_WIDTH

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

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

  27. TraceDriver • 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 wglGetCurrentDC() = 0x460108C9 • Ignore for now. • glClear(GL_COLOR_BUFFER_BIT) • AGP_COMMAND: GPU_CLEARCOLORBUFFER • glPushMatrix() • Driver internal state -> push current matrix value in the state stack. • glRotatef(2.000000,0.000000,0.000000,1.000000) • Update (multiply?) the current with the calculated rotation matrix.

  29. TraceDriver • glColor3f(1.000000,1.000000,1.000000) • Driver internal state -> set current vertex color. • glRectf(-25.000000,-25.000000,25.000000,25.000000) • Not the best example but … a lot of work to do. • 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. • Send that vertex data to the GPU -> AGP_WRITE. • Set the Streamer -> AGP_REG_WRITE. • Set the Vertex Shaders -> AGP_REG_WRITE: • Set constant bank (matrices, light parameters, …). • Select/build vertex program and set. • Start drawing: AGP_COMMAND: GPU_DRAW.

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

More Related