Question

That's about DirectX 9.

In typical case of rendering with vertex shader, there's one or more stream sources set in device, and format of the source data is defined using vertex declaration.

Now, if a vertex shader used need some attribute (for example, one with D3DDECLUSAGE_NORMAL and UsageIndex 1 or 2), but vertex declaration that's provided doesn't have that attribute included (ie. data provided in stream sources doesn't include that attribute), and DrawPrimitive is called, where does DirectX get value for that attribute?

Was it helpful?

Solution

"If the data in the vertex stream contains fewer components than the corresponding shader data type, the missing components will be initialized to 0 (except for w, which is initialized to 1)."

Taken from "Windows DirectX Graphics Documentation (August 2009)"

Contents > HLSL > Programming Guide > Writing HLSL Shaders in Direct3D 9 > Varying Shader Inputs and Semantics

OTHER TIPS

The DirectX 9 specification defines "default" values for undeclared attributes, usually (0,0,0,1). Either the device driver or GPU creates them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top