-
-
Notifications
You must be signed in to change notification settings - Fork 444
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
I've tried to compile a very basic shader with the D3DCompiler and it's Compile function and CompileFromFile function respectively. However, the compiling fails. The errorMsgs variable says in both cases error X3000. Please see the MWE and detailed error messages below.
Steps to reproduce
- Platform: Desktop
- Framework Version: .NET 6
- API: DirectX
- API Version: DirectX12
Using D3DCompiler.Compile()
D3DCompiler D3D = D3DCompiler.GetApi();
var filePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "HelloTriangle.hlsl");
if (!File.Exists(filePath))
{
throw new Exception("huh?");
}
string shaderContent = File.ReadAllText(filePath);
ID3D10Blob* shader;
ID3D10Blob* errorMsgs;
fixed (char* pContent = shaderContent)
{
int res = D3D.Compile(pSrcData: pContent,
SrcDataSize: (nuint)shaderContent.Length,
pSourceName: "triangle",
pDefines: null,
pInclude: null,
pEntrypoint: "VSMain",
pTarget: "vs_5_0",
Flags1: 0,
Flags2: 0,
ppCode: &shader,
ppErrorMsgs: &errorMsgs);
SilkMarshal.ThrowHResult(res);
}If I look into the error message, I get: ...\Debug\net6.0\triangle(1,1): error X3000: unrecognized identifier 's'
Using D3DCompiler.CompileFromFile()
D3DCompiler D3D = D3DCompiler.GetApi();
var filePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "HelloTriangle.hlsl");
ID3D10Blob* shader;
ID3D10Blob* errorMsgs;
fixed (char* pPath = filePath)
{
int res = D3D.CompileFromFile(pFileName: pPath,
pDefines: null,
pInclude: null,
pEntrypoint: "VSMain",
pTarget: "vs_5_0",
Flags1: 0,
Flags2: 0,
ppCode: &shader,
ppErrorMsgs: &errorMsgs);
SilkMarshal.ThrowHResult(res);
}If I look into the error message, I get: ...\Debug\net6.0\HelloTriangle.hlsl(1,1): error X3000: Illegal character in shader file
The shader I've tried to use: https://github.com/dotnet/Silk.NET/blob/e79e16542e0e916be8aa8460fa06eed2719d8430/src/Lab/Experiments/D3D12Triangle/HelloTriangle.hlsl
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working