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

[d3d10] Implement D3D10 texture interfaces

This commit is contained in:
Philip Rebohle 2018-08-11 18:45:41 +02:00
parent 257ac9ad6c
commit b97f9a702a
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
9 changed files with 790 additions and 14 deletions

View File

@ -102,8 +102,30 @@ namespace dxvk {
const D3D10_TEXTURE1D_DESC* pDesc,
const D3D10_SUBRESOURCE_DATA* pInitialData,
ID3D10Texture1D** ppTexture1D) {
Logger::err("D3D10Device::CreateTexture1D: Not implemented");
return E_NOTIMPL;
InitReturnPtr(ppTexture1D);
D3D11_TEXTURE1D_DESC d3d11Desc;
d3d11Desc.Width = pDesc->Width;
d3d11Desc.MipLevels = pDesc->MipLevels;
d3d11Desc.ArraySize = pDesc->ArraySize;
d3d11Desc.Format = pDesc->Format;
d3d11Desc.Usage = D3D11_USAGE(pDesc->Usage);
d3d11Desc.BindFlags = pDesc->BindFlags;
d3d11Desc.CPUAccessFlags = pDesc->CPUAccessFlags;
d3d11Desc.MiscFlags = ConvertD3D10ResourceFlags(pDesc->MiscFlags);
ID3D11Texture1D* d3d11Texture1D = nullptr;
HRESULT hr = m_device->CreateTexture1D(&d3d11Desc,
reinterpret_cast<const D3D11_SUBRESOURCE_DATA*>(pInitialData),
ppTexture1D != nullptr ? &d3d11Texture1D : nullptr);
if (FAILED(hr))
return hr;
if (ppTexture1D != nullptr) {
*ppTexture1D = static_cast<D3D11Texture1D*>(d3d11Texture1D)->GetD3D10Iface();
return S_OK;
} return S_FALSE;
}
@ -111,8 +133,32 @@ namespace dxvk {
const D3D10_TEXTURE2D_DESC* pDesc,
const D3D10_SUBRESOURCE_DATA* pInitialData,
ID3D10Texture2D** ppTexture2D) {
Logger::err("D3D10Device::CreateTexture2D: Not implemented");
return E_NOTIMPL;
InitReturnPtr(ppTexture2D);
D3D11_TEXTURE2D_DESC d3d11Desc;
d3d11Desc.Width = pDesc->Width;
d3d11Desc.Height = pDesc->Height;
d3d11Desc.MipLevels = pDesc->MipLevels;
d3d11Desc.ArraySize = pDesc->ArraySize;
d3d11Desc.Format = pDesc->Format;
d3d11Desc.SampleDesc = pDesc->SampleDesc;
d3d11Desc.Usage = D3D11_USAGE(pDesc->Usage);
d3d11Desc.BindFlags = pDesc->BindFlags;
d3d11Desc.CPUAccessFlags = pDesc->CPUAccessFlags;
d3d11Desc.MiscFlags = ConvertD3D10ResourceFlags(pDesc->MiscFlags);
ID3D11Texture2D* d3d11Texture2D = nullptr;
HRESULT hr = m_device->CreateTexture2D(&d3d11Desc,
reinterpret_cast<const D3D11_SUBRESOURCE_DATA*>(pInitialData),
ppTexture2D != nullptr ? &d3d11Texture2D : nullptr);
if (FAILED(hr))
return hr;
if (ppTexture2D != nullptr) {
*ppTexture2D = static_cast<D3D11Texture2D*>(d3d11Texture2D)->GetD3D10Iface();
return S_OK;
} return S_FALSE;
}
@ -120,8 +166,31 @@ namespace dxvk {
const D3D10_TEXTURE3D_DESC* pDesc,
const D3D10_SUBRESOURCE_DATA* pInitialData,
ID3D10Texture3D** ppTexture3D) {
Logger::err("D3D10Device::CreateTexture3D: Not implemented");
return E_NOTIMPL;
InitReturnPtr(ppTexture3D);
D3D11_TEXTURE3D_DESC d3d11Desc;
d3d11Desc.Width = pDesc->Width;
d3d11Desc.Height = pDesc->Height;
d3d11Desc.Depth = pDesc->Depth;
d3d11Desc.MipLevels = pDesc->MipLevels;
d3d11Desc.Format = pDesc->Format;
d3d11Desc.Usage = D3D11_USAGE(pDesc->Usage);
d3d11Desc.BindFlags = pDesc->BindFlags;
d3d11Desc.CPUAccessFlags = pDesc->CPUAccessFlags;
d3d11Desc.MiscFlags = ConvertD3D10ResourceFlags(pDesc->MiscFlags);
ID3D11Texture3D* d3d11Texture3D = nullptr;
HRESULT hr = m_device->CreateTexture3D(&d3d11Desc,
reinterpret_cast<const D3D11_SUBRESOURCE_DATA*>(pInitialData),
ppTexture3D != nullptr ? &d3d11Texture3D : nullptr);
if (FAILED(hr))
return hr;
if (ppTexture3D != nullptr) {
*ppTexture3D = static_cast<D3D11Texture3D*>(d3d11Texture3D)->GetD3D10Iface();
return S_OK;
} return S_FALSE;
}

View File

@ -1,4 +1,6 @@
#pragma once
#include "../dxgi/dxgi_include.h"
#include <d3d10_1.h>
#include <d3d11_1.h>
#include <d3d11_1.h>

344
src/d3d10/d3d10_texture.cpp Normal file
View File

@ -0,0 +1,344 @@
#include "d3d10_texture.h"
#include "../d3d11/d3d11_device.h"
#include "../d3d11/d3d11_context.h"
#include "../d3d11/d3d11_texture.h"
namespace dxvk {
HRESULT STDMETHODCALLTYPE D3D10Texture1D::QueryInterface(
REFIID riid,
void** ppvObject) {
return m_d3d11->QueryInterface(riid, ppvObject);
}
ULONG STDMETHODCALLTYPE D3D10Texture1D::AddRef() {
return m_d3d11->AddRef();
}
ULONG STDMETHODCALLTYPE D3D10Texture1D::Release() {
return m_d3d11->Release();
}
void STDMETHODCALLTYPE D3D10Texture1D::GetDevice(
ID3D10Device** ppDevice) {
GetD3D10Device(m_d3d11, ppDevice);
}
HRESULT STDMETHODCALLTYPE D3D10Texture1D::GetPrivateData(
REFGUID guid,
UINT* pDataSize,
void* pData) {
return m_d3d11->GetPrivateData(guid, pDataSize, pData);
}
HRESULT STDMETHODCALLTYPE D3D10Texture1D::SetPrivateData(
REFGUID guid,
UINT DataSize,
const void* pData) {
return m_d3d11->SetPrivateData(guid, DataSize, pData);
}
HRESULT STDMETHODCALLTYPE D3D10Texture1D::SetPrivateDataInterface(
REFGUID guid,
const IUnknown* pData) {
return m_d3d11->SetPrivateDataInterface(guid, pData);
}
void STDMETHODCALLTYPE D3D10Texture1D::GetType(
D3D10_RESOURCE_DIMENSION* rType) {
*rType = D3D10_RESOURCE_DIMENSION_TEXTURE1D;
}
void STDMETHODCALLTYPE D3D10Texture1D::SetEvictionPriority(
UINT EvictionPriority) {
m_d3d11->SetEvictionPriority(EvictionPriority);
}
UINT STDMETHODCALLTYPE D3D10Texture1D::GetEvictionPriority() {
return m_d3d11->GetEvictionPriority();
}
HRESULT STDMETHODCALLTYPE D3D10Texture1D::Map(
UINT Subresource,
D3D10_MAP MapType,
UINT MapFlags,
void** ppData) {
Com<ID3D11DeviceContext> ctx;
GetD3D11Context(m_d3d11, &ctx);
D3D11_MAPPED_SUBRESOURCE sr;
HRESULT hr = ctx->Map(m_d3d11, Subresource,
D3D11_MAP(MapType), MapFlags, &sr);
if (FAILED(hr))
return hr;
if (ppData != nullptr) {
*ppData = sr.pData;
return S_OK;
} return S_FALSE;
}
void STDMETHODCALLTYPE D3D10Texture1D::Unmap(
UINT Subresource) {
Com<ID3D11DeviceContext> ctx;
GetD3D11Context(m_d3d11, &ctx);
ctx->Unmap(m_d3d11, Subresource);
}
void STDMETHODCALLTYPE D3D10Texture1D::GetDesc(
D3D10_TEXTURE1D_DESC* pDesc) {
D3D11_TEXTURE1D_DESC d3d11Desc;
m_d3d11->GetDesc(&d3d11Desc);
pDesc->Width = d3d11Desc.Width;
pDesc->MipLevels = d3d11Desc.MipLevels;
pDesc->ArraySize = d3d11Desc.ArraySize;
pDesc->Format = d3d11Desc.Format;
pDesc->Usage = D3D10_USAGE(d3d11Desc.Usage);
pDesc->BindFlags = d3d11Desc.BindFlags & 0x7F;
pDesc->CPUAccessFlags = d3d11Desc.CPUAccessFlags;
pDesc->MiscFlags = ConvertD3D11ResourceFlags(d3d11Desc.MiscFlags);
}
HRESULT STDMETHODCALLTYPE D3D10Texture2D::QueryInterface(
REFIID riid,
void** ppvObject) {
return m_d3d11->QueryInterface(riid, ppvObject);
}
ULONG STDMETHODCALLTYPE D3D10Texture2D::AddRef() {
return m_d3d11->AddRef();
}
ULONG STDMETHODCALLTYPE D3D10Texture2D::Release() {
return m_d3d11->Release();
}
void STDMETHODCALLTYPE D3D10Texture2D::GetDevice(
ID3D10Device** ppDevice) {
GetD3D10Device(m_d3d11, ppDevice);
}
HRESULT STDMETHODCALLTYPE D3D10Texture2D::GetPrivateData(
REFGUID guid,
UINT* pDataSize,
void* pData) {
return m_d3d11->GetPrivateData(guid, pDataSize, pData);
}
HRESULT STDMETHODCALLTYPE D3D10Texture2D::SetPrivateData(
REFGUID guid,
UINT DataSize,
const void* pData) {
return m_d3d11->SetPrivateData(guid, DataSize, pData);
}
HRESULT STDMETHODCALLTYPE D3D10Texture2D::SetPrivateDataInterface(
REFGUID guid,
const IUnknown* pData) {
return m_d3d11->SetPrivateDataInterface(guid, pData);
}
void STDMETHODCALLTYPE D3D10Texture2D::GetType(
D3D10_RESOURCE_DIMENSION* rType) {
*rType = D3D10_RESOURCE_DIMENSION_TEXTURE2D;
}
void STDMETHODCALLTYPE D3D10Texture2D::SetEvictionPriority(
UINT EvictionPriority) {
m_d3d11->SetEvictionPriority(EvictionPriority);
}
UINT STDMETHODCALLTYPE D3D10Texture2D::GetEvictionPriority() {
return m_d3d11->GetEvictionPriority();
}
HRESULT STDMETHODCALLTYPE D3D10Texture2D::Map(
UINT Subresource,
D3D10_MAP MapType,
UINT MapFlags,
D3D10_MAPPED_TEXTURE2D* pMappedTex2D) {
Com<ID3D11DeviceContext> ctx;
GetD3D11Context(m_d3d11, &ctx);
D3D11_MAPPED_SUBRESOURCE sr;
HRESULT hr = ctx->Map(m_d3d11, Subresource,
D3D11_MAP(MapType), MapFlags, &sr);
if (FAILED(hr))
return hr;
if (pMappedTex2D != nullptr) {
pMappedTex2D->pData = sr.pData;
pMappedTex2D->RowPitch = sr.RowPitch;
return S_OK;
} return S_FALSE;
}
void STDMETHODCALLTYPE D3D10Texture2D::Unmap(
UINT Subresource) {
Com<ID3D11DeviceContext> ctx;
GetD3D11Context(m_d3d11, &ctx);
ctx->Unmap(m_d3d11, Subresource);
}
void STDMETHODCALLTYPE D3D10Texture2D::GetDesc(
D3D10_TEXTURE2D_DESC* pDesc) {
D3D11_TEXTURE2D_DESC d3d11Desc;
m_d3d11->GetDesc(&d3d11Desc);
pDesc->Width = d3d11Desc.Width;
pDesc->Height = d3d11Desc.Height;
pDesc->MipLevels = d3d11Desc.MipLevels;
pDesc->ArraySize = d3d11Desc.ArraySize;
pDesc->Format = d3d11Desc.Format;
pDesc->SampleDesc = d3d11Desc.SampleDesc;
pDesc->Usage = D3D10_USAGE(d3d11Desc.Usage);
pDesc->BindFlags = d3d11Desc.BindFlags & 0x7F;
pDesc->CPUAccessFlags = d3d11Desc.CPUAccessFlags;
pDesc->MiscFlags = ConvertD3D11ResourceFlags(d3d11Desc.MiscFlags);
}
HRESULT STDMETHODCALLTYPE D3D10Texture3D::QueryInterface(
REFIID riid,
void** ppvObject) {
return m_d3d11->QueryInterface(riid, ppvObject);
}
ULONG STDMETHODCALLTYPE D3D10Texture3D::AddRef() {
return m_d3d11->AddRef();
}
ULONG STDMETHODCALLTYPE D3D10Texture3D::Release() {
return m_d3d11->Release();
}
void STDMETHODCALLTYPE D3D10Texture3D::GetDevice(
ID3D10Device** ppDevice) {
GetD3D10Device(m_d3d11, ppDevice);
}
HRESULT STDMETHODCALLTYPE D3D10Texture3D::GetPrivateData(
REFGUID guid,
UINT* pDataSize,
void* pData) {
return m_d3d11->GetPrivateData(guid, pDataSize, pData);
}
HRESULT STDMETHODCALLTYPE D3D10Texture3D::SetPrivateData(
REFGUID guid,
UINT DataSize,
const void* pData) {
return m_d3d11->SetPrivateData(guid, DataSize, pData);
}
HRESULT STDMETHODCALLTYPE D3D10Texture3D::SetPrivateDataInterface(
REFGUID guid,
const IUnknown* pData) {
return m_d3d11->SetPrivateDataInterface(guid, pData);
}
void STDMETHODCALLTYPE D3D10Texture3D::GetType(
D3D10_RESOURCE_DIMENSION* rType) {
*rType = D3D10_RESOURCE_DIMENSION_TEXTURE3D;
}
void STDMETHODCALLTYPE D3D10Texture3D::SetEvictionPriority(
UINT EvictionPriority) {
m_d3d11->SetEvictionPriority(EvictionPriority);
}
UINT STDMETHODCALLTYPE D3D10Texture3D::GetEvictionPriority() {
return m_d3d11->GetEvictionPriority();
}
HRESULT STDMETHODCALLTYPE D3D10Texture3D::Map(
UINT Subresource,
D3D10_MAP MapType,
UINT MapFlags,
D3D10_MAPPED_TEXTURE3D* pMappedTex3D) {
Com<ID3D11DeviceContext> ctx;
GetD3D11Context(m_d3d11, &ctx);
D3D11_MAPPED_SUBRESOURCE sr;
HRESULT hr = ctx->Map(m_d3d11, Subresource,
D3D11_MAP(MapType), MapFlags, &sr);
if (FAILED(hr))
return hr;
if (pMappedTex3D != nullptr) {
pMappedTex3D->pData = sr.pData;
pMappedTex3D->RowPitch = sr.RowPitch;
pMappedTex3D->DepthPitch = sr.DepthPitch;
return S_OK;
} return S_FALSE;
}
void STDMETHODCALLTYPE D3D10Texture3D::Unmap(
UINT Subresource) {
Com<ID3D11DeviceContext> ctx;
GetD3D11Context(m_d3d11, &ctx);
ctx->Unmap(m_d3d11, Subresource);
}
void STDMETHODCALLTYPE D3D10Texture3D::GetDesc(
D3D10_TEXTURE3D_DESC* pDesc) {
D3D11_TEXTURE3D_DESC d3d11Desc;
m_d3d11->GetDesc(&d3d11Desc);
pDesc->Width = d3d11Desc.Width;
pDesc->Height = d3d11Desc.Height;
pDesc->Depth = d3d11Desc.Depth;
pDesc->MipLevels = d3d11Desc.MipLevels;
pDesc->Format = d3d11Desc.Format;
pDesc->Usage = D3D10_USAGE(d3d11Desc.Usage);
pDesc->BindFlags = d3d11Desc.BindFlags & 0x7F;
pDesc->CPUAccessFlags = d3d11Desc.CPUAccessFlags;
pDesc->MiscFlags = ConvertD3D11ResourceFlags(d3d11Desc.MiscFlags);
}
}

206
src/d3d10/d3d10_texture.h Normal file
View File

@ -0,0 +1,206 @@
#pragma once
#include "d3d10_util.h"
namespace dxvk {
class D3D11Device;
class D3D11Texture1D;
class D3D11Texture2D;
class D3D11Texture3D;
///////////////////////////////////////////
// D 3 D 1 0 T E X T U R E 1 D
class D3D10Texture1D : public ID3D10Texture1D {
public:
D3D10Texture1D(D3D11Texture1D* pParent)
: m_d3d11(pParent) { }
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject);
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
void STDMETHODCALLTYPE GetDevice(
ID3D10Device** ppDevice);
HRESULT STDMETHODCALLTYPE GetPrivateData(
REFGUID guid,
UINT* pDataSize,
void* pData);
HRESULT STDMETHODCALLTYPE SetPrivateData(
REFGUID guid,
UINT DataSize,
const void* pData);
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
REFGUID guid,
const IUnknown* pData);
void STDMETHODCALLTYPE GetType(
D3D10_RESOURCE_DIMENSION* rType);
void STDMETHODCALLTYPE SetEvictionPriority(
UINT EvictionPriority);
UINT STDMETHODCALLTYPE GetEvictionPriority();
HRESULT STDMETHODCALLTYPE Map(
UINT Subresource,
D3D10_MAP MapType,
UINT MapFlags,
void** ppData);
void STDMETHODCALLTYPE Unmap(
UINT Subresource);
void STDMETHODCALLTYPE GetDesc(
D3D10_TEXTURE1D_DESC* pDesc);
D3D11Texture1D* GetD3D11Iface() {
return m_d3d11;
}
private:
D3D11Texture1D* m_d3d11;
};
///////////////////////////////////////////
// D 3 D 1 0 T E X T U R E 2 D
class D3D10Texture2D : public ID3D10Texture2D {
public:
D3D10Texture2D(D3D11Texture2D* pParent)
: m_d3d11(pParent) { }
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject);
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
void STDMETHODCALLTYPE GetDevice(
ID3D10Device** ppDevice);
HRESULT STDMETHODCALLTYPE GetPrivateData(
REFGUID guid,
UINT* pDataSize,
void* pData);
HRESULT STDMETHODCALLTYPE SetPrivateData(
REFGUID guid,
UINT DataSize,
const void* pData);
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
REFGUID guid,
const IUnknown* pData);
void STDMETHODCALLTYPE GetType(
D3D10_RESOURCE_DIMENSION* rType);
void STDMETHODCALLTYPE SetEvictionPriority(
UINT EvictionPriority);
UINT STDMETHODCALLTYPE GetEvictionPriority();
HRESULT STDMETHODCALLTYPE Map(
UINT Subresource,
D3D10_MAP MapType,
UINT MapFlags,
D3D10_MAPPED_TEXTURE2D* pMappedTex2D);
void STDMETHODCALLTYPE Unmap(
UINT Subresource);
void STDMETHODCALLTYPE GetDesc(
D3D10_TEXTURE2D_DESC* pDesc);
D3D11Texture2D* GetD3D11Iface() {
return m_d3d11;
}
private:
D3D11Texture2D* m_d3d11;
};
///////////////////////////////////////////
// D 3 D 1 0 T E X T U R E 3 D
class D3D10Texture3D : public ID3D10Texture3D {
public:
D3D10Texture3D(D3D11Texture3D* pParent)
: m_d3d11(pParent) { }
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject);
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
void STDMETHODCALLTYPE GetDevice(
ID3D10Device** ppDevice);
HRESULT STDMETHODCALLTYPE GetPrivateData(
REFGUID guid,
UINT* pDataSize,
void* pData);
HRESULT STDMETHODCALLTYPE SetPrivateData(
REFGUID guid,
UINT DataSize,
const void* pData);
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
REFGUID guid,
const IUnknown* pData);
void STDMETHODCALLTYPE GetType(
D3D10_RESOURCE_DIMENSION* rType);
void STDMETHODCALLTYPE SetEvictionPriority(
UINT EvictionPriority);
UINT STDMETHODCALLTYPE GetEvictionPriority();
HRESULT STDMETHODCALLTYPE Map(
UINT Subresource,
D3D10_MAP MapType,
UINT MapFlags,
D3D10_MAPPED_TEXTURE3D* pMappedTex3D);
void STDMETHODCALLTYPE Unmap(
UINT Subresource);
void STDMETHODCALLTYPE GetDesc(
D3D10_TEXTURE3D_DESC* pDesc);
D3D11Texture3D* GetD3D11Iface() {
return m_d3d11;
}
private:
D3D11Texture3D* m_d3d11;
};
}

64
src/d3d10/d3d10_util.cpp Normal file
View File

@ -0,0 +1,64 @@
#include "d3d10_util.h"
#include "d3d10_device.h"
#include "../d3d11/d3d11_device.h"
namespace dxvk {
UINT ConvertD3D10ResourceFlags(UINT MiscFlags) {
UINT result = 0;
if (MiscFlags & D3D10_RESOURCE_MISC_GENERATE_MIPS)
result |= D3D11_RESOURCE_MISC_GENERATE_MIPS;
if (MiscFlags & D3D10_RESOURCE_MISC_SHARED)
result |= D3D11_RESOURCE_MISC_SHARED;
if (MiscFlags & D3D10_RESOURCE_MISC_TEXTURECUBE)
result |= D3D11_RESOURCE_MISC_TEXTURECUBE;
if (MiscFlags & D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX)
result |= D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;
if (MiscFlags & D3D10_RESOURCE_MISC_GDI_COMPATIBLE)
result |= D3D11_RESOURCE_MISC_GDI_COMPATIBLE;
return result;
}
UINT ConvertD3D11ResourceFlags(UINT MiscFlags) {
UINT result = 0;
if (MiscFlags & D3D11_RESOURCE_MISC_GENERATE_MIPS)
result |= D3D10_RESOURCE_MISC_GENERATE_MIPS;
if (MiscFlags & D3D11_RESOURCE_MISC_SHARED)
result |= D3D10_RESOURCE_MISC_SHARED;
if (MiscFlags & D3D11_RESOURCE_MISC_TEXTURECUBE)
result |= D3D10_RESOURCE_MISC_TEXTURECUBE;
if (MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX)
result |= D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX;
if (MiscFlags & D3D11_RESOURCE_MISC_GDI_COMPATIBLE)
result |= D3D10_RESOURCE_MISC_GDI_COMPATIBLE;
return result;
}
void GetD3D10Device(
ID3D11DeviceChild* pObject,
ID3D10Device** ppDevice) {
ID3D11Device* d3d11Device = nullptr;
pObject->GetDevice(&d3d11Device);
*ppDevice = static_cast<D3D11Device*>(d3d11Device)->GetD3D10Interface();
}
void GetD3D11Device(
ID3D11DeviceChild* pObject,
ID3D11Device** ppDevice) {
pObject->GetDevice(ppDevice);
}
void GetD3D11Context(
ID3D11DeviceChild* pObject,
ID3D11DeviceContext** ppContext) {
Com<ID3D11Device> d3d11Device;
pObject->GetDevice(&d3d11Device);
d3d11Device->GetImmediateContext(ppContext);
}
}

48
src/d3d10/d3d10_util.h Normal file
View File

@ -0,0 +1,48 @@
#pragma once
#include "d3d10_include.h"
namespace dxvk {
/**
* \brief Converts misc. resource flags
*
* Converts the D3D11 misc. resource flags to
* their D3D10 equivalents and vice versa.
* \param [in] MiscFlags Original bit mask
* \returns Converted bit mask
*/
UINT ConvertD3D10ResourceFlags(UINT MiscFlags);
UINT ConvertD3D11ResourceFlags(UINT MiscFlags);
/**
* \brief Retrieves D3D10 device from D3D11 object
*
* \param [in] pObject The D3D11 device child
* \param [out] ppDevice The D3D10 device pointer
*/
void GetD3D10Device(
ID3D11DeviceChild* pObject,
ID3D10Device** ppDevice);
/**
* \brief Retrieves D3D11 device from D3D11 object
*
* \param [in] pObject The D3D11 device child
* \param [out] ppDevice The D3D11 device pointer
*/
void GetD3D11Device(
ID3D11DeviceChild* pObject,
ID3D11Device** ppDevice);
/**
* \brief Retrieves D3D11 context from D3D11 object
*
* \param [in] pObject The D3D11 device child
* \param [out] ppContext The D3D11 immediate context
*/
void GetD3D11Context(
ID3D11DeviceChild* pObject,
ID3D11DeviceContext** ppContext);
}

View File

@ -481,8 +481,9 @@ namespace dxvk {
D3D11Texture1D::D3D11Texture1D(
D3D11Device* pDevice,
const D3D11_COMMON_TEXTURE_DESC* pDesc)
: m_texture(pDevice, pDesc, D3D11_RESOURCE_DIMENSION_TEXTURE1D),
m_interop(this, &m_texture) {
: m_texture (pDevice, pDesc, D3D11_RESOURCE_DIMENSION_TEXTURE1D),
m_interop (this, &m_texture),
m_d3d10 (this) {
}
@ -503,6 +504,13 @@ namespace dxvk {
return S_OK;
}
if (riid == __uuidof(ID3D10DeviceChild)
|| riid == __uuidof(ID3D10Resource)
|| riid == __uuidof(ID3D10Texture1D)) {
*ppvObject = ref(&m_d3d10);
return S_OK;
}
if (riid == __uuidof(IDXGIVkInteropSurface)) {
*ppvObject = ref(&m_interop);
return S_OK;
@ -552,8 +560,9 @@ namespace dxvk {
D3D11Texture2D::D3D11Texture2D(
D3D11Device* pDevice,
const D3D11_COMMON_TEXTURE_DESC* pDesc)
: m_texture(pDevice, pDesc, D3D11_RESOURCE_DIMENSION_TEXTURE2D),
m_interop(this, &m_texture) {
: m_texture (pDevice, pDesc, D3D11_RESOURCE_DIMENSION_TEXTURE2D),
m_interop (this, &m_texture),
m_d3d10 (this) {
}
@ -573,6 +582,13 @@ namespace dxvk {
*ppvObject = ref(this);
return S_OK;
}
if (riid == __uuidof(ID3D10DeviceChild)
|| riid == __uuidof(ID3D10Resource)
|| riid == __uuidof(ID3D10Texture2D)) {
*ppvObject = ref(&m_d3d10);
return S_OK;
}
if (riid == __uuidof(IDXGIVkInteropSurface)) {
*ppvObject = ref(&m_interop);
@ -625,8 +641,9 @@ namespace dxvk {
D3D11Texture3D::D3D11Texture3D(
D3D11Device* pDevice,
const D3D11_COMMON_TEXTURE_DESC* pDesc)
: m_texture(pDevice, pDesc, D3D11_RESOURCE_DIMENSION_TEXTURE3D),
m_interop(this, &m_texture) {
: m_texture (pDevice, pDesc, D3D11_RESOURCE_DIMENSION_TEXTURE3D),
m_interop (this, &m_texture),
m_d3d10 (this) {
}
@ -647,6 +664,13 @@ namespace dxvk {
return S_OK;
}
if (riid == __uuidof(ID3D10DeviceChild)
|| riid == __uuidof(ID3D10Resource)
|| riid == __uuidof(ID3D10Texture3D)) {
*ppvObject = ref(&m_d3d10);
return S_OK;
}
if (riid == __uuidof(IDXGIVkInteropSurface)) {
*ppvObject = ref(&m_interop);
return S_OK;

View File

@ -1,6 +1,8 @@
#pragma once
#include <dxvk_device.h>
#include "../dxvk/dxvk_device.h"
#include "../d3d10/d3d10_texture.h"
#include "d3d11_device_child.h"
#include "d3d11_interfaces.h"
@ -281,11 +283,16 @@ namespace dxvk {
D3D11CommonTexture* GetCommonTexture() {
return &m_texture;
}
D3D10Texture1D* GetD3D10Iface() {
return &m_d3d10;
}
private:
D3D11CommonTexture m_texture;
D3D11VkInteropSurface m_interop;
D3D10Texture1D m_d3d10;
};
@ -323,10 +330,15 @@ namespace dxvk {
return &m_texture;
}
D3D10Texture2D* GetD3D10Iface() {
return &m_d3d10;
}
private:
D3D11CommonTexture m_texture;
D3D11VkInteropSurface m_interop;
D3D10Texture2D m_d3d10;
};
@ -364,10 +376,15 @@ namespace dxvk {
return &m_texture;
}
D3D10Texture3D* GetD3D10Iface() {
return &m_d3d10;
}
private:
D3D11CommonTexture m_texture;
D3D11VkInteropSurface m_interop;
D3D10Texture3D m_d3d10;
};

View File

@ -1,5 +1,7 @@
d3d10_src = [
'../d3d10/d3d10_device.cpp',
'../d3d10/d3d10_texture.cpp',
'../d3d10/d3d10_util.cpp',
]
d3d11_src = [