Skip to content

Commit

Permalink
Fix DX11 shader reflection problem. Close #8.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Kovalenko committed Sep 29, 2014
1 parent f5d9728 commit dc3a09a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 9 additions & 4 deletions src/Layers/xrRenderPC_R4/r4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,11 @@ void CRender::addShaderOption(const char* name, const char* value)
m_ShaderOptions.push_back(macro);
}

// XXX nitrocaster: workaround to eliminate conflict between different GUIDs from DXSDK/Windows SDK
// 0a233719-3960-4578-9d7c-203b8b1d9cc1
static const GUID guidShaderReflection =
{0x0a233719, 0x3960, 0x4578, {0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1}};

template <typename T>
static HRESULT create_shader (
LPCSTR const pTarget,
Expand All @@ -724,7 +729,7 @@ static HRESULT create_shader (

ID3DShaderReflection *pReflection = 0;

HRESULT const _hr = D3DReflect( buffer, buffer_size, IID_ID3DShaderReflection, (void**)&pReflection);
HRESULT const _hr = D3DReflect( buffer, buffer_size, guidShaderReflection, (void**)&pReflection);
if (SUCCEEDED(_hr) && pReflection)
{
// Parse constant table data
Expand Down Expand Up @@ -766,7 +771,7 @@ static HRESULT create_shader (
ID3DShaderReflection *pReflection = 0;

#ifdef USE_DX11
_result = D3DReflect( buffer, buffer_size, IID_ID3DShaderReflection, (void**)&pReflection);
_result = D3DReflect( buffer, buffer_size, guidShaderReflection, (void**)&pReflection);
#else
_result = D3D10ReflectShader( buffer, buffer_size, &pReflection);
#endif
Expand Down Expand Up @@ -802,7 +807,7 @@ static HRESULT create_shader (

ID3DShaderReflection *pReflection = 0;
#ifdef USE_DX11
_result = D3DReflect( buffer, buffer_size, IID_ID3DShaderReflection, (void**)&pReflection);
_result = D3DReflect( buffer, buffer_size, guidShaderReflection, (void**)&pReflection);
#else
_result = D3D10ReflectShader( buffer, buffer_size, &pReflection);
#endif
Expand Down Expand Up @@ -850,7 +855,7 @@ static HRESULT create_shader (
ID3DShaderReflection *pReflection = 0;

#ifdef USE_DX11
_result = D3DReflect( buffer, buffer_size, IID_ID3DShaderReflection, (void**)&pReflection);
_result = D3DReflect( buffer, buffer_size, guidShaderReflection, (void**)&pReflection);
#else
_result = D3D10ReflectShader( buffer, buffer_size, &pReflection);
#endif
Expand Down
2 changes: 0 additions & 2 deletions src/Layers/xrRenderPC_R4/stdafx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@

#include "stdafx.h"

EXTERN_C const GUID DECLSPEC_SELECTANY IID_ID3D11ShaderReflection = { 0x17f27486, 0xa342, 0x4d10, {0x88, 0x42, 0xab, 0x08, 0x74, 0xe7, 0xf6, 0x70 } };

// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

0 comments on commit dc3a09a

Please sign in to comment.