hello folks,
I keep getting an access violation exception when I create a pixelshader.
Here's the code:
HRESULT result;
ID3D10Blob* errorMessage;
ID3D10Blob* vertexShaderBuffer;
ID3D10Blob* pixelShaderBuffer;
D3D11_INPUT_ELEMENT_DESC polygonLayout[2];
unsigned int numElements;
D3D11_BUFFER_DESC matrixBufferDesc;
errorMessage = 0;
vertexShaderBuffer = 0;
pixelShaderBuffer = 0;
result = D3DX11CompileFromFile(vsFilename, NULL, NULL, "VSTex", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL,
&vertexShaderBuffer, &errorMessage, NULL);
if(FAILED(result))
{
if(errorMessage)
{
OutputShaderErrorMessage(errorMessage, hwnd, vsFilename);
}
else
{
MessageBox(hwnd, vsFilename, L"Missing Shader File", MB_OK);
}
return false;
}
result = D3DX11CompileFromFile(psFilename, NULL, NULL, "PSTex", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL,
&pixelShaderBuffer, &errorMessage, NULL);
if(FAILED(result))
{
if(errorMessage)
{
OutputShaderErrorMessage(errorMessage, hwnd, psFilename);
}
else
{
MessageBox(hwnd, psFilename, L"Missing Shader File", MB_OK);
}
return false;
}
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader); if(FAILED(result))
{
return false;
}
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &m_pixelShader); if(FAILED(result))
{
return false;
}
I also checked if pixelShaderBuffer is still a nullpointer but it isn't and the buffersize is a non zero value.
I hope someone can help me. I also wish you a great valentine's day.