mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-03 04:24:11 +01:00
[d3d11] Duplicate format table into D3D11 device
Removes the direct D3D11Device->DXGIAdapter dependency.
This commit is contained in:
parent
193d24a3e2
commit
cc7f5c4bb1
@ -103,15 +103,9 @@ namespace dxvk {
|
||||
m_featureFlags (FeatureFlags),
|
||||
m_dxvkDevice (pDxgiDevice->GetDXVKDevice()),
|
||||
m_dxvkAdapter (m_dxvkDevice->adapter()),
|
||||
m_d3d11Formats (m_dxvkAdapter),
|
||||
m_d3d11Options (m_dxvkAdapter->instance()->config()),
|
||||
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_context = new D3D11ImmediateContext(this, m_dxvkDevice);
|
||||
m_d3d10Device = new D3D10Device(this, m_context);
|
||||
@ -512,8 +506,7 @@ namespace dxvk {
|
||||
DxvkVertexAttribute attrib;
|
||||
attrib.location = entry != nullptr ? entry->registerId : 0;
|
||||
attrib.binding = pInputElementDescs[i].InputSlot;
|
||||
attrib.format = m_dxgiAdapter->LookupFormat(
|
||||
pInputElementDescs[i].Format, DXGI_VK_FORMAT_MODE_COLOR).Format;
|
||||
attrib.format = LookupFormat(pInputElementDescs[i].Format, DXGI_VK_FORMAT_MODE_COLOR).Format;
|
||||
attrib.offset = pInputElementDescs[i].AlignedByteOffset;
|
||||
|
||||
// The application may choose to let the implementation
|
||||
@ -1135,8 +1128,7 @@ namespace dxvk {
|
||||
*pNumQualityLevels = 0;
|
||||
|
||||
// We need to check whether the format is
|
||||
VkFormat format = m_dxgiAdapter->LookupFormat(
|
||||
Format, DXGI_VK_FORMAT_MODE_ANY).Format;
|
||||
VkFormat format = LookupFormat(Format, DXGI_VK_FORMAT_MODE_ANY).Format;
|
||||
|
||||
if (format == VK_FORMAT_UNDEFINED) {
|
||||
Logger::err(str::format("D3D11: Unsupported format: ", Format));
|
||||
@ -1360,14 +1352,14 @@ namespace dxvk {
|
||||
DXGI_VK_FORMAT_INFO D3D11Device::LookupFormat(
|
||||
DXGI_FORMAT Format,
|
||||
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_FORMAT Format,
|
||||
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 {
|
||||
// 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 DxvkFormatInfo* fmtProperties = imageFormatInfo(fmtMapping.Format);
|
||||
|
||||
@ -1608,7 +1600,7 @@ namespace dxvk {
|
||||
|
||||
if (fmtSupport.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_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_2D)) flags1 |= D3D11_FORMAT_SUPPORT_TEXTURE2D;
|
||||
|
@ -363,7 +363,6 @@ namespace dxvk {
|
||||
private:
|
||||
|
||||
IDXGIObject* m_container;
|
||||
Com<IDXGIVkAdapter> m_dxgiAdapter;
|
||||
|
||||
const D3D_FEATURE_LEVEL m_featureLevel;
|
||||
const UINT m_featureFlags;
|
||||
@ -371,6 +370,7 @@ namespace dxvk {
|
||||
const Rc<DxvkDevice> m_dxvkDevice;
|
||||
const Rc<DxvkAdapter> m_dxvkAdapter;
|
||||
|
||||
const DXGIVkFormatTable m_d3d11Formats;
|
||||
const D3D11Options m_d3d11Options;
|
||||
const DxbcOptions m_dxbcOptions;
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
dxgi_common_src = [
|
||||
'../dxgi/dxgi_format.cpp',
|
||||
]
|
||||
|
||||
d3d10_src = [
|
||||
'../d3d10/d3d10_blend.cpp',
|
||||
'../d3d10/d3d10_buffer.cpp',
|
||||
@ -48,7 +52,7 @@ d3d11_src = [
|
||||
'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 : '',
|
||||
dependencies : [ lib_dxgi, dxbc_dep, dxvk_dep ],
|
||||
include_directories : dxvk_include_path,
|
||||
|
Loading…
Reference in New Issue
Block a user