VideoCommon: Fix D3D shader warning X3557 (single iteration loop)
Fix warning "loop only executes for 1 iteration(s), forcing loop to unroll" when vertex_in == 1
This commit is contained in:
parent
71541c1324
commit
e1e0f42b37
|
@ -216,7 +216,11 @@ ShaderCode GenerateGeometryShaderCode(APIType api_type, const ShaderHostConfig&
|
|||
if (wireframe)
|
||||
out.Write("\tVS_OUTPUT first;\n");
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
@ -307,6 +311,8 @@ ShaderCode GenerateGeometryShaderCode(APIType api_type, const ShaderHostConfig&
|
|||
EmitVertex(out, host_config, uid_data, "f", api_type, wireframe, stereo, true);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
|
Loading…
Reference in New Issue