render: declare copy-source usage on the readback source textures
This commit is contained in:
parent
d1a3e3d255
commit
f6e0ae87fd
2 changed files with 11 additions and 1 deletions
|
|
@ -3634,6 +3634,12 @@ bool EnsureShadowResources(const NativeGuestOutputRenderContext& context) {
|
||||||
nrhi::TextureView** views[3] = {&g_r.shadow_srv_raw, &g_r.shadow_srv_mid,
|
nrhi::TextureView** views[3] = {&g_r.shadow_srv_raw, &g_r.shadow_srv_mid,
|
||||||
&g_r.shadow_srv_final};
|
&g_r.shadow_srv_final};
|
||||||
for (int t = 0; t < 3; ++t) {
|
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);
|
*targets[t] = device->CreateTexture(desc);
|
||||||
if (*targets[t] == nullptr) {
|
if (*targets[t] == nullptr) {
|
||||||
REXLOG_ERROR("native-scene: shadow atlas creation failed");
|
REXLOG_ERROR("native-scene: shadow atlas creation failed");
|
||||||
|
|
|
||||||
|
|
@ -488,7 +488,11 @@ bool ApplySsaoPass(const NativeGuestOutputRenderContext& context,
|
||||||
td.height = RendererState::kOcclGridH;
|
td.height = RendererState::kOcclGridH;
|
||||||
td.mip_levels = 1;
|
td.mip_levels = 1;
|
||||||
td.format = nrhi::Format::kR32_FLOAT;
|
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;
|
td.initial_state = nrhi::ResourceState::kRenderTarget;
|
||||||
g_r.occl_tex = device->CreateTexture(td);
|
g_r.occl_tex = device->CreateTexture(td);
|
||||||
nrhi::BufferDesc bd;
|
nrhi::BufferDesc bd;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue