0
\$\begingroup\$

I have a vs_2_0 shader like this:

struct ConstantBuffer
{
    float4 diffuse;
    float4 specular
};

shared uniform ConstantBuffer g_cb : app_constantBuffer;

void PS(out float4 Color: COLOR0)
{
    Color = g_cb.diffuse;
}

The above example is simple, the constant buffer only stores two 4 component colors. I want to set the constant buffer before binding the pixel shader. I do not want to use the ID3DXEffect interface.

The IDirect3D9Device interface only provides methods for setting primitive types...I want to set the entire struct at one time. Is this possible?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

D3D9 doesn't support constant buffers but all uniforms are placed into one global "constant buffer". You can set multiple float4 constants at once with IDirect3DDevice9::SetPixelShaderConstantF() by passing the number of constants as the last argument.

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.