mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[d3d9] Replace macropixel size with plane count
This commit is contained in:
parent
2bf9f298af
commit
9fe1b9d03f
@ -19,9 +19,6 @@ namespace dxvk {
|
||||
|
||||
m_mapping = pDevice->LookupFormat(m_desc.Format);
|
||||
|
||||
auto pxSize = m_mapping.ConversionFormatInfo.MacroPixelSize;
|
||||
m_adjustedExtent = VkExtent3D{ m_desc.Width / pxSize.width, m_desc.Height / pxSize.height, m_desc.Depth };
|
||||
|
||||
m_mapMode = DetermineMapMode();
|
||||
m_shadow = DetermineShadowState();
|
||||
|
||||
@ -185,15 +182,15 @@ namespace dxvk {
|
||||
: m_device->UnsupportedFormatInfo(m_desc.Format);
|
||||
|
||||
const VkExtent3D mipExtent = util::computeMipLevelExtent(
|
||||
m_adjustedExtent, MipLevel);
|
||||
GetExtent(), MipLevel);
|
||||
|
||||
const VkExtent3D blockCount = util::computeBlockCount(
|
||||
mipExtent, formatInfo.blockSize);
|
||||
|
||||
const uint32_t planeCount = m_mapping.ConversionFormatInfo.MacroPixelSize.depth;
|
||||
const uint32_t planeCount = m_mapping.ConversionFormatInfo.PlaneCount;
|
||||
|
||||
return formatInfo.elementSize
|
||||
* planeCount
|
||||
return planeCount
|
||||
* formatInfo.elementSize
|
||||
* blockCount.width
|
||||
* blockCount.height
|
||||
* blockCount.depth;
|
||||
|
@ -280,7 +280,7 @@ namespace dxvk {
|
||||
* \returns The extent of the top-level mip
|
||||
*/
|
||||
VkExtent3D GetExtent() const {
|
||||
return m_adjustedExtent;
|
||||
return VkExtent3D{ m_desc.Width, m_desc.Height, m_desc.Depth };
|
||||
}
|
||||
|
||||
/**
|
||||
@ -382,8 +382,6 @@ namespace dxvk {
|
||||
|
||||
D3D9_VK_FORMAT_MAPPING m_mapping;
|
||||
|
||||
VkExtent3D m_adjustedExtent;
|
||||
|
||||
bool m_shadow; //< Depth Compare-ness
|
||||
|
||||
int64_t m_size = 0;
|
||||
|
@ -136,7 +136,7 @@ namespace dxvk {
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
{ VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G,
|
||||
VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A },
|
||||
{ D3D9ConversionFormat_L6V5U5, { 1u, 1u },
|
||||
{ D3D9ConversionFormat_L6V5U5, 1u,
|
||||
// Convert -> float (this is a mixed snorm and unorm type)
|
||||
VK_FORMAT_R16G16B16A16_SFLOAT } };
|
||||
|
||||
@ -146,7 +146,7 @@ namespace dxvk {
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
{ VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G,
|
||||
VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_ONE },
|
||||
{ D3D9ConversionFormat_X8L8V8U8, { 1u, 1u },
|
||||
{ D3D9ConversionFormat_X8L8V8U8, 1u,
|
||||
// Convert -> float (this is a mixed snorm and unorm type)
|
||||
VK_FORMAT_R16G16B16A16_SFLOAT } };
|
||||
|
||||
@ -168,7 +168,7 @@ namespace dxvk {
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
{ VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G,
|
||||
VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_A },
|
||||
{ D3D9ConversionFormat_A2W10V10U10, { 1u, 1u },
|
||||
{ D3D9ConversionFormat_A2W10V10U10, 1u,
|
||||
// Convert -> float (this is a mixed snorm and unorm type)
|
||||
VK_FORMAT_R16G16B16A16_SFLOAT } };
|
||||
|
||||
@ -178,7 +178,7 @@ namespace dxvk {
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
{ VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||
VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY },
|
||||
{ D3D9ConversionFormat_UYVY, { 2u, 1u } }
|
||||
{ D3D9ConversionFormat_UYVY, 1u }
|
||||
};
|
||||
|
||||
case D3D9Format::R8G8_B8G8: return {
|
||||
@ -192,7 +192,7 @@ namespace dxvk {
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
{ VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||
VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY },
|
||||
{ D3D9ConversionFormat_YUY2, { 2u, 1u } }
|
||||
{ D3D9ConversionFormat_YUY2, 1u }
|
||||
};
|
||||
|
||||
case D3D9Format::G8R8_G8B8: return {
|
||||
@ -412,7 +412,7 @@ namespace dxvk {
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
{ VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY,
|
||||
VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY },
|
||||
{ D3D9ConversionFormat_NV12, { 1u, 1u, 2u }, VK_FORMAT_B8G8R8A8_UNORM }
|
||||
{ D3D9ConversionFormat_NV12, 2u, VK_FORMAT_B8G8R8A8_UNORM }
|
||||
};
|
||||
|
||||
case D3D9Format::RAWZ: return {}; // Unsupported
|
||||
|
@ -140,7 +140,7 @@ namespace dxvk {
|
||||
|
||||
struct D3D9_CONVERSION_FORMAT_INFO {
|
||||
D3D9ConversionFormat FormatType = D3D9ConversionFormat_None;
|
||||
VkExtent3D MacroPixelSize = { 1u, 1u, 1u };
|
||||
uint32_t PlaneCount = 1;
|
||||
VkFormat FormatColor = VK_FORMAT_UNDEFINED;
|
||||
VkFormat FormatSrgb = VK_FORMAT_UNDEFINED;
|
||||
};
|
||||
|
@ -32,24 +32,24 @@ namespace dxvk {
|
||||
case D3D9ConversionFormat_YUY2:
|
||||
case D3D9ConversionFormat_UYVY: {
|
||||
uint32_t specConstant = conversionFormat.FormatType == D3D9ConversionFormat_UYVY ? 1 : 0;
|
||||
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, VK_FORMAT_R32_UINT, specConstant);
|
||||
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, VK_FORMAT_R32_UINT, specConstant, { 2u, 1u });
|
||||
break;
|
||||
}
|
||||
|
||||
case D3D9ConversionFormat_NV12:
|
||||
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, VK_FORMAT_R8_UINT, 0);
|
||||
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, VK_FORMAT_R8_UINT, 0, { 1u, 1u });
|
||||
break;
|
||||
|
||||
case D3D9ConversionFormat_L6V5U5:
|
||||
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, VK_FORMAT_R16_UINT, 0);
|
||||
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, VK_FORMAT_R16_UINT, 0, { 1u, 1u });
|
||||
break;
|
||||
|
||||
case D3D9ConversionFormat_X8L8V8U8:
|
||||
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, VK_FORMAT_R32_UINT, 0);
|
||||
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, VK_FORMAT_R32_UINT, 0, { 1u, 1u });
|
||||
break;
|
||||
|
||||
case D3D9ConversionFormat_A2W10V10U10:
|
||||
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, VK_FORMAT_R32_UINT, 0);
|
||||
ConvertGenericFormat(conversionFormat, dstImage, dstSubresource, srcBuffer, VK_FORMAT_R32_UINT, 0, { 1u, 1u });
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -64,7 +64,8 @@ namespace dxvk {
|
||||
VkImageSubresourceLayers dstSubresource,
|
||||
const Rc<DxvkBuffer>& srcBuffer,
|
||||
VkFormat bufferFormat,
|
||||
uint32_t specConstantValue) {
|
||||
uint32_t specConstantValue,
|
||||
VkExtent2D macroPixelRun) {
|
||||
DxvkImageViewCreateInfo imageViewInfo;
|
||||
imageViewInfo.type = VK_IMAGE_VIEW_TYPE_2D;
|
||||
imageViewInfo.format = dstImage->info().format;
|
||||
@ -77,8 +78,8 @@ namespace dxvk {
|
||||
auto tmpImageView = m_device->createImageView(dstImage, imageViewInfo);
|
||||
|
||||
VkExtent3D imageExtent = dstImage->mipLevelExtent(dstSubresource.mipLevel);
|
||||
imageExtent = VkExtent3D{ imageExtent.width / videoFormat.MacroPixelSize.width,
|
||||
imageExtent.height / videoFormat.MacroPixelSize.height,
|
||||
imageExtent = VkExtent3D{ imageExtent.width / macroPixelRun.width,
|
||||
imageExtent.height / macroPixelRun.height,
|
||||
1 };
|
||||
|
||||
DxvkBufferViewCreateInfo bufferViewInfo;
|
||||
|
@ -29,7 +29,8 @@ namespace dxvk {
|
||||
VkImageSubresourceLayers dstSubresource,
|
||||
const Rc<DxvkBuffer>& srcBuffer,
|
||||
VkFormat bufferFormat,
|
||||
uint32_t specConstantValue);
|
||||
uint32_t specConstantValue,
|
||||
VkExtent2D macroPixelRun);
|
||||
|
||||
enum BindingIds : uint32_t {
|
||||
Image = 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user