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:
parent
9eeaedeeb7
commit
6f468ec5e0
@ -3863,9 +3863,9 @@ namespace dxvk {
|
|||||||
| VK_ACCESS_INDEX_READ_BIT;
|
| VK_ACCESS_INDEX_READ_BIT;
|
||||||
info.stages = VK_PIPELINE_STAGE_VERTEX_INPUT_BIT;
|
info.stages = VK_PIPELINE_STAGE_VERTEX_INPUT_BIT;
|
||||||
} else {
|
} else {
|
||||||
info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT;
|
info.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT;
|
||||||
info.stages = VK_PIPELINE_STAGE_TRANSFER_BIT;
|
info.stages = VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
|
||||||
info.access = VK_ACCESS_TRANSFER_READ_BIT;
|
info.access = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_SHADER_READ_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentSlice.slice = DxvkBufferSlice(m_dxvkDevice->createBuffer(info, memoryFlags));
|
currentSlice.slice = DxvkBufferSlice(m_dxvkDevice->createBuffer(info, memoryFlags));
|
||||||
@ -4361,7 +4361,7 @@ namespace dxvk {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VkExtent3D texLevelExtent = image->mipLevelExtent(Subresource);
|
VkExtent3D texLevelExtent = image->mipLevelExtent(subresource.mipLevel);
|
||||||
VkExtent3D texLevelExtentBlockCount = util::computeBlockCount(texLevelExtent, formatInfo->blockSize);
|
VkExtent3D texLevelExtentBlockCount = util::computeBlockCount(texLevelExtent, formatInfo->blockSize);
|
||||||
|
|
||||||
D3D9BufferSlice slice = AllocTempBuffer<false>(srcSlice.length);
|
D3D9BufferSlice slice = AllocTempBuffer<false>(srcSlice.length);
|
||||||
@ -4376,8 +4376,7 @@ namespace dxvk {
|
|||||||
m_converter->ConvertFormat(
|
m_converter->ConvertFormat(
|
||||||
convertFormat,
|
convertFormat,
|
||||||
image, subresourceLayers,
|
image, subresourceLayers,
|
||||||
slice.slice.buffer(),
|
slice.slice);
|
||||||
slice.slice.offset());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pResource->IsAutomaticMip())
|
if (pResource->IsAutomaticMip())
|
||||||
|
@ -28,34 +28,33 @@ namespace dxvk {
|
|||||||
D3D9_CONVERSION_FORMAT_INFO conversionFormat,
|
D3D9_CONVERSION_FORMAT_INFO conversionFormat,
|
||||||
const Rc<DxvkImage>& dstImage,
|
const Rc<DxvkImage>& dstImage,
|
||||||
VkImageSubresourceLayers dstSubresource,
|
VkImageSubresourceLayers dstSubresource,
|
||||||
const Rc<DxvkBuffer>& srcBuffer,
|
const DxvkBufferSlice& srcSlice) {
|
||||||
uint32_t srcBufferOffset) {
|
|
||||||
switch (conversionFormat.FormatType) {
|
switch (conversionFormat.FormatType) {
|
||||||
case D3D9ConversionFormat_YUY2:
|
case D3D9ConversionFormat_YUY2:
|
||||||
case D3D9ConversionFormat_UYVY: {
|
case D3D9ConversionFormat_UYVY: {
|
||||||
uint32_t specConstant = conversionFormat.FormatType == D3D9ConversionFormat_UYVY ? 1 : 0;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case D3D9ConversionFormat_NV12:
|
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;
|
break;
|
||||||
|
|
||||||
case D3D9ConversionFormat_YV12:
|
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;
|
break;
|
||||||
|
|
||||||
case D3D9ConversionFormat_L6V5U5:
|
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;
|
break;
|
||||||
|
|
||||||
case D3D9ConversionFormat_X8L8V8U8:
|
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;
|
break;
|
||||||
|
|
||||||
case D3D9ConversionFormat_A2W10V10U10:
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -68,8 +67,7 @@ namespace dxvk {
|
|||||||
D3D9_CONVERSION_FORMAT_INFO videoFormat,
|
D3D9_CONVERSION_FORMAT_INFO videoFormat,
|
||||||
const Rc<DxvkImage>& dstImage,
|
const Rc<DxvkImage>& dstImage,
|
||||||
VkImageSubresourceLayers dstSubresource,
|
VkImageSubresourceLayers dstSubresource,
|
||||||
const Rc<DxvkBuffer>& srcBuffer,
|
const DxvkBufferSlice& srcSlice,
|
||||||
uint32_t srcBufferOffset,
|
|
||||||
VkFormat bufferFormat,
|
VkFormat bufferFormat,
|
||||||
uint32_t specConstantValue,
|
uint32_t specConstantValue,
|
||||||
VkExtent2D macroPixelRun) {
|
VkExtent2D macroPixelRun) {
|
||||||
@ -91,9 +89,9 @@ namespace dxvk {
|
|||||||
|
|
||||||
DxvkBufferViewCreateInfo bufferViewInfo;
|
DxvkBufferViewCreateInfo bufferViewInfo;
|
||||||
bufferViewInfo.format = bufferFormat;
|
bufferViewInfo.format = bufferFormat;
|
||||||
bufferViewInfo.rangeOffset = srcBufferOffset;
|
bufferViewInfo.rangeOffset = srcSlice.offset();
|
||||||
bufferViewInfo.rangeLength = srcBuffer->info().size;
|
bufferViewInfo.rangeLength = srcSlice.length();
|
||||||
auto tmpBufferView = m_device->createBufferView(srcBuffer, bufferViewInfo);
|
auto tmpBufferView = m_device->createBufferView(srcSlice.buffer(), bufferViewInfo);
|
||||||
|
|
||||||
if (specConstantValue)
|
if (specConstantValue)
|
||||||
m_context->setSpecConstant(VK_PIPELINE_BIND_POINT_COMPUTE, 0, specConstantValue);
|
m_context->setSpecConstant(VK_PIPELINE_BIND_POINT_COMPUTE, 0, specConstantValue);
|
||||||
|
@ -19,8 +19,7 @@ namespace dxvk {
|
|||||||
D3D9_CONVERSION_FORMAT_INFO conversionFormat,
|
D3D9_CONVERSION_FORMAT_INFO conversionFormat,
|
||||||
const Rc<DxvkImage>& dstImage,
|
const Rc<DxvkImage>& dstImage,
|
||||||
VkImageSubresourceLayers dstSubresource,
|
VkImageSubresourceLayers dstSubresource,
|
||||||
const Rc<DxvkBuffer>& srcBuffer,
|
const DxvkBufferSlice& srcSlice);
|
||||||
uint32_t srcBufferOffset);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -28,8 +27,7 @@ namespace dxvk {
|
|||||||
D3D9_CONVERSION_FORMAT_INFO videoFormat,
|
D3D9_CONVERSION_FORMAT_INFO videoFormat,
|
||||||
const Rc<DxvkImage>& dstImage,
|
const Rc<DxvkImage>& dstImage,
|
||||||
VkImageSubresourceLayers dstSubresource,
|
VkImageSubresourceLayers dstSubresource,
|
||||||
const Rc<DxvkBuffer>& srcBuffer,
|
const DxvkBufferSlice& srcSlice,
|
||||||
uint32_t srcBufferOffset,
|
|
||||||
VkFormat bufferFormat,
|
VkFormat bufferFormat,
|
||||||
uint32_t specConstantValue,
|
uint32_t specConstantValue,
|
||||||
VkExtent2D macroPixelRun);
|
VkExtent2D macroPixelRun);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user