Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Commit f4c3364

Browse files
authored
Minor code review (#29)
1 parent 9437385 commit f4c3364

5 files changed

Lines changed: 41 additions & 34 deletions

File tree

CMakePresets.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,14 @@
116116
{ "name": "x86-Debug-Clang" , "description": "Clang/LLVM for x86 (Debug)", "inherits": [ "base", "x86", "Debug", "Clang" ], "environment": { "CXXFLAGS": "-m32" } },
117117
{ "name": "x86-Release-Clang" , "description": "Clang/LLVM for x86 (Release)", "inherits": [ "base", "x86", "Release", "Clang" ], "environment": { "CXXFLAGS": "-m32" } },
118118
{ "name": "arm64-Debug-Clang" , "description": "Clang/LLVM for AArch64 (Debug)", "inherits": [ "base", "ARM64", "Debug", "Clang" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } },
119-
{ "name": "arm64-Release-Clang", "description": "Clang/LLVM for AArch64 (Release)", "inherits": [ "base", "ARM64", "Release", "Clang" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }
119+
{ "name": "arm64-Release-Clang", "description": "Clang/LLVM for AArch64 (Release)", "inherits": [ "base", "ARM64", "Release", "Clang" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } },
120+
121+
{ "name": "x64-Debug-UWP-Clang" , "description": "Clang/LLVM for x64 (Debug) for UWP", "inherits": [ "base", "x64", "Debug", "Clang", "UWP" ] },
122+
{ "name": "x64-Release-UWP-Clang" , "description": "Clang/LLVM for x64 (Release) for UWP", "inherits": [ "base", "x64", "Release", "Clang", "UWP" ] },
123+
{ "name": "x86-Debug-UWP-Clang" , "description": "Clang/LLVM for x86 (Debug) for UWP", "inherits": [ "base", "x86", "Debug", "Clang", "UWP" ], "environment": { "CXXFLAGS": "-m32" } },
124+
{ "name": "x86-Release-UWP-Clang" , "description": "Clang/LLVM for x86 (Release) for UWP", "inherits": [ "base", "x86", "Release", "Clang", "UWP" ], "environment": { "CXXFLAGS": "-m32" } },
125+
{ "name": "arm64-Debug-UWP-Clang" , "description": "Clang/LLVM for AArch64 (Debug) for UWP", "inherits": [ "base", "ARM64", "Debug", "Clang", "UWP" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } },
126+
{ "name": "arm64-Release-UWP-Clang", "description": "Clang/LLVM for AArch64 (Release) for UWP", "inherits": [ "base", "ARM64", "Release", "Clang", "UWP" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }
120127

121128
]
122129
}

Effect.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@
1414
#include "EffectBinaryFormat.h"
1515
#include "IUnknownImp.h"
1616

17-
#ifdef _DEBUG
18-
extern void __cdecl D3DXDebugPrintf(UINT lvl, _In_z_ _Printf_format_string_ LPCSTR szFormat, ...);
19-
#define DPF D3DXDebugPrintf
20-
#else
21-
#define DPF
22-
#endif
23-
2417
#pragma warning(push)
2518
#pragma warning(disable : 4481)
2619
// VS 2010 considers 'override' to be a extension, but it's part of C++11 as of VS 2012

EffectVariable.inl

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -127,23 +127,23 @@ struct SEffectInvalidScalarVariable : public TEffectInvalidVariable<ID3DX11Effec
127127
{
128128
public:
129129

130-
STDMETHOD(SetFloat)(_In_ const float Value) override { UNREFERENCED_PARAMETER(Value); return E_FAIL; }
130+
STDMETHOD(SetFloat)(_In_ float Value) override { UNREFERENCED_PARAMETER(Value); return E_FAIL; }
131131
STDMETHOD(GetFloat)(_Out_ float *pValue) override { UNREFERENCED_PARAMETER(pValue); return E_FAIL; }
132132

133133
STDMETHOD(SetFloatArray)(_In_reads_(Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
134134
{ UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
135135
STDMETHOD(GetFloatArray)(_Out_writes_(Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
136136
{ UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
137137

138-
STDMETHOD(SetInt)(_In_ const int Value) override { UNREFERENCED_PARAMETER(Value); return E_FAIL; }
138+
STDMETHOD(SetInt)(_In_ int Value) override { UNREFERENCED_PARAMETER(Value); return E_FAIL; }
139139
STDMETHOD(GetInt)(_Out_ int *pValue) override { UNREFERENCED_PARAMETER(pValue); return E_FAIL; }
140140

141141
STDMETHOD(SetIntArray)(_In_reads_(Count) const int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
142142
{ UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
143143
STDMETHOD(GetIntArray)(_Out_writes_(Count) int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
144144
{ UNREFERENCED_PARAMETER(pData); UNREFERENCED_PARAMETER(Offset); UNREFERENCED_PARAMETER(Count); return E_FAIL; }
145145

146-
STDMETHOD(SetBool)(_In_ const bool Value) override { UNREFERENCED_PARAMETER(Value); return E_FAIL; }
146+
STDMETHOD(SetBool)(_In_ bool Value) override { UNREFERENCED_PARAMETER(Value); return E_FAIL; }
147147
STDMETHOD(GetBool)(_Out_ bool *pValue) override { UNREFERENCED_PARAMETER(pValue); return E_FAIL; }
148148

149149
STDMETHOD(SetBoolArray)(_In_reads_(Count) const bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override
@@ -826,7 +826,7 @@ struct TVariable : public IBaseInterface
826826
{
827827
SVariable *pMember;
828828
UDataPointer dataPtr;
829-
TTopLevelVariable<ID3DX11EffectVariable> *pTopLevelEntity2 = GetTopLevelEntity();
829+
auto pTopLevelEntity2 = GetTopLevelEntity();
830830

831831
if (((ID3DX11Effect*)pTopLevelEntity2->pEffect)->IsOptimized())
832832
{
@@ -854,7 +854,7 @@ struct TVariable : public IBaseInterface
854854
SVariable *pMember;
855855
UDataPointer dataPtr;
856856
uint32_t index;
857-
TTopLevelVariable<ID3DX11EffectVariable> *pTopLevelEntity2 = GetTopLevelEntity();
857+
auto pTopLevelEntity2 = GetTopLevelEntity();
858858

859859
if (pTopLevelEntity2->pEffect->IsOptimized())
860860
{
@@ -883,7 +883,7 @@ struct TVariable : public IBaseInterface
883883
SVariable *pMember;
884884
UDataPointer dataPtr;
885885
uint32_t index;
886-
TTopLevelVariable<ID3DX11EffectVariable> *pTopLevelEntity2 = GetTopLevelEntity();
886+
auto pTopLevelEntity2 = GetTopLevelEntity();
887887

888888
if (pTopLevelEntity2->pEffect->IsOptimized())
889889
{
@@ -910,7 +910,7 @@ struct TVariable : public IBaseInterface
910910
STDMETHOD_(ID3DX11EffectVariable*, GetElement)(_In_ uint32_t Index)
911911
{
912912
static LPCSTR pFuncName = "ID3DX11EffectVariable::GetElement";
913-
TTopLevelVariable<ID3DX11EffectVariable> *pTopLevelEntity2 = GetTopLevelEntity();
913+
auto pTopLevelEntity2 = GetTopLevelEntity();
914914
UDataPointer dataPtr;
915915

916916
if (pTopLevelEntity2->pEffect->IsOptimized())
@@ -1557,19 +1557,19 @@ lExit:
15571557
template<typename IBaseInterface, bool IsAnnotation>
15581558
struct TFloatScalarVariable : public TNumericVariable<IBaseInterface, IsAnnotation>
15591559
{
1560-
STDMETHOD(SetFloat)(_In_ const float Value) override;
1560+
STDMETHOD(SetFloat)(_In_ float Value) override;
15611561
STDMETHOD(GetFloat)(_Out_ float *pValue) override;
15621562

15631563
STDMETHOD(SetFloatArray)(_In_reads_(Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
15641564
STDMETHOD(GetFloatArray)(_Out_writes_(Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
15651565

1566-
STDMETHOD(SetInt)(_In_ const int Value) override;
1566+
STDMETHOD(SetInt)(_In_ int Value) override;
15671567
STDMETHOD(GetInt)(_Out_ int *pValue) override;
15681568

15691569
STDMETHOD(SetIntArray)(_In_reads_(Count) const int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
15701570
STDMETHOD(GetIntArray)(_Out_writes_(Count) int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
15711571

1572-
STDMETHOD(SetBool)(_In_ const bool Value) override;
1572+
STDMETHOD(SetBool)(_In_ bool Value) override;
15731573
STDMETHOD(GetBool)(_Out_ bool *pValue) override;
15741574

15751575
STDMETHOD(SetBoolArray)(_In_reads_(Count) const bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
@@ -1614,7 +1614,7 @@ HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::GetFloatArray(float
16141614

16151615
template<typename IBaseInterface, bool IsAnnotation>
16161616
_Use_decl_annotations_
1617-
HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::SetInt(const int Value)
1617+
HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::SetInt(int Value)
16181618
{
16191619
static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetInt";
16201620
if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
@@ -1650,7 +1650,7 @@ HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::GetIntArray(int *pDa
16501650

16511651
template<typename IBaseInterface, bool IsAnnotation>
16521652
_Use_decl_annotations_
1653-
HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::SetBool(const bool Value)
1653+
HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::SetBool(bool Value)
16541654
{
16551655
static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetBool";
16561656
if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
@@ -1691,19 +1691,19 @@ HRESULT TFloatScalarVariable<IBaseInterface, IsAnnotation>::GetBoolArray(bool *p
16911691
template<typename IBaseInterface, bool IsAnnotation>
16921692
struct TIntScalarVariable : public TNumericVariable<IBaseInterface, IsAnnotation>
16931693
{
1694-
STDMETHOD(SetFloat)(_In_ const float Value) override;
1694+
STDMETHOD(SetFloat)(_In_ float Value) override;
16951695
STDMETHOD(GetFloat)(_Out_ float *pValue) override;
16961696

16971697
STDMETHOD(SetFloatArray)(_In_reads_(Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
16981698
STDMETHOD(GetFloatArray)(_Out_writes_(Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
16991699

1700-
STDMETHOD(SetInt)(_In_ const int Value) override;
1700+
STDMETHOD(SetInt)(_In_ int Value) override;
17011701
STDMETHOD(GetInt)(_Out_ int *pValue) override;
17021702

17031703
STDMETHOD(SetIntArray)(_In_reads_(Count) const int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
17041704
STDMETHOD(GetIntArray)(_Out_writes_(Count) int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
17051705

1706-
STDMETHOD(SetBool)(_In_ const bool Value) override;
1706+
STDMETHOD(SetBool)(_In_ bool Value) override;
17071707
STDMETHOD(GetBool)(_Out_ bool *pValue) override;
17081708

17091709
STDMETHOD(SetBoolArray)(_In_reads_(Count) const bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
@@ -1748,7 +1748,7 @@ HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::GetFloatArray(float *p
17481748

17491749
template<typename IBaseInterface, bool IsAnnotation>
17501750
_Use_decl_annotations_
1751-
HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::SetInt(const int Value)
1751+
HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::SetInt(int Value)
17521752
{
17531753
static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetInt";
17541754
if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
@@ -1784,7 +1784,7 @@ HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::GetIntArray(int *pData
17841784

17851785
template<typename IBaseInterface, bool IsAnnotation>
17861786
_Use_decl_annotations_
1787-
HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::SetBool(const bool Value)
1787+
HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::SetBool(bool Value)
17881788
{
17891789
static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetBool";
17901790
if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
@@ -1825,19 +1825,19 @@ HRESULT TIntScalarVariable<IBaseInterface, IsAnnotation>::GetBoolArray(bool *pDa
18251825
template<typename IBaseInterface, bool IsAnnotation>
18261826
struct TBoolScalarVariable : public TNumericVariable<IBaseInterface, IsAnnotation>
18271827
{
1828-
STDMETHOD(SetFloat)(_In_ const float Value) override;
1828+
STDMETHOD(SetFloat)(_In_ float Value) override;
18291829
STDMETHOD(GetFloat)(_Out_ float *pValue) override;
18301830

18311831
STDMETHOD(SetFloatArray)(_In_reads_(Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
18321832
STDMETHOD(GetFloatArray)(_Out_writes_(Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
18331833

1834-
STDMETHOD(SetInt)(_In_ const int Value) override;
1834+
STDMETHOD(SetInt)(_In_ int Value) override;
18351835
STDMETHOD(GetInt)(_Out_ int *pValue) override;
18361836

18371837
STDMETHOD(SetIntArray)(_In_reads_(Count) const int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
18381838
STDMETHOD(GetIntArray)(_Out_writes_(Count) int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) override;
18391839

1840-
STDMETHOD(SetBool)(_In_ const bool Value) override;
1840+
STDMETHOD(SetBool)(_In_ bool Value) override;
18411841
STDMETHOD(GetBool)(_Out_ bool *pValue) override;
18421842

18431843
STDMETHOD(SetBoolArray)(_In_reads_(Count) const bool *pData, uint32_t Offset, _In_ uint32_t Count) override;
@@ -1882,7 +1882,7 @@ HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::GetFloatArray(float *
18821882

18831883
template<typename IBaseInterface, bool IsAnnotation>
18841884
_Use_decl_annotations_
1885-
HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::SetInt(const int Value)
1885+
HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::SetInt(int Value)
18861886
{
18871887
static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetInt";
18881888
if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);
@@ -1918,7 +1918,7 @@ HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::GetIntArray(int *pDat
19181918

19191919
template<typename IBaseInterface, bool IsAnnotation>
19201920
_Use_decl_annotations_
1921-
HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::SetBool(const bool Value)
1921+
HRESULT TBoolScalarVariable<IBaseInterface, IsAnnotation>::SetBool(bool Value)
19221922
{
19231923
static LPCSTR pFuncName = "ID3DX11EffectScalarVariable::SetBool";
19241924
if (IsAnnotation) return AnnotationInvalidSetCall(pFuncName);

inc/d3dx11effect.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,19 +343,19 @@ DECLARE_INTERFACE_(ID3DX11EffectScalarVariable, ID3DX11EffectVariable)
343343
// ID3DX11EffectVariable
344344

345345
// ID3DX11EffectScalarVariable
346-
STDMETHOD(SetFloat)(THIS_ _In_ const float Value) PURE;
346+
STDMETHOD(SetFloat)(THIS_ _In_ float Value) PURE;
347347
STDMETHOD(GetFloat)(THIS_ _Out_ float *pValue) PURE;
348348

349349
STDMETHOD(SetFloatArray)(THIS_ _In_reads_(Count) const float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE;
350350
STDMETHOD(GetFloatArray)(THIS_ _Out_writes_(Count) float *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE;
351351

352-
STDMETHOD(SetInt)(THIS_ _In_ const int Value) PURE;
352+
STDMETHOD(SetInt)(THIS_ _In_ int Value) PURE;
353353
STDMETHOD(GetInt)(THIS_ _Out_ int *pValue) PURE;
354354

355355
STDMETHOD(SetIntArray)(THIS_ _In_reads_(Count) const int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE;
356356
STDMETHOD(GetIntArray)(THIS_ _Out_writes_(Count) int *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE;
357357

358-
STDMETHOD(SetBool)(THIS_ _In_ const bool Value) PURE;
358+
STDMETHOD(SetBool)(THIS_ _In_ bool Value) PURE;
359359
STDMETHOD(GetBool)(THIS_ _Out_ bool *pValue) PURE;
360360

361361
STDMETHOD(SetBoolArray)(THIS_ _In_reads_(Count) const bool *pData, _In_ uint32_t Offset, _In_ uint32_t Count) PURE;

pchfx.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// C6326 Potential comparison of a constant with another constant
2323

2424
#ifndef NOMINMAX
25-
#define NOMINMAX
25+
#define NOMINMAX 1
2626
#endif
2727

2828
#include <algorithm>
@@ -52,6 +52,13 @@
5252

5353
#define offsetof_fx( a, b ) (uint32_t)offsetof( a, b )
5454

55+
#ifdef _DEBUG
56+
extern void __cdecl D3DXDebugPrintf(UINT lvl, _In_z_ _Printf_format_string_ LPCSTR szFormat, ...);
57+
#define DPF D3DXDebugPrintf
58+
#else
59+
#define DPF
60+
#endif
61+
5562
#include "d3dxGlobal.h"
5663

5764
#include <cstddef>

0 commit comments

Comments
 (0)