1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-30 11:52:11 +01:00

[d3d9] Fix texture converter

This commit is contained in:
Robin Kertels 2021-06-12 12:14:18 +02:00 committed by Joshie
parent 9eeaedeeb7
commit 6f468ec5e0
3 changed files with 18 additions and 23 deletions

View File

@ -3863,9 +3863,9 @@ namespace dxvk {
| VK_ACCESS_INDEX_READ_BIT;
info.stages = VK_PIPELINE_STAGE_VERTEX_INPUT_BIT;
} else {
info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
info.stages = VK_PIPELINE_STAGE_TRANSFER_BIT;
info.access = VK_ACCESS_TRANSFER_READ_BIT;
info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT;
info.stages = VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
info.access = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_SHADER_READ_BIT;
}
currentSlice.slice = DxvkBufferSlice(m_dxvkDevice->createBuffer(info, memoryFlags));
@ -4361,7 +4361,7 @@ namespace dxvk {
});
}
else {
VkExtent3D texLevelExtent = image->mipLevelExtent(Subresource);
VkExtent3D texLevelExtent = image->mipLevelExtent(subresource.mipLevel);
VkExtent3D texLevelExtentBlockCount = util::computeBlockCount(texLevelExtent, formatInfo->blockSize);
D3D9BufferSlice slice = AllocTempBuffer<false>(srcSlice.length);
@ -4376,8 +4376,7 @@ namespace dxvk {
m_converter->ConvertFormat(
convertFormat,
image, subresourceLayers,
slice.slice.buffer(),
slice.slice.offset());
slice.slice);
}
if (pResource->IsAutomaticMip())

View File

@ -28,34 +28,33 @@ namespace dxvk {
D3D9_CONVERSION_FORMAT_INFO conversionFormat,
const Rc<DxvkImage>& dstImage,
VkImageSubresourceLayers dstSubresource,
const Rc<DxvkBuffer>& srcBuffer,
uint32_t srcBufferOffset) {
const DxvkBufferSlice& srcSlice) {
switch (conversionFormat.FormatType) {
case D3D9ConversionFormat_YUY2:
case D3D9ConversionFormat_UYVY: {
uint32_t specConstant = conversionFormat.FormatType == D3D9ConversionFormat_UYVY ? 1 : 0;
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, srcBufferOffset, VK_FORMAT_R32_UINT, specConstant, { 2u, 1u });
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcSlice, VK_FORMAT_R32_UINT, specConstant, { 2u, 1u });
break;
}
case D3D9ConversionFormat_NV12:
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, srcBufferOffset, VK_FORMAT_R16_UINT, 0, { 2u, 1u });
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcSlice, VK_FORMAT_R16_UINT, 0, { 2u, 1u });
break;
case D3D9ConversionFormat_YV12:
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, srcBufferOffset, VK_FORMAT_R8_UINT, 0, { 1u, 1u });
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcSlice, VK_FORMAT_R8_UINT, 0, { 1u, 1u });
break;
case D3D9ConversionFormat_L6V5U5:
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, srcBufferOffset, VK_FORMAT_R16_UINT, 0, { 1u, 1u });
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcSlice, VK_FORMAT_R16_UINT, 0, { 1u, 1u });
break;
case D3D9ConversionFormat_X8L8V8U8:
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, srcBufferOffset, VK_FORMAT_R32_UINT, 0, { 1u, 1u });
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcSlice, VK_FORMAT_R32_UINT, 0, { 1u, 1u });
break;
case D3D9ConversionFormat_A2W10V10U10:
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, srcBufferOffset, VK_FORMAT_R32_UINT, 0, { 1u, 1u });
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcSlice, VK_FORMAT_R32_UINT, 0, { 1u, 1u });
break;
default:
@ -68,8 +67,7 @@ namespace dxvk {
D3D9_CONVERSION_FORMAT_INFO videoFormat,
const Rc<DxvkImage>& dstImage,
VkImageSubresourceLayers dstSubresource,
const Rc<DxvkBuffer>& srcBuffer,
uint32_t srcBufferOffset,
const DxvkBufferSlice& srcSlice,
VkFormat bufferFormat,
uint32_t specConstantValue,
VkExtent2D macroPixelRun) {
@ -91,9 +89,9 @@ namespace dxvk {
DxvkBufferViewCreateInfo bufferViewInfo;
bufferViewInfo.format = bufferFormat;
bufferViewInfo.rangeOffset = srcBufferOffset;
bufferViewInfo.rangeLength = srcBuffer->info().size;
auto tmpBufferView = m_device->createBufferView(srcBuffer, bufferViewInfo);
bufferViewInfo.rangeOffset = srcSlice.offset();
bufferViewInfo.rangeLength = srcSlice.length();
auto tmpBufferView = m_device->createBufferView(srcSlice.buffer(), bufferViewInfo);
if (specConstantValue)
m_context->setSpecConstant(VK_PIPELINE_BIND_POINT_COMPUTE, 0, specConstantValue);

View File

@ -19,8 +19,7 @@ namespace dxvk {
D3D9_CONVERSION_FORMAT_INFO conversionFormat,
const Rc<DxvkImage>& dstImage,
VkImageSubresourceLayers dstSubresource,
const Rc<DxvkBuffer>& srcBuffer,
uint32_t srcBufferOffset);
const DxvkBufferSlice& srcSlice);
private:
@ -28,8 +27,7 @@ namespace dxvk {
D3D9_CONVERSION_FORMAT_INFO videoFormat,
const Rc<DxvkImage>& dstImage,
VkImageSubresourceLayers dstSubresource,
const Rc<DxvkBuffer>& srcBuffer,
uint32_t srcBufferOffset,
const DxvkBufferSlice& srcSlice,
VkFormat bufferFormat,
uint32_t specConstantValue,
VkExtent2D macroPixelRun);