• Advertisement
Sign in to follow this  

Slimdx Effect File Access Violation

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

Hi, I`m getting this very weird error when i try to load my shader code from an effect file next to my executable.

An unhandled exception of type 'System.AccessViolationException' occurred in SlimDX.dll

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. 

Here`s my shader loading code.

...
var vertexBuffer = new SlimDX.Direct3D11.Buffer(device, vertices, 12 * 3, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);

            using (var bytecode = ShaderBytecode.CompileFromFile("green.fx", "VShader", ShaderFlags.None, EffectFlags.None))
            {
                vertexShader = new VertexShader(device, bytecode);
                var elements = new[] { new InputElement("POSITION", 0, Format.R32G32B32_Float, 0) };
                inputLayout = new InputLayout(device, ShaderSignature.GetInputSignature(bytecode), elements);
            }

            using (var bytecode = ShaderBytecode.CompileFromFile("green.fx", "PShader", ShaderFlags.None, EffectFlags.None))
                pixelShader = new PixelShader(device, bytecode);

            context.InputAssembler.InputLayout = inputLayout;
            context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
...

Any ideas whats`s causing this? Never happened to me before.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement