MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / LoadAAShaders

Method LoadAAShaders

TombEngine/Renderer/ShaderManager/ShaderManager.cpp:53–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 }
52
53 void ShaderManager::LoadAAShaders(int width, int height, bool recompile)
54 {
55 auto string = std::stringstream{};
56 auto defines = std::vector<D3D10_SHADER_MACRO>{};
57
58 // Set up pixel size macro.
59 string << "float4(1.0 / " << width << ", 1.0 / " << height << ", " << width << ", " << height << ")";
60 auto pixelSizeText = string.str();
61 auto renderTargetMetricsMacro = D3D10_SHADER_MACRO{ "SMAA_RT_METRICS", pixelSizeText.c_str() };
62 defines.push_back(renderTargetMetricsMacro);
63
64 if (g_Configuration.AntialiasingMode == AntialiasingMode::Medium)
65 {
66 defines.push_back({ "SMAA_PRESET_MEDIUM", nullptr });
67 }
68 else
69 {
70 defines.push_back({ "SMAA_PRESET_ULTRA", nullptr });
71 }
72
73 // defines.push_back({ "SMAA_PREDICATION", "1" });
74
75 // Set up target macro.
76 auto dx101Macro = D3D10_SHADER_MACRO{ "SMAA_HLSL_4_1", "1" };
77 defines.push_back(dx101Macro);
78
79 auto null = D3D10_SHADER_MACRO{ nullptr, nullptr };
80 defines.push_back(null);
81
82 Load(Shader::SmaaEdgeDetection, "SMAA", "EdgeDetection", ShaderType::Vertex, defines.data(), recompile);
83 Load(Shader::SmaaLumaEdgeDetection, "SMAA", "LumaEdgeDetection", ShaderType::Pixel, defines.data(), recompile);
84 Load(Shader::SmaaColorEdgeDetection, "SMAA", "ColorEdgeDetection", ShaderType::Pixel, defines.data(), recompile);
85 Load(Shader::SmaaDepthEdgeDetection, "SMAA", "DepthEdgeDetection", ShaderType::Pixel, defines.data(), recompile);
86 Load(Shader::SmaaBlendingWeightCalculation, "SMAA", "BlendingWeightCalculation", ShaderType::PixelAndVertex, defines.data(), recompile);
87 Load(Shader::SmaaNeighborhoodBlending, "SMAA", "NeighborhoodBlending", ShaderType::PixelAndVertex, defines.data(), recompile);
88
89 Load(Shader::Fxaa, "FXAA", "", ShaderType::Pixel);
90 }
91
92 void ShaderManager::LoadCommonShaders()
93 {

Callers

nothing calls this directly

Calls 4

strMethod · 0.45
c_strMethod · 0.45
push_backMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected