Jump to content

  • Log In with Google      Sign In   
  • Create Account


CreateVertexShader is returning with System.NullReferenceException.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 SIC Games   Members   -  Reputation: 410

Like
0Likes
Like

Posted 23 July 2012 - 09:42 PM

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
-Paul

Sponsor:

#2 SIC Games   Members   -  Reputation: 410

Like
0Likes
Like

Posted 24 July 2012 - 01:14 AM

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.
-Paul

#3 SIC Games   Members   -  Reputation: 410

Like
0Likes
Like

Posted 24 July 2012 - 08:26 AM

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.
-Paul




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS