Vulkan: Fix incorrect geometry shader input/output usage

This commit is contained in:
Stenzek 2016-10-23 22:12:28 +10:00
parent 5250f3c6a4
commit 70eb904536
1 changed files with 18 additions and 30 deletions

View File

@ -899,12 +899,12 @@ bool operator<(const SamplerState& lhs, const SamplerState& rhs)
bool ObjectCache::CompileSharedShaders() bool ObjectCache::CompileSharedShaders()
{ {
static const char PASSTHROUGH_VERTEX_SHADER_SOURCE[] = R"( static const char PASSTHROUGH_VERTEX_SHADER_SOURCE[] = R"(
layout(location = 0) in float4 ipos; layout(location = 0) in vec4 ipos;
layout(location = 5) in float4 icol0; layout(location = 5) in vec4 icol0;
layout(location = 8) in float3 itex0; layout(location = 8) in vec3 itex0;
layout(location = 0) out float3 uv0; layout(location = 0) out vec3 uv0;
layout(location = 1) out float4 col0; layout(location = 1) out vec4 col0;
void main() void main()
{ {
@ -918,17 +918,11 @@ bool ObjectCache::CompileSharedShaders()
layout(triangles) in; layout(triangles) in;
layout(triangle_strip, max_vertices = EFB_LAYERS * 3) out; layout(triangle_strip, max_vertices = EFB_LAYERS * 3) out;
in VertexData layout(location = 0) in vec3 in_uv0[];
{ layout(location = 1) in vec4 in_col0[];
float3 uv0;
float4 col0;
} in_data[];
out VertexData layout(location = 0) out vec3 out_uv0;
{ layout(location = 1) out vec4 out_col0;
float3 uv0;
float4 col0;
} out_data;
void main() void main()
{ {
@ -938,8 +932,8 @@ bool ObjectCache::CompileSharedShaders()
{ {
gl_Layer = j; gl_Layer = j;
gl_Position = gl_in[i].gl_Position; gl_Position = gl_in[i].gl_Position;
out_data.uv0 = float3(in_data[i].uv0.xy, float(j)); out_uv0 = vec3(in_uv0[i].xy, float(j));
out_data.col0 = in_data[i].col0; out_col0 = in_col0[i];
EmitVertex(); EmitVertex();
} }
EndPrimitive(); EndPrimitive();
@ -948,7 +942,7 @@ bool ObjectCache::CompileSharedShaders()
)"; )";
static const char SCREEN_QUAD_VERTEX_SHADER_SOURCE[] = R"( static const char SCREEN_QUAD_VERTEX_SHADER_SOURCE[] = R"(
layout(location = 0) out float3 uv0; layout(location = 0) out vec3 uv0;
void main() void main()
{ {
@ -959,9 +953,9 @@ bool ObjectCache::CompileSharedShaders()
* 2 0,2 0,1 -1,1 BL * 2 0,2 0,1 -1,1 BL
* 3 1,2 1,1 1,1 BR * 3 1,2 1,1 1,1 BR
*/ */
vec2 rawpos = float2(float(gl_VertexID & 1), clamp(float(gl_VertexID & 2), 0.0f, 1.0f)); vec2 rawpos = vec2(float(gl_VertexID & 1), clamp(float(gl_VertexID & 2), 0.0f, 1.0f));
gl_Position = float4(rawpos * 2.0f - 1.0f, 0.0f, 1.0f); gl_Position = vec4(rawpos * 2.0f - 1.0f, 0.0f, 1.0f);
uv0 = float3(rawpos, 0.0f); uv0 = vec3(rawpos, 0.0f);
} }
)"; )";
@ -969,15 +963,9 @@ bool ObjectCache::CompileSharedShaders()
layout(triangles) in; layout(triangles) in;
layout(triangle_strip, max_vertices = EFB_LAYERS * 3) out; layout(triangle_strip, max_vertices = EFB_LAYERS * 3) out;
in VertexData layout(location = 0) in vec3 in_uv0[];
{
float3 uv0;
} in_data[];
out VertexData layout(location = 0) out vec3 out_uv0;
{
float3 uv0;
} out_data;
void main() void main()
{ {
@ -987,7 +975,7 @@ bool ObjectCache::CompileSharedShaders()
{ {
gl_Layer = j; gl_Layer = j;
gl_Position = gl_in[i].gl_Position; gl_Position = gl_in[i].gl_Position;
out_data.uv0 = float3(in_data[i].uv0.xy, float(j)); out_uv0 = vec3(in_uv0[i].xy, float(j));
EmitVertex(); EmitVertex();
} }
EndPrimitive(); EndPrimitive();