admin管理员组

文章数量:1405871

Problem Description

I try to draw a white triangle on the screen using Evergine with DirectX 12.

I've made a repository with minimal code base for this purpose, see HelloTriangle

Using DirectX 11 as a graphic context, it works fine, but with DirectX 12, it does not. See Renderable.cs -> Initialize().

When using DirectX 12, I get following exception:

An unhandled exception of type 'System.AccessViolationException' occurred in Vortice.Direct3D12.dll Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

at the line 118 at Triangle.cs -> RenderInternal(...):

commandBuffer.SetGraphicsPipelineState(_pipelineState);

Can somebody explain me, what might be the cause for this exception and how to fix it?

Things I've tried so far

1. Changing position in HLSL to float3

Since the vertices are stored as Vector3 data, I changed the input position in the HLSL file to float3. Didn't help.

I also tried storing Vector4 data instead of Vector3 and accessing them with float4 in the shader. Didn't work too.

2. Compile Shader with higher profile

Since DirectX12 needs shader model language 5.1, I tried to compile with a higher profile:

var compilerParams = CompilerParameters.Default with { Profile = GraphicsProfile.Level_12_0 };
var byteCode = graphicsContext.ShaderCompile(sourceCode, entryPoint, shaderStages, compilerParams).ByteCode;

This made no difference.

Summary

I suspect that something's wrong with the Evergine.DirectX12 package, but at the same time, this only seems too improbable.

Thanks for any help.

If it helps, there is a sample project by Evergine showing how to use the low-level API where I get my inspirations from: Link

Problem Description

I try to draw a white triangle on the screen using Evergine with DirectX 12.

I've made a repository with minimal code base for this purpose, see HelloTriangle

Using DirectX 11 as a graphic context, it works fine, but with DirectX 12, it does not. See Renderable.cs -> Initialize().

When using DirectX 12, I get following exception:

An unhandled exception of type 'System.AccessViolationException' occurred in Vortice.Direct3D12.dll Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

at the line 118 at Triangle.cs -> RenderInternal(...):

commandBuffer.SetGraphicsPipelineState(_pipelineState);

Can somebody explain me, what might be the cause for this exception and how to fix it?

Things I've tried so far

1. Changing position in HLSL to float3

Since the vertices are stored as Vector3 data, I changed the input position in the HLSL file to float3. Didn't help.

I also tried storing Vector4 data instead of Vector3 and accessing them with float4 in the shader. Didn't work too.

2. Compile Shader with higher profile

Since DirectX12 needs shader model language 5.1, I tried to compile with a higher profile:

var compilerParams = CompilerParameters.Default with { Profile = GraphicsProfile.Level_12_0 };
var byteCode = graphicsContext.ShaderCompile(sourceCode, entryPoint, shaderStages, compilerParams).ByteCode;

This made no difference.

Summary

I suspect that something's wrong with the Evergine.DirectX12 package, but at the same time, this only seems too improbable.

Thanks for any help.

If it helps, there is a sample project by Evergine showing how to use the low-level API where I get my inspirations from: Link

Share asked Mar 6 at 19:44 bertiooobertiooo 407 bronze badges 2
  • 1 You github code example works for me regardless if DX11 or DX12 is used. So maybe something in your hardware and not the code? – Paweł Łukasik Commented Mar 6 at 21:56
  • Thanks for checking out. This could be the issue. I have a rather older machine even though DirectX12 should be supported. – bertiooo Commented Mar 8 at 12:48
Add a comment  | 

1 Answer 1

Reset to default 0

Updating the Intel HD Graphics driver was the solution.

I was assuming, that my application would run using the Nvidia GPU of my system, but that was not the case. Instead, the processor graphics of Intel was used. And its driver was outdated.

Thanks to Paweł Łukasik for the hint.

本文标签: netWhy do I get a SystemAccessViolationException when using DirectX12 with EvergineStack Overflow