MCPcopy Create free account
hub / github.com/TheRealMJP/Shadows / LoadShaders

Method LoadShaders

Shadows/MeshRenderer.cpp:319–391  ·  view source on GitHub ↗

Loads all shaders

Source from the content-addressed store, hash-verified

317
318// Loads all shaders
319void MeshRenderer::LoadShaders()
320{
321 // Load the mesh shaders
322 meshDepthVS = CompileVSFromFile(device, L"DepthOnly.hlsl", "VS", "vs_5_0");
323 meshVS = CompileVSFromFile(device, L"Mesh.hlsl", "VS", "vs_5_0");
324 meshPS = CompileMeshPS(device);
325
326 fullScreenVS = CompileVSFromFile(device, L"VSMConvert.hlsl", "FullScreenVS");
327 for(uint32 shadowMode = uint32(ShadowMode::VSM); shadowMode < uint32(ShadowMode::NumValues); ++shadowMode)
328 {
329 for(uint32 msaaMode = 0; msaaMode < uint32(ShadowMSAA::NumValues); ++msaaMode)
330 {
331 PixelShaderPtr& shader = vsmConvertPS[shadowMode - uint32(ShadowMode::VSM)][msaaMode];
332
333 CompileOptions opts;
334 opts.Add("ShadowMode_", shadowMode);
335 opts.Add("MSAASamples_", AppSettings::MSAASamples(msaaMode));
336 shader = CompilePSFromFile(device, L"VSMConvert.hlsl", "ConvertToVSM", "ps_5_0", opts);
337 }
338 }
339
340 for(uint32 i = 0; i <= MaxBlurRadius; ++i)
341 {
342
343 CompileOptions opts;
344 opts.Add("Horizontal_", 1);
345 opts.Add("Vertical_", 0);
346 opts.Add("SampleRadius_", i);
347 opts.Add("GPUSceneSubmission_", 0);
348 vsmBlurH[i] = CompilePSFromFile(device, L"VSMConvert.hlsl", "BlurVSM", "ps_5_0", opts);
349
350
351 opts.Reset();
352 opts.Add("Horizontal_", 0);
353 opts.Add("Vertical_", 1);
354 opts.Add("SampleRadius_", i);
355 opts.Add("GPUSceneSubmission_", 0);
356 vsmBlurV[i] = CompilePSFromFile(device, L"VSMConvert.hlsl", "BlurVSM", "ps_5_0", opts);
357 }
358
359
360 CompileOptions opts;
361 opts.Add("Horizontal_", 1);
362 opts.Add("Vertical_", 0);
363 opts.Add("GPUSceneSubmission_", 1);
364 vsmBlurGPUH = CompilePSFromFile(device, L"VSMConvert.hlsl", "BlurVSM", "ps_5_0", opts);
365
366
367 opts.Reset();
368 opts.Add("Horizontal_", 0);
369 opts.Add("Vertical_", 1);
370 opts.Add("GPUSceneSubmission_", 1);
371 vsmBlurGPUV = CompilePSFromFile(device, L"VSMConvert.hlsl", "BlurVSM", "ps_5_0", opts);
372
373
374 depthReductionInitialPS = CompilePSFromFile(device, L"DepthReduction.hlsl", "DepthReductionInitialPS");
375 depthReductionPS = CompilePSFromFile(device, L"DepthReduction.hlsl", "DepthReductionPS");
376

Callers

nothing calls this directly

Calls 7

CompileVSFromFileFunction · 0.85
CompileMeshPSFunction · 0.85
MSAASamplesFunction · 0.85
CompilePSFromFileFunction · 0.85
CompileCSFromFileFunction · 0.85
AddMethod · 0.80
ResetMethod · 0.45

Tested by

no test coverage detected