Export (0) Print
Expand All

Effects (Direct3D 11)

A DirectX effect is a collection of pipeline state, set by expressions written in HLSL and some syntax that is specific to the effect framework. After compiling an effect, use the effect framework APIs to render. Effect functionality can range from something as simple as a vertex shader that transforms geometry and a pixel shader that outputs a solid color, to a rendering technique that requires multiple passes, uses every stage of the graphics pipeline, and manipulates shader state as well as the pipeline state not associated with the programmable shaders. This section describes DirectX effects.

The first step is to organize the state you want to control in an effect. This includes shader state (vertex, hull, domain, geometry, pixel and compute shaders), texture and sampler state used by the shaders, and other non-programmable pipeline state. You can create an effect in memory as a text string, but typically, the size gets large enough that it is handy to store effect state in an effect file (a text file that ends in a .fx extension). To use an effect, you must compile it (to check HLSL syntax as well as effect framework syntax), initialize effect state through API calls, and modify your render loop to call the rendering APIs.

An effect encapsulates all of the render state required by a particular effect into a single rendering function called a technique. A pass is a sub-set of a technique, that contains render state. To implement a multiple pass rendering effect, implement one or more passes within a technique. For example, say you wanted to render some geometry with one set of depth/stencil buffers, and then draw some sprites on top of that. You could implement the geometry rendering in the first pass, and the sprite drawing in the second pass. To render the effect, you simply render both passes in your render loop. You can implement any number of techniques in an effect. Of course, the greater the number of techniques, the greater the compile time for the effect. One way to exploit this functionality is to create effects with techniques that are designed to run on different hardware. This allows an application to gracefully downgrade performance based on the hardware capabilities detected.

A set of techniques can be grouped in a group (which uses the syntax "fxgroup"). Techniques can be grouped in any way. For example, multiple groups could be created, one per material; each material could have a technique for each hardware level; each technique would have a set of passes which define the material on the particular hardware.

In This Section

ItemDescription

Organizing State in an Effect

Describes organizing the pipeline state in an effect.

Effect System Interfaces

Groups and describes Effects 11 interfaces.

Specializing Interfaces

Describes ways to cast Effects 11 interfaces into particular types of interfaces you need.

Interfaces and Classes in Effects

Describes ways to use classes and interfaces in Effects 11.

Rendering an Effect

Describes the steps for preparing an effect for rendering.

Cloning an Effect

Describes the syntax for cloning an effect.

Stream Out Syntax

Describes the syntax for a geometry shader with stream out.

Differences Between Effects 10 and Effects 11

Describes the differences between Effects 10 and Effects 11.

 

Related topics

Programming Guide for Direct3D 11

 

 

Community Additions

ADD
Show:
© 2014 Microsoft