1 // Copyright 2001-2018 Crytek GmbH / Crytek Group. All rights reserved.
7 #include "CShaderBin.h"
8 #include "ShaderSerialize.h"
9 #include "ShaderCache.h"
10 #include "ShaderComponents.h" // ECGParam
11 #include "../ResFileLookupDataMan.h"
17 struct SPartMoveStage
;
20 //===================================================================
22 #define MAX_ENVTEXTURES 16
23 #define MAX_ENVTEXSCANDIST 0.1f
25 //===============================================================================
33 //typedef std::unordered_map<string, SMacroFX, stl::hash_strcmp<string>, stl::hash_strcmp<string>> FXMacro;
34 //typedef std::map<string,SMacroFX> FXMacro;
35 typedef std::unordered_map
<string
, SMacroFX
, stl::hash_strcmp
<const char*>, stl::hash_strcmp
<const char*>> FXMacro
;
37 typedef FXMacro::iterator FXMacroItor
;
39 //////////////////////////////////////////////////////////////////////////
40 // Helper class for shader parser, holds temporary strings vector etc...
41 //////////////////////////////////////////////////////////////////////////
42 struct CShaderParserHelper
47 ~CShaderParserHelper()
51 char* GetTempStringArray(int nIndex
, int nLen
)
53 m_tempString
.reserve(nLen
+ 1);
54 return (char*)&(m_tempStringArray
[nIndex
])[0];
57 std::vector
<char> m_tempStringArray
[32];
58 std::vector
<char> m_tempString
;
60 extern CShaderParserHelper
* g_pShaderParserHelper
;
70 enum EShaderFilterOperation
72 eSFO_Expand
= 0, // expand all permutations of the mask
73 eSFO_And
, // and against the mask
74 eSFO_Eq
, // set the mask
77 // includes or excludes
78 struct CShaderListFilter
97 EShaderFlagType m_Flags
;
98 EShaderFilterOperation m_Op
;
101 std::vector
<Predicate
> m_Predicates
;
104 //==================================================================================
112 const char* szAliasName
;
115 void (* ParserFunc
)(const char* szScr
, const char* szAnnotations
, std::vector
<STexSamplerFX
>* pSamplers
, SCGParam
* vpp
, int nComp
, CShader
* ef
);
118 , szAliasName(nullptr)
119 , eParamType(ECGP_Unknown
)
121 , ParserFunc(nullptr)
124 SParamDB(const char* inName
, ECGParam ePrmType
, uint32 inFlags
)
130 eParamType
= ePrmType
;
132 SParamDB(const char* inName
, ECGParam ePrmType
, uint32 inFlags
, void(*InParserFunc
)(const char* szScr
, const char* szAnnotations
, std::vector
<STexSamplerFX
>* pSamplers
, SCGParam
* vpp
, int nComp
, CShader
* ef
))
137 ParserFunc
= InParserFunc
;
138 eParamType
= ePrmType
;
145 ECGSampler eSamplerType
;
147 void (* ParserFunc
)(const char* szScr
, const char* szAnnotations
, std::vector
<SFXSampler
>* pSamplers
, SCGSampler
* vpp
, CShader
* ef
);
153 eSamplerType
= ECGS_Unknown
;
155 SSamplerDB(const char* inName
, ECGSampler ePrmType
, uint32 inFlags
)
160 eSamplerType
= ePrmType
;
162 SSamplerDB(const char* inName
, ECGSampler ePrmType
, uint32 inFlags
, void(*InParserFunc
)(const char* szScr
, const char* szAnnotations
, std::vector
<SFXSampler
>* pSamplers
, SCGSampler
* vpp
, CShader
* ef
))
166 ParserFunc
= InParserFunc
;
167 eSamplerType
= ePrmType
;
174 ECGTexture eTextureType
;
176 void (* ParserFunc
)(const char* szScr
, const char* szAnnotations
, std::vector
<SFXTexture
>* pSamplers
, SCGTexture
* vpp
, CShader
* ef
);
182 eTextureType
= ECGT_Unknown
;
184 STextureDB(const char* inName
, ECGTexture ePrmType
, uint32 inFlags
)
189 eTextureType
= ePrmType
;
191 STextureDB(const char* inName
, ECGTexture ePrmType
, uint32 inFlags
, void(*InParserFunc
)(const char* szScr
, const char* szAnnotations
, std::vector
<SFXTexture
>* pSamplers
, SCGTexture
* vpp
, CShader
* ef
))
195 ParserFunc
= InParserFunc
;
196 eTextureType
= ePrmType
;
200 enum EShaderCacheMode
204 eSC_BuildGlobalList
= 3,
208 //////////////////////////////////////////////////////////////////////////
210 public ISystemEventListener
211 #if defined(SHADERS_SERIALIZING)
212 , public CShaderSerialize
215 friend class CShader
;
216 friend class CParserBin
;
218 //////////////////////////////////////////////////////////////////////////
219 // ISystemEventListener interface implementation.
220 //////////////////////////////////////////////////////////////////////////
221 virtual void OnSystemEvent(ESystemEvent event
, UINT_PTR wparam
, UINT_PTR lparam
);
222 //////////////////////////////////////////////////////////////////////////
225 STexAnim
* mfReadTexSequence(const char* name
, int Flags
, bool bFindOnly
);
226 int mfReadTexSequence(STexSamplerRT
* smp
, const char* name
, int Flags
, bool bFindOnly
);
228 CShader
* mfNewShader(const char* szName
);
230 bool mfCompileShaderGen(SShaderGen
* shg
, char* scr
);
231 SShaderGenBit
* mfCompileShaderGenProperty(char* scr
);
233 void mfSetResourceTexState(SEfResTexture
* Tex
);
234 CTexture
* mfTryToLoadTexture(const char* nameTex
, STexSamplerRT
* smp
, int Flags
, bool bFindOnly
);
235 void mfRefreshResourceTextureConstants(EEfResTextures Id
, SInputShaderResources
& RS
);
236 void mfRefreshResourceTextureConstants(EEfResTextures Id
, CShaderResources
& RS
);
237 CTexture
* mfFindResourceTexture(const char* nameTex
, const char* path
, int Flags
, SEfResTexture
* Tex
);
238 CTexture
* mfLoadResourceTexture(const char* nameTex
, const char* path
, int Flags
, SEfResTexture
* Tex
);
239 bool mfLoadResourceTexture(EEfResTextures Id
, SInputShaderResources
& RS
, uint32 CustomFlags
, bool bReplaceMeOnFail
= false);
240 bool mfLoadResourceTexture(EEfResTextures Id
, CShaderResources
& RS
, uint32 CustomFlags
, bool bReplaceMeOnFail
= false);
241 void mfLoadDefaultTexture(EEfResTextures Id
, CShaderResources
& RS
, EEfResTextures Alias
);
242 void mfCheckShaderResTextures(TArray
<SShaderPass
>& Dst
, CShader
* ef
, CShaderResources
* Res
);
243 void mfCheckShaderResTexturesHW(TArray
<SShaderPass
>& Dst
, CShader
* ef
, CShaderResources
* Res
);
244 CTexture
* mfCheckTemplateTexName(const char* mapname
, ETEX_Type eTT
);
246 CShader
* mfCompile(CShader
* ef
, char* scr
);
248 void mfRefreshResources(CShaderResources
* Res
, const IRenderer::SLoadShaderItemArgs
* pArgs
= 0);
250 bool mfReloadShaderFile(const char* szName
, int nFlags
);
251 #if CRY_PLATFORM_DESKTOP
252 bool CheckAllFilesAreWritable(const char* szDir
) const;
255 static void FilterShaderCacheGenListForOrbis(FXShaderCacheCombinations
& combinations
);
260 CResFileLookupDataMan m_ResLookupDataMan
[2]; // CACHE_READONLY, CACHE_USER
262 const char* mfTemplateTexIdToName(int Id
);
263 SShaderGenComb
* mfGetShaderGenInfo(const char* nmFX
);
265 bool mfReloadShaderIncludes(const char* szPath
, int nFlags
);
266 bool mfReloadAllShaders(int nFlags
, uint32 nFlagsHW
);
267 bool mfReloadFile(const char* szPath
, const char* szName
, int nFlags
);
269 void ParseShaderProfiles();
270 void ParseShaderProfile(char* scr
, SShaderProfile
* pr
);
272 EEfResTextures
mfCheckTextureSlotName(const char* mapname
);
273 SParamDB
* mfGetShaderParamDB(const char* szSemantic
);
274 const char* mfGetShaderParamName(ECGParam ePR
);
275 bool mfParseParamComp(int comp
, SCGParam
* pCurParam
, const char* szSemantic
, char* params
, const char* szAnnotations
, SShaderFXParams
& FXParams
, CShader
* ef
, uint32 nParamFlags
, EHWShaderClass eSHClass
, bool bExpressionOperand
);
276 bool mfParseCGParam(char* scr
, const char* szAnnotations
, SShaderFXParams
& FXParams
, CShader
* ef
, std::vector
<SCGParam
>* pParams
, int nComps
, uint32 nParamFlags
, EHWShaderClass eSHClass
, bool bExpressionOperand
);
277 bool mfParseFXParameter(SShaderFXParams
& FXParams
, SFXParam
* pr
, const char* ParamName
, CShader
* ef
, bool bInstParam
, int nParams
, std::vector
<SCGParam
>* pParams
, EHWShaderClass eSHClass
, bool bExpressionOperand
);
279 bool mfParseFXTexture(SShaderFXParams
& FXParams
, SFXTexture
* pr
, const char* ParamName
, CShader
* ef
, int nParams
, std::vector
<SCGTexture
>* pParams
, EHWShaderClass eSHClass
);
280 bool mfParseFXSampler(SShaderFXParams
& FXParams
, SFXSampler
* pr
, const char* ParamName
, CShader
* ef
, int nParams
, std::vector
<SCGSampler
>* pParams
, EHWShaderClass eSHClass
);
282 void mfCheckObjectDependParams(std::vector
<SCGParam
>& PNoObj
, std::vector
<SCGParam
>& PObj
, EHWShaderClass eSH
, CShader
* pFXShader
);
286 void mfGetShaderListPath(stack_string
& nameOut
, int nType
);
290 bool m_bLoadedSystem
;
292 string m_ShadersGamePath
;
293 string m_ShadersGameExtPath
;
294 const char* m_ShadersPath
;
295 const char* m_ShadersExtPath
;
296 const char* m_ShadersCache
;
297 const char* m_ShadersFilter
;
298 const char* m_ShadersMergeCachePath
;
301 int m_nFrameForceReload
;
305 CShader
* m_pCurShader
;
306 static SResourceContainer
* s_pContainer
; // List/Map of objects for shaders resource class
308 std::vector
<string
> m_ShaderNames
;
310 static CCryNameTSCRC s_cNameHEAD
;
312 static CShader
* s_DefaultShader
;
313 static CShader
* s_shPostEffects
; // engine specific post process effects
314 static CShader
* s_shPostDepthOfField
; // depth of field
315 static CShader
* s_shPostMotionBlur
;
316 static CShader
* s_shPostSunShafts
;
317 static CShader
* s_sh3DHUD
;
319 // Deferred rendering passes
320 static CShader
* s_shDeferredShading
;
321 static CShader
* s_ShaderDeferredCaustics
;
322 static CShader
* s_ShaderDeferredRain
;
323 static CShader
* s_ShaderDeferredSnow
;
325 static CShader
* s_ShaderFPEmu
;
326 static CShader
* s_ShaderFallback
;
327 static CShader
* s_ShaderScaleForm
;
328 static CShader
* s_ShaderStars
;
329 static CShader
* s_ShaderShadowBlur
;
330 static CShader
* s_ShaderShadowMaskGen
;
331 #if defined(FEATURE_SVO_GI)
332 static CShader
* s_ShaderSVOGI
;
334 static CShader
* s_shHDRPostProcess
;
335 static CShader
* s_shPostEffectsGame
; // game specific post process effects
336 static CShader
* s_shPostEffectsRenderModes
;
337 static CShader
* s_shPostAA
;
338 static CShader
* s_ShaderDebug
;
339 static CShader
* s_ShaderLensOptics
;
340 static CShader
* s_ShaderSoftOcclusionQuery
;
341 static CShader
* s_ShaderLightStyles
;
342 static CShader
* s_ShaderCommon
;
343 static CShader
* s_ShaderOcclTest
;
344 static CShader
* s_ShaderDXTCompress
;
345 static CShader
* s_ShaderStereo
;
346 static CShader
* s_ShaderClouds
;
347 static CShader
* s_ShaderMobileComposition
;
348 static CShader
* s_ShaderGpuParticles
;
350 const SInputShaderResources
* m_pCurInputResources
;
351 SShaderGen
* m_pGlobalExt
;
353 std::vector
<SShaderGenComb
> m_SGC
;
355 int m_nCombinationsProcess
;
356 int m_nCombinationsProcessOverall
;
357 int m_nCombinationsCompiled
;
358 int m_nCombinationsEmpty
;
360 EShaderCacheMode m_eCacheMode
;
362 const char* m_szShaderPrecache
;
364 FXShaderCacheCombinations m_ShaderCacheCombinations
[2];
365 FXShaderCacheCombinations m_ShaderCacheExportCombinations
;
366 FILE* m_FPCacheCombinations
[2];
368 typedef std::vector
<CCryNameTSCRC
, stl::STLGlobalAllocator
<CCryNameTSCRC
>> ShaderCacheMissesVec
;
369 ShaderCacheMissesVec m_ShaderCacheMisses
;
370 string m_ShaderCacheMissPath
;
371 ShaderCacheMissCallback m_ShaderCacheMissCallback
;
373 SShaderCacheStatistics m_ShaderCacheStats
;
375 uint32 m_nFrameLastSubmitted
;
376 uint32 m_nFrameSubmit
;
377 SShaderProfile m_ShaderProfiles
[eST_Max
];
378 SShaderProfile m_ShaderFixedProfiles
[eSQ_Max
];
382 CShaderParserHelper m_shaderParserHelper
;
386 // Shared common global flags data
388 // Map used for storing automatically-generated flags and mapping old shader names masks to generated ones
389 // map< shader flag names, mask >
390 typedef std::map
<string
, uint64
> MapNameFlags
;
391 typedef MapNameFlags::iterator MapNameFlagsItor
;
392 MapNameFlags m_pShaderCommonGlobalFlag
;
394 MapNameFlags m_pSCGFlagLegacyFix
;
395 uint64 m_nSGFlagsFix
;
397 // Map stored for convenience mapping betweens old flags and new ones
398 // map < shader name , map< shader flag names, mask > >
399 typedef std::map
<string
, MapNameFlags
*> ShaderMapNameFlags
;
400 typedef ShaderMapNameFlags::iterator ShaderMapNameFlagsItor
;
401 ShaderMapNameFlags m_pShadersGlobalFlags
;
403 typedef std::map
<CCryNameTSCRC
, SShaderGen
*> ShaderExt
;
404 typedef ShaderExt::iterator ShaderExtItor
;
405 ShaderExt m_ShaderExts
;
407 // Concatenated list of shader names using automatic masks generation
408 string m_pShadersRemapList
;
410 // Helper functors for cleaning up
412 struct SShaderMapNameFlagsContainerDelete
414 void operator()(ShaderMapNameFlags::value_type
& pObj
)
416 SAFE_DELETE(pObj
.second
);
424 void mfReleaseShaders();
426 SShaderGen
* mfCreateShaderGenInfo(const char* szName
, bool bRuntime
);
427 void mfRemapShaderGenInfoBits(const char* szName
, SShaderGen
* pShGen
);
429 uint64
mfGetRemapedShaderMaskGen(const char* szName
, uint64 nMaskGen
= 0, bool bFixup
= 0);
430 string
mfGetShaderBitNamesFromMaskGen(const char* szName
, uint64 nMaskGen
);
432 bool mfUsesGlobalFlags(const char* szShaderName
);
433 const char* mfGetShaderBitNamesFromGlobalMaskGen(uint64 nMaskGen
);
434 uint64
mfGetShaderGlobalMaskGenFromString(const char* szShaderGen
);
436 void mfInitGlobal(void);
437 void mfInitLookups(void);
439 void mfPreloadShaderExts(void);
440 void mfInitCommonGlobalFlags(void);
441 void mfInitCommonGlobalFlagsLegacyFix(void);
442 bool mfRemapCommonGlobalFlagsWithLegacy(void);
443 void mfCreateCommonGlobalFlags(const char* szName
);
444 void mfSaveCommonGlobalFlagsToDisk(const char* szName
, uint32 nMaskCount
);
447 void mfPostInit(void);
448 void mfSortResources();
449 CShaderResources
* mfCreateShaderResources(const SInputShaderResources
* Res
, bool bShare
);
450 bool mfRefreshResourceConstants(CShaderResources
* Res
);
451 inline bool mfRefreshResourceConstants(SShaderItem
& SI
) { return mfRefreshResourceConstants((CShaderResources
*)SI
.m_pShaderResources
); }
452 bool mfUpdateTechnik(SShaderItem
& SI
, CCryNameTSCRC
& Name
);
453 SShaderItem
mfShaderItemForName(const char* szName
, bool bShare
, int flags
, SInputShaderResources
* Res
= NULL
, uint64 nMaskGen
= 0, const IRenderer::SLoadShaderItemArgs
* pArgs
= 0);
454 CShader
* mfForName(const char* name
, int flags
, const CShaderResources
* Res
= NULL
, uint64 nMaskGen
= 0);
456 bool mfRefreshSystemShader(const char* szName
, CShader
*& pSysShader
)
460 CryComment("Load System Shader '%s'...", szName
);
462 if (pSysShader
= mfForName(szName
, EF_SYSTEM
))
469 void RT_ParseShader(CShader
* pSH
, uint64 nMaskGen
, uint32 flags
, CShaderResources
* Res
);
470 void RT_SetShaderQuality(EShaderType eST
, EShaderQuality eSQ
);
472 void CreateShaderMaskGenString(const CShader
* pSH
, stack_string
& flagString
);
473 void CreateShaderExportRequestLine(const CShader
* pSH
, stack_string
& exportString
);
475 SFXParam
* mfGetFXParameter(std::vector
<SFXParam
>& Params
, const char* param
);
476 SFXSampler
* mfGetFXSampler(std::vector
<SFXSampler
>& Params
, const char* param
);
477 SFXTexture
* mfGetFXTexture(std::vector
<SFXTexture
>& Params
, const char* param
);
478 const char* mfParseFX_Parameter(const string
& buf
, EParamType eType
, const char* szName
);
479 void mfParseFX_Annotations_Script(char* buf
, CShader
* ef
, std::vector
<SFXStruct
>& Structs
, bool* bPublic
, CCryNameR techStart
[2]);
480 void mfParseFX_Annotations(char* buf
, CShader
* ef
, std::vector
<SFXStruct
>& Structs
, bool* bPublic
, CCryNameR techStart
[2]);
481 void mfParseFXTechnique_Annotations_Script(char* buf
, CShader
* ef
, std::vector
<SFXStruct
>& Structs
, SShaderTechnique
* pShTech
, bool* bPublic
, std::vector
<SShaderTechParseParams
>& techParams
);
482 void mfParseFXTechnique_Annotations(char* buf
, CShader
* ef
, std::vector
<SFXStruct
>& Structs
, SShaderTechnique
* pShTech
, bool* bPublic
, std::vector
<SShaderTechParseParams
>& techParams
);
483 void mfParseFXSampler_Annotations_Script(char* buf
, CShader
* ef
, std::vector
<SFXStruct
>& Structs
, STexSamplerFX
* pSamp
);
484 void mfParseFXSampler_Annotations(char* buf
, CShader
* ef
, std::vector
<SFXStruct
>& Structs
, STexSamplerFX
* pSamp
);
485 void mfParseFX_Global(SFXParam
& pr
, CShader
* ef
, std::vector
<SFXStruct
>& Structs
, CCryNameR techStart
[2]);
486 bool mfParseDummyFX_Global(std::vector
<SFXStruct
>& Structs
, char* annot
, CCryNameR techStart
[2]);
487 const string
& mfParseFXTechnique_GenerateShaderScript(std::vector
<SFXStruct
>& Structs
, FXMacro
& Macros
, std::vector
<SFXParam
>& Params
, std::vector
<SFXParam
>& AffectedParams
, const char* szEntryFunc
, CShader
* ef
, EHWShaderClass eSHClass
, const char* szShaderName
, uint32
& nAffectMask
, const char* szType
);
488 bool mfParseFXTechnique_MergeParameters(std::vector
<SFXStruct
>& Structs
, std::vector
<SFXParam
>& Params
, std::vector
<int>& AffectedFunc
, SFXStruct
* pMainFunc
, CShader
* ef
, EHWShaderClass eSHClass
, const char* szShaderName
, std::vector
<SFXParam
>& NewParams
);
489 CTexture
* mfParseFXTechnique_LoadShaderTexture(STexSamplerRT
* smp
, const char* szName
, SShaderPass
* pShPass
, CShader
* ef
, int nIndex
, byte ColorOp
, byte AlphaOp
, byte ColorArg
, byte AlphaArg
);
490 bool mfParseFXTechnique_LoadShader(const char* szShaderCom
, SShaderPass
* pShPass
, CShader
* ef
, std::vector
<STexSamplerFX
>& Samplers
, std::vector
<SFXStruct
>& Structs
, std::vector
<SFXParam
>& Params
, FXMacro
& Macros
, EHWShaderClass eSHClass
);
491 bool mfParseFXTechniquePass(char* buf
, char* annotations
, SShaderTechnique
* pShTech
, CShader
* ef
, std::vector
<STexSamplerFX
>& Samplers
, std::vector
<SFXStruct
>& Structs
, std::vector
<SFXParam
>& Params
);
492 bool mfParseFXTechnique_CustomRE(char* buf
, const char* name
, SShaderTechnique
* pShTech
, CShader
* ef
);
493 SShaderTechnique
* mfParseFXTechnique(char* buf
, char* annotations
, CShader
* ef
, std::vector
<STexSamplerFX
>& Samplers
, std::vector
<SFXStruct
>& Structs
, std::vector
<SFXParam
>& Params
, bool* bPublic
, std::vector
<SShaderTechParseParams
>& techParams
);
494 bool mfParseFXSampler(char* buf
, char* name
, char* annotations
, CShader
* ef
, std::vector
<STexSamplerFX
>& Samplers
, std::vector
<SFXStruct
>& Structs
);
495 bool mfParseLightStyle(CLightStyle
* ls
, char* buf
);
496 bool mfParseFXLightStyle(char* buf
, int nID
, CShader
* ef
, std::vector
<SFXStruct
>& Structs
);
497 CShader
* mfParseFX(char* buf
, CShader
* ef
, CShader
* efGen
, uint64 nMaskGen
);
498 void mfPostLoadFX(CShader
* efT
, std::vector
<SShaderTechParseParams
>& techParams
, CCryNameR techStart
[2]);
499 bool mfParseDummyFX(char* buf
, std::vector
<string
>& ShaderNames
, const char* szName
);
500 bool mfAddFXShaderNames(const char* szName
, std::vector
<string
>* ShaderNames
, bool bUpdateCRC
);
501 bool mfInitShadersDummy(bool bUpdateCRC
);
503 uint64
mfGetRTForName(char* buf
);
504 uint32
mfGetGLForName(char* buf
, CShader
* ef
);
506 void mfFillGenMacroses(SShaderGen
* shG
, TArray
<char>& buf
, uint64 nMaskGen
);
507 bool mfModifyGenFlags(CShader
* efGen
, const CShaderResources
* pRes
, uint64
& nMaskGen
, uint64
& nMaskGenHW
);
509 bool mfGatherShadersList(const char* szPath
, bool bCheckIncludes
, bool bUpdateCRC
, std::vector
<string
>* Names
);
510 void mfGatherFilesList(const char* szPath
, std::vector
<CCryNameR
>& Names
, int nLevel
, bool bUseFilter
, bool bMaterial
= false);
511 int mfInitShadersList(std::vector
<string
>* ShaderNames
);
512 void mfSetDefaults(void);
513 void mfReleaseSystemShaders();
514 void mfLoadBasicSystemShaders();
515 void mfLoadDefaultSystemShaders();
516 void mfCloseShadersCache(int nID
);
517 void mfInitShadersCacheMissLog();
519 void mfInitShadersCache(byte bForLevel
, FXShaderCacheCombinations
* Combinations
= NULL
, const char* pCombinations
= NULL
, int nType
= 0);
520 void mfMergeShadersCombinations(FXShaderCacheCombinations
* Combinations
, int nType
);
521 void mfInsertNewCombination(SShaderCombIdent
& Ident
, EHWShaderClass eCL
, const char* name
, int nID
, string
* Str
= NULL
, byte bStore
= 1);
522 string
mfGetShaderCompileFlags(EHWShaderClass eClass
, UPipelineState pipelineState
) const;
523 const char* mfGetLevelListName() const;
524 void mfExportShaders();
526 bool mfPreloadBinaryShaders();
528 bool LoadShaderStartupCache();
529 void UnloadShaderStartupCache();
531 #if CRY_PLATFORM_DESKTOP
532 void AddCombination(SCacheCombination
& cmb
, FXShaderCacheCombinations
& CmbsMap
, CHWShader
* pHWS
);
533 void AddGLCombinations(CShader
* pSH
, std::vector
<SCacheCombination
>& CmbsGL
);
534 void AddLTCombinations(SCacheCombination
& cmb
, FXShaderCacheCombinations
& CmbsMap
, CHWShader
* pHWS
);
535 void AddRTCombinations(FXShaderCacheCombinations
& CmbsMap
, CHWShader
* pHWS
, CShader
* pSH
, FXShaderCacheCombinations
* Combinations
);
536 void AddGLCombination(FXShaderCacheCombinations
& CmbsMap
, SCacheCombination
& cc
);
537 void FilterShaderCombinations(std::vector
<SCacheCombination
>& Cmbs
, const std::vector
<CShaderListFilter
>& Filters
);
538 void mfPrecacheShaders(bool bStatsOnly
);
539 void _PrecacheShaderList(bool bStatsOnly
);
540 void mfOptimiseShaders(const char* szFolder
, bool bForce
);
541 void mfAddRTCombinations(FXShaderCacheCombinations
& CmbsMapSrc
, FXShaderCacheCombinations
& CmbsMapDst
, CHWShader
* pSH
, bool bListOnly
);
542 void mfAddRTCombination_r(int nComb
, FXShaderCacheCombinations
& CmbsMapDst
, SCacheCombination
* cmb
, CHWShader
* pSH
, bool bAutoPrecache
);
543 void mfAddLTCombinations(SCacheCombination
* cmb
, FXShaderCacheCombinations
& CmbsMapDst
);
544 void mfAddLTCombination(SCacheCombination
* cmb
, FXShaderCacheCombinations
& CmbsMapDst
, DWORD dwL
);
547 #if CRY_PLATFORM_WINDOWS && CRY_PLATFORM_64BIT
548 #pragma warning( push ) //AMD Port
549 #pragma warning( disable : 4267 ) // conversion from 'size_t' to 'XXX', possible loss of data
554 int nSize
= sizeof(*this);
556 nSize
+= m_SGC
.capacity();
557 nSize
+= m_Bin
.Size();
562 void GetMemoryUsage(ICrySizer
* pSizer
) const
564 pSizer
->AddObject(m_Bin
);
565 pSizer
->AddObject(m_SGC
);
566 pSizer
->AddObject(m_ShaderNames
);
567 pSizer
->AddObject(m_ShaderCacheCombinations
[0]);
568 pSizer
->AddObject(m_ShaderCacheCombinations
[1]);
571 static float EvalWaveForm(SWaveForm
* wf
);
572 static float EvalWaveForm(SWaveForm2
* wf
);
573 static float EvalWaveForm2(SWaveForm
* wf
, float frac
);
576 #if CRY_PLATFORM_WINDOWS && CRY_PLATFORM_64BIT
577 #pragma warning( pop ) //AMD Port
580 //=====================================================================
582 #endif // __CSHADER_H__