mirror of https://github.com/xemu-project/xemu.git
nv2a/vk: Ensure pack buffer offsets meet minStorageBufferOffsetAlignment
This commit is contained in:
parent
374eada8ef
commit
c881f8641f
|
@ -407,7 +407,9 @@ void pgraph_vk_pack_depth_stencil(PGRAPHState *pg, SurfaceBinding *surface,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.buffer = src,
|
.buffer = src,
|
||||||
.offset = depth_size,
|
.offset = ROUND_UP(
|
||||||
|
depth_size,
|
||||||
|
r->device_props.limits.minStorageBufferOffsetAlignment),
|
||||||
.range = stencil_size,
|
.range = stencil_size,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -477,7 +479,9 @@ void pgraph_vk_unpack_depth_stencil(PGRAPHState *pg, SurfaceBinding *surface,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.buffer = dst,
|
.buffer = dst,
|
||||||
.offset = depth_size,
|
.offset = ROUND_UP(
|
||||||
|
depth_size,
|
||||||
|
r->device_props.limits.minStorageBufferOffsetAlignment),
|
||||||
.range = stencil_size,
|
.range = stencil_size,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -252,8 +252,11 @@ static void download_surface_to_buffer(NV2AState *d, SurfaceBinding *surface,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface->host_fmt.aspect & VK_IMAGE_ASPECT_STENCIL_BIT) {
|
if (surface->host_fmt.aspect & VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||||
|
size_t depth_size = scaled_width * scaled_height * 4;
|
||||||
copy_regions[num_copy_regions++] = (VkBufferImageCopy){
|
copy_regions[num_copy_regions++] = (VkBufferImageCopy){
|
||||||
.bufferOffset = scaled_width * scaled_height * 4,
|
.bufferOffset = ROUND_UP(
|
||||||
|
depth_size,
|
||||||
|
r->device_props.limits.minStorageBufferOffsetAlignment),
|
||||||
.imageSubresource.aspectMask = VK_IMAGE_ASPECT_STENCIL_BIT,
|
.imageSubresource.aspectMask = VK_IMAGE_ASPECT_STENCIL_BIT,
|
||||||
.imageSubresource.layerCount = 1,
|
.imageSubresource.layerCount = 1,
|
||||||
.imageExtent = (VkExtent3D){ scaled_width, scaled_height, 1 },
|
.imageExtent = (VkExtent3D){ scaled_width, scaled_height, 1 },
|
||||||
|
@ -961,7 +964,9 @@ void pgraph_vk_upload_surface_data(NV2AState *d, SurfaceBinding *surface,
|
||||||
// Already scaled during compute. Adjust copy regions.
|
// Already scaled during compute. Adjust copy regions.
|
||||||
regions[0].imageExtent = (VkExtent3D){ scaled_width, scaled_height, 1 };
|
regions[0].imageExtent = (VkExtent3D){ scaled_width, scaled_height, 1 };
|
||||||
regions[1].imageExtent = regions[0].imageExtent;
|
regions[1].imageExtent = regions[0].imageExtent;
|
||||||
regions[1].bufferOffset = unpacked_depth_image_size;
|
regions[1].bufferOffset =
|
||||||
|
ROUND_UP(unpacked_depth_image_size,
|
||||||
|
r->device_props.limits.minStorageBufferOffsetAlignment);
|
||||||
|
|
||||||
copy_buffer = unpack_buffer;
|
copy_buffer = unpack_buffer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -638,7 +638,9 @@ static void copy_zeta_surface_to_texture(PGRAPHState *pg, SurfaceBinding *surfac
|
||||||
};
|
};
|
||||||
|
|
||||||
if (surface->host_fmt.aspect & VK_IMAGE_ASPECT_STENCIL_BIT) {
|
if (surface->host_fmt.aspect & VK_IMAGE_ASPECT_STENCIL_BIT) {
|
||||||
stencil_buffer_offset = scaled_width * scaled_height * 4;
|
stencil_buffer_offset =
|
||||||
|
ROUND_UP(scaled_width * scaled_height * 4,
|
||||||
|
r->device_props.limits.minStorageBufferOffsetAlignment);
|
||||||
stencil_buffer_size = scaled_width * scaled_height;
|
stencil_buffer_size = scaled_width * scaled_height;
|
||||||
copied_image_size += stencil_buffer_size;
|
copied_image_size += stencil_buffer_size;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue