1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-11 10:24:10 +01:00

[d3d11] Duplicate format table into D3D11 device

Removes the direct D3D11Device->DXGIAdapter dependency.
This commit is contained in:
Philip Rebohle 2018-11-28 18:34:05 +01:00
parent 193d24a3e2
commit cc7f5c4bb1
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 13 additions and 17 deletions

View File

@ -103,15 +103,9 @@ namespace dxvk {
m_featureFlags (FeatureFlags), m_featureFlags (FeatureFlags),
m_dxvkDevice (pDxgiDevice->GetDXVKDevice()), m_dxvkDevice (pDxgiDevice->GetDXVKDevice()),
m_dxvkAdapter (m_dxvkDevice->adapter()), m_dxvkAdapter (m_dxvkDevice->adapter()),
m_d3d11Formats (m_dxvkAdapter),
m_d3d11Options (m_dxvkAdapter->instance()->config()), m_d3d11Options (m_dxvkAdapter->instance()->config()),
m_dxbcOptions (m_dxvkDevice, m_d3d11Options) { m_dxbcOptions (m_dxvkDevice, m_d3d11Options) {
Com<IDXGIAdapter> adapter;
if (FAILED(pDxgiDevice->GetAdapter(&adapter))
|| FAILED(adapter->QueryInterface(__uuidof(IDXGIVkAdapter),
reinterpret_cast<void**>(&m_dxgiAdapter))))
throw DxvkError("D3D11Device: Failed to query adapter");
m_initializer = new D3D11Initializer(m_dxvkDevice); m_initializer = new D3D11Initializer(m_dxvkDevice);
m_context = new D3D11ImmediateContext(this, m_dxvkDevice); m_context = new D3D11ImmediateContext(this, m_dxvkDevice);
m_d3d10Device = new D3D10Device(this, m_context); m_d3d10Device = new D3D10Device(this, m_context);
@ -512,8 +506,7 @@ namespace dxvk {
DxvkVertexAttribute attrib; DxvkVertexAttribute attrib;
attrib.location = entry != nullptr ? entry->registerId : 0; attrib.location = entry != nullptr ? entry->registerId : 0;
attrib.binding = pInputElementDescs[i].InputSlot; attrib.binding = pInputElementDescs[i].InputSlot;
attrib.format = m_dxgiAdapter->LookupFormat( attrib.format = LookupFormat(pInputElementDescs[i].Format, DXGI_VK_FORMAT_MODE_COLOR).Format;
pInputElementDescs[i].Format, DXGI_VK_FORMAT_MODE_COLOR).Format;
attrib.offset = pInputElementDescs[i].AlignedByteOffset; attrib.offset = pInputElementDescs[i].AlignedByteOffset;
// The application may choose to let the implementation // The application may choose to let the implementation
@ -1135,8 +1128,7 @@ namespace dxvk {
*pNumQualityLevels = 0; *pNumQualityLevels = 0;
// We need to check whether the format is // We need to check whether the format is
VkFormat format = m_dxgiAdapter->LookupFormat( VkFormat format = LookupFormat(Format, DXGI_VK_FORMAT_MODE_ANY).Format;
Format, DXGI_VK_FORMAT_MODE_ANY).Format;
if (format == VK_FORMAT_UNDEFINED) { if (format == VK_FORMAT_UNDEFINED) {
Logger::err(str::format("D3D11: Unsupported format: ", Format)); Logger::err(str::format("D3D11: Unsupported format: ", Format));
@ -1360,14 +1352,14 @@ namespace dxvk {
DXGI_VK_FORMAT_INFO D3D11Device::LookupFormat( DXGI_VK_FORMAT_INFO D3D11Device::LookupFormat(
DXGI_FORMAT Format, DXGI_FORMAT Format,
DXGI_VK_FORMAT_MODE Mode) const { DXGI_VK_FORMAT_MODE Mode) const {
return m_dxgiAdapter->LookupFormat(Format, Mode); return m_d3d11Formats.GetFormatInfo(Format, Mode);
} }
DXGI_VK_FORMAT_FAMILY D3D11Device::LookupFamily( DXGI_VK_FORMAT_FAMILY D3D11Device::LookupFamily(
DXGI_FORMAT Format, DXGI_FORMAT Format,
DXGI_VK_FORMAT_MODE Mode) const { DXGI_VK_FORMAT_MODE Mode) const {
return m_dxgiAdapter->LookupFormatFamily(Format, Mode); return m_d3d11Formats.GetFormatFamily(Format, Mode);
} }
@ -1560,7 +1552,7 @@ namespace dxvk {
HRESULT D3D11Device::GetFormatSupportFlags(DXGI_FORMAT Format, UINT* pFlags1, UINT* pFlags2) const { HRESULT D3D11Device::GetFormatSupportFlags(DXGI_FORMAT Format, UINT* pFlags1, UINT* pFlags2) const {
// Query some general information from DXGI, DXVK and Vulkan about the format // Query some general information from DXGI, DXVK and Vulkan about the format
const DXGI_VK_FORMAT_INFO fmtMapping = m_dxgiAdapter->LookupFormat(Format, DXGI_VK_FORMAT_MODE_ANY); const DXGI_VK_FORMAT_INFO fmtMapping = LookupFormat(Format, DXGI_VK_FORMAT_MODE_ANY);
const VkFormatProperties fmtSupport = m_dxvkAdapter->formatProperties(fmtMapping.Format); const VkFormatProperties fmtSupport = m_dxvkAdapter->formatProperties(fmtMapping.Format);
const DxvkFormatInfo* fmtProperties = imageFormatInfo(fmtMapping.Format); const DxvkFormatInfo* fmtProperties = imageFormatInfo(fmtMapping.Format);
@ -1608,7 +1600,7 @@ namespace dxvk {
if (fmtSupport.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT if (fmtSupport.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
|| fmtSupport.optimalTilingFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) { || fmtSupport.optimalTilingFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) {
const VkFormat depthFormat = m_dxgiAdapter->LookupFormat(Format, DXGI_VK_FORMAT_MODE_DEPTH).Format; const VkFormat depthFormat = LookupFormat(Format, DXGI_VK_FORMAT_MODE_DEPTH).Format;
if (GetImageTypeSupport(fmtMapping.Format, VK_IMAGE_TYPE_1D)) flags1 |= D3D11_FORMAT_SUPPORT_TEXTURE1D; if (GetImageTypeSupport(fmtMapping.Format, VK_IMAGE_TYPE_1D)) flags1 |= D3D11_FORMAT_SUPPORT_TEXTURE1D;
if (GetImageTypeSupport(fmtMapping.Format, VK_IMAGE_TYPE_2D)) flags1 |= D3D11_FORMAT_SUPPORT_TEXTURE2D; if (GetImageTypeSupport(fmtMapping.Format, VK_IMAGE_TYPE_2D)) flags1 |= D3D11_FORMAT_SUPPORT_TEXTURE2D;

View File

@ -363,7 +363,6 @@ namespace dxvk {
private: private:
IDXGIObject* m_container; IDXGIObject* m_container;
Com<IDXGIVkAdapter> m_dxgiAdapter;
const D3D_FEATURE_LEVEL m_featureLevel; const D3D_FEATURE_LEVEL m_featureLevel;
const UINT m_featureFlags; const UINT m_featureFlags;
@ -371,6 +370,7 @@ namespace dxvk {
const Rc<DxvkDevice> m_dxvkDevice; const Rc<DxvkDevice> m_dxvkDevice;
const Rc<DxvkAdapter> m_dxvkAdapter; const Rc<DxvkAdapter> m_dxvkAdapter;
const DXGIVkFormatTable m_d3d11Formats;
const D3D11Options m_d3d11Options; const D3D11Options m_d3d11Options;
const DxbcOptions m_dxbcOptions; const DxbcOptions m_dxbcOptions;

View File

@ -1,3 +1,7 @@
dxgi_common_src = [
'../dxgi/dxgi_format.cpp',
]
d3d10_src = [ d3d10_src = [
'../d3d10/d3d10_blend.cpp', '../d3d10/d3d10_blend.cpp',
'../d3d10/d3d10_buffer.cpp', '../d3d10/d3d10_buffer.cpp',
@ -48,7 +52,7 @@ d3d11_src = [
'd3d11_view_uav.cpp', 'd3d11_view_uav.cpp',
] ]
d3d11_dll = shared_library('d3d11'+dll_ext, d3d11_src + d3d10_src, glsl_generator.process(dxgi_shaders), d3d11_dll = shared_library('d3d11'+dll_ext, dxgi_common_src + d3d11_src + d3d10_src, glsl_generator.process(dxgi_shaders),
name_prefix : '', name_prefix : '',
dependencies : [ lib_dxgi, dxbc_dep, dxvk_dep ], dependencies : [ lib_dxgi, dxbc_dep, dxvk_dep ],
include_directories : dxvk_include_path, include_directories : dxvk_include_path,