0

I'm trying to load a shader file using the D3DX11CompileFromFile() function when I get the HRESULT error "An undetermined error occurred"( I'm using DXGetErrorDescription() to debug). The weird thing is that I can't find the error even listed in the MSDN documentation of HRESULT. I'm abit unsure what the problem could be, because lately my visual studio 2010 c++ express have been acting up giving me loads of code unrelated errors. Have anyone else encountered this error, and if so what was the problem ?

I have only made a few small changes to the program since it last worked perfectly. I'm 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 just in case there is some silly error.

.fx -file:

 VS_OUTPUT VS(float4 inPos : POSITION, float4 inColor : COLOR)
 {
     VS_OUTPUT output;

     output.Pos = inPos;
     output.Color = inColor;

     return output;
 }

 float4 PS(VS_OUTPUT input) : SV_TARGET
 {
      return input.Color;
 }

The other code that have been changed:

   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 added the the new parameters to the vertex strucs on the place i use them.

  • Does the previous version still run without error? – stark Mar 17 '13 at 22:43
  • Yes. It's so hard to know what it is, because I cant change back part by part to se when it starts working. The only thing i have been able to rule out so far is the pixel shader. It must be something wrong with either the vertex shader, the layout or the vertex struct – Fredrik Boston Westman Mar 17 '13 at 23:32
  • http://msdn.microsoft.com/en-us/library/windows/desktop/ff476261%28v=vs.85%29.aspx Loks like the function is deprecated – stark Mar 19 '13 at 11:05
  • Fixed the problem, was a undecleared variable in the shader – Fredrik Boston Westman Mar 19 '13 at 14:11

0 Answers0