forked from hitmen047/Source-PlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcshader.h
492 lines (422 loc) · 19.6 KB
/
cshader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef CSHADER_H
#define CSHADER_H
#ifdef _WIN32
#pragma once
#endif
// uncomment this if you want to build for nv3x
//#define NV3X 1
// This is what all shaders include.
// CBaseShader will become CShader in this file.
#include "materialsystem/ishaderapi.h"
#include "utlvector.h"
#include "materialsystem/imaterialvar.h"
#include "materialsystem/imaterial.h"
#include "BaseShader.h"
#include "materialsystem/itexture.h"
// Included for convenience because they are used in a bunch of shaders
#include "materialsystem/imesh.h"
#include "materialsystem/imaterialsystemhardwareconfig.h"
#include "materialsystem/materialsystem_config.h"
#include "shaderlib/ShaderDLL.h"
// make "local variable is initialized but not referenced" warnings errors for combo checking macros
#pragma warning ( error : 4189 )
//-----------------------------------------------------------------------------
// Global interfaces
//-----------------------------------------------------------------------------
extern IMaterialSystemHardwareConfig *g_pHardwareConfig;
extern const MaterialSystem_Config_t *g_pConfig;
extern bool g_shaderConfigDumpEnable;
// Helper method
bool IsUsingGraphics();
#define SOFTWARE_VERTEX_SHADER(name) \
static void SoftwareVertexShader_ ## name( CMeshBuilder &meshBuilder, IMaterialVar **params, IShaderDynamicAPI* pShaderAPI )
#define FORWARD_DECLARE_SOFTWARE_VERTEX_SHADER(name)\
static void SoftwareVertexShader_ ## name( CMeshBuilder &meshBuilder, IMaterialVar **params, IShaderDynamicAPI* pShaderAPI );
#define USE_SOFTWARE_VERTEX_SHADER(name) \
m_SoftwareVertexShader = SoftwareVertexShader_ ## name
#define SHADER_INIT_PARAMS() \
virtual void OnInitShaderParams( IMaterialVar **params, const char *pMaterialName )
#define SHADER_FALLBACK \
virtual char const* GetFallbackShader( IMaterialVar** params ) const
// Typesafe flag setting
inline void CShader_SetFlags( IMaterialVar **params, MaterialVarFlags_t _flag )
{
params[FLAGS]->SetIntValue( params[FLAGS]->GetIntValue() | (_flag) );
}
inline bool CShader_IsFlagSet( IMaterialVar **params, MaterialVarFlags_t _flag )
{
return ((params[FLAGS]->GetIntValue() & (_flag) ) != 0);
}
#define SET_FLAGS( _flag ) CShader_SetFlags( params, _flag )
#define CLEAR_FLAGS( _flag ) params[FLAGS]->SetIntValue( params[FLAGS]->GetIntValue() & ~(_flag) )
#define IS_FLAG_SET( _flag ) CShader_IsFlagSet( params, _flag )
#define IS_FLAG_DEFINED( _flag ) ((params[FLAGS_DEFINED]->GetIntValue() & (_flag) ) != 0)
#define IS_PARAM_DEFINED( _param ) ( ( ( _param >= 0 ) && ( params[_param]->IsDefined() ) ) )
#define SET_PARAM_STRING_IF_NOT_DEFINED( nParamIndex, kDefaultValue ) \
if ( ( nParamIndex != -1 ) && ( !params[nParamIndex]->IsDefined() ) ) \
{ \
params[nParamIndex]->SetStringValue( kDefaultValue ); \
}
#define SET_PARAM_INT_IF_NOT_DEFINED( nParamIndex, kDefaultValue ) \
if ( ( nParamIndex != -1 ) && ( !params[nParamIndex]->IsDefined() ) ) \
{ \
params[nParamIndex]->SetIntValue( kDefaultValue ); \
}
#define SET_PARAM_FLOAT_IF_NOT_DEFINED( nParamIndex, kDefaultValue ) \
if ( ( nParamIndex != -1 ) && ( !params[nParamIndex]->IsDefined() ) ) \
{ \
params[nParamIndex]->SetFloatValue( kDefaultValue ); \
}
#define SET_PARAM_VEC_IF_NOT_DEFINED( nParamIndex, kDefaultValue, nSize ) \
if ( ( nParamIndex != -1 ) && ( !params[nParamIndex]->IsDefined() ) ) \
{ \
params[nParamIndex]->SetVecValue( kDefaultValue, nSize ); \
}
// Typesafe flag setting
inline void CShader_SetFlags2( IMaterialVar **params, MaterialVarFlags2_t _flag )
{
params[FLAGS2]->SetIntValue( params[FLAGS2]->GetIntValue() | (_flag) );
}
inline bool CShader_IsFlag2Set( IMaterialVar **params, MaterialVarFlags2_t _flag )
{
return ((params[FLAGS2]->GetIntValue() & (_flag) ) != 0);
}
#define SET_FLAGS2( _flag ) CShader_SetFlags2( params, _flag )
#define CLEAR_FLAGS2( _flag ) params[FLAGS2]->SetIntValue( params[FLAGS2]->GetIntValue() & ~(_flag) )
#define IS_FLAG2_SET( _flag ) CShader_IsFlag2Set( params, _flag )
#define IS_FLAG2_DEFINED( _flag ) ((params[FLAGS_DEFINED2]->GetIntValue() & (_flag) ) != 0)
#define __BEGIN_SHADER_INTERNAL(_baseclass, name, help, flags) \
namespace name \
{\
typedef _baseclass CBaseClass;\
static const char *s_HelpString = help; \
static const char *s_Name = #name; \
static int s_nFlags = flags; \
class CShaderParam;\
static CUtlVector<CShaderParam *> s_ShaderParams;\
static CShaderParam *s_pShaderParamOverrides[NUM_SHADER_MATERIAL_VARS];\
class CShaderParam\
{\
public:\
CShaderParam( ShaderMaterialVars_t var, ShaderParamType_t type, const char *pDefaultParam, const char *pHelp, int nFlags )\
{\
m_Info.m_pName = "override";\
m_Info.m_Type = type;\
m_Info.m_pDefaultValue = pDefaultParam;\
m_Info.m_pHelp = pHelp;\
m_Info.m_nFlags = nFlags;\
AssertMsg( !s_pShaderParamOverrides[var], ( "Shader parameter override duplicately defined!" ) );\
s_pShaderParamOverrides[var] = this;\
m_Index = var;\
}\
CShaderParam( const char *pName, ShaderParamType_t type, const char *pDefaultParam, const char *pHelp, int nFlags )\
{\
m_Info.m_pName = pName;\
m_Info.m_Type = type;\
m_Info.m_pDefaultValue = pDefaultParam;\
m_Info.m_pHelp = pHelp;\
m_Info.m_nFlags = nFlags;\
m_Index = NUM_SHADER_MATERIAL_VARS + s_ShaderParams.Count();\
s_ShaderParams.AddToTail( this );\
}\
operator int() \
{\
return m_Index;\
}\
const char *GetName()\
{\
return m_Info.m_pName;\
}\
ShaderParamType_t GetType()\
{\
return m_Info.m_Type;\
}\
const char *GetDefault()\
{\
return m_Info.m_pDefaultValue;\
}\
int GetFlags() const\
{\
return m_Info.m_nFlags;\
}\
const char *GetHelp()\
{\
return m_Info.m_pHelp;\
}\
private:\
ShaderParamInfo_t m_Info; \
int m_Index;\
};\
#define BEGIN_SHADER(name,help) __BEGIN_SHADER_INTERNAL( CBaseShader, name, help, 0 )
#define BEGIN_SHADER_FLAGS(name,help,flags) __BEGIN_SHADER_INTERNAL( CBaseShader, name, help, flags )
#define BEGIN_SHADER_PARAMS
#define SHADER_PARAM( param, paramtype, paramdefault, paramhelp ) \
static CShaderParam param( "$" #param, paramtype, paramdefault, paramhelp, 0 );
#define SHADER_PARAM_FLAGS( param, paramtype, paramdefault, paramhelp, flags ) \
static CShaderParam param( "$" #param, paramtype, paramdefault, paramhelp, flags );
#define SHADER_PARAM_OVERRIDE( param, paramtype, paramdefault, paramhelp, flags ) \
static CShaderParam param( (ShaderMaterialVars_t) ::param, paramtype, paramdefault, paramhelp, flags );
// regarding the macro above: the "::" was added to the first argument in order to disambiguate it for GCC.
// for example, in cloak.cpp, this usage appears:
// SHADER_PARAM_OVERRIDE( COLOR, SHADER_PARAM_TYPE_COLOR, "{255 255 255}", "unused", SHADER_PARAM_NOT_EDITABLE )
// which in turn tries to ask the compiler to instantiate an object like so:
// static CShaderParam COLOR( (ShaderMaterialVars_t)COLOR, SHADER_PARAM_TYPE_COLOR, "{255 255 255}", "unused", SHADER_PARAM_NOT_EDITABLE )
// and GCC thinks that the reference to COLOR in the arg list is actually a reference to the object we're in the middle of making.
// and you get --> error: invalid cast from type ‘Cloak_DX90::CShaderParam’ to type ‘ShaderMaterialVars_t’
// Resolved: add the "::" so compiler knows that reference is to the enum, not to the name of the object being made.
#define END_SHADER_PARAMS \
class CShader : public CBaseClass\
{\
public:
#define END_SHADER }; \
static CShader s_ShaderInstance;\
} // namespace
#define SHADER_INIT \
char const* GetName() const \
{ \
return s_Name; \
} \
int GetFlags() const \
{ \
return s_nFlags; \
} \
int GetNumParams() const \
{\
return CBaseClass::GetNumParams() + s_ShaderParams.Count();\
}\
char const* GetParamName( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
return CBaseClass::GetParamName(param); \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetName(); \
}\
char const* GetParamHelp( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
{ \
if ( !s_pShaderParamOverrides[param] ) \
return CBaseClass::GetParamHelp( param ); \
else \
return s_pShaderParamOverrides[param]->GetHelp(); \
} \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetHelp(); \
}\
ShaderParamType_t GetParamType( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
return CBaseClass::GetParamType( param ); \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetType(); \
}\
char const* GetParamDefault( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
{ \
if ( !s_pShaderParamOverrides[param] ) \
return CBaseClass::GetParamDefault( param ); \
else \
return s_pShaderParamOverrides[param]->GetDefault(); \
} \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetDefault(); \
}\
int GetParamFlags( int param ) const \
{\
int nBaseClassParamCount = CBaseClass::GetNumParams(); \
if (param < nBaseClassParamCount) \
{ \
if ( !s_pShaderParamOverrides[param] ) \
return CBaseClass::GetParamFlags( param ); \
else \
return s_pShaderParamOverrides[param]->GetFlags(); \
} \
else \
return s_ShaderParams[param - nBaseClassParamCount]->GetFlags(); \
}\
void OnInitShaderInstance( IMaterialVar **params, IShaderInit *pShaderInit, const char *pMaterialName )
#define SHADER_DRAW \
void OnDrawElements( IMaterialVar **params, IShaderShadow* pShaderShadow, IShaderDynamicAPI* pShaderAPI, VertexCompressionType_t vertexCompression, CBasePerMaterialContextData **pContextDataPtr )
#define SHADOW_STATE if (pShaderShadow)
#define DYNAMIC_STATE if (pShaderAPI)
#define ShaderWarning if (pShaderShadow) Warning
//-----------------------------------------------------------------------------
// Used to easily define a shader which *always* falls back
//-----------------------------------------------------------------------------
#define DEFINE_FALLBACK_SHADER( _shadername, _fallbackshadername ) \
BEGIN_SHADER( _shadername, "" ) \
BEGIN_SHADER_PARAMS \
END_SHADER_PARAMS \
SHADER_FALLBACK { return #_fallbackshadername; } \
SHADER_INIT {} \
SHADER_DRAW {} \
END_SHADER
//-----------------------------------------------------------------------------
// Used to easily define a shader which inherits from another shader
//-----------------------------------------------------------------------------
// FIXME: There's a compiler bug preventing this from working.
// Maybe it'll work under VC7!
/*
//#define BEGIN_INHERITED_SHADER( name, _baseclass, help ) \
// namespace _baseclass \
// {\
// __BEGIN_SHADER_INTERNAL( _baseclass::CShader, name, help )
*/
//#define END_INHERITED_SHADER END_SHADER }
//#define CHAIN_SHADER_INIT_PARAMS() CBaseClass::OnInitShaderParams( params, pMaterialName )
//#define CHAIN_SHADER_FALLBACK() CBaseClass::GetFallbackShader( params )
//#define CHAIN_SHADER_INIT() CBaseClass::OnInitShaderInstance( params, pShaderInit, pMaterialName )
//#define CHAIN_SHADER_DRAW() CBaseClass::OnDrawElements( params, pShaderShadow, pShaderAPI )
// A dumbed-down version which does what I need now which works
// This version doesn't allow you to do chain *anything* down to the base class
#define BEGIN_INHERITED_SHADER_FLAGS( _name, _base, _help, _flags ) \
namespace _base\
{\
namespace _name\
{\
static const char *s_Name = #_name; \
static const char *s_HelpString = _help;\
static int s_nFlags = _flags;\
class CShader : public _base::CShader\
{\
public:\
char const* GetName() const \
{ \
return s_Name; \
} \
int GetFlags() const \
{ \
return s_nFlags; \
}
#define BEGIN_INHERITED_SHADER( _name, _base, _help ) BEGIN_INHERITED_SHADER_FLAGS( _name, _base, _help, 0 )
#define END_INHERITED_SHADER END_SHADER }
// psh ## shader is used here to generate a warning if you don't ever call SET_DYNAMIC_PIXEL_SHADER
#define DECLARE_DYNAMIC_PIXEL_SHADER( shader ) \
int declaredynpixshader_ ## shader ## _missingcurlybraces = 0; \
NOTE_UNUSED( declaredynpixshader_ ## shader ## _missingcurlybraces ); \
shader ## _Dynamic_Index _pshIndex; \
int psh ## shader = 0
// vsh ## shader is used here to generate a warning if you don't ever call SET_DYNAMIC_VERTEX_SHADER
#define DECLARE_DYNAMIC_VERTEX_SHADER( shader ) \
int declaredynvertshader_ ## shader ## _missingcurlybraces = 0; \
NOTE_UNUSED( declaredynvertshader_ ## shader ## _missingcurlybraces ); \
shader ## _Dynamic_Index _vshIndex; \
int vsh ## shader = 0
// psh ## shader is used here to generate a warning if you don't ever call SET_STATIC_PIXEL_SHADER
#define DECLARE_STATIC_PIXEL_SHADER( shader ) \
int declarestaticpixshader_ ## shader ## _missingcurlybraces = 0; \
NOTE_UNUSED( declarestaticpixshader_ ## shader ## _missingcurlybraces ); \
shader ## _Static_Index _pshIndex; \
int psh ## shader = 0
// vsh ## shader is used here to generate a warning if you don't ever call SET_STATIC_VERTEX_SHADER
#define DECLARE_STATIC_VERTEX_SHADER( shader ) \
int declarestaticvertshader_ ## shader ## _missingcurlybraces = 0; \
NOTE_UNUSED( declarestaticvertshader_ ## shader ## _missingcurlybraces ); \
shader ## _Static_Index _vshIndex; \
int vsh ## shader = 0
// psh_forgot_to_set_dynamic_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_DYNAMIC_PIXEL_SHADER block.
#define SET_DYNAMIC_PIXEL_SHADER_COMBO( var, val ) \
int dynpixshadercombo_ ## var ## _missingcurlybraces = 0; \
NOTE_UNUSED( dynpixshadercombo_ ## var ## _missingcurlybraces ); \
_pshIndex.Set ## var( ( val ) ); if(g_shaderConfigDumpEnable){printf("\n PS dyn var %s = %d (%s)", #var, (int) val, #val );}; \
int psh_forgot_to_set_dynamic_ ## var = 0
// vsh_forgot_to_set_dynamic_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_DYNAMIC_VERTEX_SHADER block.
#define SET_DYNAMIC_VERTEX_SHADER_COMBO( var, val ) \
int dynvertshadercombo_ ## var ## _missingcurlybraces = 0; \
NOTE_UNUSED( dynvertshadercombo_ ## var ## _missingcurlybraces ); \
_vshIndex.Set ## var( ( val ) ); if(g_shaderConfigDumpEnable){printf("\n VS dyn var %s = %d (%s)", #var, (int) val, #val );}; \
int vsh_forgot_to_set_dynamic_ ## var = 0
// psh_forgot_to_set_static_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_STATIC_PIXEL_SHADER block.
#define SET_STATIC_PIXEL_SHADER_COMBO( var, val ) \
int staticpixshadercombo_ ## var ## _missingcurlybraces = 0; \
NOTE_UNUSED( staticpixshadercombo_ ## var ## _missingcurlybraces ); \
_pshIndex.Set ## var( ( val ) ); if(g_shaderConfigDumpEnable){printf("\n PS stat var %s = %d (%s)", #var, (int) val, #val );}; \
int psh_forgot_to_set_static_ ## var = 0
// vsh_forgot_to_set_static_ ## var is used to make sure that you set all
// all combos. If you don't, you will get an undefined variable used error
// in the SET_STATIC_VERTEX_SHADER block.
#define SET_STATIC_VERTEX_SHADER_COMBO( var, val ) \
int staticvertshadercombo_ ## var ## _missingcurlybraces = 0; \
NOTE_UNUSED( staticvertshadercombo_ ## var ## _missingcurlybraces ); \
_vshIndex.Set ## var( ( val ) ); if(g_shaderConfigDumpEnable){printf("\n VS stat var %s = %d (%s)", #var, (int) val, #val );}; \
int vsh_forgot_to_set_static_ ## var = 0
// psh_testAllCombos adds up all of the psh_forgot_to_set_dynamic_ ## var's from
// SET_DYNAMIC_PIXEL_SHADER_COMBO so that an error is generated if they aren't set.
// psh_testAllCombos is set to itself to avoid an unused variable warning.
// psh ## shader being set to itself ensures that DECLARE_DYNAMIC_PIXEL_SHADER
// was called for this particular shader.
#define SET_DYNAMIC_PIXEL_SHADER( shader ) \
int dynamicpixshader_ ## shader ## _missingcurlybraces = 0; \
NOTE_UNUSED( dynamicpixshader_ ## shader ## _missingcurlybraces ); \
int psh_testAllCombos = shaderDynamicTest_ ## shader; \
NOTE_UNUSED( psh_testAllCombos ); \
NOTE_UNUSED( psh ## shader ); \
pShaderAPI->SetPixelShaderIndex( _pshIndex.GetIndex() )
#define SET_DYNAMIC_PIXEL_SHADER_CMD( cmdstream, shader ) \
int dynamicpixshader_ ## shader ## _missingcurlybraces = 0; \
NOTE_UNUSED( dynamicpixshader_ ## shader ## _missingcurlybraces ); \
int psh_testAllCombos = shaderDynamicTest_ ## shader; \
NOTE_UNUSED( psh_testAllCombos ); \
NOTE_UNUSED( psh ## shader ); \
cmdstream.SetPixelShaderIndex( _pshIndex.GetIndex() )
// vsh_testAllCombos adds up all of the vsh_forgot_to_set_dynamic_ ## var's from
// SET_DYNAMIC_VERTEX_SHADER_COMBO so that an error is generated if they aren't set.
// vsh_testAllCombos is set to itself to avoid an unused variable warning.
// vsh ## shader being set to itself ensures that DECLARE_DYNAMIC_VERTEX_SHADER
// was called for this particular shader.
#define SET_DYNAMIC_VERTEX_SHADER( shader ) \
int dynamicvertshader_ ## shader ## _missingcurlybraces = 0; \
NOTE_UNUSED( dynamicvertshader_ ## shader ## _missingcurlybraces ); \
int vsh_testAllCombos = shaderDynamicTest_ ## shader; \
NOTE_UNUSED( vsh_testAllCombos ); \
NOTE_UNUSED( vsh ## shader ); \
pShaderAPI->SetVertexShaderIndex( _vshIndex.GetIndex() )
#define SET_DYNAMIC_VERTEX_SHADER_CMD( cmdstream, shader ) \
int dynamicvertshader_ ## shader ## _missingcurlybraces = 0; \
NOTE_UNUSED( dynamicvertshader_ ## shader ## _missingcurlybraces ); \
int vsh_testAllCombos = shaderDynamicTest_ ## shader; \
NOTE_UNUSED( vsh_testAllCombos ); \
NOTE_UNUSED( vsh ## shader ); \
cmdstream.SetVertexShaderIndex( _vshIndex.GetIndex() )
// psh_testAllCombos adds up all of the psh_forgot_to_set_static_ ## var's from
// SET_STATIC_PIXEL_SHADER_COMBO so that an error is generated if they aren't set.
// psh_testAllCombos is set to itself to avoid an unused variable warning.
// psh ## shader being set to itself ensures that DECLARE_STATIC_PIXEL_SHADER
// was called for this particular shader.
#define SET_STATIC_PIXEL_SHADER( shader ) \
int staticpixshader_ ## shader ## _missingcurlybraces = 0; \
NOTE_UNUSED( staticpixshader_ ## shader ## _missingcurlybraces ); \
int psh_testAllCombos = shaderStaticTest_ ## shader; \
NOTE_UNUSED( psh_testAllCombos ); \
NOTE_UNUSED( psh ## shader ); \
pShaderShadow->SetPixelShader( #shader, _pshIndex.GetIndex() )
// vsh_testAllCombos adds up all of the vsh_forgot_to_set_static_ ## var's from
// SET_STATIC_VERTEX_SHADER_COMBO so that an error is generated if they aren't set.
// vsh_testAllCombos is set to itself to avoid an unused variable warning.
// vsh ## shader being set to itself ensures that DECLARE_STATIC_VERTEX_SHADER
// was called for this particular shader.
#define SET_STATIC_VERTEX_SHADER( shader ) \
int staticvertshader_ ## shader ## _missingcurlybraces = 0; \
NOTE_UNUSED( staticvertshader_ ## shader ## _missingcurlybraces ); \
int vsh_testAllCombos = shaderStaticTest_ ## shader; \
NOTE_UNUSED( vsh_testAllCombos ); \
NOTE_UNUSED( vsh ## shader ); \
pShaderShadow->SetVertexShader( #shader, _vshIndex.GetIndex() )
#endif // CSHADER_H