Jump to content
  • Advertisement
Sign in to follow this  

CreateInputLayout crashes only outside VS

This topic is 3161 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

Hello everyone, This problem is driving me nuts. I was porting a simple OBJ mesh loader from Direct3D 9 (no shaders) to Direct3D 10. When it runs inside the debugger, everything is fine, albeit taking more than it should to load. It also won't step into the call when I try figure out where it might go wrong... I assume this is expected? Is this particular call's source closed? What I did was basically copy and paste most of the SDK's tutorial about lighting, changing what was necessary, encapsulating what made sense with my classes, etc. Here's the fragment where it happens:
  /* Create the effect */
#if defined( DEBUG ) || defined( _DEBUG )
/* Set the D3D10_SHADER_DEBUG flag to embed debug information in the shaders.
   Setting this flag improves the shader debugging experience, but still allows 
   the shaders to be optimized and to run exactly the way they will run in 
   the release configuration of this program. */
  shader_flags |= D3D10_SHADER_DEBUG;
  hr = D3DX10CreateEffectFromFile ("Tutorial06.fx",
                                   NULL, NULL,
                                   NULL, NULL,
                                   NULL, NULL);
  if (FAILED (hr)) {
    printf ("Tutorial06.fx not found.\n");
    return hr;
    getchar ();

  /* obtain the techniques */
  technique_render       = effect->GetTechniqueByName ("render");
  technique_render_light = effect->GetTechniqueByName ("render_light");

  /* obtain the variables */
  world_variable         = effect->GetVariableByName ("world_matrix")->AsMatrix();
  view_variable          = effect->GetVariableByName ("view_matrix")->AsMatrix();
  projection_variable    = effect->GetVariableByName ("projection_matrix")->AsMatrix();
  light_dir_variable     = effect->GetVariableByName ("light_dir")->AsVector();
  light_color_variable   = effect->GetVariableByName ("light_color")->AsVector();
  output_color_variable  = effect->GetVariableByName ("output_color")->AsVector();

  /* define the input layout */
  D3D10_INPUT_ELEMENT_DESC layout[] = {
    {"NORMAL",   0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0},
  UINT num_elements = sizeof (layout) / sizeof (layout[0]);

  /* create the input layout */
  D3D10_PASS_DESC pass_desc;
  technique_render->GetPassByIndex (0)->GetDesc (&pass_desc);

  /* Using printf, I noticed it works up to here. This next call crashes. */

  hr = d3ddev->CreateInputLayout (layout,
  if (FAILED (hr))
    return hr;

  /* Set the input layout */
  d3ddev->IASetInputLayout (vertex_layout);

  return init_graphics ();

Can anyone help me with some clues as to what might have gone wrong? :) [Edited by - LMedina on February 21, 2010 1:54:15 AM]

Share this post

Link to post
Share on other sites
OOps, problem solved. Turns out I had a copy of the shader file with the variables under a different name in the Debug folder... it called the correct one in the project folder when I ran it through Visual Studio, but the wrong one from the command line.

Sorry for the bother :)

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!