Jump to content

  • Log In with Google      Sign In   
  • Create Account


MagnarTBL

Member Since 26 Apr 2012
Offline Last Active Apr 28 2012 04:46 AM
-----

Posts I've Made

In Topic: DirectX Tutorial.com - App crashes

28 April 2012 - 04:46 AM

This is the shader code. And, to be honest, this is straight off from the tutorial.

struct VOut
{
float4 position : SV_POSITION;
float4 color : COLOR;
};
VOut VShader(float4 position : POSITION, float4 color : COLOR)
{
VOut output;
output.position = position;
output.color = color;
return output;
}
 
float4 PShader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET
{
return color;
}

In Topic: DirectX Tutorial.com - App crashes

27 April 2012 - 02:28 AM

You should be putting a breakpoint in your application's entry and stepping until you encounter the crash (or just spam printf's everywhere), it's probably not DirectX that's failing here but StdAfx.h, since you said previous examples work.


I also had to put in #include <StdAfx.h> on the other examples (the white screen and the blue screen), and both of those examples worked. So I kind of think that the StdAfx.h is just needed for Visual Studio itself to easier rebuild the headers etc. And that part works fine.

The problems seems to me to be either the load of the shaders.hlsl file doesn't work as intended, or there is something else that does work with the shader function invoked. Very strange, though?

In Topic: DirectX Tutorial.com - App crashes

27 April 2012 - 02:23 AM

Hi again,
It seems to be a issue on the shader load.

On the last line of the code in the text-cut below is where the debugger crashes.

// this function loads and prepares the shaders
void InitPipeline()
{
// load and compile the two shaders
ID3D10Blob *VS, *PS;
D3DX11CompileFromFile(L
"shaders.hlsl", 0, 0, "VShader", "vs_5_0", 0, 0, 0, &VS, 0, 0);
D3DX11CompileFromFile(L
"shaders.hlsl", 0, 0, "PShader", "ps_5_0", 0, 0, 0, &PS, 0, 0);
// encapsulate both shaders into shader objects
dev->CreateVertexShader(VS->GetBufferPointer(), VS->GetBufferSize(), NULL, &pVS);

The Debugger error is:
Unhandled exception at 0x771115de in DirectX_Test.exe 0xc0000005: Access violation reading location 0x00000000.

The shaders.hlsl file is part of the project together with the cpp file. And the shaders file includes the code that is on the tutorial webpage.

Why is it crashing on the dev->CreateVertexShader line?

In Topic: DirectX Tutorial.com - App crashes

26 April 2012 - 10:51 PM

I might add to say that all examples before the triangle is to be drawn works fine. So the first example of the "white screen" works. Also the "blue screen" example works. But not the example where it draws the triangle.

In Topic: direct x9 project

26 April 2012 - 12:13 PM

Guys, how did you make the examples work from that tutorial site? All that happens when I build that project is that the build goes OK - but when I run the file the application itself crashes. Regardless if I use reference or hardware mode on the driver settings...

Any ideas why it crashes? The white window with the DirectX application do turn up on the screen - but it crashes direct after.

Magnar

PARTNERS