mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[d3d10] Implement D3D10RasterizerState
This commit is contained in:
parent
2a2079114a
commit
ddb2a7bd59
@ -393,8 +393,20 @@ namespace dxvk {
|
|||||||
HRESULT STDMETHODCALLTYPE D3D10Device::CreateRasterizerState(
|
HRESULT STDMETHODCALLTYPE D3D10Device::CreateRasterizerState(
|
||||||
const D3D10_RASTERIZER_DESC* pRasterizerDesc,
|
const D3D10_RASTERIZER_DESC* pRasterizerDesc,
|
||||||
ID3D10RasterizerState** ppRasterizerState) {
|
ID3D10RasterizerState** ppRasterizerState) {
|
||||||
Logger::err("D3D10Device::CreateRasterizerState: Not implemented");
|
InitReturnPtr(ppRasterizerState);
|
||||||
return E_NOTIMPL;
|
|
||||||
|
ID3D11RasterizerState* d3d11RasterizerState = nullptr;
|
||||||
|
HRESULT hr = m_device->CreateRasterizerState(
|
||||||
|
reinterpret_cast<const D3D11_RASTERIZER_DESC*>(pRasterizerDesc),
|
||||||
|
ppRasterizerState ? &d3d11RasterizerState : nullptr);
|
||||||
|
|
||||||
|
if (FAILED(hr))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
if (ppRasterizerState != nullptr) {
|
||||||
|
*ppRasterizerState = static_cast<D3D11RasterizerState*>(d3d11RasterizerState)->GetD3D10Iface();
|
||||||
|
return S_OK;
|
||||||
|
} return S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
60
src/d3d10/d3d10_rasterizer.cpp
Normal file
60
src/d3d10/d3d10_rasterizer.cpp
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#include "d3d10_rasterizer.h"
|
||||||
|
|
||||||
|
#include "../d3d11/d3d11_device.h"
|
||||||
|
#include "../d3d11/d3d11_rasterizer.h"
|
||||||
|
|
||||||
|
namespace dxvk {
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE D3D10RasterizerState::QueryInterface(
|
||||||
|
REFIID riid,
|
||||||
|
void** ppvObject) {
|
||||||
|
return m_d3d11->QueryInterface(riid, ppvObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ULONG STDMETHODCALLTYPE D3D10RasterizerState::AddRef() {
|
||||||
|
return m_d3d11->AddRef();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ULONG STDMETHODCALLTYPE D3D10RasterizerState::Release() {
|
||||||
|
return m_d3d11->Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE D3D10RasterizerState::GetDevice(
|
||||||
|
ID3D10Device** ppDevice) {
|
||||||
|
GetD3D10Device(m_d3d11, ppDevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE D3D10RasterizerState::GetPrivateData(
|
||||||
|
REFGUID guid,
|
||||||
|
UINT* pDataSize,
|
||||||
|
void* pData) {
|
||||||
|
return m_d3d11->GetPrivateData(guid, pDataSize, pData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE D3D10RasterizerState::SetPrivateData(
|
||||||
|
REFGUID guid,
|
||||||
|
UINT DataSize,
|
||||||
|
const void* pData) {
|
||||||
|
return m_d3d11->SetPrivateData(guid, DataSize, pData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE D3D10RasterizerState::SetPrivateDataInterface(
|
||||||
|
REFGUID guid,
|
||||||
|
const IUnknown* pData) {
|
||||||
|
return m_d3d11->SetPrivateDataInterface(guid, pData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void STDMETHODCALLTYPE D3D10RasterizerState::GetDesc(
|
||||||
|
D3D10_RASTERIZER_DESC* pDesc) {
|
||||||
|
static_assert(sizeof(D3D10_RASTERIZER_DESC) == sizeof(D3D11_RASTERIZER_DESC));
|
||||||
|
m_d3d11->GetDesc(reinterpret_cast<D3D11_RASTERIZER_DESC*>(pDesc));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
55
src/d3d10/d3d10_rasterizer.h
Normal file
55
src/d3d10/d3d10_rasterizer.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "d3d10_util.h"
|
||||||
|
|
||||||
|
namespace dxvk {
|
||||||
|
|
||||||
|
class D3D11RasterizerState;
|
||||||
|
class D3D11Device;
|
||||||
|
|
||||||
|
class D3D10RasterizerState : public ID3D10RasterizerState {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
D3D10RasterizerState(D3D11RasterizerState* 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_RASTERIZER_DESC* pDesc);
|
||||||
|
|
||||||
|
D3D11RasterizerState* GetD3D11Iface() {
|
||||||
|
return m_d3d11;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
D3D11RasterizerState* m_d3d11;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -6,8 +6,7 @@ namespace dxvk {
|
|||||||
D3D11RasterizerState::D3D11RasterizerState(
|
D3D11RasterizerState::D3D11RasterizerState(
|
||||||
D3D11Device* device,
|
D3D11Device* device,
|
||||||
const D3D11_RASTERIZER_DESC1& desc)
|
const D3D11_RASTERIZER_DESC1& desc)
|
||||||
: m_device(device), m_desc(desc) {
|
: m_device(device), m_desc(desc), m_d3d10(this) {
|
||||||
|
|
||||||
// Polygon mode. Determines whether the rasterizer fills
|
// Polygon mode. Determines whether the rasterizer fills
|
||||||
// a polygon or renders lines connecting the vertices.
|
// a polygon or renders lines connecting the vertices.
|
||||||
m_state.polygonMode = VK_POLYGON_MODE_FILL;
|
m_state.polygonMode = VK_POLYGON_MODE_FILL;
|
||||||
@ -73,6 +72,12 @@ namespace dxvk {
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (riid == __uuidof(ID3D10DeviceChild)
|
||||||
|
|| riid == __uuidof(ID3D10RasterizerState)) {
|
||||||
|
*ppvObject = ref(&m_d3d10);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
Logger::warn("D3D11RasterizerState::QueryInterface: Unknown interface query");
|
Logger::warn("D3D11RasterizerState::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_rasterizer.h"
|
||||||
|
|
||||||
#include "d3d11_device_child.h"
|
#include "d3d11_device_child.h"
|
||||||
|
|
||||||
@ -35,6 +37,10 @@ namespace dxvk {
|
|||||||
void BindToContext(
|
void BindToContext(
|
||||||
const Rc<DxvkContext>& ctx);
|
const Rc<DxvkContext>& ctx);
|
||||||
|
|
||||||
|
D3D10RasterizerState* GetD3D10Iface() {
|
||||||
|
return &m_d3d10;
|
||||||
|
}
|
||||||
|
|
||||||
static D3D11_RASTERIZER_DESC1 DefaultDesc();
|
static D3D11_RASTERIZER_DESC1 DefaultDesc();
|
||||||
|
|
||||||
static D3D11_RASTERIZER_DESC1 PromoteDesc(
|
static D3D11_RASTERIZER_DESC1 PromoteDesc(
|
||||||
@ -48,6 +54,7 @@ namespace dxvk {
|
|||||||
D3D11Device* const m_device;
|
D3D11Device* const m_device;
|
||||||
D3D11_RASTERIZER_DESC1 m_desc;
|
D3D11_RASTERIZER_DESC1 m_desc;
|
||||||
DxvkRasterizerState m_state;
|
DxvkRasterizerState m_state;
|
||||||
|
D3D10RasterizerState m_d3d10;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ d3d10_src = [
|
|||||||
'../d3d10/d3d10_depth_stencil.cpp',
|
'../d3d10/d3d10_depth_stencil.cpp',
|
||||||
'../d3d10/d3d10_device.cpp',
|
'../d3d10/d3d10_device.cpp',
|
||||||
'../d3d10/d3d10_input_layout.cpp',
|
'../d3d10/d3d10_input_layout.cpp',
|
||||||
|
'../d3d10/d3d10_rasterizer.cpp',
|
||||||
'../d3d10/d3d10_sampler.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