gpgp background lecture
Download
Skip this Video
Download Presentation
GPGP - Background Lecture

Loading in 2 Seconds...

play fullscreen
1 / 32

GPGP - Background Lecture - PowerPoint PPT Presentation


  • 91 Views
  • Uploaded on

GPGP - Background Lecture. Graphics Pipelines, OpenGL, Fragment Programs, First GPGP Programs. Purpose. Give sufficient background to non-graphics students to program a simple GPGP program Attempted to minimize any assumptions prior knowledge of Graphics. My Background in GPGP.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' GPGP - Background Lecture' - yardan


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
gpgp background lecture

GPGP - Background Lecture

Graphics Pipelines, OpenGL, Fragment Programs, First GPGP Programs

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

purpose
Purpose
  • Give sufficient background to non-graphics students to program a simple GPGP program
    • Attempted to minimize any assumptions prior knowledge of Graphics

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

my background in gpgp
My Background in GPGP
  • 06/2003 - Worked with Bill Baxter on paint work using GPU to transform volume representation of paint to RGB
  • 01/2004 - Worked with Brandon Lloyd on shadow work
    • Didn’t touch GPU work, but understood what it did
  • 09/2005 - Taught COMP136 and we talked about GPU
  • 10/2006 - Wrote a simple program to remove radial distortion from images in real time
  • 01/2007 - Prepared for this lecture

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

overview
Overview
  • Raster Graphics
    • Where did this start?
  • Graphics Pipeline
    • What’s the hardware like?
  • OpenGL
    • How to talk to the hardware?
  • GPU Programming
    • How to make it do something non-standard?
  • A First GPGP Program
    • Hello World!

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

raster graphics utah rendering
Raster Graphics --“Utah” Rendering
  • 1960s-1970s The University of Utah led raster graphics research
    • Ivan Sutherland
  • How do we convert mathematical representations of objects into images on the screen?
    • Conversion of continuous to discrete
    • Solution of light-surface-eye interactions

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

object representations
Object Representations
  • MANY continuous representations exist for objects
    • Planar polygons, quadrics, splines, M-Reps, general equations …
  • Discrete representations are sparser
    • Generally some interpretation of an array of numbers

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

the winner
The Winner!
  • In modern raster graphics, the triangle is king
    • It is the simplest continuous representation that can approximate all other surface-types
    • All other continuous representations must be triangulated before being rasterized
      • Unless GPGP is used!

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

rasterization terms
Rasterization Terms
  • Tessellate - convert some other continuous representation to planar polygons
  • Triangulate - converting some other continuous representation to triangles
  • Vertex - a point in some nD space
  • Rasterize - convert a triangle* to fragments
  • Fragment - a potential pixel**

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

utah graphics pipeline
“Utah” Graphics Pipeline
  • Obtain triangulation of model
  • Affine Transforms
  • Projective Transforms
  • Clip to viewable region
  • Rasterize

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

overview1
Overview
  • Raster Graphics
    • Where did this start?
  • Graphics Pipeline
    • What’s the hardware like?
  • OpenGL
    • How to talk to the hardware?
  • GPU Programming
    • How to make it do something non-standard?
  • A First GPGP Program
    • Hello World!

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

why specialty hardware
Why Specialty Hardware?
  • CPU can do all Turing complete operations

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

earliest commodity hardware
Earliest Commodity Hardware

Vertex Transformation

  • State of pipeline initialized
  • Vertices come down the pipe
  • Framebuffer and depth buffer set by the end

Clipping

Rasterization

Fragment Operations

Visibility

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

cutting edge commodity hardware
Cutting-edge Commodity Hardware

Vertex Transformation

  • Okay, not much changed
  • Orange denotes programmability
  • Power of standard set of settings increased
  • Output can go to any/many buffers

Clipping

Rasterization

Fragment Operations

Visibility

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

overview2
Overview
  • Raster Graphics
    • Where did this start?
  • Graphics Pipeline
    • What’s the hardware like?
  • OpenGL
    • How to talk to the hardware?
  • GPU Programming
    • How to make it do something non-standard?
  • A First GPGP Program
    • Hello World!

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

talking to the gpu
Talking to the GPU
  • Two parts:
    • STATE: The majority of OpenGL calls modify the state machine
    • INPUT: Vertices
      • Three vertices make a triangle
      • Once a triangle is complete, the GPU runs with it

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

opengl overview
OpenGL Overview
  • Most of the features in OpenGL will probably never be used in this class
  • For the majority of GPGP work, you render a quad (two triangles) that fills the screen on a one-input-texture-to-one-output-pixel basis

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

note on opengl
Note on OpenGL
  • Although OpenGL calls are supported by nVIDIA or ATi drivers, some windowing system must be used
    • Native to OS - a pain
    • GLUT - quick, easy, small, has some issues with the “nicities of coding”
    • Almost all windowing toolkits support OpenGL
      • FLTK, Qt, WxWindows, etc.

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

let s go to the code
Let’s go to the code
  • All code is available at http://www.cs.unc.edu/~jwendt/classes/GPGPLecture

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

opengl gnitty gritties
OpenGL Gnitty-Gritties
  • Three more important OpenGL features
    • Multi-pass rendering
    • Read-backs
    • Extensions

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

overview3
Overview
  • Raster Graphics
    • Where did this start?
  • Graphics Pipeline
    • What’s the hardware like?
  • OpenGL
    • How to talk to the hardware?
  • GPU Programming
    • How to make it do something non-standard?
  • A First GPGP Program
    • Hello World!

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

history of commodity gpu programming
History of Commodity GPU Programming
  • Pre-1999 - Basic rasterizers
    • Some texture combination ability
    • Vertex transformation occurs on CPU
  • 1999-2000 - Slightly configurable
    • Cube maps, signed math ops
    • Vertex transforms added to GPU
  • 2001 - Vertex programmability
  • 2002-present - Vertex/fragment programmability

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

history of gpu non commodity programmability
History of GPU non-Commodity Programmability
  • mid-1990’s - UNC PixelFlow
  • later-1990’s - Stanford RTSL

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

gpu programming languages
GPU Programming Languages
  • Assembly language
  • Cg and HLSL
  • GLSL

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

types of gpu programs
Types of GPU Programs
  • Vertex Programs
    • Required Outputs: Vertex position and Vertex color
    • Optional Outputs: Hardware/language dependant maximum number of output values
  • Fragment Programs
    • Required Outputs: RGBA color
    • Optional Outputs: Writing to multiple sources

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

communicating with gpu programs
Communicating with GPU Programs
  • There are two ways of sending information to GPU Programs:
    • Explicitly setting parameters using specified function calls
    • Sending down standard values by setting OpenGL state

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

for more info
For More Info
  • Tutorials, sample code, etc.
    • Go to www.gpgpu.org/developer
  • Cg Tutorial
    • Amazon: http://www.amazon.com/Cg-Tutorial-Definitive-Programmable-Real-Time/dp/0321194969
  • GLSL (Orange Book)
    • Amazon: http://www.amazon.com/OpenGL-Shading-Language-2nd/dp/0321334892/sr=1-1/qid=1169220867/ref=pd_bbs_1/102-4102099-2237769?ie=UTF8&s=books

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

overview4
Overview
  • Raster Graphics
    • Where did this start?
  • Graphics Pipeline
    • What’s the hardware like?
  • OpenGL
    • How to talk to the hardware?
  • GPU Programming
    • How to make it do something non-standard?
  • A First GPGP Program
    • Hello World!

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

let s go to the code1
Let’s go to the code
  • Borrowed heavily from gpgpu.org/developer
  • All code is available at http://www.cs.unc.edu/~jwendt/classes/GPGPLecture

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

notes
Notes
  • No Vertex program! … no use for one.
  • The framebuffer-to-texture transfers we were doing are slow
  • Use the framebuffer object class available from GPGPU.org/developer
  • GLEW is downloadable from glew.sourceforge.net/
  • We only passed one parameter down in this example

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

reading the data back to the cpu
Reading the Data Back to the CPU
  • See function SnapShot at the bottom of the last file

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

debugging
Debugging
  • IMDebug by Bill Baxter:
    • http://www.billbaxter.com/projects/imdebug/index.html

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

questions
Questions?

The University of North Carolina - Chapel Hill

COMP 790-058 Spring 2007

ad