Jump to content
  • Advertisement
Sign in to follow this  
Florian22222

ERROR: DrawIndexed

This topic is 2521 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement

[font=arial,helvetica,sans-serif]Hi,[/font]



[font=arial,helvetica,sans-serif]Is [color="#660066"]gTex a cubemap or a 3d texture? If there is a mismatch, you'll get that error.[/font]



[font=arial,helvetica,sans-serif][color=#660066]Cheers![/font]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!