more fixes
Some checks failed
Clang Format / clang-format (push) Has been cancelled

This commit is contained in:
IndecisiveTurtle 2024-09-22 01:40:25 +03:00
parent f98a73b360
commit bf1660869e
2 changed files with 3 additions and 5 deletions

View file

@ -181,6 +181,7 @@ Id EmitImageQueryDimensions(EmitContext& ctx, IR::Inst* inst, u32 handle, Id lod
case AmdGpu::ImageType::Color1DArray:
case AmdGpu::ImageType::Color2D:
case AmdGpu::ImageType::Cube:
case AmdGpu::ImageType::Color2DMsaa:
return ctx.OpCompositeConstruct(ctx.U32[4], query(ctx.U32[2]), zero, mips());
case AmdGpu::ImageType::Color2DArray:
case AmdGpu::ImageType::Color3D:

View file

@ -584,15 +584,13 @@ bool BufferCache::SynchronizeBufferFromImage(Buffer& buffer, VAddr device_addr,
if (False(image.flags & ImageFlagBits::GpuModified)) {
return false;
}
LOG_INFO(Render_Vulkan, "Copying image with size {:#x}, max_size {:#x}",
image.info.guest_size_bytes, size);
ASSERT_MSG(device_addr == image.info.guest_address,
"Texel buffer aliases image subresources {:x} : {:x}", device_addr,
image.info.guest_address);
boost::container::small_vector<vk::BufferImageCopy, 8> copies;
u32 offset = buffer.Offset(image.cpu_addr);
const u32 num_layers = image.info.resources.layers;
u32 total_size = 0;
const u32 max_offset = offset + size;
for (u32 m = 0; m < image.info.resources.levels; m++) {
const u32 width = std::max(image.info.size.width >> m, 1u);
const u32 height = std::max(image.info.size.height >> m, 1u);
@ -600,7 +598,7 @@ bool BufferCache::SynchronizeBufferFromImage(Buffer& buffer, VAddr device_addr,
image.info.props.is_volume ? std::max(image.info.size.depth >> m, 1u) : 1u;
const auto& [mip_size, mip_pitch, mip_height, mip_ofs] = image.info.mips_layout[m];
offset += mip_ofs * num_layers;
if (offset + (mip_size * num_layers) > buffer.SizeBytes()) {
if (offset + (mip_size * num_layers) > max_offset) {
break;
}
copies.push_back({
@ -616,7 +614,6 @@ bool BufferCache::SynchronizeBufferFromImage(Buffer& buffer, VAddr device_addr,
.imageOffset = {0, 0, 0},
.imageExtent = {width, height, depth},
});
total_size += mip_size * num_layers;
}
if (!copies.empty()) {
scheduler.EndRendering();