From 1f2d56278c876df5b8ee3898c22adbf476ffd606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Tue, 22 Mar 2016 21:52:11 -0700 Subject: [PATCH] Cleanup. --- src/shader.cpp | 4 ++-- src/shader_dxbc.cpp | 1 - src/shader_dxbc.h | 2 ++ src/shader_spirv.h | 2 ++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/shader.cpp b/src/shader.cpp index 32970b8ce..54c08aec5 100644 --- a/src/shader.cpp +++ b/src/shader.cpp @@ -42,13 +42,13 @@ namespace bgfx uint32_t magic; bx::peek(_reader, magic); - if (magic == 0x07230203) + if (magic == SPV_CHUNK_HEADER) { SpirV spirv; read(_reader, spirv, _err); parse(spirv.shader, printAsm, _writer, _err); } - else if (magic == BX_MAKEFOURCC('D', 'X', 'B', 'C') ) + else if (magic == DXBC_CHUNK_HEADER) { DxbcContext dxbc; read(_reader, dxbc, _err); diff --git a/src/shader_dxbc.cpp b/src/shader_dxbc.cpp index 780688a3e..1cc948d31 100644 --- a/src/shader_dxbc.cpp +++ b/src/shader_dxbc.cpp @@ -1735,7 +1735,6 @@ namespace bgfx return size; } -#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') diff --git a/src/shader_dxbc.h b/src/shader_dxbc.h index 0216ec808..db90e3ef8 100644 --- a/src/shader_dxbc.h +++ b/src/shader_dxbc.h @@ -8,6 +8,8 @@ #include +#define DXBC_CHUNK_HEADER BX_MAKEFOURCC('D', 'X', 'B', 'C') + namespace bgfx { struct DxbcOpcode diff --git a/src/shader_spirv.h b/src/shader_spirv.h index 6036ba7f8..9a7f4ccde 100644 --- a/src/shader_spirv.h +++ b/src/shader_spirv.h @@ -11,6 +11,8 @@ BX_ERROR_RESULT(BGFX_SHADER_SPIRV_INVALID_HEADER, BX_MAKEFOURCC('S', 'H', 0, 1) ); BX_ERROR_RESULT(BGFX_SHADER_SPIRV_INVALID_INSTRUCTION, BX_MAKEFOURCC('S', 'H', 0, 2) ); +#define SPV_CHUNK_HEADER BX_MAKEFOURCC(0x03, 0x02, 0x23, 0x07) + namespace bgfx { // Reference: https://www.khronos.org/registry/spir-v/specs/1.0/SPIRV.html