aboutsummaryrefslogtreecommitdiff
path: root/adapters/fparkan-render-vulkan/src/ffi/resources.rs
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/fparkan-render-vulkan/src/ffi/resources.rs')
-rw-r--r--adapters/fparkan-render-vulkan/src/ffi/resources.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/adapters/fparkan-render-vulkan/src/ffi/resources.rs b/adapters/fparkan-render-vulkan/src/ffi/resources.rs
index fe71d12..449750f 100644
--- a/adapters/fparkan-render-vulkan/src/ffi/resources.rs
+++ b/adapters/fparkan-render-vulkan/src/ffi/resources.rs
@@ -528,7 +528,7 @@ pub(super) fn create_static_texture_image(
})
}
-/// Allocates two aligned camera slots used by the dynamic frame UBO.
+/// Allocates a main and reflected view slot for each in-flight frame.
pub(super) fn create_frame_uniform_buffer(
instance: &VulkanInstanceProbe,
device: &VulkanLogicalDeviceProbe,
@@ -545,7 +545,7 @@ pub(super) fn create_frame_uniform_buffer(
)? / alignment
* alignment;
let size = stride
- .checked_mul(super::VULKAN_FRAME_SLOT_COUNT as u64)
+ .checked_mul(2 * super::VULKAN_FRAME_SLOT_COUNT as u64)
.ok_or(VulkanSmokeRendererError::InvalidStaticMesh {
context: "frame uniform buffer size overflow",
})?;
@@ -687,12 +687,13 @@ pub(super) fn encode_point_lights(
.chain(light.rgb)
.chain([if light.active { 1.0 } else { 0.0 }])
.chain(light.coefficients)
- .chain([if light.active { 1.0 } else { 0.0 }])
{
bytes[offset..offset + std::mem::size_of::<f32>()]
.copy_from_slice(&value.to_ne_bytes());
offset += std::mem::size_of::<f32>();
}
+ bytes[offset..offset + 4].copy_from_slice(&light.owner_scope.to_ne_bytes());
+ offset += 4;
}
debug_assert_eq!(offset, total);
Ok(bytes)
@@ -888,7 +889,7 @@ pub(super) fn write_frame_uniform(
.ok_or(VulkanSmokeRendererError::InvariantViolation {
context: "frame uniform slot offset",
})?;
- // SAFETY: The offset is one of the two allocated aligned slots and the
+ // SAFETY: The caller supplies an allocated, fence-safe main or reflection slot; the
// mapped range is exactly one complete frame block.
let mapped = unsafe {
device.device().map_memory(
@@ -1385,7 +1386,7 @@ fn create_host_visible_buffer(
Ok(VulkanAllocatedBuffer { buffer, memory })
}
-fn find_memory_type(
+pub(super) fn find_memory_type(
instance: &VulkanInstanceProbe,
physical_device: vk::PhysicalDevice,
type_bits: u32,