summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/PixelShaderGen.cpp
diff options
context:
space:
mode:
authorMai <mai.iam2048@gmail.com>2023-12-17 14:42:34 -0500
committerGitHub <noreply@github.com>2023-12-17 14:42:34 -0500
commit0125b5182f15ba9af56abaf2a7e93cad8e9ecc5e (patch)
tree2f1058942375988fa0e1435223e9505612e2d3b0 /Source/Core/VideoCommon/PixelShaderGen.cpp
parentb27c15fab61787cb7a00af6a9b646f7f61ab28e4 (diff)
parentb1d9e13d75ecab111dae12a328c5a7f8933277dc (diff)
Merge pull request #12409 from iwubcode/custom_material_graphics_mod_action_data
VideoCommon: prepare graphics mods for custom shader material data
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/PixelShaderGen.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp
index 69fdc36efc..fff2374531 100644
--- a/Source/Core/VideoCommon/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/PixelShaderGen.cpp
@@ -345,7 +345,8 @@ void ClearUnusedPixelShaderUidBits(APIType api_type, const ShaderHostConfig& hos
}
void WritePixelShaderCommonHeader(ShaderCode& out, APIType api_type,
- const ShaderHostConfig& host_config, bool bounding_box)
+ const ShaderHostConfig& host_config, bool bounding_box,
+ const CustomPixelShaderContents& custom_details)
{
// dot product for integer vectors
out.Write("int idot(int3 x, int3 y)\n"
@@ -426,6 +427,14 @@ void WritePixelShaderCommonHeader(ShaderCode& out, APIType api_type,
out.Write("}};\n");
}
+ if (!custom_details.shaders.empty() &&
+ !custom_details.shaders.back().material_uniform_block.empty())
+ {
+ out.Write("UBO_BINDING(std140, 3) uniform CustomShaderBlock {{\n");
+ out.Write("{}", custom_details.shaders.back().material_uniform_block);
+ out.Write("}} custom_uniforms;\n");
+ }
+
if (bounding_box)
{
out.Write("SSBO_BINDING(0) coherent buffer BBox {{\n"
@@ -907,7 +916,7 @@ ShaderCode GeneratePixelShaderCode(APIType api_type, const ShaderHostConfig& hos
// Stuff that is shared between ubershaders and pixelgen.
WriteBitfieldExtractHeader(out, api_type, host_config);
- WritePixelShaderCommonHeader(out, api_type, host_config, uid_data->bounding_box);
+ WritePixelShaderCommonHeader(out, api_type, host_config, uid_data->bounding_box, custom_details);
// Custom shader details
WriteCustomShaderStructDef(&out, uid_data->genMode_numtexgens);