Files
2026-07-12 13:49:26 +01:00

2.0 KiB

Session Log — 2026-07-12

RHI Global Context Refactor

Reviewed the user's staged changes to the Vulkan RHI backend. The changes encompassed:

Global Context Adoption

  • RHI functions no longer take allocator parameters
  • _G_RHI_CONTEXT provides allocator (user-facing objects) and tmp (short-lived temporaries)
  • prRhiInit(void) / prRhiDestroy(void) manage the global context

KTX Texture Bug Fix

  • Original implementation only copied mip level 0
  • Fixed to iterate all mip levels using ktxTexture_GetImageOffset()
  • Final layout changed from VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL to VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL

Frame-by-Frame Command Batching Pattern

  • Commands that run every frame avoid arena allocation
  • Use stack arrays with while-loop to batch operations in fixed-size chunks
  • Applied to: prRhiCmdBindDescriptorSets, prRhiCmdBindVertexBuffers, prRhiCmdCopyBufferToImage

API Simplifications

  • prRhiCreateCommandPool: removed desc parameter, uses device->queue_family_index
  • prRhiFreeCommandBuffers: removed count parameter, uses wpArrayCount
  • prRhiAllocateDescriptorSet: changed u32 variable_count to WpU32Array variable_descriptor_counts
  • prRhiCmdBindVertexBuffers: changed raw pointer + count to WpU64Array

New Pipeline Configuration

  • Added polygon_mode, cull_mode, front_face to rasterization
  • Added depth_test_enable, depth_write_enable, depth_compare_op
  • Added vertex_shader_entry_point, fragment_shader_entry_point (not hardcoded to "main")
  • Added line_width, multisample_count

Code Style Updates

  • All Vulkan info structs use C99 designated initializers
  • Removed unnecessary type casts on opaque struct handles
  • Added braces to all single-line if statements
  • Braces rule moved from prism-rhi skill to AGENTS.md formatting section

Documentation Updates

  • Updated prism-rhi skill with all new conventions
  • Updated AGENTS.md with frame-by-frame batching pattern
  • Moved braces rule to AGENTS.md (not RHI-specific)