mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-17 17:52:11 +01:00
[d3d9] Return a pointer in GetUnsupportedFormatInfo
This commit is contained in:
parent
fa4f40a0e6
commit
82d40f5bba
@ -83,7 +83,7 @@ namespace dxvk {
|
||||
return m_d3d9Formats.GetFormatMapping(Format);
|
||||
}
|
||||
|
||||
DxvkFormatInfo GetUnsupportedFormatInfo(D3D9Format Format) const {
|
||||
const DxvkFormatInfo* GetUnsupportedFormatInfo(D3D9Format Format) const {
|
||||
return m_d3d9Formats.GetUnsupportedFormatInfo(Format);
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ namespace dxvk {
|
||||
if (!mapping.IsValid() && pDesc->Format != D3D9Format::NULL_FORMAT) {
|
||||
auto info = pDevice->UnsupportedFormatInfo(pDesc->Format);
|
||||
|
||||
if (pDesc->Pool != D3DPOOL_SCRATCH || info.elementSize == 0)
|
||||
if (pDesc->Pool != D3DPOOL_SCRATCH || info->elementSize == 0)
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
@ -186,20 +186,20 @@ namespace dxvk {
|
||||
VkDeviceSize D3D9CommonTexture::GetMipSize(UINT Subresource) const {
|
||||
const UINT MipLevel = Subresource % m_desc.MipLevels;
|
||||
|
||||
const DxvkFormatInfo formatInfo = m_mapping.FormatColor != VK_FORMAT_UNDEFINED
|
||||
? *imageFormatInfo(m_mapping.FormatColor)
|
||||
const DxvkFormatInfo* formatInfo = m_mapping.FormatColor != VK_FORMAT_UNDEFINED
|
||||
? imageFormatInfo(m_mapping.FormatColor)
|
||||
: m_device->UnsupportedFormatInfo(m_desc.Format);
|
||||
|
||||
const VkExtent3D mipExtent = util::computeMipLevelExtent(
|
||||
GetExtent(), MipLevel);
|
||||
|
||||
const VkExtent3D blockCount = util::computeBlockCount(
|
||||
mipExtent, formatInfo.blockSize);
|
||||
mipExtent, formatInfo->blockSize);
|
||||
|
||||
const uint32_t planeCount = m_mapping.ConversionFormatInfo.PlaneCount;
|
||||
|
||||
return std::min(planeCount, 2u)
|
||||
* align(formatInfo.elementSize * blockCount.width, 4)
|
||||
* align(formatInfo->elementSize * blockCount.width, 4)
|
||||
* blockCount.height
|
||||
* blockCount.depth;
|
||||
}
|
||||
|
@ -4004,7 +4004,7 @@ namespace dxvk {
|
||||
return m_adapter->GetFormatMapping(Format);
|
||||
}
|
||||
|
||||
DxvkFormatInfo D3D9DeviceEx::UnsupportedFormatInfo(
|
||||
const DxvkFormatInfo* D3D9DeviceEx::UnsupportedFormatInfo(
|
||||
D3D9Format Format) const {
|
||||
return m_adapter->GetUnsupportedFormatInfo(Format);
|
||||
}
|
||||
|
@ -657,7 +657,7 @@ namespace dxvk {
|
||||
D3D9_VK_FORMAT_MAPPING LookupFormat(
|
||||
D3D9Format Format) const;
|
||||
|
||||
DxvkFormatInfo UnsupportedFormatInfo(
|
||||
const DxvkFormatInfo* UnsupportedFormatInfo(
|
||||
D3D9Format Format) const;
|
||||
|
||||
bool WaitForResource(
|
||||
|
@ -502,44 +502,55 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
DxvkFormatInfo D3D9VkFormatTable::GetUnsupportedFormatInfo(
|
||||
const DxvkFormatInfo* D3D9VkFormatTable::GetUnsupportedFormatInfo(
|
||||
D3D9Format Format) const {
|
||||
static const DxvkFormatInfo r8b8g8 = { 3, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
static const DxvkFormatInfo r3g3b2 = { 1, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
static const DxvkFormatInfo a8r3g3b2 = { 2, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
static const DxvkFormatInfo a8p8 = { 2, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
static const DxvkFormatInfo p8 = { 1, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
static const DxvkFormatInfo l6v5u5 = { 2, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
static const DxvkFormatInfo x8l8v8u8 = { 4, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
static const DxvkFormatInfo a2w10v10u10 = { 4, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
static const DxvkFormatInfo cxv8u8 = { 2, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
static const DxvkFormatInfo unknown = {};
|
||||
|
||||
switch (Format) {
|
||||
case D3D9Format::R8G8B8:
|
||||
return { 3, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
return &r8b8g8;
|
||||
|
||||
case D3D9Format::R3G3B2:
|
||||
return { 1, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
return &r3g3b2;
|
||||
|
||||
case D3D9Format::A8R3G3B2:
|
||||
return { 2, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
return &a8r3g3b2;
|
||||
|
||||
case D3D9Format::A8P8:
|
||||
return { 2, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
return &a8p8;
|
||||
|
||||
case D3D9Format::P8:
|
||||
return { 1, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
return &p8;
|
||||
|
||||
case D3D9Format::L6V5U5:
|
||||
return { 2, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
return &l6v5u5;
|
||||
|
||||
case D3D9Format::X8L8V8U8:
|
||||
return { 4, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
return &x8l8v8u8;
|
||||
|
||||
case D3D9Format::A2W10V10U10:
|
||||
return { 4, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
return &a2w10v10u10;
|
||||
|
||||
// MULTI2_ARGB8 -> Don't have a clue what this is.
|
||||
|
||||
case D3D9Format::CxV8U8:
|
||||
return { 2, VK_IMAGE_ASPECT_COLOR_BIT };
|
||||
return &cxv8u8;
|
||||
|
||||
// A1 -> Doesn't map nicely here cause it's not byte aligned.
|
||||
// Gonna just pretend that doesn't exist until something
|
||||
// depends on that.
|
||||
|
||||
default:
|
||||
return {};
|
||||
return &unknown;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ namespace dxvk {
|
||||
*
|
||||
* \param [in] Format The D3D9 format to look up
|
||||
*/
|
||||
DxvkFormatInfo GetUnsupportedFormatInfo(
|
||||
const DxvkFormatInfo* GetUnsupportedFormatInfo(
|
||||
D3D9Format Format) const;
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user