Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented exprimental support for dxc compiler (WIP) #3133

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/renderer_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3136,7 +3136,7 @@ namespace bgfx { namespace d3d12
bx::Error err;
read(&rd, dxbc, &err);

bool patchShader = !dxbc.shader.aon9;
bool patchShader = !dxbc.shader.aon9 && !dxbc.shader.dxil;
if (BX_ENABLED(BGFX_CONFIG_DEBUG)
&& patchShader)
{
Expand Down
9 changes: 9 additions & 0 deletions src/shader_dxbc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1970,6 +1970,7 @@ namespace bgfx
size += bx::read(_reader, _dxbc.header, _err);
_dxbc.shader.shex = false;
_dxbc.shader.aon9 = false;
_dxbc.shader.dxil = false;

for (uint32_t ii = 0; ii < _dxbc.header.numChunks; ++ii)
{
Expand Down Expand Up @@ -2041,6 +2042,14 @@ namespace bgfx
size += chunkSize;
break;

// Detect if it's DXIL
case BX_MAKEFOURCC('H', 'A', 'S', 'H'):
case BX_MAKEFOURCC('P', 'S', 'V', '0'):
case BX_MAKEFOURCC('D', 'X', 'I', 'L'):
_dxbc.shader.dxil = true;
size += chunkSize;
break;

default:
size += chunkSize;
BX_ASSERT(false, "UNKNOWN FOURCC %c%c%c%c %d"
Expand Down
1 change: 1 addition & 0 deletions src/shader_dxbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ namespace bgfx
stl::vector<uint8_t> byteCode;
bool shex;
bool aon9;
bool dxil;
};

struct DxbcSFI0
Expand Down
1 change: 1 addition & 0 deletions tools/shaderc/shaderc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ namespace bgfx
{ ShadingLang::HLSL, 300, "s_3_0" },
{ ShadingLang::HLSL, 400, "s_4_0" },
{ ShadingLang::HLSL, 500, "s_5_0" },
{ ShadingLang::HLSL, 610, "s_6_1" }, // This is a part of an ugly hack to enable SM6.1 barycentrics
{ ShadingLang::Metal, 1000, "metal" },
{ ShadingLang::PSSL, 1000, "pssl" },
{ ShadingLang::SpirV, 1010, "spirv" },
Expand Down
Loading