fix: rendering now works — three critical bugs fixed
1. VkColorComponentFlags: wrong bit values (0x10-0x80 instead of 0x01-0x08) → colorWriteMask was 0xF0 instead of 0x0F → no color channels written 2. VkClearValue: was Sequential layout instead of Explicit (union) → depthStencil clear value written at wrong offset → depth buffer cleared to 0.0 instead of 1.0 → all fragments failed depth test 3. Vulkan clip space correction in vertex shader: gl_Position.y = -gl_Position.y (Vulkan Y-down vs OpenGL Y-up) gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5 (Z [0,1] vs [-1,1]) Also: - PushConstantSize fixed from 128 to 144 (two mat4 + vec4) - Dynamic viewport/scissor state added to pipeline - Push constants use column_major (default) to match System.Numerics row-major layout - Camera.GetProjectionMatrix reverted to pure OpenGL-style (correction in shader) - Screenshots show actual 3D geometry (calibration cubes visible) - 66/66 tests pass
This commit is contained in:
@@ -4,7 +4,7 @@ layout(location = 0) in vec3 inPosition;
|
||||
layout(location = 1) in vec3 inColor;
|
||||
layout(location = 2) in vec3 inNormal;
|
||||
|
||||
layout(row_major, set = 0, binding = 0) uniform FrameUBO {
|
||||
layout(set = 0, binding = 0) uniform FrameUBO {
|
||||
vec3 cameraPosition;
|
||||
uint lightCount;
|
||||
vec3 ambientColor;
|
||||
@@ -27,6 +27,10 @@ void main() {
|
||||
vec4 worldPos = pc.model * vec4(inPosition, 1.0);
|
||||
gl_Position = pc.mvp * vec4(inPosition, 1.0);
|
||||
|
||||
// Vulkan clip space: Y-down, Z [0,1] — convert from OpenGL Y-up, Z [-1,1]
|
||||
gl_Position.y = -gl_Position.y;
|
||||
gl_Position.z = (gl_Position.z + gl_Position.w) * 0.5;
|
||||
|
||||
fragColor = inColor;
|
||||
fragNormal = normalize(mat3(pc.model) * inNormal);
|
||||
fragWorldPos = worldPos.xyz;
|
||||
|
||||
Reference in New Issue
Block a user