Introdução às GPUs. Graphics Pipeline. Marcelo Walter UFPE. 3D Application or Game. 3D API: OpenGL or Direct 3D. Vertices

Similar documents
Rasterization Overview

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

Advanced Rendering Techniques

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

Introduction to Shaders.

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

CS770/870 Spring 2017 Open GL Shader Language GLSL

CS770/870 Spring 2017 Open GL Shader Language GLSL

1.2.3 The Graphics Hardware Pipeline

OpenGL Programmable Shaders

GPU Memory Model. Adapted from:

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

Supplement to Lecture 22

Shaders. Slide credit to Prof. Zwicker

CS179: GPU Programming

Graphics Hardware. Instructor Stephen J. Guy

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

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

Graphics Processing Unit Architecture (GPU Arch)

E.Order of Operations

2.11 Particle Systems

The Graphics Pipeline

Lecture 2. Shaders, GLSL and GPGPU

Programmable Graphics Hardware

SHADER PROGRAMMING. Based on Jian Huang s lecture on Shader Programming

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

Introduction to Computer Graphics with WebGL

Programmable GPUs Outline

Models and Architectures

Sung-Eui Yoon ( 윤성의 )

12.2 Programmable Graphics Hardware

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

WebGL and GLSL Basics. CS559 Fall 2015 Lecture 10 October 6, 2015

EDAF80 Introduction to Computer Graphics. Seminar 3. Shaders. Michael Doggett. Slides by Carl Johan Gribel,

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

INF3320 Computer Graphics and Discrete Geometry

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

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

Shader Programs. Lecture 30 Subsections 2.8.2, Robb T. Koether. Hampden-Sydney College. Wed, Nov 16, 2011

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

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

The GPGPU Programming Model

Pipeline Operations. CS 4620 Lecture 14

CS770/870 Fall 2015 Advanced GLSL

Rendering Objects. Need to transform all geometry then

Computergrafik. Matthias Zwicker. Herbst 2010

Introduction to Shaders for Visualization. The Basic Computer Graphics Pipeline

Drawing Fast The Graphics Pipeline

Programmable Graphics Hardware

Drawing Fast The Graphics Pipeline

Drawing Fast The Graphics Pipeline

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

WebGL and GLSL Basics. CS559 Fall 2016 Lecture 14 October

Basics of GPU-Based Programming

Blis: Better Language for Image Stuff Project Proposal Programming Languages and Translators, Spring 2017

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

Computer graphics 2: Graduate seminar in computational aesthetics

GPU-Based Volume Rendering of. Unstructured Grids. João L. D. Comba. Fábio F. Bernardon UFRGS

The Rasterization Pipeline

OpenGL SUPERBIBLE. Fifth Edition. Comprehensive Tutorial and Reference. Richard S. Wright, Jr. Nicholas Haemel Graham Sellers Benjamin Lipchak

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

Programmable shader. Hanyang University

The Application Stage. The Game Loop, Resource Management and Renderer Design

CS4620/5620: Lecture 14 Pipeline

INF3320 Computer Graphics and Discrete Geometry

Graphics Pipeline & APIs

Graphics Pipeline & APIs

CSE4030 Introduction to Computer Graphics

OpenGL. White Square Code 11/4/09. OpenGL. OpenGL. OpenGL

Spring 2009 Prof. Hyesoon Kim

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

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

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

Spring 2011 Prof. Hyesoon Kim

Ciril Bohak. - INTRODUCTION TO WEBGL

CS 130 Final. Fall 2015

Sign up for crits! Announcments

VTU QUESTION PAPER SOLUTION UNIT -1 INTRODUCTION

Game Graphics & Real-time Rendering

OpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL

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

GPU Programming EE Midterm Examination

CS451Real-time Rendering Pipeline

General Purpose computation on GPUs. Liangjun Zhang 2/23/2005

Working with Metal Overview

Dave Shreiner, ARM March 2009

Next-Generation Graphics on Larrabee. Tim Foley Intel Corp

Shaders (some slides taken from David M. course)

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

Introduction to Programmable GPUs CPSC 314. Real Time Graphics

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

COMP371 COMPUTER GRAPHICS

The Graphics Pipeline and OpenGL IV: Stereo Rendering, Depth of Field Rendering, Multi-pass Rendering!

GeForce4. John Montrym Henry Moreton

GPU Memory Model Overview

OpenGL Rendering Pipeline and Programmable Shaders

What was removed? (1) OpenGL ES vs. OpenGL

Cornell University CS 569: Interactive Computer Graphics. Introduction. Lecture 1. [John C. Stone, UIUC] NASA. University of Calgary

Scanline Rendering 2 1/42

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

Transcription:

Introdução às GPUs Marcelo Walter UFPE atualização/maio 2009 Graphics Pipeline 2 1

Graphics Pipeline glbegin(gl_triangles); gl3f(0.0,0.0,0.0); gl3f(1.0,0.0,0.0); gl3f(0.5,1.0,0.0);... glend(); 3 Graphics Pipeline 2 3 1 4 4 2

Graphics Pipeline 1 2 3 4 3 1 2 3 1 4 5 Graphics Pipeline 4 3 1 1 2 3 6 transf em coordenadas câmera iluminação 3

Graphics Pipeline 4 2 3 1 3 1 7 Graphics Pipeline 3 1 3 4 2 1 8 4

Graphics Pipeline 1 3 4 3 2 1 9 Graphics Pipeline 1 2 1 3 4 3 10 Conecta vértices em triângulos recorte Eliminação de faces traseiras rasterização 5

Graphics Pipeline 1 2 1 3 4 3 11 Graphics Pipeline 3 4 12 Executa interpolações Determina cor final do fragmento 6

Graphics Pipeline 4 3 1 13 Graphics Pipeline 4 3 1 14 7

Graphics Pipeline 15 Depth buffer Blending Stencil operations Graphics Pipeline 16 8

Graphics Pipeline 17 Graphics Pipeline 18 9

Graphics Pipeline: Paralelização 1 2 3 19 Graphics Pipeline: Paralelização 1 2 3 20 10

Graphics Pipeline: Paralelização 21 Graphics Pipeline: Paralelização 22 11

// In: // eye_space position = TEX7 Programmable Graphics Pipeline // eye space T = (TEX4.x, TEX5.x, TEX6.x) denormalized // eye space B = (TEX4.y, TEX5.y, TEX6.y) denormalized // eye space N = (TEX4.z, TEX5.z, TEX6.z) denormalized fragout frag program main(vf30 In) { CPU GPU Boundary Programmable Processor 23 float m = 30; // power float3 hicol = float3( 1.0, 0.1, 0.1 ); // lit color float3 lowcol = float3( 0.3, 0.0, 0.0 ); // dark color float3 speccol = float3( 1.0, 1.0, 1.0 ); // specular color // Get eye-space eye vector. float3 e = normalize( -In.TEX7.xyz ); // Get eye-space normal vector. float3 n = normalize( float3(in.tex4.z, In.TEX5.z, In.TEX6.z ) ); Processor Programmable Graphics Pipeline CPU GPU Boundary 24 Program 12

25 Processor Processor Processor Processor Program Programmable Graphics Pipeline CPU GPU Boundary Processor Programmable Graphics Pipeline CPU GPU Boundary 26 Programmable Fragment Processor Program 13

Processor Programmable Graphics Pipeline CPU GPU Boundary Fragment Processor 27 Program Processor Programmable Graphics Pipeline CPU GPU Boundary Fragment Processor Fragment Processor Fragment Processor Fragment Processor 28 Program 14

Processor Graphics Pipeline: The Big Picture CPU GPU Boundary Fragment Processor 29 GPU como um processador de streams (fluxo) Multiple programmable processing units Connected by data flows Application Processor Assembly & ization Fragment Processor Framebuffer Framebuffer Textures 30 Program Program 15

Gargalos: Computation Frequencies 1 2 3 > vários 3 Processor Fragment Processor 31 4 3 1 Processador de Vértices Totalmente programável (SIMD / MIMD) Processa 4-vectors (RGBA / XYZW) Não consegue ler informações de outros vértices No edge, face, nor neighboring vertex info Não cria nem deleta vértices 1 vertex in and 1 vertex out Programas podem ser carregados dinamicamente Texture Fetch Consegue acessar texturas 32 16

Processador de Vértices input attributes output attributes Processor input parameters temporary registers texture memory 33 Atributos de Entrada dos Vértices Processor position texture coord 0 weight texture coord 1 normal texture coord 2 primary color texture coord 3 secondary color texture coord 4 34 fog - - texture coord 5 texture coord 6 texture coord 7 17

Parâmetros de Entrada Processor 35 parameter 0 parameter 1 parameter 2 parameter 3 parameter 4... - parameter 127... modelview modelview inverse skinning matrices other parameters Parâmetros de Entrada Processor 36 temporary 0 temporary 1 temporary 2 temporary 3 temporary 4... - temporary 12... 18

Atributos de Saída dos Vértices Processor clip-space position texture coord 0 front primary color front secondary color texture coord 1 texture coord 2 back secondary color texture coord 3 back primary color texture coord 4 37 fog point size - texture coord 5 texture coord 6 texture coord 7 Processador de Fragmentos Totalmente programável (SIMD) Processa vectors (4 valores)(rgba / XYZW) Acesso a Texturas Render to Texture Fragmentos transformados em pixels são escritos numa textura e não enviados ao Tipicamente mais útil do que o VP Mais pipelines de fragmentos do que de vértices 38 19

Processador de Fragmentos Interpolated vertex attributes Fragment attributes Fragment Processor input parameters temporary registers texture memory 39 Atributos de Entrada Interpolated vertex attributes Fragment Processor color Secondary color Texture coordinate Fog coordinate x - - - 40 20

Atributos de Saída Fragment attributes Fragment Processor z depth color Frag data 41 Tipos de Dados Scalars: float/integer/boolean Precisão de 32 ou 16 bits ATI suporta 24 bits GLSL tem inteiros de 16 bits Vector 3 ou 4 componentes Arrays (de tamanho fixo) No bit operations Matrix data types Texture data type 42 21

Data Binding Modos: uniform: : o parâmetro é fixo dentro de uma chamda glbegin() ()-glend() varying: : dados interpolados enviados ao programa de fragmento (ex. cor pixel, coordenadas de textura) attribute: : dados per-vertex enviados à GPU pela CPU (coordenadas( de vértices, coordenadas de texturas, normais,, etc). 43 Data Binding Direção ção: in: : dados enviados para dentro do programa (ex. vertex coordinates) out: : dados enviados para fora do the programa (ex. depth) inout: : ambos acima (ex. cor) 44 22

Operações e Fluxo de Controle Aritmética usual e operações algébricas especiais (trigonometry, interpolation, discrete derivatives, etc) No integer mod for-loops, while-do loops, if-then-else statements. discard permite desabilitar um fragmento e encerrar o processamento Chamadas recursivas não n estão suportadas Sempre uma função main default que começa o programa 45 23