Jump to content
  • Advertisement
Sign in to follow this  
Paul C Skertich

CreateVertexShader is returning with System.NullReferenceException.

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

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

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!