Sponza repeats the albedo's format for its heap view; ImageVulkan does not keep its view create-info #176

Open
opened 2026-10-31 14:57:58 +00:00 by jorijnvdgraaf · 0 comments

Summary

examples/Sponza/main.cpp:178 builds the view create-info for the albedo's heap descriptor with VK_FORMAT_R8G8B8A8_UNORM, repeating the format passed to albedo.Create at :145. It has to, because ImageVulkan neither stores its format nor keeps the view create-info it builds (interfaces/Crafter.Graphics-ImageVulkan.cppm:149). Changing :145 to VK_FORMAT_R8G8B8A8_SRGB for correct albedo gamma without also changing :178 makes the descriptor write invalid. ImageVulkan::Create never sets MUTABLE_FORMAT, so a view must use the image's own format (VUID-VkImageViewCreateInfo-image-12397). Before 6e94cc6, Sponza used albedo.imageView, derived from the single format.

ImageVulkan::imageView and descriptor (:69-70) are no longer read anywhere. Separately, Create's VkImageCreateFlags flags parameter is written to imageInfo.usage (:121): it is a usage mask under the wrong name and type.

Line numbers refer to 6e94cc6.

Suggested fix

Keep the VkImageViewCreateInfo on ImageVulkan in place of the unread imageView and descriptor, so a heap write passes .pView = &albedo.viewInfo, and rename the parameter to the usage it is.

Found in a code review of the #163 change.

## Summary `examples/Sponza/main.cpp:178` builds the view create-info for the albedo's heap descriptor with `VK_FORMAT_R8G8B8A8_UNORM`, repeating the format passed to `albedo.Create` at `:145`. It has to, because `ImageVulkan` neither stores its format nor keeps the view create-info it builds (`interfaces/Crafter.Graphics-ImageVulkan.cppm:149`). Changing `:145` to `VK_FORMAT_R8G8B8A8_SRGB` for correct albedo gamma without also changing `:178` makes the descriptor write invalid. `ImageVulkan::Create` never sets `MUTABLE_FORMAT`, so a view must use the image's own format (VUID-VkImageViewCreateInfo-image-12397). Before `6e94cc6`, Sponza used `albedo.imageView`, derived from the single format. `ImageVulkan::imageView` and `descriptor` (`:69-70`) are no longer read anywhere. Separately, `Create`'s `VkImageCreateFlags flags` parameter is written to `imageInfo.usage` (`:121`): it is a usage mask under the wrong name and type. Line numbers refer to `6e94cc6`. ## Suggested fix Keep the `VkImageViewCreateInfo` on `ImageVulkan` in place of the unread `imageView` and `descriptor`, so a heap write passes `.pView = &albedo.viewInfo`, and rename the parameter to the usage it is. Found in a code review of the #163 change.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Catcrafts/Crafter.Graphics#176
No description provided.