MCPcopy Create free account
hub / github.com/GPUOpen-LibrariesAndSDKs/Cauldron / DXCompile

Function DXCompile

src/DX12/base/ShaderCompilerHelper.cpp:59–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57 }
58
59 bool DXCompile(const char *pSrcCode,
60 const DefineList* pDefines,
61 const char *pEntryPoint,
62 const char *pParams,
63 D3D12_SHADER_BYTECODE* pOutBytecode)
64 {
65 //compute hash
66 //
67 size_t hash;
68 hash = HashShaderString((GetShaderCompilerLibDir() + "\\").c_str() , pSrcCode);
69 hash = Hash(pEntryPoint, strlen(pEntryPoint), hash);
70 hash = Hash(pParams, strlen(pParams), hash);
71 if (pDefines != NULL)
72 {
73 hash = pDefines->Hash(hash);
74 }
75
76#ifdef USE_MULTITHREADED_CACHE
77 // Compile if not in cache
78 //
79 if (s_shaderCache.CacheMiss(hash, pOutBytecode))
80#endif
81 {
82 char *SpvData = NULL;
83 size_t SpvSize = 0;
84
85 DXCompileToDXO(hash, pSrcCode, pDefines, pEntryPoint, pParams, &SpvData, &SpvSize);
86
87 assert(SpvSize != 0);
88 pOutBytecode->BytecodeLength = SpvSize;
89 pOutBytecode->pShaderBytecode = SpvData;
90
91#ifdef USE_MULTITHREADED_CACHE
92 s_shaderCache.UpdateCache(hash, pOutBytecode);
93#endif
94 }
95
96 return true;
97 }
98
99 bool CompileShaderFromString(
100 const char *pShaderCode,

Callers 1

CompileShaderFromStringFunction · 0.85

Calls 8

HashShaderStringFunction · 0.85
GetShaderCompilerLibDirFunction · 0.85
HashFunction · 0.85
DXCompileToDXOFunction · 0.85
c_strMethod · 0.80
HashMethod · 0.80
CacheMissMethod · 0.80
UpdateCacheMethod · 0.80

Tested by

no test coverage detected