mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-23 10:54:14 +01:00
[d3d8] Set priority only for D3DPOOL_MANAGED resources
This commit is contained in:
parent
8efa3ed84a
commit
84b2ac3f97
@ -16,8 +16,7 @@ namespace dxvk {
|
||||
Com<D3D9>&& pBuffer,
|
||||
D3DPOOL Pool,
|
||||
DWORD Usage)
|
||||
: D3D8Resource<D3D9, D3D8> (pDevice, std::move(pBuffer))
|
||||
, m_pool (Pool)
|
||||
: D3D8Resource<D3D9, D3D8> (pDevice, Pool, std::move(pBuffer))
|
||||
, m_usage (Usage) {
|
||||
m_options = this->GetParent()->GetOptions();
|
||||
}
|
||||
@ -52,7 +51,6 @@ namespace dxvk {
|
||||
protected:
|
||||
|
||||
const D3D8Options* m_options;
|
||||
const D3DPOOL m_pool;
|
||||
const DWORD m_usage;
|
||||
|
||||
};
|
||||
|
@ -287,7 +287,7 @@ namespace dxvk {
|
||||
HRESULT res = GetD3D9()->GetBackBuffer(0, iBackBuffer, (d3d9::D3DBACKBUFFER_TYPE)Type, &pSurface9);
|
||||
|
||||
if (likely(SUCCEEDED(res))) {
|
||||
m_backBuffers[iBackBuffer] = new D3D8Surface(this, std::move(pSurface9));
|
||||
m_backBuffers[iBackBuffer] = new D3D8Surface(this, D3DPOOL_DEFAULT, std::move(pSurface9));
|
||||
*ppBackBuffer = m_backBuffers[iBackBuffer].ref();
|
||||
}
|
||||
|
||||
@ -347,7 +347,7 @@ namespace dxvk {
|
||||
NULL);
|
||||
|
||||
if (likely(SUCCEEDED(res)))
|
||||
*ppTexture = ref(new D3D8Texture2D(this, std::move(pTex9)));
|
||||
*ppTexture = ref(new D3D8Texture2D(this, Pool, std::move(pTex9)));
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -381,7 +381,7 @@ namespace dxvk {
|
||||
NULL);
|
||||
|
||||
if (likely(SUCCEEDED(res)))
|
||||
*ppVolumeTexture = ref(new D3D8Texture3D(this, std::move(pVolume9)));
|
||||
*ppVolumeTexture = ref(new D3D8Texture3D(this, Pool, std::move(pVolume9)));
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -414,7 +414,7 @@ namespace dxvk {
|
||||
NULL);
|
||||
|
||||
if (likely(SUCCEEDED(res)))
|
||||
*ppCubeTexture = ref(new D3D8TextureCube(this, std::move(pCube9)));
|
||||
*ppCubeTexture = ref(new D3D8TextureCube(this, Pool, std::move(pCube9)));
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -493,7 +493,7 @@ namespace dxvk {
|
||||
NULL);
|
||||
|
||||
if (likely(SUCCEEDED(res)))
|
||||
*ppSurface = ref(new D3D8Surface(this, std::move(pSurf9)));
|
||||
*ppSurface = ref(new D3D8Surface(this, D3DPOOL_DEFAULT, std::move(pSurf9)));
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -526,7 +526,7 @@ namespace dxvk {
|
||||
NULL);
|
||||
|
||||
if (likely(SUCCEEDED(res)))
|
||||
*ppSurface = ref(new D3D8Surface(this, std::move(pSurf9)));
|
||||
*ppSurface = ref(new D3D8Surface(this, D3DPOOL_DEFAULT, std::move(pSurf9)));
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -558,7 +558,7 @@ namespace dxvk {
|
||||
NULL);
|
||||
|
||||
if (likely(SUCCEEDED(res)))
|
||||
*ppSurface = ref(new D3D8Surface(this, std::move(pSurf)));
|
||||
*ppSurface = ref(new D3D8Surface(this, pool, std::move(pSurf)));
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -1064,7 +1064,7 @@ namespace dxvk {
|
||||
HRESULT res = GetD3D9()->GetRenderTarget(0, &pRT9); // use RT index 0
|
||||
|
||||
if (likely(SUCCEEDED(res))) {
|
||||
m_renderTarget = new D3D8Surface(this, std::move(pRT9));
|
||||
m_renderTarget = new D3D8Surface(this, D3DPOOL_DEFAULT, std::move(pRT9));
|
||||
*ppRenderTarget = m_renderTarget.ref();
|
||||
}
|
||||
|
||||
@ -1088,7 +1088,7 @@ namespace dxvk {
|
||||
HRESULT res = GetD3D9()->GetDepthStencilSurface(&pStencil9);
|
||||
|
||||
if (likely(SUCCEEDED(res))) {
|
||||
m_depthStencil = new D3D8Surface(this, std::move(pStencil9));
|
||||
m_depthStencil = new D3D8Surface(this, D3DPOOL_DEFAULT, std::move(pStencil9));
|
||||
*ppZStencilSurface = m_depthStencil.ref();
|
||||
}
|
||||
|
||||
|
@ -401,14 +401,14 @@ namespace dxvk {
|
||||
for (UINT i = 0; i < m_presentParams.BackBufferCount; i++) {
|
||||
Com<d3d9::IDirect3DSurface9> pSurface9;
|
||||
GetD3D9()->GetBackBuffer(0, i, d3d9::D3DBACKBUFFER_TYPE_MONO, &pSurface9);
|
||||
m_backBuffers[i] = new D3D8Surface(this, std::move(pSurface9));
|
||||
m_backBuffers[i] = new D3D8Surface(this, D3DPOOL_DEFAULT, std::move(pSurface9));
|
||||
}
|
||||
|
||||
Com<d3d9::IDirect3DSurface9> pStencil9;
|
||||
// This call will fail if the D3D9 device is created without
|
||||
// the EnableAutoDepthStencil presentation parameter set to TRUE.
|
||||
HRESULT res = GetD3D9()->GetDepthStencilSurface(&pStencil9);
|
||||
m_autoDepthStencil = FAILED(res) ? nullptr : new D3D8Surface(this, std::move(pStencil9));
|
||||
m_autoDepthStencil = FAILED(res) ? nullptr : new D3D8Surface(this, D3DPOOL_DEFAULT, std::move(pStencil9));
|
||||
|
||||
m_renderTarget = m_backBuffers[0];
|
||||
m_depthStencil = m_autoDepthStencil;
|
||||
|
@ -18,8 +18,9 @@ namespace dxvk {
|
||||
|
||||
public:
|
||||
|
||||
D3D8Resource(D3D8Device* pDevice, Com<D3D9>&& Object)
|
||||
D3D8Resource(D3D8Device* pDevice, D3DPOOL Pool, Com<D3D9>&& Object)
|
||||
: D3D8DeviceChild<D3D9, D3D8>(pDevice, std::move(Object))
|
||||
, m_pool ( Pool )
|
||||
, m_priority ( 0 ) { }
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateData(
|
||||
@ -79,9 +80,14 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
DWORD STDMETHODCALLTYPE SetPriority(DWORD PriorityNew) {
|
||||
DWORD oldPriority = m_priority;
|
||||
m_priority = PriorityNew;
|
||||
return oldPriority;
|
||||
// Priority can only be set for D3DPOOL_MANAGED resources
|
||||
if (likely(m_pool == D3DPOOL_MANAGED)) {
|
||||
DWORD oldPriority = m_priority;
|
||||
m_priority = PriorityNew;
|
||||
return oldPriority;
|
||||
}
|
||||
|
||||
return m_priority;
|
||||
}
|
||||
|
||||
DWORD STDMETHODCALLTYPE GetPriority() {
|
||||
@ -99,7 +105,8 @@ namespace dxvk {
|
||||
|
||||
protected:
|
||||
|
||||
DWORD m_priority;
|
||||
const D3DPOOL m_pool;
|
||||
DWORD m_priority;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -16,9 +16,10 @@ namespace dxvk {
|
||||
|
||||
D3D8Subresource(
|
||||
D3D8Device* pDevice,
|
||||
const D3DPOOL Pool,
|
||||
Com<D3D9>&& Object,
|
||||
IDirect3DBaseTexture8* pBaseTexture)
|
||||
: Resource(pDevice, std::move(Object)),
|
||||
: Resource(pDevice, Pool, std::move(Object)),
|
||||
m_container(pBaseTexture) {
|
||||
}
|
||||
|
||||
|
@ -7,16 +7,18 @@ namespace dxvk {
|
||||
|
||||
D3D8Surface::D3D8Surface(
|
||||
D3D8Device* pDevice,
|
||||
const D3DPOOL Pool,
|
||||
IDirect3DBaseTexture8* pTexture,
|
||||
Com<d3d9::IDirect3DSurface9>&& pSurface)
|
||||
: D3D8SurfaceBase (pDevice, std::move(pSurface), pTexture) {
|
||||
: D3D8SurfaceBase (pDevice, Pool, std::move(pSurface), pTexture) {
|
||||
}
|
||||
|
||||
// A surface does not need to be attached to a texture
|
||||
D3D8Surface::D3D8Surface(
|
||||
D3D8Device* pDevice,
|
||||
const D3DPOOL Pool,
|
||||
Com<d3d9::IDirect3DSurface9>&& pSurface)
|
||||
: D3D8Surface (pDevice, nullptr, std::move(pSurface)) {
|
||||
: D3D8Surface (pDevice, Pool, nullptr, std::move(pSurface)) {
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D8Surface::GetDesc(D3DSURFACE_DESC* pDesc) {
|
||||
|
@ -15,11 +15,13 @@ namespace dxvk {
|
||||
|
||||
D3D8Surface(
|
||||
D3D8Device* pDevice,
|
||||
const D3DPOOL Pool,
|
||||
IDirect3DBaseTexture8* pTexture,
|
||||
Com<d3d9::IDirect3DSurface9>&& pSurface);
|
||||
|
||||
D3D8Surface(
|
||||
D3D8Device* pDevice,
|
||||
const D3DPOOL Pool,
|
||||
Com<d3d9::IDirect3DSurface9>&& pSurface);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetDesc(D3DSURFACE_DESC* pDesc) final;
|
||||
|
@ -27,7 +27,7 @@ namespace dxvk {
|
||||
HRESULT res = GetD3D9()->GetBackBuffer(BackBuffer, (d3d9::D3DBACKBUFFER_TYPE)Type, &pSurface9);
|
||||
|
||||
if (likely(SUCCEEDED(res))) {
|
||||
m_backBuffers[BackBuffer] = new D3D8Surface(GetParent(), std::move(pSurface9));
|
||||
m_backBuffers[BackBuffer] = new D3D8Surface(GetParent(), D3DPOOL_DEFAULT, std::move(pSurface9));
|
||||
*ppBackBuffer = m_backBuffers[BackBuffer].ref();
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,9 @@ namespace dxvk {
|
||||
|
||||
D3D8Texture2D::D3D8Texture2D(
|
||||
D3D8Device* pDevice,
|
||||
const D3DPOOL Pool,
|
||||
Com<d3d9::IDirect3DTexture9>&& pTexture)
|
||||
: D3D8Texture2DBase(pDevice, std::move(pTexture), pTexture->GetLevelCount()) {
|
||||
: D3D8Texture2DBase(pDevice, Pool, std::move(pTexture), pTexture->GetLevelCount()) {
|
||||
}
|
||||
|
||||
D3DRESOURCETYPE STDMETHODCALLTYPE D3D8Texture2D::GetType() { return D3DRTYPE_TEXTURE; }
|
||||
@ -51,8 +52,9 @@ namespace dxvk {
|
||||
|
||||
D3D8Texture3D::D3D8Texture3D(
|
||||
D3D8Device* pDevice,
|
||||
const D3DPOOL Pool,
|
||||
Com<d3d9::IDirect3DVolumeTexture9>&& pVolumeTexture)
|
||||
: D3D8Texture3DBase(pDevice, std::move(pVolumeTexture), pVolumeTexture->GetLevelCount()) {}
|
||||
: D3D8Texture3DBase(pDevice, Pool, std::move(pVolumeTexture), pVolumeTexture->GetLevelCount()) {}
|
||||
|
||||
D3DRESOURCETYPE STDMETHODCALLTYPE D3D8Texture3D::GetType() { return D3DRTYPE_VOLUMETEXTURE; }
|
||||
|
||||
@ -98,8 +100,9 @@ namespace dxvk {
|
||||
|
||||
D3D8TextureCube::D3D8TextureCube(
|
||||
D3D8Device* pDevice,
|
||||
const D3DPOOL Pool,
|
||||
Com<d3d9::IDirect3DCubeTexture9>&& pTexture)
|
||||
: D3D8TextureCubeBase(pDevice, std::move(pTexture), pTexture->GetLevelCount() * CUBE_FACES) {
|
||||
: D3D8TextureCubeBase(pDevice, Pool, std::move(pTexture), pTexture->GetLevelCount() * CUBE_FACES) {
|
||||
}
|
||||
|
||||
D3DRESOURCETYPE STDMETHODCALLTYPE D3D8TextureCube::GetType() { return D3DRTYPE_CUBETEXTURE; }
|
||||
|
@ -21,9 +21,10 @@ namespace dxvk {
|
||||
|
||||
D3D8BaseTexture(
|
||||
D3D8Device* pDevice,
|
||||
const D3DPOOL Pool,
|
||||
Com<D3D9>&& pBaseTexture,
|
||||
UINT SubresourceCount)
|
||||
: D3D8Resource<D3D9, D3D8> ( pDevice, std::move(pBaseTexture) ) {
|
||||
: D3D8Resource<D3D9, D3D8> ( pDevice, Pool, std::move(pBaseTexture) ) {
|
||||
m_subresources.resize(SubresourceCount, nullptr);
|
||||
}
|
||||
|
||||
@ -74,7 +75,7 @@ namespace dxvk {
|
||||
Com<SubresourceType9> subresource = LookupSubresource(Index);
|
||||
|
||||
// Cache the subresource
|
||||
m_subresources[Index] = new SubresourceType(this->m_parent, this, std::move(subresource));
|
||||
m_subresources[Index] = new SubresourceType(this->m_parent, this->m_pool, this, std::move(subresource));
|
||||
} catch (HRESULT res) {
|
||||
return res;
|
||||
}
|
||||
@ -112,6 +113,7 @@ namespace dxvk {
|
||||
|
||||
D3D8Texture2D(
|
||||
D3D8Device* pDevice,
|
||||
const D3DPOOL Pool,
|
||||
Com<d3d9::IDirect3DTexture9>&& pTexture);
|
||||
|
||||
D3DRESOURCETYPE STDMETHODCALLTYPE GetType() final;
|
||||
@ -139,6 +141,7 @@ namespace dxvk {
|
||||
|
||||
D3D8Texture3D(
|
||||
D3D8Device* pDevice,
|
||||
const D3DPOOL Pool,
|
||||
Com<d3d9::IDirect3DVolumeTexture9>&& pVolumeTexture);
|
||||
|
||||
D3DRESOURCETYPE STDMETHODCALLTYPE GetType() final;
|
||||
@ -166,6 +169,7 @@ namespace dxvk {
|
||||
|
||||
D3D8TextureCube(
|
||||
D3D8Device* pDevice,
|
||||
const D3DPOOL Pool,
|
||||
Com<d3d9::IDirect3DCubeTexture9>&& pTexture);
|
||||
|
||||
D3DRESOURCETYPE STDMETHODCALLTYPE GetType() final;
|
||||
|
@ -6,9 +6,10 @@ namespace dxvk {
|
||||
|
||||
D3D8Volume::D3D8Volume(
|
||||
D3D8Device* pDevice,
|
||||
const D3DPOOL Pool,
|
||||
IDirect3DVolumeTexture8* pTexture,
|
||||
Com<d3d9::IDirect3DVolume9>&& pVolume)
|
||||
: D3D8VolumeBase(pDevice, std::move(pVolume), pTexture) {
|
||||
: D3D8VolumeBase(pDevice, Pool, std::move(pVolume), pTexture) {
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D8Volume::GetDesc(D3DVOLUME_DESC* pDesc) {
|
||||
|
@ -11,6 +11,7 @@ namespace dxvk {
|
||||
|
||||
D3D8Volume(
|
||||
D3D8Device* pDevice,
|
||||
const D3DPOOL Pool,
|
||||
IDirect3DVolumeTexture8* pTexture,
|
||||
Com<d3d9::IDirect3DVolume9>&& pVolume);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user