diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2024-01-28 14:30:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-28 14:30:37 +0100 |
| commit | 8482a50154648f653104d7da0b8d371efb720565 (patch) | |
| tree | 1ad065403c8087736319635c70969b134bf16a87 /Source/Core/VideoCommon/PixelShaderGen.cpp | |
| parent | 4843705061cb0c98f2f2c11d9ec4e0af9a484756 (diff) | |
| parent | cf081e839da523fc2e22e7ac6aef404b173079e1 (diff) | |
Merge pull request #12530 from iwubcode/custom_shaders_compilation_fixes
VideoCommon: fix some issues when compiling custom shaders
Diffstat (limited to 'Source/Core/VideoCommon/PixelShaderGen.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/PixelShaderGen.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index fff2374531..0d6efe9f6a 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -839,7 +839,8 @@ void WriteCustomShaderStructImpl(ShaderCode* out, u32 num_stages, bool per_pixel texcoord); } - GenerateCustomLightingImplementation(out, uid_data->lighting, "colors_"); + if (per_pixel_lighting) + GenerateCustomLightingImplementation(out, uid_data->lighting, "colors_"); for (u32 i = 0; i < 16; i++) { @@ -1326,8 +1327,20 @@ ShaderCode GeneratePixelShaderCode(APIType api_type, const ShaderHostConfig& hos if (!shader_details.custom_shader.empty()) { out.Write("\t{{\n"); - out.Write("\t\tcustom_data.final_color = ocol0;\n"); - out.Write("\t\tocol0.xyz = {}_{}(custom_data).xyz;\n", CUSTOM_PIXELSHADER_COLOR_FUNC, i); + if (uid_data->uint_output) + { + out.Write("\t\tcustom_data.final_color = float4(ocol0.x / 255.0, ocol0.y / 255.0, ocol0.z " + "/ 255.0, ocol0.w / 255.0);\n"); + out.Write("\t\tfloat3 custom_output = {}_{}(custom_data).xyz;\n", + CUSTOM_PIXELSHADER_COLOR_FUNC, i); + out.Write("\t\tocol0.xyz = uint3(custom_output.x * 255, custom_output.y * 255, " + "custom_output.z * 255);\n"); + } + else + { + out.Write("\t\tcustom_data.final_color = ocol0;\n"); + out.Write("\t\tocol0.xyz = {}_{}(custom_data).xyz;\n", CUSTOM_PIXELSHADER_COLOR_FUNC, i); + } out.Write("\t}}\n\n"); } } |
