mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-07 16:54:14 +01:00
[d3d10] Implement D3D10SamplerState
This commit is contained in:
parent
7f357217b9
commit
759ff737a4
@ -335,8 +335,33 @@ namespace dxvk {
|
|||||||
HRESULT STDMETHODCALLTYPE D3D10Device::CreateSamplerState(
|
HRESULT STDMETHODCALLTYPE D3D10Device::CreateSamplerState(
|
||||||
const D3D10_SAMPLER_DESC* pSamplerDesc,
|
const D3D10_SAMPLER_DESC* pSamplerDesc,
|
||||||
ID3D10SamplerState** ppSamplerState) {
|
ID3D10SamplerState** ppSamplerState) {
|
||||||
Logger::err("D3D10Device::CreateSamplerState: Not implemented");
|
InitReturnPtr(ppSamplerState);
|
||||||
return E_NOTIMPL;
|
|
||||||
|
D3D11_SAMPLER_DESC d3d11Desc;
|
||||||
|
d3d11Desc.Filter = D3D11_FILTER(pSamplerDesc->Filter);
|
||||||
|
d3d11Desc.AddressU = D3D11_TEXTURE_ADDRESS_MODE(pSamplerDesc->AddressU);
|
||||||
|
d3d11Desc.AddressV = D3D11_TEXTURE_ADDRESS_MODE(pSamplerDesc->AddressV);
|
||||||
|
d3d11Desc.AddressW = D3D11_TEXTURE_ADDRESS_MODE(pSamplerDesc->AddressW);
|
||||||
|
d3d11Desc.MipLODBias = pSamplerDesc->MipLODBias;
|
||||||
|
d3d11Desc.MaxAnisotropy = pSamplerDesc->MaxAnisotropy;
|
||||||
|
d3d11Desc.ComparisonFunc = D3D11_COMPARISON_FUNC(pSamplerDesc->ComparisonFunc);
|
||||||
|
d3d11Desc.MinLOD = pSamplerDesc->MinLOD;
|
||||||
|
d3d11Desc.MaxLOD = pSamplerDesc->MaxLOD;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < 4; i++)
|
||||||
|
d3d11Desc.BorderColor[i] = pSamplerDesc->BorderColor[i];
|
||||||
|
|
||||||
|
ID3D11SamplerState* d3d11SamplerState = nullptr;
|
||||||
|
HRESULT hr = m_device->CreateSamplerState(&d3d11Desc,
|
||||||
|
ppSamplerState ? &d3d11SamplerState : nullptr);
|
||||||
|
|
||||||
|
if (FAILED(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
if (ppSamplerState) {
|
||||||
|
*ppSamplerState = static_cast<D3D11SamplerState*>(d3d11SamplerState)->GetD3D10Iface();
|
||||||
|
return S_OK;
|
||||||
|
} return S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
73
src/d3d10/d3d10_sampler.cpp
Normal file
73
src/d3d10/d3d10_sampler.cpp
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
#include "d3d10_sampler.h"
|
||||||
|
|
||||||
|
#include "../d3d11/d3d11_device.h"
|
||||||
|
#include "../d3d11/d3d11_sampler.h"
|
||||||
|
|
||||||
|
namespace dxvk {
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE D3D10SamplerState::QueryInterface(
|
||||||
|
REFIID riid,
|
||||||
|
void** ppvObject) {
|
||||||
|
return m_d3d11->QueryInterface(riid, ppvObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ULONG STDMETHODCALLTYPE D3D10SamplerState::AddRef() {
|
||||||
|
return m_d3d11->AddRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ULONG STDMETHODCALLTYPE D3D10SamplerState::Release() {
|
||||||
|
return m_d3d11->Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE D3D10SamplerState::GetDevice(
|
||||||
|
ID3D10Device** ppDevice) {
|
||||||
|
GetD3D10Device(m_d3d11, ppDevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE D3D10SamplerState::GetPrivateData(
|
||||||
|
REFGUID guid,
|
||||||
|
UINT* pDataSize,
|
||||||
|
void* pData) {
|
||||||
|
return m_d3d11->GetPrivateData(guid, pDataSize, pData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE D3D10SamplerState::SetPrivateData(
|
||||||
|
REFGUID guid,
|
||||||
|
UINT DataSize,
|
||||||
|
const void* pData) {
|
||||||
|
return m_d3d11->SetPrivateData(guid, DataSize, pData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE D3D10SamplerState::SetPrivateDataInterface(
|
||||||
|
REFGUID guid,
|
||||||
|
const IUnknown* pData) {
|
||||||
|
return m_d3d11->SetPrivateDataInterface(guid, pData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE D3D10SamplerState::GetDesc(
|
||||||
|
D3D10_SAMPLER_DESC* pDesc) {
|
||||||
|
D3D11_SAMPLER_DESC d3d11Desc;
|
||||||
|
m_d3d11->GetDesc(&d3d11Desc);
|
||||||
|
|
||||||
|
pDesc->Filter = D3D10_FILTER(d3d11Desc.Filter);
|
||||||
|
pDesc->AddressU = D3D10_TEXTURE_ADDRESS_MODE(d3d11Desc.AddressU);
|
||||||
|
pDesc->AddressV = D3D10_TEXTURE_ADDRESS_MODE(d3d11Desc.AddressV);
|
||||||
|
pDesc->AddressW = D3D10_TEXTURE_ADDRESS_MODE(d3d11Desc.AddressW);
|
||||||
|
pDesc->MipLODBias = d3d11Desc.MipLODBias;
|
||||||
|
pDesc->MaxAnisotropy = d3d11Desc.MaxAnisotropy;
|
||||||
|
pDesc->ComparisonFunc = D3D10_COMPARISON_FUNC(d3d11Desc.ComparisonFunc);
|
||||||
|
pDesc->MinLOD = d3d11Desc.MinLOD;
|
||||||
|
pDesc->MaxLOD = d3d11Desc.MaxLOD;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < 4; i++)
|
||||||
|
pDesc->BorderColor[i] = d3d11Desc.BorderColor[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
55
src/d3d10/d3d10_sampler.h
Normal file
55
src/d3d10/d3d10_sampler.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "d3d10_util.h"
|
||||||
|
|
||||||
|
namespace dxvk {
|
||||||
|
|
||||||
|
class D3D11Device;
|
||||||
|
class D3D11SamplerState;
|
||||||
|
|
||||||
|
class D3D10SamplerState : public ID3D10SamplerState {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
D3D10SamplerState(D3D11SamplerState* 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 GetDesc(
|
||||||
|
D3D10_SAMPLER_DESC* pDesc);
|
||||||
|
|
||||||
|
D3D11SamplerState* GetD3D11Iface() {
|
||||||
|
return m_d3d11;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
D3D11SamplerState* m_d3d11;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -7,7 +7,7 @@ namespace dxvk {
|
|||||||
D3D11SamplerState::D3D11SamplerState(
|
D3D11SamplerState::D3D11SamplerState(
|
||||||
D3D11Device* device,
|
D3D11Device* device,
|
||||||
const D3D11_SAMPLER_DESC& desc)
|
const D3D11_SAMPLER_DESC& desc)
|
||||||
: m_device(device), m_desc(desc) {
|
: m_device(device), m_desc(desc), m_d3d10(this) {
|
||||||
DxvkSamplerCreateInfo info;
|
DxvkSamplerCreateInfo info;
|
||||||
|
|
||||||
// While D3D11_FILTER is technically an enum, its value bits
|
// While D3D11_FILTER is technically an enum, its value bits
|
||||||
@ -65,6 +65,12 @@ namespace dxvk {
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (riid == __uuidof(ID3D10DeviceChild)
|
||||||
|
|| riid == __uuidof(ID3D10SamplerState)) {
|
||||||
|
*ppvObject = ref(&m_d3d10);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
Logger::warn("D3D11SamplerState::QueryInterface: Unknown interface query");
|
Logger::warn("D3D11SamplerState::QueryInterface: Unknown interface query");
|
||||||
Logger::warn(str::format(riid));
|
Logger::warn(str::format(riid));
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <dxvk_device.h>
|
#include "../dxvk/dxvk_device.h"
|
||||||
|
|
||||||
|
#include "../d3d10/d3d10_sampler.h"
|
||||||
|
|
||||||
#include "d3d11_device_child.h"
|
#include "d3d11_device_child.h"
|
||||||
|
|
||||||
@ -33,6 +35,10 @@ namespace dxvk {
|
|||||||
return m_sampler;
|
return m_sampler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
D3D10SamplerState* GetD3D10Iface() {
|
||||||
|
return &m_d3d10;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT NormalizeDesc(
|
static HRESULT NormalizeDesc(
|
||||||
D3D11_SAMPLER_DESC* pDesc);
|
D3D11_SAMPLER_DESC* pDesc);
|
||||||
|
|
||||||
@ -41,6 +47,7 @@ namespace dxvk {
|
|||||||
D3D11Device* const m_device;
|
D3D11Device* const m_device;
|
||||||
D3D11_SAMPLER_DESC m_desc;
|
D3D11_SAMPLER_DESC m_desc;
|
||||||
Rc<DxvkSampler> m_sampler;
|
Rc<DxvkSampler> m_sampler;
|
||||||
|
D3D10SamplerState m_d3d10;
|
||||||
|
|
||||||
static bool ValidateAddressMode(
|
static bool ValidateAddressMode(
|
||||||
D3D11_TEXTURE_ADDRESS_MODE Mode);
|
D3D11_TEXTURE_ADDRESS_MODE Mode);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
d3d10_src = [
|
d3d10_src = [
|
||||||
'../d3d10/d3d10_buffer.cpp',
|
'../d3d10/d3d10_buffer.cpp',
|
||||||
'../d3d10/d3d10_device.cpp',
|
'../d3d10/d3d10_device.cpp',
|
||||||
|
'../d3d10/d3d10_sampler.cpp',
|
||||||
'../d3d10/d3d10_texture.cpp',
|
'../d3d10/d3d10_texture.cpp',
|
||||||
'../d3d10/d3d10_util.cpp',
|
'../d3d10/d3d10_util.cpp',
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user