CreateVertexShader is returning with System.NullReferenceException.

Started by
1 comment, last by Paul C Skertich 11 years, 9 months ago
When I build the Managed Assembly C++ file it compiles fine. In C# - where I'm designing the level editor is when the exception happens. Only if I don't comment out the part where it compile shader file. I looked at it carefully and the ID3D10Blob isn't placing anything because it shows up as
"Undefined Value" or perhaps the D3D11CompileFromFile isn't loading the HLSL file.

I'm using oldsyntax CLI for my custom Engine wrapper just to design the level in C#.

Here's a small snipplet.


namespace Engine {
namespace Shaders {

__gc public class Shader {

private:
LPCWSTR *shaderfile;

public:

Shader() {

}

void Load() {
// load and compile the two shaders
ID3D10Blob *VS, *PS;


D3DX11CompileFromFile((LPCWSTR)"basicShader.hlsl", 0, 0, "VShader", "vs_5_0", 0, 0, 0, &VS, 0, 0);
D3DX11CompileFromFile((LPCWSTR)"basicShader.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);
dev->CreatePixelShader(PS->GetBufferPointer(), PS->GetBufferSize(), NULL, &pPS);

....


The error happens when


dev->CreateVertexShader(VS->GetBufferPoint(),....);


when I hover my mouse over &pVS it shows up Undefined Value. I can only assume the Blobby isn't doing it's job.

It's not pain I like - it's only that it challenges me to think! :D
Game Engine's WIP Videos - http://www.youtube.com/sicgames88
SIC Games @ GitHub - https://github.com/SICGames?tab=repositories
Simple D2D1 Font Wrapper for D3D11 - https://github.com/SICGames/D2DFontX
Advertisement
What I've read the LPCTSTR that the D3DX11CompileFromFile uses is a const TCHAR *. So, I changed the part Load(const TCHAR *file) and it compiled file. However, when I enter C# this gives me there's a overloaded argument. I've been at this whole thing pretty much all day.
Game Engine's WIP Videos - http://www.youtube.com/sicgames88
SIC Games @ GitHub - https://github.com/SICGames?tab=repositories
Simple D2D1 Font Wrapper for D3D11 - https://github.com/SICGames/D2DFontX
I'm still cracking at it. When the program gives me the error after I change the ID3DBlob10 *VS to a __value ID3DBlob10. It returns that &PS can not obtain value. Additionally, it says PS - IUnknown. I'm assuming that IUnknown is a interface for DIrectX C++.

I just updated the engine C++ managed code and it compiles fine. In C# is giving me crap.
Game Engine's WIP Videos - http://www.youtube.com/sicgames88
SIC Games @ GitHub - https://github.com/SICGames?tab=repositories
Simple D2D1 Font Wrapper for D3D11 - https://github.com/SICGames/D2DFontX

This topic is closed to new replies.

Advertisement