Skip to content

Commit dc3a09a

Browse files
author
Pavel Kovalenko
committed
Fix DX11 shader reflection problem. Close #8.
1 parent f5d9728 commit dc3a09a

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/Layers/xrRenderPC_R4/r4.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,11 @@ void CRender::addShaderOption(const char* name, const char* value)
710710
m_ShaderOptions.push_back(macro);
711711
}
712712

713+
// XXX nitrocaster: workaround to eliminate conflict between different GUIDs from DXSDK/Windows SDK
714+
// 0a233719-3960-4578-9d7c-203b8b1d9cc1
715+
static const GUID guidShaderReflection =
716+
{0x0a233719, 0x3960, 0x4578, {0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1}};
717+
713718
template <typename T>
714719
static HRESULT create_shader (
715720
LPCSTR const pTarget,
@@ -724,7 +729,7 @@ static HRESULT create_shader (
724729

725730
ID3DShaderReflection *pReflection = 0;
726731

727-
HRESULT const _hr = D3DReflect( buffer, buffer_size, IID_ID3DShaderReflection, (void**)&pReflection);
732+
HRESULT const _hr = D3DReflect( buffer, buffer_size, guidShaderReflection, (void**)&pReflection);
728733
if (SUCCEEDED(_hr) && pReflection)
729734
{
730735
// Parse constant table data
@@ -766,7 +771,7 @@ static HRESULT create_shader (
766771
ID3DShaderReflection *pReflection = 0;
767772

768773
#ifdef USE_DX11
769-
_result = D3DReflect( buffer, buffer_size, IID_ID3DShaderReflection, (void**)&pReflection);
774+
_result = D3DReflect( buffer, buffer_size, guidShaderReflection, (void**)&pReflection);
770775
#else
771776
_result = D3D10ReflectShader( buffer, buffer_size, &pReflection);
772777
#endif
@@ -802,7 +807,7 @@ static HRESULT create_shader (
802807

803808
ID3DShaderReflection *pReflection = 0;
804809
#ifdef USE_DX11
805-
_result = D3DReflect( buffer, buffer_size, IID_ID3DShaderReflection, (void**)&pReflection);
810+
_result = D3DReflect( buffer, buffer_size, guidShaderReflection, (void**)&pReflection);
806811
#else
807812
_result = D3D10ReflectShader( buffer, buffer_size, &pReflection);
808813
#endif
@@ -850,7 +855,7 @@ static HRESULT create_shader (
850855
ID3DShaderReflection *pReflection = 0;
851856

852857
#ifdef USE_DX11
853-
_result = D3DReflect( buffer, buffer_size, IID_ID3DShaderReflection, (void**)&pReflection);
858+
_result = D3DReflect( buffer, buffer_size, guidShaderReflection, (void**)&pReflection);
854859
#else
855860
_result = D3D10ReflectShader( buffer, buffer_size, &pReflection);
856861
#endif

src/Layers/xrRenderPC_R4/stdafx.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@
44

55
#include "stdafx.h"
66

7-
EXTERN_C const GUID DECLSPEC_SELECTANY IID_ID3D11ShaderReflection = { 0x17f27486, 0xa342, 0x4d10, {0x88, 0x42, 0xab, 0x08, 0x74, 0xe7, 0xf6, 0x70 } };
8-
97
// TODO: reference any additional headers you need in STDAFX.H
108
// and not in this file

0 commit comments

Comments
 (0)