mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 05:40:01 -06:00
Multithreadded Shadergen: Minor fixups.
This commit is contained in:
@ -42,14 +42,13 @@ static void EmitVertex(ShaderCode& out, const geometry_shader_uid_data* uid_data
|
||||
static void EndPrimitive(ShaderCode& out, const geometry_shader_uid_data* uid_data,
|
||||
API_TYPE ApiType);
|
||||
|
||||
ShaderCode GenerateGeometryShaderCode(u32 primitive_type, API_TYPE ApiType,
|
||||
const geometry_shader_uid_data* uid_data)
|
||||
ShaderCode GenerateGeometryShaderCode(API_TYPE ApiType, const geometry_shader_uid_data* uid_data)
|
||||
{
|
||||
ShaderCode out;
|
||||
// Non-uid template parameters will write to the dummy data (=> gets optimized out)
|
||||
|
||||
const unsigned int vertex_in = primitive_type + 1;
|
||||
unsigned int vertex_out = primitive_type == PRIMITIVE_TRIANGLES ? 3 : 4;
|
||||
const unsigned int vertex_in = uid_data->primitive_type + 1;
|
||||
unsigned int vertex_out = uid_data->primitive_type == PRIMITIVE_TRIANGLES ? 3 : 4;
|
||||
|
||||
if (uid_data->wireframe)
|
||||
vertex_out++;
|
||||
@ -59,14 +58,14 @@ ShaderCode GenerateGeometryShaderCode(u32 primitive_type, API_TYPE ApiType,
|
||||
// Insert layout parameters
|
||||
if (g_ActiveConfig.backend_info.bSupportsGSInstancing)
|
||||
{
|
||||
out.Write("layout(%s, invocations = %d) in;\n", primitives_ogl[primitive_type],
|
||||
out.Write("layout(%s, invocations = %d) in;\n", primitives_ogl[uid_data->primitive_type],
|
||||
uid_data->stereo ? 2 : 1);
|
||||
out.Write("layout(%s_strip, max_vertices = %d) out;\n",
|
||||
uid_data->wireframe ? "line" : "triangle", vertex_out);
|
||||
}
|
||||
else
|
||||
{
|
||||
out.Write("layout(%s) in;\n", primitives_ogl[primitive_type]);
|
||||
out.Write("layout(%s) in;\n", primitives_ogl[uid_data->primitive_type]);
|
||||
out.Write("layout(%s_strip, max_vertices = %d) out;\n",
|
||||
uid_data->wireframe ? "line" : "triangle",
|
||||
uid_data->stereo ? vertex_out * 2 : vertex_out);
|
||||
@ -130,21 +129,21 @@ ShaderCode GenerateGeometryShaderCode(u32 primitive_type, API_TYPE ApiType,
|
||||
out.Write("[maxvertexcount(%d)]\n[instance(%d)]\n", vertex_out, uid_data->stereo ? 2 : 1);
|
||||
out.Write("void main(%s VS_OUTPUT o[%d], inout %sStream<VertexData> output, in uint "
|
||||
"InstanceID : SV_GSInstanceID)\n{\n",
|
||||
primitives_d3d[primitive_type], vertex_in,
|
||||
primitives_d3d[uid_data->primitive_type], vertex_in,
|
||||
uid_data->wireframe ? "Line" : "Triangle");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.Write("[maxvertexcount(%d)]\n", uid_data->stereo ? vertex_out * 2 : vertex_out);
|
||||
out.Write("void main(%s VS_OUTPUT o[%d], inout %sStream<VertexData> output)\n{\n",
|
||||
primitives_d3d[primitive_type], vertex_in,
|
||||
primitives_d3d[uid_data->primitive_type], vertex_in,
|
||||
uid_data->wireframe ? "Line" : "Triangle");
|
||||
}
|
||||
|
||||
out.Write("\tVertexData ps;\n");
|
||||
}
|
||||
|
||||
if (primitive_type == PRIMITIVE_LINES)
|
||||
if (uid_data->primitive_type == PRIMITIVE_LINES)
|
||||
{
|
||||
if (ApiType == API_OPENGL)
|
||||
{
|
||||
@ -175,7 +174,7 @@ ShaderCode GenerateGeometryShaderCode(u32 primitive_type, API_TYPE ApiType,
|
||||
"\t\toffset = float2(0, -" I_LINEPTPARAMS ".z / " I_LINEPTPARAMS ".y);\n"
|
||||
"\t}\n");
|
||||
}
|
||||
else if (primitive_type == PRIMITIVE_POINTS)
|
||||
else if (uid_data->primitive_type == PRIMITIVE_POINTS)
|
||||
{
|
||||
if (ApiType == API_OPENGL)
|
||||
{
|
||||
@ -235,7 +234,7 @@ ShaderCode GenerateGeometryShaderCode(u32 primitive_type, API_TYPE ApiType,
|
||||
out.Write("\tf.pos.x += " I_STEREOPARAMS "[eye] * (f.pos.w - " I_STEREOPARAMS "[2]);\n");
|
||||
}
|
||||
|
||||
if (primitive_type == PRIMITIVE_LINES)
|
||||
if (uid_data->primitive_type == PRIMITIVE_LINES)
|
||||
{
|
||||
out.Write("\tVS_OUTPUT l = f;\n"
|
||||
"\tVS_OUTPUT r = f;\n");
|
||||
@ -256,7 +255,7 @@ ShaderCode GenerateGeometryShaderCode(u32 primitive_type, API_TYPE ApiType,
|
||||
EmitVertex(out, uid_data, "l", ApiType, true);
|
||||
EmitVertex(out, uid_data, "r", ApiType);
|
||||
}
|
||||
else if (primitive_type == PRIMITIVE_POINTS)
|
||||
else if (uid_data->primitive_type == PRIMITIVE_POINTS)
|
||||
{
|
||||
out.Write("\tVS_OUTPUT ll = f;\n"
|
||||
"\tVS_OUTPUT lr = f;\n"
|
||||
|
Reference in New Issue
Block a user