kurt akeley nvidia corporation nvidia u presentation, 25 ... · nvidia corporation nvidia u...
TRANSCRIPT
Data Storage and Transfer in OpenGL®Data Storage and Transfer in OpenGL®
Kurt AkeleyNVIDIA CorporationNVIDIA U Presentation, 25 July 2003
NVIDIA CONFIDENTIAL
Outline
Data movement is the issueMemory typesDesign examples
Buffer objectsSuperbuffers (in process)
Programmable GPU memoryQ & A
Data MovementData Movement
NVIDIA CONFIDENTIAL
Semiconductor Scaling Rates
From: Digital Systems Engineering, Dally and Poulton
31.28Aggregate off-chip bandwidth
71.11750Pins per package
1.31.71Die-length wire delay / gate delay
1.00Device-length wire delay
1.31.71Capability (grids / gate delay)
(5)0.87150 pSGate Delay
1.751.491 BMoore’s Law (grids on a die)**
Years to Double (Half)
Yearly Factor
Current ValueParameter
** Ignores multi-layer metal, 8-layers in 2001
NVIDIA CONFIDENTIAL
Two Approaches
Move data faster (optimize speed)Point-to-point wiringAdvanced protocols (e.g. clock in data)Wide interfaces (256-bit GPUs)
Move data less (optimize locality)AlgorithmArchitecture (e.g. pipeline GPU)Cache data
NVIDIA CONFIDENTIAL
It’s All Cache!
Memory TypesMemory Types
NVIDIA CONFIDENTIAL
OpenGL’s Memory Types
Byte memoryClient pixel data
Element memoryFramebufferTexture object’s image
OthersDisplay list memory...
NVIDIA CONFIDENTIAL
Memory Properties
Server sideClient side *Typical location
Not allowedMay be allowedOut-of-order ops
Not allowedMay be allowedCPU mapping
PersistentPer-transactionFormatting
Component, indexByteBasic unit
Element memoryByte memoryProperty
Client pixel data Framebuffer
* We’ll see an exception soon
Buffer ObjectsBuffer Objects
NVIDIA CONFIDENTIAL
Classic Immediate Mode
ConvenientFlexible
Match client data structuresPer-vertex / per-primitive
SlowVector form slightly faster
float loc[2] = {2, 3};
glColor3f(1, 1, 1);
glBegin(GL_LINES);
glVertex2f(0, 1);
glVertex2fv(loc);
glEnd();
NVIDIA CONFIDENTIAL
Vertex Arrays
glVertexPointer(size, type, stride, *pointer);
size
type
stride
pointer
glDrawArrays(mode, first, count);
glEnableClientState(GL_VERTEX_ARRAY);
enable
NVIDIA CONFIDENTIAL
Vertex Array Problems
Client-side array is far from pipelineHard for application to use the right memory
On PC, AGP memory
NVIDIA CONFIDENTIAL
Solutions
NV_vertex_array_rangeMake vertex arrays work betterRelax coherence rules to enable pullingHelp client to position arrays in AGP memory
Array objectsExtend vertex arrays with element memory
NVIDIA CONFIDENTIAL
Good Qualities of Vertex Arrays
Easy to mix and match array dataShare vertex array with multiple color arraysDisable any array for debugging
Memory mappedClient can cherry-pick updatesExtra copies avoidedGreat for immediate mode rendering
Easy to mix usage modelsStatic array dataDynamic array data
NVIDIA CONFIDENTIAL
ARB Solution: Server-side Buffer Objects
Byte memory (mappable)Server side (efficient for rendering, sharable)
ApplicationByte
Memory+ State
Buffer Object
GL ServerGL Client
NVIDIA CONFIDENTIAL
Modifying Buffer Object Data
FunctionalglBufferSubDataARB(target, offset, size, *data);
glGetBufferSubDataARB(target, offset, size, *data);
Always safeMemory mapped
void *glMapBufferARB(target, access);
GLboolean *glUnmapBufferARB(target);
May result in data lossMay not be faster
NVIDIA CONFIDENTIAL
Mapping Rules
Be prepared for data lossMap for brief periods only
Map it, modify it, then unmap itDon’t render from a mapped buffer
Don’t pass a map pointer to the GL
NVIDIA CONFIDENTIAL
Store Vertex Arrays in Buffers
VertexPointer(size, type, stride, *pointer);
size
type
stride
pointer
bufferARRAY_BUFFER_ARB
offset
NVIDIA CONFIDENTIAL
Client and Server State
Application
Buffer Objects
GL ServerGL Client
ARRAY_BUFFER_ARB
size
type
stride
pointer
buffer
Buffer objects are server stateVertex arrays parameters are client state
size
type
stride
pointer
buffer
size
type
stride
pointer
buffer
size
type
stride
pointer
buffer
Byte Memory+ State
SuperbuffersSuperbuffers(In Process)(In Process)
NVIDIA CONFIDENTIAL
The OpenGL “Machine Tool”
Point, Line,Polygon
Rasterization
UnpackPixels
PackPixels
PixelOperations
ImageRasterization
TextureMemory
FragmentOperations
UnpackVertexes
VertexOperations
Framebuffer
Image
Geometry
NVIDIA CONFIDENTIAL
Problems
Framebuffer to texture transferCopy is too slowCurrent acceleration methods (pbuffers) are
Window-system specificAwkward to use
Framebuffer to geometry transferCopy is too slowThere are no acceleration methods
Render to texture
NVIDIA CONFIDENTIAL
Why Not Add Destructive Copy?
Virtue of simplicityIssues
Can’t be anticipatedForces 2x memory when not otherwise needed
NVIDIA CONFIDENTIAL
Superbuffer Solution
Invent framebuffer objectsMuch like texture objects
Invent element memory objects1D, 2D, or 3D images
Attach element memory objectsTo texture objects, as image levelsTo framebuffer objects, as color, depth, and stencil buffers
NVIDIA CONFIDENTIAL
Superbuffers
Texture Object
Memory Object
FramebufferObject
Buffer Object
?
Can element memory objects be attached to
buffer objects?
Can element memory objects be attached to
buffer objects?
GPU MemoryGPU Memory
NVIDIA CONFIDENTIAL
So Far So Good
Byte / element distinction makes senseTexture is element memory
Always accessed through functional interfaceFramebuffer is element memory
Rendered through functional interfaceCannot be read by vertex/fragment processor
Language arrays are “byte” memory
NVIDIA CONFIDENTIAL
Summary
NVIDIA is committed to OpenGL
OpenGL is evolvingBuffer objects will be in 1.5, due this summerSuperbuffers are underway, no target date
Byte / element memory distinction has been useful
NVIDIA CONFIDENTIAL
For More Information
www.opengl.orghttp://developer.nvidia.com/view.asp?IO=presentations