Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


ERROR: DrawIndexed


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 IceBreaker23   Members   -  Reputation: 618

Like
0Likes
Like

Posted 20 January 2012 - 04:51 AM

I get this error at the above code:

D3D10: ERROR: ID3D10Device::DrawIndexed: The view dimension declared in the shader code does not match the view type bound to slot 0 of the Pixel Shader unit. This is invalid if the shader actually uses the view (e.g. it is not skipped due to shader code branching). [ EXECUTION ERROR #354: DEVICE_DRAW_VIEW_DIMENSION_MISMATCH ]


ID3D10ShaderResourceView *m_pTexture;
if(FAILED(D3DX10CreateShaderResourceViewFromFile(m_pd3dDevice,m_EnvMapFilename,NULL,NULL,&m_pTexture,NULL)))
  {
   MessageBox(NULL,TEXT("Skybox.dds cant be loaded"),TEXT("Skybox error"),MB_OK);
   exit(1);
  }

Setting up the variables:
//compute WVP
  D3DXMATRIX mWVP;
  mWVP = m_World;
  D3DXMatrixMultiply(&mWVP,&mWVP,pView);
  D3DXMatrixMultiply(&mWVP,&mWVP,pProj);
 
  ID3D10EffectVariable *gWVP = m_pEffect->GetVariableByName("gWVP");
  ID3D10EffectVariable *gTex = m_pEffect->GetVariableByName("gTex");
  gWVP->AsMatrix()->SetMatrix(mWVP);
  gTex->AsShaderResource()->SetResource(m_pTexture);

and finally my shader:
uniform extern matrix gWVP;
uniform extern Texture3D gTex;
SamplerState CubeTextureSampler
{
    Filter = MIN_MAG_MIP_LINEAR;
    AddressU = CLAMP;
    AddressV = CLAMP;
};
//shader i/o structs
struct VS_OUTPUT
{
    float4 Position	 : SV_POSITION; // vertex position
    float3 TexCoord3    : TEXCOORD0;   // vertex texture coords
};
VS_OUTPUT RenderSceneVS( float3 Position : POSITION, float3 TexCoord3 : TEXCOORD0 )
{
    VS_OUTPUT Output = (VS_OUTPUT) 0;

Output.Position = mul(float4(Position,1.0f),gWVP);
Output.TexCoord3 = TexCoord3;

return Output;
}
float4 RenderScenePS(VS_OUTPUT Input) : SV_TARGET
{
return gTex.Sample(CubeTextureSampler,Input.TexCoord3);
}
technique10 T1
{
pass P1
{
  SetVertexShader( CompileShader( vs_4_0, RenderSceneVS() ) );
  SetGeometryShader( NULL );
  SetPixelShader( CompileShader( ps_4_0, RenderScenePS() ) );
}
}

Please help me! :D

Sponsor:

#2 kauna   Crossbones+   -  Reputation: 2894

Like
1Likes
Like

Posted 20 January 2012 - 07:14 AM

Hi,


Is gTex a cubemap or a 3d texture? If there is a mismatch, you'll get that error.


Cheers!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS