Sung-Eui Yoon ( 윤성의 )

Similar documents
Graphics Hardware. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 2/26/07 1

Graphics Hardware. Instructor Stephen J. Guy

Lecture 2. Shaders, GLSL and GPGPU

Real - Time Rendering. Graphics pipeline. Michal Červeňanský Juraj Starinský

Graphics Hardware, Graphics APIs, and Computation on GPUs. Mark Segal

Graphics Processing Unit Architecture (GPU Arch)

Introduction to the OpenGL Shading Language

X. GPU Programming. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter X 1

E.Order of Operations

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Graphics Hardware. Graphics Processing Unit (GPU) is a Subsidiary hardware. With massively multi-threaded many-core. Dedicated to 2D and 3D graphics

Introduction to Shaders.

Tutorial on GPU Programming #2. Joong-Youn Lee Supercomputing Center, KISTI

CSE 591: GPU Programming. Introduction. Entertainment Graphics: Virtual Realism for the Masses. Computer games need to have: Klaus Mueller

CS GPU and GPGPU Programming Lecture 2: Introduction; GPU Architecture 1. Markus Hadwiger, KAUST

Programmable Graphics Hardware

Today. Rendering - III. Outline. Texturing: The 10,000m View. Texture Coordinates. Specifying Texture Coordinates in GL

1.2.3 The Graphics Hardware Pipeline

Programmable GPUs. Real Time Graphics 11/13/2013. Nalu 2004 (NVIDIA Corporation) GeForce 6. Virtua Fighter 1995 (SEGA Corporation) NV1

Introduction to Shaders for Visualization. The Basic Computer Graphics Pipeline

Shaders. Slide credit to Prof. Zwicker

CS427 Multicore Architecture and Parallel Computing

Supplement to Lecture 22

Programming Graphics Hardware

CS4620/5620: Lecture 14 Pipeline

Evolution of GPUs Chris Seitz

CS770/870 Spring 2017 Open GL Shader Language GLSL

CS770/870 Spring 2017 Open GL Shader Language GLSL

GeForce4. John Montrym Henry Moreton

3D buzzwords. Adding programmability to the pipeline 6/7/16. Bandwidth Gravity of modern computer systems

Hardware Accelerated Volume Visualization. Leonid I. Dimitrov & Milos Sramek GMI Austrian Academy of Sciences

CSE 591/392: GPU Programming. Introduction. Klaus Mueller. Computer Science Department Stony Brook University

Basics of GPU-Based Programming

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people

2.11 Particle Systems

Programming shaders & GPUs Christian Miller CS Fall 2011

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

GpuPy: Accelerating NumPy With a GPU

Threading Hardware in G80

Rendering Objects. Need to transform all geometry then

Spring 2009 Prof. Hyesoon Kim

General Purpose Computation (CAD/CAM/CAE) on the GPU (a.k.a. Topics in Manufacturing)

Pipeline Operations. CS 4620 Lecture 14

CS452/552; EE465/505. Clipping & Scan Conversion

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)!

Spring 2011 Prof. Hyesoon Kim

Real - Time Rendering. Pipeline optimization. Michal Červeňanský Juraj Starinský

The Rasterization Pipeline

GPU Computation Strategies & Tricks. Ian Buck NVIDIA

Scanline Rendering 2 1/42

Could you make the XNA functions yourself?

Tutorial on GPU Programming. Joong-Youn Lee Supercomputing Center, KISTI

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

Programmable Graphics Hardware

Mattan Erez. The University of Texas at Austin

Programming Guide. Aaftab Munshi Dan Ginsburg Dave Shreiner. TT r^addison-wesley

12.2 Programmable Graphics Hardware

Programmable GPUS. Last Time? Reading for Today. Homework 4. Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes

The Graphics Pipeline

Current Trends in Computer Graphics Hardware

INF3320 Computer Graphics and Discrete Geometry

Optimizing DirectX Graphics. Richard Huddy European Developer Relations Manager

CS8803SC Software and Hardware Cooperative Computing GPGPU. Prof. Hyesoon Kim School of Computer Science Georgia Institute of Technology

GPU Memory Model. Adapted from:

The Transition from RenderMan to the OpenGL Shading Language (GLSL)

Graphics Pipeline & APIs

Windowing System on a 3D Pipeline. February 2005

frame buffer depth buffer stencil buffer

General Purpose Computation (CAD/CAM/CAE) on the GPU (a.k.a. Topics in Manufacturing)

Portland State University ECE 588/688. Graphics Processors

General Purpose Computation (CAD/CAM/CAE) on the GPU (a.k.a. Topics in Manufacturing)

OpenGL on Android. Lecture 7. Android and Low-level Optimizations Summer School. 27 July 2015

Drawing Fast The Graphics Pipeline

Next-Generation Graphics on Larrabee. Tim Foley Intel Corp

Models and Architectures

The NVIDIA GeForce 8800 GPU

Cg 2.0. Mark Kilgard

Shaders (some slides taken from David M. course)

Levy: Constraint Texture Mapping, SIGGRAPH, CS 148, Summer 2012 Introduction to Computer Graphics and Imaging Justin Solomon

Drawing Fast The Graphics Pipeline

CHAPTER 1 Graphics Systems and Models 3

Module 13C: Using The 3D Graphics APIs OpenGL ES

GPU Architecture. Michael Doggett Department of Computer Science Lund university

What s New with GPGPU?

Working with Metal Overview

! Readings! ! Room-level, on-chip! vs.!

The Need for Programmability

Introduction to OpenGL

CS195V Week 9. GPU Architecture and Other Shading Languages

Graphics Pipeline & APIs

Programmable GPUs Outline

Volume Graphics Introduction

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Performance OpenGL Programming (for whatever reason)

Programmable Graphics Hardware

Graphics Performance Optimisation. John Spitzer Director of European Developer Technology

GPGPU. Peter Laurens 1st-year PhD Student, NSC

From Brook to CUDA. GPU Technology Conference

Antonio R. Miele Marco D. Santambrogio

Transcription:

Introduction to Computer Graphics and OpenGL Graphics Hardware Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/etri_cg/

Class Objectives Understand how GPUs have been evolved Understand vertex and fragment shaders 2

3

Graphics from a system s perspective Graphics operations most frequently executed on a co-processor called a Graphics Processing Unit (GPU) Dedicated buses between the host CPU and the GPU AGP, PCI Express Separate GPU memory Framebuffer, textures, etc. Shared memory with CPU 4

Host Commands OpenGL 1.4 - Graphics Past Fixed-function graphics pipeline Every step neatly planned Philosophy: Performance > Flexibility Extended by committee Why process anything other than polygons or the occasional pixel? Vertex Transforms Cull, Clip & Project Process And Rasterize Primitive Fragment Processing Texture Memory Per- Fragment Operations Frame Buffer Operations Frame Buffer Display 5 Pixel Pack & Unpack A fragment is a potential pixel Read Back Control

OpenGL 3.0 - Graphics Today Programmable processing units Programmable vertex and fragment processors Exposes what was always there beneath the covers Texture memory general-purpose data storage Texture Memory Host Commands Vertex Processor Cull, Clip & Project Process and Rasterize Primitive Fragment Processor Per- Fragment Operations Frame Buffer Operations Frame Buffer Display Pixel Pack & Unpack Read Back Control 6

A GPU Block Diagram GeForce 6 Series Massive parallelism Pipelining Multiple data paths Mix of programmable and hardwired function blocks Simple inter-processor connectivity High-bandwidth memory interfaces 7

Vertex Processor Capabilities Lighting, Material and Geometry flexibility Vertex programs replace the following parts of the pipeline: Vertex & normal transformation Per-vertex lighting calculations Texture coordinate generation & transformation The vertex program does NOT replace: Perspective divide and viewport (NDC) mapping Clipping Backface culling Primitive assembly (triangle setup, edge equations, etc.) 8

9 Vertex processor Inputs & Outputs Vertex shader is supplied with a number of parameters Vertex parameters, OpenGL state, user supplied parameters Results written into prearranged locations (registers) that are understood by later processing steps Standard OpenGL attributes glcolor, glnormal glvertex, glmultitexcoord User-Defined Attributes User-Defined Uniform Variables eyeposition, lightposition, modelscalefactor, etc. Vertex Processor Standard OpenGL State ModelViewMatrix, gllightsource[0,..n], glfogcolor, glfrontmaterial, etc. Standard OpenGL variables Vertex & texture coords, Vertex color User-Defined variables Model coordinates, Normals, hvector, toeyevector, etc

Fragment Processor Capabilities Flexibility for texturing and per-pixel operations Fragment programs replace the following parts of the OpenGL pipeline: Operations on interpolated values Pixel zoom Texture access Scale and bias Texture application (modulate, add) Color table lookup Fog (color, depth) Convolution Color sums (blends, mattes) Color matrix The Fragment shader does NOT replace: Scan Conversion Histogram Coverage Pixel packing and unpacking Scissor Stipple Alpha test Depth test Stencil test Alpha blending Logical ops Dithering Plane masking Z-buffer replacement test 10

Fragment processor Inputs & Outputs Fragment shader is supplied with a number of parameters fragment parameters, OpenGL state, user supplied parameters Results written into prearranged locations (registers) that are understood by later processing steps User-Defined Uniform Variables eyeposition, li:ghtposition, modelscalefactor, epsilon, etc. Standard Rasterizer attributes color (r, g, b, a), depth (z), texturecoordinates 11 User-Defined Attributes Normals, modelcoord, density, etc Fragment Processor TextureMemory Textures, Tables, TempStorage Standard OpenGL variables FragmentColor, FragmentDepth

GPU Programmability The first vertex and fragment programs were written in lowlevel, H/W- specific assembly languages Trend is toward higher-level languages and unified shaders Same capabilities for both Vertex and fragment shaders Application Vertex Processor Process and Rasterize Primitive Fragment Processor Per Fragment & Frame Buffer Ops Frame Buffer 12 Application Program Vertex Shader Program Fragment Shader Program

Historical: GeForce 3 Vertex Processor In the beginning, resources were limited Difficult to do anything, even at the assembly level Useful macros for Vector-scalar mult Vector-vector add Dot-product Normalize became the programming method of choice Vector Floating Pt Datapath Vertex Attributes 16x4 registers Vertex Program 128 instrs Vertex Results 15x4 registers Uniform Parameters (don t change on each vertex) 96x4 registers Temp Registers 12x4 registers 13

GPU/CPU Differences Early GPUs offered no branching support Conditional operations instead If (rega < 0) regb = regc No general indirect access to memory (i.e. lookup tables, textures, etc.) Limited Arrays (uniform parameters) Fixed vector sizes (2, 3 & 4) Vector Floating Pt Datapath Vertex Attributes 16x4 registers Vertex Program 128 instrs Vertex Results 15x4 registers Uniform Parameters (don t change on each vertex) 96x4 registers Temp Registers 12x4 registers 14

Later Version of GPUs (GeForce 6) 512 total instructions 64K executed per primitive Independent execution (MIMD) Branching Subroutine calls Flexible per-vertex processing General purpose vector registers 4-element (x,y,z,w) Vertex cache Texture accesses 15

Recent Fragment Processors 512 total instructions 64K executed per primitive Coupled execution (SIMD) Branching Subroutine calls Flexible per-fragment processing General purpose vector registers 4-element (r,g,b,a) Streamed Datapaths Texture accesses 16

Programming the Beast GPU Assembly Example: FRC R2.y, C11.w; ADD R3.x, C11.w, -R2.y; MOV H4.y, R2.y; ADD H4.x, -H4.y, C4.w; MUL R3.xy, R3.xyww, C11.xyww; ADD R3.xy, R3.xyww, C11.z; TEX H5, R3, TEX2, 2D; ADD R3.x, R3.x, C11.x; 17 TEX H6, R3, TEX2, 2D; GPU programs were quirky and non-portable

High-level Languages Cg High-level language example: Cg = C for graphics float4 main( float2 detailcoords : TEXCOORD0, float2 bumpcoords: TEXCOORD1, float3 lightvector : COLOR0, uniform float3 ambientcolor, uniform sampler2d detailtexture : TEXUNIT0, uniform sampler2d bumptexture : TEXUNIT1): COLOR { float3 detailcolor = tex2d(detailtexture, detailcoords).rgb; float3 lightvectorfinal = 2.0 * (lightvector.rgb - 0.5); float3 bumpnormalvectorfinal = 2.0 * (tex2d(bumptexture, bumpcoords).rgb - 0.5); float diffuse = dot(bumpnormalvectorfinal, lightvectorfinal); 18 } return float4(diffuse * detailcolor + ambientcolor, 1.0); Easier to read and maintain (old-lesson relearned), but still quirky Symbolic named variables (allocated by compiler) Portability between implementations Reuse pieces

Explosion of GPU HLLs Stanford shading language (Predecessor to Cg) C/Renderman-like Cg Separate programming environment Compiled and linked into application GLSL (OpenGL shading language) Embedded into application and compiled on the fly HLSL - DirectX pixel-shading language Integrated into application programming environment 19

Shading language uses Lots of versatility Subsurface Scattering NPR Renders Fire Effects Refraction 20 Ray Tracing Solid Textures Ambient Occlusion Cloth Simulation

HLLs are still hard to use All of the old problems associated with managing projects with multiple parts resurface Separate host, Vertex, Fragment programs Multiple shaders per application Want incremental tweaks of shaders to propagate to successors What s the solution? Smart syntax aware editors Project Managements scripts (Makefiles) Wrappers, Linking loaders, (OOP??) 21

22 Enter the GPU IDE

FX Composer Integrated Shader Development Environment Interactive Preview window-- lets you see the impact of your shader changes immediately Supports HLSL (RM also supports GLSL) Separate editor windows for vertex and fragment shading code Support generation of artwork (textures, color palettes, MIPmaps) Built-in host application that allows loading geometry Built-in disassembler Provides error checking and limited debugging 23

GPGPU General processing on graphics processing units Map more general computation to the GPU to take advantage of the massive amounts of raw processing power 24

Graphics Hardware at 2007 GeForce 8800 Unified shader architecture General scalar processors (integer and bitwise ops) 25

Graphics Hardware Future Convergence between CPUs and GPUs CPUs going multi-core Many simpler, lower power cores GPUs becoming more and more programmable CUDA, etc. Heterogeneous collection of processors Cell ATI Fusion Larrabee Massive multi-threading to hide latency 26

Fermi GPU Architecture Designed for general supercomputing applications Not just for graphics Supports for double-precision floating point 27

Fermi GPU Architecture 16 SM (streaming processors) 512 CUDA cores Memory interfaces 28

29 Fermi GPU Architecture

Wheel of Reincarnation Coined by Myer and Sutherland, 1968? CPU only 1995 CPU & GPU 1999 CPU & GAccel. 30

31 Convergence between CPUs and GPUs

Class Objectives were: Understand how GPUs have been evolved Understand vertex and fragment shaders 32