summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/ShaderGenCommon.cpp
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2025-03-15 17:29:13 -0500
committeriwubcode <iwubcode@users.noreply.github.com>2025-03-22 15:22:00 -0500
commit8e253518e6f8b918dffe7361faf897c16eabc6d3 (patch)
tree7d53662ef01ceb75cf8d8b556284733d110e93cf /Source/Core/VideoCommon/ShaderGenCommon.cpp
parent0afbeae70c94b72318035c300ef085d4753f7462 (diff)
VideoCommon: move to a 'process_fragment()' function to simplify custom shaders and provide a direct override of the tev stage logic
Diffstat (limited to 'Source/Core/VideoCommon/ShaderGenCommon.cpp')
-rw-r--r--Source/Core/VideoCommon/ShaderGenCommon.cpp92
1 files changed, 0 insertions, 92 deletions
diff --git a/Source/Core/VideoCommon/ShaderGenCommon.cpp b/Source/Core/VideoCommon/ShaderGenCommon.cpp
index ec251c3cce..26463f4476 100644
--- a/Source/Core/VideoCommon/ShaderGenCommon.cpp
+++ b/Source/Core/VideoCommon/ShaderGenCommon.cpp
@@ -362,95 +362,3 @@ const char* GetInterpolationQualifier(bool msaa, bool ssaa, bool in_glsl_interfa
return "sample";
}
}
-
-void WriteCustomShaderStructDef(ShaderCode* out, u32 numtexgens)
-{
- // Bump this when there are breaking changes to the API
- out->Write("#define CUSTOM_SHADER_API_VERSION 1;\n");
-
- // CUSTOM_SHADER_LIGHTING_ATTENUATION_TYPE "enum" values
- out->Write("const uint CUSTOM_SHADER_LIGHTING_ATTENUATION_TYPE_NONE = {}u;\n",
- static_cast<u32>(AttenuationFunc::None));
- out->Write("const uint CUSTOM_SHADER_LIGHTING_ATTENUATION_TYPE_POINT = {}u;\n",
- static_cast<u32>(AttenuationFunc::Spec));
- out->Write("const uint CUSTOM_SHADER_LIGHTING_ATTENUATION_TYPE_DIR = {}u;\n",
- static_cast<u32>(AttenuationFunc::Dir));
- out->Write("const uint CUSTOM_SHADER_LIGHTING_ATTENUATION_TYPE_SPOT = {}u;\n",
- static_cast<u32>(AttenuationFunc::Spot));
-
- out->Write("struct CustomShaderOutput\n");
- out->Write("{{\n");
- out->Write("\tfloat4 main_rt;\n");
- out->Write("}};\n\n");
-
- out->Write("struct CustomShaderLightData\n");
- out->Write("{{\n");
- out->Write("\tfloat3 position;\n");
- out->Write("\tfloat3 direction;\n");
- out->Write("\tfloat3 color;\n");
- out->Write("\tuint attenuation_type;\n");
- out->Write("\tfloat4 cosatt;\n");
- out->Write("\tfloat4 distatt;\n");
- out->Write("}};\n\n");
-
- // CUSTOM_SHADER_TEV_STAGE_INPUT_TYPE "enum" values
- out->Write("const uint CUSTOM_SHADER_TEV_STAGE_INPUT_TYPE_PREV = 0u;\n");
- out->Write("const uint CUSTOM_SHADER_TEV_STAGE_INPUT_TYPE_COLOR = 1u;\n");
- out->Write("const uint CUSTOM_SHADER_TEV_STAGE_INPUT_TYPE_TEX = 2u;\n");
- out->Write("const uint CUSTOM_SHADER_TEV_STAGE_INPUT_TYPE_RAS = 3u;\n");
- out->Write("const uint CUSTOM_SHADER_TEV_STAGE_INPUT_TYPE_KONST = 4u;\n");
- out->Write("const uint CUSTOM_SHADER_TEV_STAGE_INPUT_TYPE_NUMERIC = 5u;\n");
- out->Write("const uint CUSTOM_SHADER_TEV_STAGE_INPUT_TYPE_UNUSED = 6u;\n");
-
- out->Write("struct CustomShaderTevStageInputColor\n");
- out->Write("{{\n");
- out->Write("\tuint input_type;\n");
- out->Write("\tfloat3 value;\n");
- out->Write("}};\n\n");
-
- out->Write("struct CustomShaderTevStageInputAlpha\n");
- out->Write("{{\n");
- out->Write("\tuint input_type;\n");
- out->Write("\tfloat value;\n");
- out->Write("}};\n\n");
-
- out->Write("struct CustomShaderTevStage\n");
- out->Write("{{\n");
- out->Write("\tCustomShaderTevStageInputColor[4] input_color;\n");
- out->Write("\tCustomShaderTevStageInputAlpha[4] input_alpha;\n");
- out->Write("\tuint texmap;\n");
- out->Write("\tfloat4 output_color;\n");
- out->Write("}};\n\n");
-
- // Custom structure for data we pass to custom shader hooks
- out->Write("struct CustomShaderData\n");
- out->Write("{{\n");
- out->Write("\tfloat3 position;\n");
- out->Write("\tfloat3 normal;\n");
- if (numtexgens == 0)
- {
- // Cheat so shaders compile
- out->Write("\tfloat3[1] texcoord;\n");
- }
- else
- {
- out->Write("\tfloat3[{}] texcoord;\n", numtexgens);
- }
- out->Write("\tuint texcoord_count;\n");
- out->Write("\tuint[8] texmap_to_texcoord_index;\n");
- out->Write("\tCustomShaderLightData[8] lights_chan0_color;\n");
- out->Write("\tCustomShaderLightData[8] lights_chan0_alpha;\n");
- out->Write("\tCustomShaderLightData[8] lights_chan1_color;\n");
- out->Write("\tCustomShaderLightData[8] lights_chan1_alpha;\n");
- out->Write("\tfloat4[2] ambient_lighting;\n");
- out->Write("\tfloat4[2] base_material;\n");
- out->Write("\tuint light_chan0_color_count;\n");
- out->Write("\tuint light_chan0_alpha_count;\n");
- out->Write("\tuint light_chan1_color_count;\n");
- out->Write("\tuint light_chan1_alpha_count;\n");
- out->Write("\tCustomShaderTevStage[16] tev_stages;\n");
- out->Write("\tuint tev_stage_count;\n");
- out->Write("\tfloat4 final_color;\n");
- out->Write("\tuint time_ms;\n");
- out->Write("}};\n\n");
-}