mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxgi] Add methods to retrieve original format mappings
This commit is contained in:
parent
b3ea1b02eb
commit
6c2f16fce8
@ -853,26 +853,16 @@ namespace dxvk {
|
|||||||
DXGI_VK_FORMAT_INFO DXGIVkFormatTable::GetFormatInfo(
|
DXGI_VK_FORMAT_INFO DXGIVkFormatTable::GetFormatInfo(
|
||||||
DXGI_FORMAT Format,
|
DXGI_FORMAT Format,
|
||||||
DXGI_VK_FORMAT_MODE Mode) const {
|
DXGI_VK_FORMAT_MODE Mode) const {
|
||||||
const DXGI_VK_FORMAT_MAPPING* mapping = GetFormatMapping(Format);
|
return GetFormatInfoFromMapping(
|
||||||
|
GetFormatMapping(Format), Mode);
|
||||||
switch (Mode) {
|
}
|
||||||
case DXGI_VK_FORMAT_MODE_ANY:
|
|
||||||
return mapping->FormatColor != VK_FORMAT_UNDEFINED
|
|
||||||
? DXGI_VK_FORMAT_INFO { mapping->FormatColor, mapping->AspectColor, mapping->Swizzle }
|
DXGI_VK_FORMAT_INFO DXGIVkFormatTable::GetPackedFormatInfo(
|
||||||
: DXGI_VK_FORMAT_INFO { mapping->FormatDepth, mapping->AspectDepth };
|
DXGI_FORMAT Format,
|
||||||
|
DXGI_VK_FORMAT_MODE Mode) const {
|
||||||
case DXGI_VK_FORMAT_MODE_COLOR:
|
return GetFormatInfoFromMapping(
|
||||||
return { mapping->FormatColor, mapping->AspectColor, mapping->Swizzle };
|
GetPackedFormatMapping(Format), Mode);
|
||||||
|
|
||||||
case DXGI_VK_FORMAT_MODE_DEPTH:
|
|
||||||
return { mapping->FormatDepth, mapping->AspectDepth };
|
|
||||||
|
|
||||||
case DXGI_VK_FORMAT_MODE_RAW:
|
|
||||||
return { mapping->FormatRaw, mapping->AspectColor };
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger::err("DXGI: GetFormatInfo: Internal error");
|
|
||||||
return DXGI_VK_FORMAT_INFO();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -890,6 +880,30 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DXGI_VK_FORMAT_INFO DXGIVkFormatTable::GetFormatInfoFromMapping(
|
||||||
|
const DXGI_VK_FORMAT_MAPPING* pMapping,
|
||||||
|
DXGI_VK_FORMAT_MODE Mode) const {
|
||||||
|
switch (Mode) {
|
||||||
|
case DXGI_VK_FORMAT_MODE_ANY:
|
||||||
|
return pMapping->FormatColor != VK_FORMAT_UNDEFINED
|
||||||
|
? DXGI_VK_FORMAT_INFO { pMapping->FormatColor, pMapping->AspectColor, pMapping->Swizzle }
|
||||||
|
: DXGI_VK_FORMAT_INFO { pMapping->FormatDepth, pMapping->AspectDepth };
|
||||||
|
|
||||||
|
case DXGI_VK_FORMAT_MODE_COLOR:
|
||||||
|
return { pMapping->FormatColor, pMapping->AspectColor, pMapping->Swizzle };
|
||||||
|
|
||||||
|
case DXGI_VK_FORMAT_MODE_DEPTH:
|
||||||
|
return { pMapping->FormatDepth, pMapping->AspectDepth };
|
||||||
|
|
||||||
|
case DXGI_VK_FORMAT_MODE_RAW:
|
||||||
|
return { pMapping->FormatRaw, pMapping->AspectColor };
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger::err("DXGI: GetFormatInfoFromMapping: Internal error");
|
||||||
|
return DXGI_VK_FORMAT_INFO();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const DXGI_VK_FORMAT_MAPPING* DXGIVkFormatTable::GetFormatMapping(
|
const DXGI_VK_FORMAT_MAPPING* DXGIVkFormatTable::GetFormatMapping(
|
||||||
DXGI_FORMAT Format) const {
|
DXGI_FORMAT Format) const {
|
||||||
const size_t formatId = size_t(Format);
|
const size_t formatId = size_t(Format);
|
||||||
@ -900,6 +914,16 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const DXGI_VK_FORMAT_MAPPING* DXGIVkFormatTable::GetPackedFormatMapping(
|
||||||
|
DXGI_FORMAT Format) const {
|
||||||
|
const size_t formatId = size_t(Format);
|
||||||
|
|
||||||
|
return formatId < g_dxgiFormats.size()
|
||||||
|
? &g_dxgiFormats[formatId]
|
||||||
|
: &g_dxgiFormats[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DXGIVkFormatTable::CheckImageFormatSupport(
|
bool DXGIVkFormatTable::CheckImageFormatSupport(
|
||||||
const Rc<DxvkAdapter>& Adapter,
|
const Rc<DxvkAdapter>& Adapter,
|
||||||
VkFormat Format,
|
VkFormat Format,
|
||||||
|
@ -114,6 +114,20 @@ namespace dxvk {
|
|||||||
DXGI_FORMAT Format,
|
DXGI_FORMAT Format,
|
||||||
DXGI_VK_FORMAT_MODE Mode) const;
|
DXGI_VK_FORMAT_MODE Mode) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Retrieves original info for a given DXGI format
|
||||||
|
*
|
||||||
|
* Doesn't perform any format adjustment, so this
|
||||||
|
* can be used to determine the packed data format
|
||||||
|
* of a DXGI format for things like data uploads.
|
||||||
|
* \param [in] Format The DXGI format to look up
|
||||||
|
* \param [in] Mode the format lookup mode
|
||||||
|
* \returns Format info
|
||||||
|
*/
|
||||||
|
DXGI_VK_FORMAT_INFO GetPackedFormatInfo(
|
||||||
|
DXGI_FORMAT Format,
|
||||||
|
DXGI_VK_FORMAT_MODE Mode) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retrieves a format family
|
* \brief Retrieves a format family
|
||||||
*
|
*
|
||||||
@ -129,10 +143,17 @@ namespace dxvk {
|
|||||||
|
|
||||||
std::array<DXGI_VK_FORMAT_MAPPING, 133> m_dxgiFormats;
|
std::array<DXGI_VK_FORMAT_MAPPING, 133> m_dxgiFormats;
|
||||||
std::array<DXGI_VK_FORMAT_FAMILY, 133> m_dxgiFamilies;
|
std::array<DXGI_VK_FORMAT_FAMILY, 133> m_dxgiFamilies;
|
||||||
|
|
||||||
|
DXGI_VK_FORMAT_INFO GetFormatInfoFromMapping(
|
||||||
|
const DXGI_VK_FORMAT_MAPPING* pMapping,
|
||||||
|
DXGI_VK_FORMAT_MODE Mode) const;
|
||||||
|
|
||||||
const DXGI_VK_FORMAT_MAPPING* GetFormatMapping(
|
const DXGI_VK_FORMAT_MAPPING* GetFormatMapping(
|
||||||
DXGI_FORMAT Format) const;
|
DXGI_FORMAT Format) const;
|
||||||
|
|
||||||
|
const DXGI_VK_FORMAT_MAPPING* GetPackedFormatMapping(
|
||||||
|
DXGI_FORMAT Format) const;
|
||||||
|
|
||||||
bool CheckImageFormatSupport(
|
bool CheckImageFormatSupport(
|
||||||
const Rc<DxvkAdapter>& Adapter,
|
const Rc<DxvkAdapter>& Adapter,
|
||||||
VkFormat Format,
|
VkFormat Format,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user