Skip to content

Commit

Permalink
vkd3d: Validate against ID3D12Heap desc, not allocation.
Browse files Browse the repository at this point in the history
Signed-off-by: Hans-Kristian Arntzen <[email protected]>
  • Loading branch information
HansKristian-Work committed Nov 27, 2024
1 parent 4fd7d3a commit 28876e0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libs/vkd3d/resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -3955,10 +3955,10 @@ HRESULT d3d12_resource_create_placed(struct d3d12_device *device, const D3D12_RE

heap_offset = align(heap->allocation.offset + heap_offset, memory_requirements.alignment) - heap->allocation.offset;

if (heap_offset + memory_requirements.size > heap->allocation.resource.size)
if (heap_offset + memory_requirements.size > heap->desc.SizeInBytes)
{
ERR("Heap too small for the texture (heap=%"PRIu64", res=%"PRIu64".\n",
heap->allocation.resource.size, heap_offset + memory_requirements.size);
heap->desc.SizeInBytes, heap_offset + memory_requirements.size);
hr = E_INVALIDARG;
goto fail;
}
Expand Down Expand Up @@ -3989,10 +3989,10 @@ HRESULT d3d12_resource_create_placed(struct d3d12_device *device, const D3D12_RE
}
else
{
if (heap_offset + desc->Width > heap->allocation.resource.size)
if (heap_offset + desc->Width > heap->desc.SizeInBytes)
{
ERR("Heap too small for the buffer (heap=%"PRIu64", res=%"PRIu64".\n",
heap->allocation.resource.size, heap_offset + desc->Width);
heap->desc.SizeInBytes, heap_offset + desc->Width);
hr = E_INVALIDARG;
goto fail;
}
Expand Down

0 comments on commit 28876e0

Please sign in to comment.