From f6e0ae87fdfecbadb5c1e36c55d66a744187a3cd Mon Sep 17 00:00:00 2001 From: mchughalex <25671999+mchughalex@users.noreply.github.com> Date: Fri, 24 Jul 2026 21:49:05 +0100 Subject: [PATCH] render: declare copy-source usage on the readback source textures --- src/skate3_native_scene_gpu.cpp | 6 ++++++ src/skate3_native_scene_post.cpp | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/skate3_native_scene_gpu.cpp b/src/skate3_native_scene_gpu.cpp index 60cbd44..f2009df 100644 --- a/src/skate3_native_scene_gpu.cpp +++ b/src/skate3_native_scene_gpu.cpp @@ -3634,6 +3634,12 @@ bool EnsureShadowResources(const NativeGuestOutputRenderContext& context) { nrhi::TextureView** views[3] = {&g_r.shadow_srv_raw, &g_r.shadow_srv_mid, &g_r.shadow_srv_final}; for (int t = 0; t < 3; ++t) { + // The raw and final tiles are the shadow-dump readback sources, so + // those two also need copy-source usage; the intermediate is never + // copied and stays render-target only. + desc.usage = nrhi::kTextureUsageRenderTarget | + (t != 1 ? nrhi::kTextureUsageCopySource + : nrhi::kTextureUsageNone); *targets[t] = device->CreateTexture(desc); if (*targets[t] == nullptr) { REXLOG_ERROR("native-scene: shadow atlas creation failed"); diff --git a/src/skate3_native_scene_post.cpp b/src/skate3_native_scene_post.cpp index 1e7a9d0..cc81b89 100644 --- a/src/skate3_native_scene_post.cpp +++ b/src/skate3_native_scene_post.cpp @@ -488,7 +488,11 @@ bool ApplySsaoPass(const NativeGuestOutputRenderContext& context, td.height = RendererState::kOcclGridH; td.mip_levels = 1; td.format = nrhi::Format::kR32_FLOAT; - td.usage = nrhi::kTextureUsageRenderTarget; + // The grid is read back to the CPU every frame, so it must declare + // copy-source usage: the Vulkan backend only requests TRANSFER_SRC for + // textures that ask for it, and both the transition to the copy-source + // state and the copy itself are invalid without it. + td.usage = nrhi::kTextureUsageRenderTarget | nrhi::kTextureUsageCopySource; td.initial_state = nrhi::ResourceState::kRenderTarget; g_r.occl_tex = device->CreateTexture(td); nrhi::BufferDesc bd;