Few minor fixes.

This commit is contained in:
squidbus 2024-12-03 07:32:09 -08:00
parent eda3629114
commit 063dc4afe3
3 changed files with 12 additions and 3 deletions

View File

@ -660,7 +660,7 @@ spv::ImageFormat GetFormat(const AmdGpu::Image& image) {
} }
Id ImageType(EmitContext& ctx, const ImageResource& desc, Id sampled_type) { Id ImageType(EmitContext& ctx, const ImageResource& desc, Id sampled_type) {
const auto image = ctx.info.ReadUdSharp<AmdGpu::Image>(desc.sharp_idx); const auto image = desc.GetSharp(ctx.info);
const auto format = desc.is_atomic ? GetFormat(image) : spv::ImageFormat::Unknown; const auto format = desc.is_atomic ? GetFormat(image) : spv::ImageFormat::Unknown;
const auto type = image.GetBoundType(); const auto type = image.GetBoundType();
const u32 sampled = desc.is_storage ? 2 : 1; const u32 sampled = desc.is_storage ? 2 : 1;

View File

@ -281,7 +281,12 @@ constexpr AmdGpu::Buffer TextureBufferResource::GetSharp(const Info& info) const
} }
constexpr AmdGpu::Image ImageResource::GetSharp(const Info& info) const noexcept { constexpr AmdGpu::Image ImageResource::GetSharp(const Info& info) const noexcept {
return info.ReadUdSharp<AmdGpu::Image>(sharp_idx); const auto image = info.ReadUdSharp<AmdGpu::Image>(sharp_idx);
if (!image.Valid()) {
// Fall back to null image if unbound.
return AmdGpu::Image::Null();
}
return image;
} }
constexpr AmdGpu::Sampler SamplerResource::GetSharp(const Info& info) const noexcept { constexpr AmdGpu::Sampler SamplerResource::GetSharp(const Info& info) const noexcept {

View File

@ -304,8 +304,12 @@ bool PipelineCache::RefreshGraphicsKey() {
} }
auto params = Liverpool::GetParams(*pgm); auto params = Liverpool::GetParams(*pgm);
std::tie(infos[stage_out_idx], modules[stage_out_idx], fetch_shader, std::optional<Shader::Gcn::FetchShaderData> fetch_shader_;
std::tie(infos[stage_out_idx], modules[stage_out_idx], fetch_shader_,
key.stage_hashes[stage_out_idx]) = GetProgram(stage_in, params, binding); key.stage_hashes[stage_out_idx]) = GetProgram(stage_in, params, binding);
if (fetch_shader_) {
fetch_shader = fetch_shader_;
}
return true; return true;
}; };