mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #10819 from Dentomologist/fix_shader_compilation_warnings
VideoCommon: Fix D3D shader compilation warnings
This commit is contained in:
commit
fac66897af
@ -219,7 +219,11 @@ ShaderCode GenerateGeometryShaderCode(APIType api_type, const ShaderHostConfig&
|
||||
if (wireframe)
|
||||
out.Write("\tVS_OUTPUT first;\n");
|
||||
|
||||
out.Write("\tfor (int i = 0; i < {}; ++i) {{\n", vertex_in);
|
||||
// Avoid D3D warning about forced unrolling of single-iteration loop
|
||||
if (vertex_in > 1)
|
||||
out.Write("\tfor (int i = 0; i < {}; ++i) {{\n", vertex_in);
|
||||
else
|
||||
out.Write("\tint i = 0;\n");
|
||||
|
||||
if (api_type == APIType::OpenGL || api_type == APIType::Vulkan)
|
||||
{
|
||||
@ -310,7 +314,9 @@ ShaderCode GenerateGeometryShaderCode(APIType api_type, const ShaderHostConfig&
|
||||
EmitVertex(out, host_config, uid_data, "f", api_type, wireframe, stereo, true);
|
||||
}
|
||||
|
||||
out.Write("\t}}\n");
|
||||
// Only close loop if previous code was in one (See D3D warning above)
|
||||
if (vertex_in > 1)
|
||||
out.Write("\t}}\n");
|
||||
|
||||
EndPrimitive(out, host_config, uid_data, api_type, wireframe, stereo);
|
||||
|
||||
|
@ -712,8 +712,8 @@ static void WriteXFBEncoder(ShaderCode& code, APIType api_type, const EFBCopyPar
|
||||
WriteSampleColor(code, "rgb", "color1", 1, api_type, params);
|
||||
|
||||
// Gamma is only applied to XFB copies.
|
||||
code.Write(" color0 = pow(color0, float3(gamma_rcp, gamma_rcp, gamma_rcp));\n"
|
||||
" color1 = pow(color1, float3(gamma_rcp, gamma_rcp, gamma_rcp));\n");
|
||||
code.Write(" color0 = pow(abs(color0), float3(gamma_rcp, gamma_rcp, gamma_rcp));\n"
|
||||
" color1 = pow(abs(color1), float3(gamma_rcp, gamma_rcp, gamma_rcp));\n");
|
||||
|
||||
// Convert to YUV.
|
||||
code.Write(" const float3 y_const = float3(0.257, 0.504, 0.098);\n"
|
||||
|
@ -278,8 +278,8 @@ ShaderCode GeneratePixelShader(APIType api_type, const UidData* uid_data)
|
||||
break;
|
||||
|
||||
case EFBCopyFormat::XFB:
|
||||
out.Write(
|
||||
" ocol0 = float4(pow(texcol.rgb, float3(gamma_rcp, gamma_rcp, gamma_rcp)), 1.0f);\n");
|
||||
out.Write(" ocol0 = float4(pow(abs(texcol.rgb), float3(gamma_rcp, gamma_rcp, gamma_rcp)), "
|
||||
"1.0f);\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -827,8 +827,8 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config,
|
||||
out.Write(
|
||||
" uint alpha_compare_op = alpha_scale << 1 | uint(alpha_op);\n"
|
||||
"\n"
|
||||
" int alpha_A;\n"
|
||||
" int alpha_B;\n"
|
||||
" int alpha_A = 0;\n"
|
||||
" int alpha_B = 0;\n"
|
||||
" if (alpha_bias != 3u || alpha_compare_op > 5u) {{\n"
|
||||
" // Small optimisation here: alpha_A and alpha_B are unused by compare ops 0-5\n"
|
||||
" alpha_A = selectAlphaInput(s, ss, {0}colors_0, {0}colors_1, alpha_a) & 255;\n"
|
||||
|
Loading…
Reference in New Issue
Block a user