mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
Merge pull request #11436 from liamwhite/bad-format
shader_recompiler: always declare image format for image buffers
This commit is contained in:
commit
5b8fdedf4d
1 changed files with 6 additions and 1 deletions
|
@ -74,6 +74,11 @@ spv::ImageFormat GetImageFormat(ImageFormat format) {
|
||||||
throw InvalidArgument("Invalid image format {}", format);
|
throw InvalidArgument("Invalid image format {}", format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spv::ImageFormat GetImageFormatForBuffer(ImageFormat format) {
|
||||||
|
const auto spv_format = GetImageFormat(format);
|
||||||
|
return spv_format == spv::ImageFormat::Unknown ? spv::ImageFormat::R32ui : spv_format;
|
||||||
|
}
|
||||||
|
|
||||||
Id ImageType(EmitContext& ctx, const ImageDescriptor& desc) {
|
Id ImageType(EmitContext& ctx, const ImageDescriptor& desc) {
|
||||||
const spv::ImageFormat format{GetImageFormat(desc.format)};
|
const spv::ImageFormat format{GetImageFormat(desc.format)};
|
||||||
const Id type{ctx.U32[1]};
|
const Id type{ctx.U32[1]};
|
||||||
|
@ -1271,7 +1276,7 @@ void EmitContext::DefineImageBuffers(const Info& info, u32& binding) {
|
||||||
if (desc.count != 1) {
|
if (desc.count != 1) {
|
||||||
throw NotImplementedException("Array of image buffers");
|
throw NotImplementedException("Array of image buffers");
|
||||||
}
|
}
|
||||||
const spv::ImageFormat format{GetImageFormat(desc.format)};
|
const spv::ImageFormat format{GetImageFormatForBuffer(desc.format)};
|
||||||
const Id image_type{TypeImage(U32[1], spv::Dim::Buffer, false, false, false, 2, format)};
|
const Id image_type{TypeImage(U32[1], spv::Dim::Buffer, false, false, false, 2, format)};
|
||||||
const Id pointer_type{TypePointer(spv::StorageClass::UniformConstant, image_type)};
|
const Id pointer_type{TypePointer(spv::StorageClass::UniformConstant, image_type)};
|
||||||
const Id id{AddGlobalVariable(pointer_type, spv::StorageClass::UniformConstant)};
|
const Id id{AddGlobalVariable(pointer_type, spv::StorageClass::UniformConstant)};
|
||||||
|
|
Loading…
Reference in a new issue