Merge pull request #10819 from Dentomologist/fix_shader_compilation_warnings

VideoCommon: Fix D3D shader compilation warnings
This commit is contained in:
JMC47
2022-07-08 18:46:29 -04:00
committed by GitHub
4 changed files with 14 additions and 8 deletions

View File

@ -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);