more download fixes
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
953be4225c
commit
23aed89ad9
|
@ -2086,8 +2086,8 @@ static void D3D11_DownloadFromTexture(
|
||||||
d3d11Texture->levelCount
|
d3d11Texture->levelCount
|
||||||
);
|
);
|
||||||
int32_t formatSize = Texture_GetFormatSize(d3d11Texture->format);
|
int32_t formatSize = Texture_GetFormatSize(d3d11Texture->format);
|
||||||
uint32_t bufferStride = copyParams->bufferStride;
|
uint32_t bufferStride = copyParams->bufferStride == 0 ? (textureRegion->w * formatSize) : copyParams->bufferStride;
|
||||||
uint32_t bufferImageHeight = copyParams->bufferImageHeight;
|
uint32_t bufferImageHeight = copyParams->bufferImageHeight == 0 ? (textureRegion->h * formatSize) : copyParams->bufferImageHeight;
|
||||||
D3D11_BOX srcBox = {textureRegion->x, textureRegion->y, textureRegion->z, textureRegion->x + textureRegion->w, textureRegion->y + textureRegion->h, 1};
|
D3D11_BOX srcBox = {textureRegion->x, textureRegion->y, textureRegion->z, textureRegion->x + textureRegion->w, textureRegion->y + textureRegion->h, 1};
|
||||||
D3D11_MAPPED_SUBRESOURCE subresource;
|
D3D11_MAPPED_SUBRESOURCE subresource;
|
||||||
HRESULT res;
|
HRESULT res;
|
||||||
|
@ -2130,7 +2130,7 @@ static void D3D11_DownloadFromTexture(
|
||||||
renderer->immediateContext,
|
renderer->immediateContext,
|
||||||
stagingTexture,
|
stagingTexture,
|
||||||
0,
|
0,
|
||||||
copyParams->bufferOffset,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
d3d11Texture->handle,
|
d3d11Texture->handle,
|
||||||
|
@ -2142,43 +2142,23 @@ static void D3D11_DownloadFromTexture(
|
||||||
res = ID3D11DeviceContext_Map(
|
res = ID3D11DeviceContext_Map(
|
||||||
renderer->immediateContext,
|
renderer->immediateContext,
|
||||||
stagingTexture,
|
stagingTexture,
|
||||||
subresourceIndex,
|
0,
|
||||||
D3D11_MAP_READ,
|
D3D11_MAP_READ,
|
||||||
0,
|
0,
|
||||||
&subresource
|
&subresource
|
||||||
);
|
);
|
||||||
ERROR_CHECK_RETURN("Could not map texture for reading",)
|
ERROR_CHECK_RETURN("Could not map texture for reading",)
|
||||||
|
|
||||||
if (bufferStride == 0)
|
|
||||||
{
|
|
||||||
bufferStride = BytesPerRow(textureRegion->w, d3d11Texture->format);
|
|
||||||
}
|
|
||||||
if (bufferImageHeight == 0)
|
|
||||||
{
|
|
||||||
bufferImageHeight = textureRegion->h;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t* dataPtr = (uint8_t*) d3d11TransferBuffer->data + copyParams->bufferOffset;
|
uint8_t* dataPtr = (uint8_t*) d3d11TransferBuffer->data + copyParams->bufferOffset;
|
||||||
|
|
||||||
if (bufferStride == 0 && bufferImageHeight == 0) // assume tightly packed
|
for (uint32_t row = textureRegion->y; row < textureRegion->h; row += 1)
|
||||||
{
|
{
|
||||||
SDL_memcpy(
|
SDL_memcpy(
|
||||||
dataPtr,
|
dataPtr,
|
||||||
(uint8_t *)subresource.pData,
|
(uint8_t*) subresource.pData + (row * subresource.RowPitch) + (textureRegion->x * formatSize),
|
||||||
BytesPerImage(textureRegion->w, textureRegion->h, d3d11Texture->format)
|
bufferStride
|
||||||
);
|
);
|
||||||
}
|
dataPtr += bufferStride;
|
||||||
else
|
|
||||||
{
|
|
||||||
for (uint32_t row = textureRegion->y; row < bufferImageHeight; row += 1)
|
|
||||||
{
|
|
||||||
SDL_memcpy(
|
|
||||||
dataPtr,
|
|
||||||
(uint8_t*) subresource.pData + (row * bufferStride) + (textureRegion->x * formatSize),
|
|
||||||
textureRegion->w * formatSize
|
|
||||||
);
|
|
||||||
dataPtr += textureRegion->w * formatSize;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ID3D11DeviceContext1_Unmap(
|
ID3D11DeviceContext1_Unmap(
|
||||||
|
|
|
@ -10212,6 +10212,8 @@ static void VULKAN_DownloadFromTexture(
|
||||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&textureRegion->textureSlice);
|
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&textureRegion->textureSlice);
|
||||||
Refresh_Fence *fence;
|
Refresh_Fence *fence;
|
||||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) VULKAN_AcquireCommandBuffer(driverData);
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) VULKAN_AcquireCommandBuffer(driverData);
|
||||||
|
VulkanResourceAccessType originalTextureSliceAccessType;
|
||||||
|
VulkanResourceAccessType originalBufferAccessType;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
transferOption == REFRESH_TRANSFEROPTIONS_SAFEDISCARD &&
|
transferOption == REFRESH_TRANSFEROPTIONS_SAFEDISCARD &&
|
||||||
|
@ -10224,6 +10226,9 @@ static void VULKAN_DownloadFromTexture(
|
||||||
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&textureRegion->textureSlice);
|
vulkanTextureSlice = VULKAN_INTERNAL_RefreshToVulkanTextureSlice(&textureRegion->textureSlice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
originalTextureSliceAccessType = vulkanTextureSlice->resourceAccessType;
|
||||||
|
originalBufferAccessType = transferBufferContainer->activeBufferHandle->vulkanBuffer->resourceAccessType;
|
||||||
|
|
||||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||||
renderer,
|
renderer,
|
||||||
vulkanCommandBuffer->commandBuffer,
|
vulkanCommandBuffer->commandBuffer,
|
||||||
|
@ -10261,6 +10266,19 @@ static void VULKAN_DownloadFromTexture(
|
||||||
&imageCopy
|
&imageCopy
|
||||||
);
|
);
|
||||||
|
|
||||||
|
VULKAN_INTERNAL_ImageMemoryBarrier(
|
||||||
|
renderer,
|
||||||
|
vulkanCommandBuffer->commandBuffer,
|
||||||
|
originalTextureSliceAccessType,
|
||||||
|
vulkanTextureSlice
|
||||||
|
);
|
||||||
|
|
||||||
|
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||||
|
renderer,
|
||||||
|
vulkanCommandBuffer->commandBuffer,
|
||||||
|
originalBufferAccessType,
|
||||||
|
transferBufferContainer->activeBufferHandle->vulkanBuffer);
|
||||||
|
|
||||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, transferBufferContainer->activeBufferHandle->vulkanBuffer);
|
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, transferBufferContainer->activeBufferHandle->vulkanBuffer);
|
||||||
VULKAN_INTERNAL_TrackTextureSlice(renderer, vulkanCommandBuffer, vulkanTextureSlice);
|
VULKAN_INTERNAL_TrackTextureSlice(renderer, vulkanCommandBuffer, vulkanTextureSlice);
|
||||||
VULKAN_INTERNAL_TrackCopiedTextureSlice(renderer, vulkanCommandBuffer, vulkanTextureSlice);
|
VULKAN_INTERNAL_TrackCopiedTextureSlice(renderer, vulkanCommandBuffer, vulkanTextureSlice);
|
||||||
|
@ -10283,6 +10301,8 @@ static void VULKAN_DownloadFromBuffer(
|
||||||
VkBufferCopy bufferCopy;
|
VkBufferCopy bufferCopy;
|
||||||
Refresh_Fence *fence;
|
Refresh_Fence *fence;
|
||||||
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) VULKAN_AcquireCommandBuffer(driverData);
|
VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer*) VULKAN_AcquireCommandBuffer(driverData);
|
||||||
|
VulkanResourceAccessType originalTransferBufferAccessType;
|
||||||
|
VulkanResourceAccessType originalGpuBufferAccessType;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
transferOption == REFRESH_TRANSFEROPTIONS_SAFEDISCARD &&
|
transferOption == REFRESH_TRANSFEROPTIONS_SAFEDISCARD &&
|
||||||
|
@ -10294,6 +10314,9 @@ static void VULKAN_DownloadFromBuffer(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
originalTransferBufferAccessType = transferBufferContainer->activeBufferHandle->vulkanBuffer->resourceAccessType;
|
||||||
|
originalGpuBufferAccessType = gpuBufferContainer->activeBufferHandle->vulkanBuffer->resourceAccessType;
|
||||||
|
|
||||||
VULKAN_INTERNAL_BufferMemoryBarrier(
|
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||||
renderer,
|
renderer,
|
||||||
vulkanCommandBuffer->commandBuffer,
|
vulkanCommandBuffer->commandBuffer,
|
||||||
|
@ -10320,6 +10343,19 @@ static void VULKAN_DownloadFromBuffer(
|
||||||
&bufferCopy
|
&bufferCopy
|
||||||
);
|
);
|
||||||
|
|
||||||
|
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||||
|
renderer,
|
||||||
|
vulkanCommandBuffer->commandBuffer,
|
||||||
|
originalTransferBufferAccessType,
|
||||||
|
transferBufferContainer->activeBufferHandle->vulkanBuffer
|
||||||
|
);
|
||||||
|
|
||||||
|
VULKAN_INTERNAL_BufferMemoryBarrier(
|
||||||
|
renderer,
|
||||||
|
vulkanCommandBuffer->commandBuffer,
|
||||||
|
originalGpuBufferAccessType,
|
||||||
|
gpuBufferContainer->activeBufferHandle->vulkanBuffer);
|
||||||
|
|
||||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, transferBufferContainer->activeBufferHandle->vulkanBuffer);
|
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, transferBufferContainer->activeBufferHandle->vulkanBuffer);
|
||||||
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, gpuBufferContainer->activeBufferHandle->vulkanBuffer);
|
VULKAN_INTERNAL_TrackBuffer(renderer, vulkanCommandBuffer, gpuBufferContainer->activeBufferHandle->vulkanBuffer);
|
||||||
VULKAN_INTERNAL_TrackCopiedBuffer(renderer, vulkanCommandBuffer, gpuBufferContainer->activeBufferHandle->vulkanBuffer);
|
VULKAN_INTERNAL_TrackCopiedBuffer(renderer, vulkanCommandBuffer, gpuBufferContainer->activeBufferHandle->vulkanBuffer);
|
||||||
|
|
Loading…
Reference in New Issue