Clean up vertex inputs

Fixes #766
This commit is contained in:
Sascha Willems 2022-08-04 17:24:11 +02:00
parent 0f8a349f0c
commit 465c18862c
8 changed files with 4 additions and 12 deletions

View file

@ -2,8 +2,7 @@
layout (binding = 1) uniform sampler2D samplerColor; layout (binding = 1) uniform sampler2D samplerColor;
layout (location = 0) in vec2 inUV; layout (location = 0) in vec4 inPos;
layout (location = 1) in vec4 inPos;
layout (location = 0) out vec4 outFragColor; layout (location = 0) out vec4 outFragColor;

View file

@ -1,7 +1,6 @@
#version 450 #version 450
layout (location = 0) in vec3 inPos; layout (location = 0) in vec3 inPos;
layout (location = 1) in vec2 inUV;
layout (binding = 0) uniform UBO layout (binding = 0) uniform UBO
{ {
@ -10,12 +9,10 @@ layout (binding = 0) uniform UBO
mat4 model; mat4 model;
} ubo; } ubo;
layout (location = 0) out vec2 outUV; layout (location = 0) out vec4 outPos;
layout (location = 1) out vec4 outPos;
void main() void main()
{ {
outUV = inUV;
outPos = ubo.projection * ubo.view * ubo.model * vec4(inPos.xyz, 1.0); outPos = ubo.projection * ubo.view * ubo.model * vec4(inPos.xyz, 1.0);
gl_Position = outPos; gl_Position = outPos;
} }

View file

@ -5,8 +5,7 @@ SamplerState samplerColor : register(s1);
struct VSOutput struct VSOutput
{ {
[[vk::location(0)]] float2 UV : TEXCOORD0; [[vk::location(0)]] float4 ProjCoord : POSITION0;
[[vk::location(1)]] float4 ProjCoord : POSITION0;
}; };
float4 main(VSOutput input, bool FrontFacing : SV_IsFrontFace) : SV_TARGET float4 main(VSOutput input, bool FrontFacing : SV_IsFrontFace) : SV_TARGET

View file

@ -3,7 +3,6 @@
struct VSInput struct VSInput
{ {
[[vk::location(0)]] float3 Pos : POSITION0; [[vk::location(0)]] float3 Pos : POSITION0;
[[vk::location(1)]] float2 UV : TEXCOORD0;
}; };
struct UBO struct UBO
@ -18,14 +17,12 @@ cbuffer ubo : register(b0) { UBO ubo; }
struct VSOutput struct VSOutput
{ {
float4 Pos : SV_POSITION; float4 Pos : SV_POSITION;
[[vk::location(0)]] float2 UV : TEXCOORD0; [[vk::location(0)]] float4 ProjCoord : POSITION0;
[[vk::location(1)]] float4 ProjCoord : POSITION0;
}; };
VSOutput main(VSInput input) VSOutput main(VSInput input)
{ {
VSOutput output = (VSOutput)0; VSOutput output = (VSOutput)0;
output.UV = input.UV;
output.ProjCoord = mul(ubo.projection, mul(ubo.view, mul(ubo.model, float4(input.Pos.xyz, 1.0)))); output.ProjCoord = mul(ubo.projection, mul(ubo.view, mul(ubo.model, float4(input.Pos.xyz, 1.0))));
output.Pos = output.ProjCoord; output.Pos = output.ProjCoord;
return output; return output;