Image subresources barriers (#904)

* video_core: texture: image subresources state tracking

* shader_recompiler: use one binding if the same image is read and written

* video_core: added rebinding of changed textures after overlap resolve

* don't use pointers; slight `FindTexture` refactoring

* video_core: buffer_cache: don't copy over the image size

* redundant barriers removed; fixes

* regression fixes

* texture_cache: 3d texture layers count fixup

* shader_recompiler: support for partially bound cubemaps

* added support for cubemap arrays

* don't bind unused color buffers

* fixed depth promotion to do not use stencil

* doors

* bonfire lit

* cubemap array index calculation

* final touches
This commit is contained in:
psucien 2024-09-21 21:45:56 +02:00 committed by GitHub
parent 913a46173a
commit 5f4ddc14fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 495 additions and 283 deletions

View file

@ -157,8 +157,11 @@ Id EmitImageFetch(EmitContext& ctx, IR::Inst* inst, u32 handle, Id coords, const
ImageOperands operands;
operands.AddOffset(ctx, offset);
operands.Add(spv::ImageOperandsMask::Lod, lod);
return ctx.OpBitcast(
ctx.F32[4], ctx.OpImageFetch(result_type, image, coords, operands.mask, operands.operands));
const Id texel =
texture.is_storage
? ctx.OpImageRead(result_type, image, coords, operands.mask, operands.operands)
: ctx.OpImageFetch(result_type, image, coords, operands.mask, operands.operands);
return ctx.OpBitcast(ctx.F32[4], texel);
}
Id EmitImageQueryDimensions(EmitContext& ctx, IR::Inst* inst, u32 handle, Id lod, bool skip_mips) {

View file

@ -510,7 +510,8 @@ Id ImageType(EmitContext& ctx, const ImageResource& desc, Id sampled_type) {
case AmdGpu::ImageType::Color3D:
return ctx.TypeImage(sampled_type, spv::Dim::Dim3D, false, false, false, sampled, format);
case AmdGpu::ImageType::Cube:
return ctx.TypeImage(sampled_type, spv::Dim::Cube, false, false, false, sampled, format);
return ctx.TypeImage(sampled_type, spv::Dim::Cube, false, desc.is_array, false, sampled,
format);
default:
break;
}
@ -534,6 +535,7 @@ void EmitContext::DefineImagesAndSamplers() {
.sampled_type = image_desc.is_storage ? sampled_type : TypeSampledImage(image_type),
.pointer_type = pointer_type,
.image_type = image_type,
.is_storage = image_desc.is_storage,
});
interfaces.push_back(id);
++binding;

View file

@ -200,6 +200,7 @@ public:
Id sampled_type;
Id pointer_type;
Id image_type;
bool is_storage = false;
};
struct BufferDefinition {
@ -216,8 +217,8 @@ public:
u32 binding;
Id image_type;
Id result_type;
bool is_integer;
bool is_storage;
bool is_integer = false;
bool is_storage = false;
};
u32& binding;