EDN Admin
Well-known member
First of all, i hope this is the rigth place in the forum for this subject, if not im sorry.
Im trying to load a shader file using the D3DX11CompileFromFile() function when I get the HRESULT error "An undetermined error occurred".I have tried alot of things but still dont get it to work, and the error dosnt help me much
I have only made a few small changes to the program since it last worked perfectly ( and if i reverse the changes it works perfectly again). Im following a tutorial to so one would expect the code to be correct, but seeing how i am a newbie i will list the changed areas since it last worked:
.fx -file
Before:
float4 VS(float4 inPos : POSITION) : SV_POSITION
{
return inPos;
}
float4 PS() : SV_TARGET
{
return float4(0.0f, 0.0f, 1.0f, 1.0f);
}
Now (not working): struct VS_OUTPUT
{
float4
float4 color : COLOR;
};
VS_OUTPUT VS(float4 inPos : POSITION, float4 inColor : COLOR)
{
VS_OUTPUT output;
output.Pos = inPos;
output.Color = inColor;
return output;
}
float4 PS(float4 nbsp; return color;
}
The other code (not working version):
only thing i added was the 4 last parameters on the struct, the color part and the last element in the layout
struct Vertex //Overloaded Vertex Structure
{
Vertex(){}
Vertex(float x, float y, float z, float cr, float cg, float cb, float ca)
: pos(x,y,z), color(cr,cg,cb,ca){}
XMFLOAT3 pos;
XMFLOAT4 color;
};
//the layout, one element for each variable in the vertex struct
D3D11_INPUT_ELEMENT_DESC layout[] =
{
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
{"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
UINT numElements = ARRAYSIZE(layout); //the number of elements
I also update the place where i use my vertex struct.
Help is very appreciated, thanks in advance
View the full article
Im trying to load a shader file using the D3DX11CompileFromFile() function when I get the HRESULT error "An undetermined error occurred".I have tried alot of things but still dont get it to work, and the error dosnt help me much
I have only made a few small changes to the program since it last worked perfectly ( and if i reverse the changes it works perfectly again). Im following a tutorial to so one would expect the code to be correct, but seeing how i am a newbie i will list the changed areas since it last worked:
.fx -file
Before:
float4 VS(float4 inPos : POSITION) : SV_POSITION
{
return inPos;
}
float4 PS() : SV_TARGET
{
return float4(0.0f, 0.0f, 1.0f, 1.0f);
}
Now (not working): struct VS_OUTPUT
{
float4
float4 color : COLOR;
};
VS_OUTPUT VS(float4 inPos : POSITION, float4 inColor : COLOR)
{
VS_OUTPUT output;
output.Pos = inPos;
output.Color = inColor;
return output;
}
float4 PS(float4 nbsp; return color;
}
The other code (not working version):
only thing i added was the 4 last parameters on the struct, the color part and the last element in the layout
struct Vertex //Overloaded Vertex Structure
{
Vertex(){}
Vertex(float x, float y, float z, float cr, float cg, float cb, float ca)
: pos(x,y,z), color(cr,cg,cb,ca){}
XMFLOAT3 pos;
XMFLOAT4 color;
};
//the layout, one element for each variable in the vertex struct
D3D11_INPUT_ELEMENT_DESC layout[] =
{
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
{"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
UINT numElements = ARRAYSIZE(layout); //the number of elements
I also update the place where i use my vertex struct.
Help is very appreciated, thanks in advance
View the full article