Advertisement

Understanding D3D11 basics

Started by June 28, 2015 10:10 PM
10 comments, last by bigworld12 9 years, 6 months ago

What you pass through has to match what the shader expects to receive.

If the shader expects 2x Vector4 values per vertex (1 for position and 1 for color), then you need to supply that.

Different shaders can expect different things, for example a single vector position, and the color hard coded in the shader.


struct VS_IN
{
	float4 pos : POSITION;
	float4 col : COLOR;
};

Your vertex shader is expecting 8 floats(2x float4) per vertex, as mentioned above, and this is where that information was dictated. if you do not follow the signature of the shader bad ju ju will follow. In dx9 this meansgarbage in garbage out. In dx10 and later, they got smart by forcing a validation with an input signature when compiling a shader. This is your layout parameter above as well. the shader signature, input layout, and vertex data must match if the shader has any hope of doing something with that data other than mangling it.

What you pass through has to match what the shader expects to receive.

If the shader expects 2x Vector4 values per vertex (1 for position and 1 for color), then you need to supply that.

Different shaders can expect different things, for example a single vector position, and the color hard coded in the shader.


struct VS_IN
{
	float4 pos : POSITION;
	float4 col : COLOR;
};

Your vertex shader is expecting 8 floats(2x float4) per vertex, as mentioned above, and this is where that information was dictated. if you do not follow the signature of the shader bad ju ju will follow. In dx9 this meansgarbage in garbage out. In dx10 and later, they got smart by forcing a validation with an input signature when compiling a shader. This is your layout parameter above as well. the shader signature, input layout, and vertex data must match if the shader has any hope of doing something with that data other than mangling it.

thanks now i understand what to do

Edit :

i changed my vertexes to this


Dim MyVertexes() As Vector4 = {New Vector4(0.0F, 0.5F, 0.0F, 1.0F),
                                           New Vector4(GetColorRGBA(Color.Red)),
                                           New Vector4(0.45F, -0.5F, 0.0F, 1.0F),
                                           New Vector4(GetColorRGBA(Color.Green)),
                                           New Vector4(-0.45F, -0.5F, 0.0F, 1.0F),
                                           New Vector4(GetColorRGBA(Color.Blue))}

which works perfectly ! thanks all

This topic is closed to new replies.

Advertisement