13.07.2015 Views

Mali GPU User Interface Engine Application Development Guide

Mali GPU User Interface Engine Application Development Guide

Mali GPU User Interface Engine Application Development Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Tutorial on Constructing Custom Shaders6.1 Overview of the graphics pipelineFigure 6-1 shows the processing flow for a typical CPU and OpenGL ES 2.0 <strong>GPU</strong> combination:Start processing<strong>Application</strong> running on CPU defines shape data, textures, andshader programs<strong>Application</strong> on CPU communicates with <strong>GPU</strong> to set texturesand shader programsInitialization andpre-processing<strong>Application</strong> on CPU makes library call to clear the back buffer(if double-buffered drawing)<strong>Application</strong> on CPU calculates new shape data or view optionsPrimitive shapeinformation calculatedand loaded into drawbufferLibrary draw function called to perform shape calculation anddisplayVertex shader program executes in the <strong>GPU</strong> geometryprocessor and calculates vertex data and interpolates pointswithin primitive shapePer-vertex operationsand primitive assemblyThe fragment shader program is executed in one of the <strong>GPU</strong>processors and calculates the appearance of the fragmentlocation passed from the vertex shaderRasterization andfragment shadingThe fragment data is written to the framebufferThere might be additional blending or modificationSwitch framebuffers to display calculated image to the displayBlending andframebuffer operationsFigure 6-1 Processing flow with <strong>GPU</strong> shadersThe primary function of the vertex shader is to calculate the position of a point on the primitiveshape by interpolation from the vertex locations. This is often called the transformation stagebecause it typically generates a pixel location based on matrix operations on a 3D shape. It canalso:• read uniform and attribute values passed to the vertex shader by the application• create new varying constants to pass to the fragment shader• use matrix transformations to modify the interpolated position• calculate tangents and normals that will be used by the fragment shader to adjust lightingand color• calculate the color for a point based on its distance from the vertices and output theintermediate color to the fragment shader.• modify global variables that determine the position of the fragment.ARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 6-2ID070710Non-Confidential - Draft - Beta

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!