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:
@@ -475,7 +475,7 @@ public sealed unsafe class VulkanRenderer : IRenderer, IScreenshotProvider
|
||||
};
|
||||
Vk.vkCmdSetScissor(cmd, 0, 1, &scissor);
|
||||
|
||||
VkDescriptorSet ds = _descriptorSets[_currentFrame];
|
||||
var ds = _descriptorSets[_currentFrame];
|
||||
Vk.vkCmdBindDescriptorSets(cmd, 0, _pipeline.PipelineLayout, 0, 1, &ds, 0, null);
|
||||
|
||||
world.Each((Entity e, ref Transform transform, ref Mesh mesh, ref Material material) =>
|
||||
@@ -502,7 +502,7 @@ public sealed unsafe class VulkanRenderer : IRenderer, IScreenshotProvider
|
||||
proj = cam.GetProjectionMatrix();
|
||||
});
|
||||
|
||||
var mvp = model * view * proj;
|
||||
var mvp = proj * view * model;
|
||||
|
||||
var pushData = new byte[VulkanPipeline.PushConstantSize];
|
||||
fixed (byte* pPush = pushData)
|
||||
|
||||
Reference in New Issue
Block a user