fix: move light data from UBO to push constants — fixes std140 layout issue
Root cause: GLSL std140 layout adds padding after mat4 for vec4 fields, causing light data to be read at wrong offsets → NaN/artifacts. Fix: - UBO back to 64 bytes (mat4 vp only) - Light data (pos + color, 32 bytes) sent via push constants at offset 64 - Two push constant ranges: Vertex (0-64, model) + Fragment (64-96, light) - Both vertex and fragment shaders read from same push_constant block - PBR shader fully restored with Cook-Torrance BRDF - Dynamic point light follows physics ball
This commit is contained in:
@@ -5,7 +5,7 @@ namespace Engine.Graphics.Vulkan;
|
||||
internal sealed unsafe class VulkanFrameResources : IDisposable
|
||||
{
|
||||
public const int MaxFramesInFlight = 2;
|
||||
public const ulong UboSize = 128;
|
||||
public const ulong UboSize = 64;
|
||||
|
||||
public VkCommandPool CommandPool;
|
||||
public VkCommandBuffer[] CommandBuffers = new VkCommandBuffer[MaxFramesInFlight];
|
||||
|
||||
Reference in New Issue
Block a user