DXBC: Remember SHEX chunk type.

This commit is contained in:
Branimir Karadžić 2015-08-09 20:19:27 -07:00
parent a87cc953cf
commit 0f9d6cefa5
2 changed files with 9 additions and 2 deletions

View file

@ -1738,6 +1738,8 @@ namespace bgfx
#define DXBC_CHUNK_HEADER BX_MAKEFOURCC('D', 'X', 'B', 'C') #define DXBC_CHUNK_HEADER BX_MAKEFOURCC('D', 'X', 'B', 'C')
#define DXBC_CHUNK_SHADER BX_MAKEFOURCC('S', 'H', 'D', 'R') #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_INPUT_SIGNATURE BX_MAKEFOURCC('I', 'S', 'G', 'N')
#define DXBC_CHUNK_OUTPUT_SIGNATURE BX_MAKEFOURCC('O', 'S', 'G', 'N') #define DXBC_CHUNK_OUTPUT_SIGNATURE BX_MAKEFOURCC('O', 'S', 'G', 'N')
@ -1745,6 +1747,7 @@ namespace bgfx
{ {
int32_t size = 0; int32_t size = 0;
size += bx::read(_reader, _dxbc.header); size += bx::read(_reader, _dxbc.header);
_dxbc.shader.shex = false;
for (uint32_t ii = 0; ii < _dxbc.header.numChunks; ++ii) for (uint32_t ii = 0; ii < _dxbc.header.numChunks; ++ii)
{ {
@ -1763,8 +1766,11 @@ namespace bgfx
switch (fourcc) switch (fourcc)
{ {
case DXBC_CHUNK_SHADER_EX:
_dxbc.shader.shex = true;
// fallthrough
case DXBC_CHUNK_SHADER: case DXBC_CHUNK_SHADER:
case BX_MAKEFOURCC('S', 'H', 'E', 'X'):
size += read(_reader, _dxbc.shader); size += read(_reader, _dxbc.shader);
break; break;
@ -1839,7 +1845,7 @@ namespace bgfx
chunkSize[1] = write(_writer, _dxbc.outputSignature); chunkSize[1] = write(_writer, _dxbc.outputSignature);
chunkOffset[2] = uint32_t(bx::seek(_writer) - dxbcOffset); 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) ); size += write(_writer, UINT32_C(0) );
chunkSize[2] = write(_writer, _dxbc.shader); chunkSize[2] = write(_writer, _dxbc.shader);

View file

@ -569,6 +569,7 @@ namespace bgfx
{ {
uint32_t version; uint32_t version;
stl::vector<uint8_t> byteCode; stl::vector<uint8_t> byteCode;
bool shex;
}; };
int32_t read(bx::ReaderSeekerI* _reader, DxbcShader& _shader); int32_t read(bx::ReaderSeekerI* _reader, DxbcShader& _shader);