ARB Fragment Program in GPULib. Summary Fragment program arquitecture New instructions.  Emulating instructions not supported directly New Required GL.

Slides:



Advertisements
Similar presentations
Fragment level programmability in OpenGL Evan Hart
Advertisements

Slides created by: Professor Ian G. Harris Efficient C Code  Your C program is not exactly what is executed  Machine code is specific to each ucontroller.
DirectX 8 and GeForce3 Christian Schär & Sacha Saxer.
Polygon Rendering Flat Rendering Goraud Rendering Uses Phong Reflectance Phong Rendering.
Topics covered: CPU Architecture CSE 243: Introduction to Computer Architecture and Hardware/Software Interface.
Michael I. Gold NVIDIA Corporation
Frame Buffer Postprocessing Effects in DOUBLE-S.T.E.A.L (Wreckless)
OpenGL Fragment Operations
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Graphics Pipeline.
Status – Week 257 Victor Moya. Summary GPU interface. GPU interface. GPU state. GPU state. API/Driver State. API/Driver State. Driver/CPU Proxy. Driver/CPU.
Computer Graphics(Fall 2003) COMS 4160, Lecture 7: OpenGL 3 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
CS-378: Game Technology Lecture #9: More Mapping Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
9/25/2001CS 638, Fall 2001 Today Shadow Volume Algorithms Vertex and Pixel Shaders.
The Programmable Graphics Hardware Pipeline Doug James Asst. Professor CS & Robotics.
Shading Languages GeForce3, DirectX 8 Michael Oswald.
ARBVP10 FrameWork in GLLib. Contents New GLLib FrameWork classes  ProgramObjects (and related).  VSLoader  GLState Vertex Attributes management through.
A Crash Course on Programmable Graphics Hardware Li-Yi Wei 2005 at Tsinghua University, Beijing.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Status – Week 243 Victor Moya. Summary Current status. Current status. Tests. Tests. XBox documentation. XBox documentation. Post Vertex Shader geometry.
Modern Graphics Hardware 2002 Vertex Programs Joe Michael Kniss.
3D Graphics Processor Architecture Victor Moya. PhD Project Research on architecture improvements for future Graphic Processor Units (GPUs). Research.
Atila OGL library “T&L emulated via Vertex Shaders”
Status – Week 242 Victor Moya. Summary Current status. Current status. Tests. Tests. XBox documentation. XBox documentation. Post Vertex Shader geometry.
Status – Week 277 Victor Moya.
The Processor 2 Andreas Klappenecker CPSC321 Computer Architecture.
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
Status – Week 276 Victor Moya. Hardware Pipeline Command Processor. Command Processor. Vertex Shader. Vertex Shader. Rasterization. Rasterization. Pixel.
Status – Week 279 Victor Moya. Rasterization Setup triangles (calculate slope values). Setup triangles (calculate slope values). Fill triangle: Interpolate.
Status – Week 281 Victor Moya. Objectives Research in future GPUs for 3D graphics. Research in future GPUs for 3D graphics. Simulate current and future.
Compilation, Architectural Support, and Evaluation of SIMD Graphics Pipeline Programs on a General-Purpose CPU Mauricio Breternitz Jr, Herbert Hum, Sanjeev.
Status – Week 260 Victor Moya. Summary shSim. shSim. GPU design. GPU design. Future Work. Future Work. Rumors and News. Rumors and News. Imagine. Imagine.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
Shader generation and compilation for a programmable GPU Student: Jordi Roca Monfort Advisor: Agustín Fernández Jiménez Co-advisor: Carlos González Rodríguez.
GPU Acceleration in Registration Danny Ruijters 26 April 2007.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Shading in OpenGL.
Geometric Objects and Transformations. Coordinate systems rial.html.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Using Vertex Shader in DirectX 8.1 강 신 진
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
6-1 Chapter 6 - Languages and the Machine Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer.
Chapter 4 The Von Neumann Model
CSE 690: GPGPU Lecture 6: Cg Tutorial Klaus Mueller Computer Science, Stony Brook University.
Shading Languages & HW Giovanni Civati Dept. of Information Tecnology University of Milan, Italy Milan, 26 th May 2004.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
Review of OpenGL Basics
A User-Programmable Vertex Engine Erik Lindholm Mark Kilgard Henry Moreton NVIDIA Corporation Presented by Han-Wei Shen.
Shading in OpenGL Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E.
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
COMPILERS CLASS 22/7,23/7. Introduction Compiler: A Compiler is a program that can read a program in one language (Source) and translate it into an equivalent.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
David Luebke 1 1/25/2016 Programmable Graphics Hardware.
09/25/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Shadows Stage 2 outline.
Pixel Shader  Based on nVIDIA’s GF3/4 architecture  Texture shader + register combiner texture unit 0texture program texture unit 1texture program texture.
An Introduction to the Cg Shading Language Marco Leon Brandeis University Computer Science Department.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
Chapter 5. Lighting Computer Graphics (spring, 2009) School of Computer Science University of Seoul.
A Crash Course on Programmable Graphics Hardware
Chapter 6 GPU, Shaders, and Shading Languages
Computer Architecture
Compiler Construction
The fetch-execute cycle
Design of the Control Unit for One-cycle Instruction Execution
Introduction to Programmable Hardware
Where does the Vertex Engine fit?
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
Presentation transcript:

ARB Fragment Program in GPULib

Summary Fragment program arquitecture New instructions.  Emulating instructions not supported directly New Required GL State Compiler status

Fragment program architecture What fragment programs bypass:  Replaces multitexturing pipe: Replaces this calculations:  Texture blending  Color sum  Fog What not (is preserved):  Coverage application  Alpha Test  Stencil and depth test  Blending

Fragment program architecture (II) User-defined Fragment Processing frame-buffer ops Color Sum setup Texture Fetch and Application rasterizer Fog

Fragment program architecture (III) Attributes Fragment Program Result Registers Temporary Variables Program Local Parameters Program Environment Parameters Address Variables

Fragment program architecture(IV) Input attributes (called fragment attributes):  color (primary and secondary)  vector of texture coordinates (for multitexturing)  fog coordinate  position (window position + z) Output attributes:  2 attributes to write: color (r,g,b,a) depth (*,*,d,*)

Fragment program architecture(V) Program local and environment parameters:  Like vertex programs: local: private for each fragment program env: shared for all programs (including vertex programs). Limits (the implementation has to guarantee equal or higher limits):  Total Number of instructions: 72 ALU instructions: 48 Texture instructions: 24  Texture indirections: 4  Temporaries: 16  Program parameters: 24

New instructions The same instructions as vertex programs:  Except: ARL: Now, no address registers to load LOG, EXP: Remain LG2 and EX2 instructions.  Plus: SIN, COS, SCS(leave sinus on.x and cosinus on.y) LRP (Linear Interpolation instruction) CMP (Compare instruction) Note about ALU instructions:  Implementations may be able to perform fragment program computations at more than one precision:  New program option directives: OPTION ARB_precision_hint_fastest; # Minimize execution time OPTION ARB_precision_hint_nicest; # Maximize execution time

New instructions (II) And... the Texture instructions:  Gets texture coordinates of fragment and samples the texture color corresponding to the fragment. TEX myTexel, fragment.texcoord[1], texture[2], 3D;  Extended texture fetches: TXP and TXB

Texture indirections A texture dependency occurs when a texture instruction depends on the result of a previous instruction (ALU or texture) for use as its texture coordinate. A fragment program with no dependencies has 1 texture indirections: !!ARBfp1.0 # No texture instructions, but always 1 indirection MOV result.color, fragment.color; END Texture dependencies sums indirection !!ARBfp1.0 # A simple dependent texture instruction, 2 indirections TEMP myColor; MUL myColor, fragment.texcoord[0], fragment.texcoord[1]; TEX result.color, myColor, texture[0], 2D; END

New instructions (III) KIL instruction: KIL vectorSrcReg;  Prevents a fragment from receiving any future processing if any component of its source vector is negative  ARB instruction takes a vector operand rather than a condition code (NVIDIA) Saturation Flag:  Optional clamping of each component of the destination register to the range [0,1] is controlled by an opcode modifier.  There is a clamped version of each instruction: ADD_SAT, TEX_SAT, CMP_SAT, LRP_SAT.

Instruction emulation SIN, COS, TEX, TXP, TXB supported directly by GPU. SCS:  Emulated using the separate SIN and COS LRP: LPR result, op0, op1, op2; ADD result, op0, -op2; MAD result, result, op1, op2;

Instruction emulation CMP: CMP dst, src0, src1, src2; SLT tmp, src0, {0,0,0,0}; LRP dst, tmp, src1, src2;

New GLState GLState shared with vertex programs:  Material Properties: material ambient, diffuse, specular (for front and back faces)  Light and Lightmodel Properties: ambient, diffuse, specular, attenuation, spot direction, spot cut-off (for each GL_LIGHTX).  Matrix Properties: Modelview, MVP, projection matrices with.transpose,.inverse,.invtrans modifiers. New GLState:  Texture Environment Color Property: state.texenv[n].color ( n = 0 to #texture units)  Fog Properties: RGB fog color Params (fog density, linear start and end, and 1/(end-start))  Depth Properties: Depth range near, far, and (far-near)

Compiler Status !!ARBfp1.0 # Simple program to show how to code up # the default texture environment ATTRIB tex = fragment.texcoord; #first set of texture # coordinates ATTRIB col = fragment.color.primary; OUTPUT outColor = result.color; TEMP tmp; TXP tmp, tex, texture, 2D; #sample the texture MUL outColor, tmp, col; #perform the modulation END Flex + Bison (Completed) !!ARBvp1.0 IR Code Generation Específico GPU Generic + TEX,CMP,... Line:By0By1By2By3By4By5By6By7By8By9ByAByBByByDByEByF 011: b 6a 00 0f 1b : b 1b b : b 1b b 14 b8 014: b 1b b : b 1b b 04 f8 016: b 1b b : b 1b b : b b 04 d8 019: b b : ae 00 0c 1b : b 04 b8 022: b : c 1b 14 f8 024: a ae 00 0c 1b : b c 1b (Completed) Current work:

Compiler Status Lexical and Syntactical: Complete Translation of generic to GPU instructions: Complete Current Work:  Generating new IR for the fragment program grammar.  Semantic Parse and Code generation parse