From 0f9d6cefa59ba5a005c4ed7a88ac414a580ae6b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Sun, 9 Aug 2015 20:19:27 -0700 Subject: [PATCH] DXBC: Remember SHEX chunk type. --- src/shader_dxbc.cpp | 10 ++++++++-- src/shader_dxbc.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/shader_dxbc.cpp b/src/shader_dxbc.cpp index c387c2b2..d59af86e 100644 --- a/src/shader_dxbc.cpp +++ b/src/shader_dxbc.cpp @@ -1738,6 +1738,8 @@ namespace bgfx #define DXBC_CHUNK_HEADER BX_MAKEFOURCC('D', 'X', 'B', 'C') #define DXBC_CHUNK_SHADER BX_MAKEFOURCC('S', 'H', 'D', 'R') +#define DXBC_CHUNK_SHADER_EX BX_MAKEFOURCC('S', 'H', 'E', 'X') + #define DXBC_CHUNK_INPUT_SIGNATURE BX_MAKEFOURCC('I', 'S', 'G', 'N') #define DXBC_CHUNK_OUTPUT_SIGNATURE BX_MAKEFOURCC('O', 'S', 'G', 'N') @@ -1745,6 +1747,7 @@ namespace bgfx { int32_t size = 0; size += bx::read(_reader, _dxbc.header); + _dxbc.shader.shex = false; for (uint32_t ii = 0; ii < _dxbc.header.numChunks; ++ii) { @@ -1763,8 +1766,11 @@ namespace bgfx switch (fourcc) { + case DXBC_CHUNK_SHADER_EX: + _dxbc.shader.shex = true; + // fallthrough + case DXBC_CHUNK_SHADER: - case BX_MAKEFOURCC('S', 'H', 'E', 'X'): size += read(_reader, _dxbc.shader); break; @@ -1839,7 +1845,7 @@ namespace bgfx chunkSize[1] = write(_writer, _dxbc.outputSignature); chunkOffset[2] = uint32_t(bx::seek(_writer) - dxbcOffset); - size += write(_writer, DXBC_CHUNK_SHADER); + size += write(_writer, _dxbc.shader.shex ? DXBC_CHUNK_SHADER_EX : DXBC_CHUNK_SHADER); size += write(_writer, UINT32_C(0) ); chunkSize[2] = write(_writer, _dxbc.shader); diff --git a/src/shader_dxbc.h b/src/shader_dxbc.h index 96625c99..710ac87f 100644 --- a/src/shader_dxbc.h +++ b/src/shader_dxbc.h @@ -569,6 +569,7 @@ namespace bgfx { uint32_t version; stl::vector byteCode; + bool shex; }; int32_t read(bx::ReaderSeekerI* _reader, DxbcShader& _shader);