Advertisement Jump to content
Sign in to follow this  

Slimdx Effect File Access Violation

This topic is 860 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
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!