+ All Categories
Home > Documents > Status – Week 252

Status – Week 252

Date post: 03-Jan-2016
Category:
Upload: raymond-rosario
View: 24 times
Download: 1 times
Share this document with a friend
Description:
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. - PowerPoint PPT Presentation
Popular Tags:
30
Status – Week Status – Week 252 252 Victor Moya Victor Moya
Transcript
Page 1: Status – Week 252

Status – Week Status – Week 252252

Victor MoyaVictor Moya

Page 2: Status – Week 252

SummarySummary

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.

Page 3: Status – Week 252

Command

Processor

Memory

Controller

Streamer

Vertex

Shader

CommProcMemoryWrite

CommProcMemoryRead

StreamerMemoryReq

StreamerMemoryReadStreamerCrontrolStreamerState

ShaderStateShaderCommand

Page 4: Status – Week 252

Vertex

Shader

Command

ProcessorCommShaderCommand

CommShaderState

Rasterizer

(Fake)

ShaderOutput

ConsumerState

RasterizerCommand

RasterizerState

Page 5: Status – Week 252

Memory

Controller

MemoryModule

Rasterizer

(Fake)

RastMemoryReadRastMemoryRequest

Page 6: Status – Week 252

Command ProcessorCommand Processor

Stores all GPU state (debug?).Stores all GPU state (debug?). Receives data from AGP and sends Receives data from AGP and sends

it to the Memory Controller.it to the Memory Controller. Receives state changes and sends Receives state changes and sends

them to the GPU units.them to the GPU units. Receives commands and issues Receives commands and issues

them to the GPU units.them to the GPU units.

Page 7: Status – Week 252

Command ProcessorCommand Processor

Missing some comunication code Missing some comunication code with the other units (shaders, with the other units (shaders, rasterizer).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 Missing AGP_READ and

AGP_REG_READ (not useful right AGP_REG_READ (not useful right now).now).

Page 8: Status – Week 252

Memory ControllerMemory Controller

Access to memory modules => Access to memory modules => Signal.Signal.

To decide: number of transactions To decide: number of transactions in process at the same time.in process at the same time.

Currently only one transaction at a Currently only one transaction at a time.time.

Support multiple modules and Support multiple modules and multiple banks per module.multiple banks per module.

Page 9: Status – Week 252

StreamerStreamer

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 3) send vertex input to a vertex

shader.shader. 4) repeat until end.4) repeat until end.

Page 10: Status – Week 252

StreamerStreamer

Index based streaming mode:Index based streaming mode: 1) get index data.1) get index data. 2) get vertex attribute data using 2) get vertex attribute data using

index information.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.

Page 11: Status – Week 252

StreamerStreamer

Accessing to attribute data in stream Accessing to attribute data in stream mode:mode: Direct access.Direct access. Double buffer (pipelined: read first, process Double buffer (pipelined: read first, process

first/read second, read first/process second).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.

Page 12: Status – Week 252

StreamerStreamer from Memory Controller

Attribute Buffers (16?)

Vertex Input

Vertex FIFO

to Vertex Shader

Index Buffer

Page 13: Status – Week 252

RasterizerRasterizer

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.

Page 14: Status – Week 252

RasterizerRasterizer

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.

Page 15: Status – Week 252

Vertex Arrays in OpenGLVertex Arrays in OpenGL Array definition functions:Array definition functions:

VertexPointer(int size, enum type, sizei stride, void VertexPointer(int size, enum type, sizei stride, void *pointer).*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 SecondaryColorPointer(int size, enum type, sizei stride, void

*pointer).*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, VertexAttribPointerARB(uint index, int size, enum type,

boolean normalized, sizei stride, const void *pointer).boolean normalized, sizei stride, const void *pointer). InterleavedArrays(enum format, sizei stride, void InterleavedArrays(enum format, sizei stride, void

*pointer).*pointer).

Page 16: Status – Week 252

Vertex Arrays in OpenGLVertex 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 MultiDrawArrays(enum mode, int *first, sizei

*count, sizei primcount).*count, sizei primcount). DrawElements(enum mode, sizei count, enum DrawElements(enum mode, sizei count, enum

type, void *indices).type, void *indices). MultiDrawElements(enum mode, sizei *count, MultiDrawElements(enum mode, sizei *count,

enum type, void **indices, sizei primcount).enum type, void **indices, sizei primcount). DrawRangeElements(enum mode, uint start, DrawRangeElements(enum mode, uint start,

unit end, sizei count, enum type, void *indices).unit end, sizei count, enum type, void *indices).

Page 17: Status – Week 252

ARB_vertex_buffer_objectARB_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 BufferDataARB(enum target, sizeiptrARB size, const

void *data, enum usage).void *data, enum usage). BufferSubDataARB(enum target, intptrARB offset, BufferSubDataARB(enum target, intptrARB offset,

sizeiptrARB size, const void *data).sizeiptrARB size, const void *data). GetBufferSubDataARB(enum target, intptrARB offset, GetBufferSubDataARB(enum target, intptrARB offset,

sizeiptrARB size, void *data).sizeiptrARB size, void *data). void *MapBufferARB(enum target, enum access).void *MapBufferARB(enum target, enum access). boolean UnMapBufferARB(enum target).boolean UnMapBufferARB(enum target).

Page 18: Status – Week 252

ARB_vertex_buffer_objectARB_vertex_buffer_object target:target:

ARRAY_BUFFER_ARB.ARRAY_BUFFER_ARB. ELEMENT_ARRAY_BUFFER_ARB.ELEMENT_ARRAY_BUFFER_ARB.

usage:usage: STREAM_DRAW_ARBSTREAM_DRAW_ARB STREAM_READ_ARBSTREAM_READ_ARB STREAM_COPY_ARBSTREAM_COPY_ARB STATIC_DRAW_ARBSTATIC_DRAW_ARB STATIC_READ_ARBSTATIC_READ_ARB STATIC_COPY_ARBSTATIC_COPY_ARB DYNAMIC_DRAW_ARBDYNAMIC_DRAW_ARB DYNAMIC_READ_ARBDYNAMIC_READ_ARB DYNAMIC_COPY_ARBDYNAMIC_COPY_ARB

Page 19: Status – Week 252

ARB_vertex_buffer_objectARB_vertex_buffer_object

access:access: READ_ONLY_ARB.READ_ONLY_ARB. WRITE_ONLY_ARB.WRITE_ONLY_ARB. READ_WRITE_ARB.READ_WRITE_ARB.

Page 20: Status – Week 252

TraceDriverTraceDriver

Translates driver traces to AGP Translates driver traces to AGP Transactions for the Command Transactions for the Command Processor.Processor.

Uses TraceReader.Uses TraceReader. Interface:Interface:

startTrace().startTrace(). bool bool

nextAGPTransaction(AGPTransaction nextAGPTransaction(AGPTransaction *agpTrans).*agpTrans).

Page 21: Status – Week 252

TraceDriverTraceDriver OpenGL trace example:OpenGL trace example:wglChoosePixelFormat(0x460108C9, ...wglChoosePixelFormat(0x460108C9, ...wglDescribePixelFormat(0x460108C9,4,40, ...wglDescribePixelFormat(0x460108C9,4,40, ...wglChoosePixelFormat(0x460108C9, ...wglChoosePixelFormat(0x460108C9, ...wglDescribePixelFormat(0x460108C9,4,40, ...wglDescribePixelFormat(0x460108C9,4,40, ...wglSetPixelFormat(0x460108C9,4, ...wglSetPixelFormat(0x460108C9,4, ...wglGetPixelFormat(0x460108C9) = 4wglGetPixelFormat(0x460108C9) = 4wglDescribePixelFormat(0x460108C9,4,40, ...wglDescribePixelFormat(0x460108C9,4,40, ...wglGetPixelFormat(0x460108C9) = 4wglGetPixelFormat(0x460108C9) = 4wglDescribePixelFormat(0x460108C9,1,0,) = 75wglDescribePixelFormat(0x460108C9,1,0,) = 75wglCreateContext(0x460108C9) = 0x10000wglCreateContext(0x460108C9) = 0x10000wglGetCurrentContext() = 0x0wglGetCurrentContext() = 0x0wglGetCurrentDC() = 0x0wglGetCurrentDC() = 0x0wglGetPixelFormat(0x460108C9) = 4wglGetPixelFormat(0x460108C9) = 4wglGetPixelFormat(0x460108C9) = 4wglGetPixelFormat(0x460108C9) = 4wglDescribePixelFormat(0x460108C9,4,40, ...wglDescribePixelFormat(0x460108C9,4,40, ...

Page 22: Status – Week 252

TraceDriverTraceDriver

GLX (X11) and wgl (win32) display GLX (X11) and wgl (win32) display and window initializations.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 assume 32bits RGBA (8 bits per component) standard fb format.component) standard fb format.

Page 23: Status – Week 252

TraceDriverTraceDriver

Example:Example:

glClearColor(0.000000,0.000000,0.000000,0.000000)glClearColor(0.000000,0.000000,0.000000,0.000000)glShadeModel(GL_FLAT)glShadeModel(GL_FLAT)wglGetCurrentContext() = 0x10000wglGetCurrentContext() = 0x10000wglGetCurrentDC() = 0x460108C9wglGetCurrentDC() = 0x460108C9glViewport(0,0,250,250)glViewport(0,0,250,250)glMatrixMode(GL_PROJECTION)glMatrixMode(GL_PROJECTION)glLoadIdentity()glLoadIdentity()glOrtho(-50.000000,50.000000,-50.000000,50.000000,-glOrtho(-50.000000,50.000000,-50.000000,50.000000,-1.000000,1.000000)1.000000,1.000000)glMatrixMode(GL_MODELVIEW)glMatrixMode(GL_MODELVIEW)glLoadIdentity()glLoadIdentity()

Page 24: Status – Week 252

TraceDriverTraceDriver 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, AGP_REG_WRITE: GPU_COLOR_BUFFER_CLEAR, (u32bit?)0(u32bit?)0

glShadeModel(GL_FLAT)glShadeModel(GL_FLAT) AGP_REG_WRITE: GPU_INTERPOLATION, TRUEAGP_REG_WRITE: GPU_INTERPOLATION, TRUE

wglGetCurrentContext() = 0x10000wglGetCurrentContext() = 0x10000wglGetCurrentDC() = 0x460108C9wglGetCurrentDC() = 0x460108C9 ignore for now.ignore for now.

glViewport(0,0,250,250)glViewport(0,0,250,250) AGP_REG_WRITE: GPU_VIEWPORT_INI_X, 0AGP_REG_WRITE: GPU_VIEWPORT_INI_X, 0 AGP_REG_WRITE: GPU_VIEWPORT_INI_Y, 0AGP_REG_WRITE: GPU_VIEWPORT_INI_Y, 0 AGP_REG_WRITE: GPU_VIEWPORT_HEIGHTAGP_REG_WRITE: GPU_VIEWPORT_HEIGHT AGP_REG_WRITE: GPU_VIEWPORT_WIDTHAGP_REG_WRITE: GPU_VIEWPORT_WIDTH

Page 25: Status – Week 252

TraceDriverTraceDriver glMatrixMode(GL_PROJECTION)glMatrixMode(GL_PROJECTION)

Driver internal state -> Current matrix is the Driver internal state -> Current matrix is the projection matrix.projection matrix.

Changes to matrix state affect only to the internal Changes to matrix state affect only to the internal projection matrix.projection matrix.

glLoadIdentity()glLoadIdentity() Driver internal state -> load current matrix with Driver internal state -> load current matrix with

identity matrix.identity matrix. glOrtho(-50.000000,50.000000,-50.000000,50.000000,-glOrtho(-50.000000,50.000000,-50.000000,50.000000,-

1.000000,1.000000)1.000000,1.000000) Selects orthogonal projection (?):Selects orthogonal projection (?):

AGP_REG_WRITE: GPU_PROJECTION, ORTHOGONALAGP_REG_WRITE: GPU_PROJECTION, ORTHOGONAL Creates and stores orthogonal projection matrix.Creates and stores orthogonal projection matrix.

Page 26: Status – Week 252

TraceDriverTraceDriver glMatrixMode(GL_MODELVIEW)glMatrixMode(GL_MODELVIEW)

Driver internal state -> Current matrix is the model Driver internal state -> Current matrix is the model view matrix.view matrix.

Changes to matrix state affect only to the internal Changes to matrix state affect only to the internal model view matrix.model view matrix.

glLoadIdentity()glLoadIdentity() Driver internal state -> load current matrix with Driver internal state -> load current matrix with

identity matrix.identity matrix.

Page 27: Status – Week 252

TraceDriverTraceDriver

Example:Example:

wglGetCurrentContext() = 0x10000wglGetCurrentContext() = 0x10000wglGetCurrentDC() = 0x460108C9wglGetCurrentDC() = 0x460108C9glClear(GL_COLOR_BUFFER_BIT)glClear(GL_COLOR_BUFFER_BIT)glPushMatrix()glPushMatrix()glRotatef(2.000000,0.000000,0.000000,1.000000)glRotatef(2.000000,0.000000,0.000000,1.000000)glColor3f(1.000000,1.000000,1.000000)glColor3f(1.000000,1.000000,1.000000)glRectf(-25.000000,-25.000000,25.000000,25.000000)glRectf(-25.000000,-25.000000,25.000000,25.000000)glPopMatrix()glPopMatrix()wglSwapBuffers(0x460108C9) = TRUEwglSwapBuffers(0x460108C9) = TRUE

Page 28: Status – Week 252

TraceDriverTraceDriver wglGetCurrentContext() = 0x10000wglGetCurrentContext() = 0x10000

wglGetCurrentDC() = 0x460108C9wglGetCurrentDC() = 0x460108C9 Ignore for now.Ignore for now.

glClear(GL_COLOR_BUFFER_BIT)glClear(GL_COLOR_BUFFER_BIT) AGP_COMMAND: GPU_CLEARCOLORBUFFERAGP_COMMAND: GPU_CLEARCOLORBUFFER

glPushMatrix()glPushMatrix() Driver internal state -> push current matrix value in Driver internal state -> push current matrix value in

the state stack.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 Update (multiply?) the current with the calculated rotation matrix.rotation matrix.

Page 29: Status – Week 252

TraceDriverTraceDriver 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 Create a vertex stream: two triangles (6 vertices) forming

the rectangle using the default color as vertex color.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.

Page 30: Status – Week 252

TraceDriverTraceDriver

glPopMatrix()glPopMatrix() Driver internal state change -> pop from the state Driver internal state change -> pop from the state

stack the value for the current activ matrix.stack the value for the current activ matrix. wglSwapBuffers(0x460108C9) = TRUEwglSwapBuffers(0x460108C9) = TRUE

Swap frontbuffer and backbuffer (display current Swap frontbuffer and backbuffer (display current frame).frame).

AGP_COMMAND: GPU_SWAPBUFFERSAGP_COMMAND: GPU_SWAPBUFFERS


Recommended