mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Added constant state object binding functions
This commit is contained in:
parent
ae0c186f26
commit
a895b0159b
@ -191,7 +191,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
struct DxvkConstantStateObjects {
|
||||
Rc<DxvkInputAssemblyState> inputAssembly;
|
||||
Rc<DxvkInputAssemblyState> inputAssemblyState;
|
||||
Rc<DxvkInputLayout> inputLayout;
|
||||
Rc<DxvkRasterizerState> rasterizerState;
|
||||
Rc<DxvkMultisampleState> multisampleState;
|
||||
|
@ -145,6 +145,60 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::setInputAssemblyState(
|
||||
const Rc<DxvkInputAssemblyState>& state) {
|
||||
if (m_state.co.inputAssemblyState != state) {
|
||||
m_state.co.inputAssemblyState = state;
|
||||
m_state.flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::setInputLayout(
|
||||
const Rc<DxvkInputLayout>& state) {
|
||||
if (m_state.co.inputLayout != state) {
|
||||
m_state.co.inputLayout = state;
|
||||
m_state.flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::setRasterizerState(
|
||||
const Rc<DxvkRasterizerState>& state) {
|
||||
if (m_state.co.rasterizerState != state) {
|
||||
m_state.co.rasterizerState = state;
|
||||
m_state.flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::setMultisampleState(
|
||||
const Rc<DxvkMultisampleState>& state) {
|
||||
if (m_state.co.multisampleState != state) {
|
||||
m_state.co.multisampleState = state;
|
||||
m_state.flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::setDepthStencilState(
|
||||
const Rc<DxvkDepthStencilState>& state) {
|
||||
if (m_state.co.depthStencilState != state) {
|
||||
m_state.co.depthStencilState = state;
|
||||
m_state.flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::setBlendState(
|
||||
const Rc<DxvkBlendState>& state) {
|
||||
if (m_state.co.blendState != state) {
|
||||
m_state.co.blendState = state;
|
||||
m_state.flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::renderPassBegin() {
|
||||
if (!m_state.flags.test(DxvkContextFlag::GpRenderPassBound)
|
||||
&& (m_state.om.framebuffer != nullptr)) {
|
||||
@ -194,7 +248,14 @@ namespace dxvk {
|
||||
m_state.flags.clr(DxvkContextFlag::GpDirtyPipelineState);
|
||||
|
||||
DxvkGraphicsPipelineStateInfo gpState;
|
||||
// TODO fill state object
|
||||
gpState.inputAssemblyState = m_state.co.inputAssemblyState;
|
||||
gpState.inputLayout = m_state.co.inputLayout;
|
||||
gpState.rasterizerState = m_state.co.rasterizerState;
|
||||
gpState.multisampleState = m_state.co.multisampleState;
|
||||
gpState.depthStencilState = m_state.co.depthStencilState;
|
||||
gpState.blendState = m_state.co.blendState;
|
||||
gpState.renderPass = m_state.om.framebuffer->renderPass();
|
||||
gpState.viewportCount = m_state.vp.viewportCount;
|
||||
|
||||
m_cmd->cmdBindPipeline(VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
m_state.activeGraphicsPipeline->getPipelineHandle(gpState));
|
||||
|
@ -126,6 +126,48 @@ namespace dxvk {
|
||||
uint32_t vertexOffset,
|
||||
uint32_t firstInstance);
|
||||
|
||||
/**
|
||||
* \brief Sets input assembly state
|
||||
* \param [in] state New state object
|
||||
*/
|
||||
void setInputAssemblyState(
|
||||
const Rc<DxvkInputAssemblyState>& state);
|
||||
|
||||
/**
|
||||
* \brief Sets input layout state
|
||||
* \param [in] state New state object
|
||||
*/
|
||||
void setInputLayout(
|
||||
const Rc<DxvkInputLayout>& state);
|
||||
|
||||
/**
|
||||
* \brief Sets rasterizer state
|
||||
* \param [in] state New state object
|
||||
*/
|
||||
void setRasterizerState(
|
||||
const Rc<DxvkRasterizerState>& state);
|
||||
|
||||
/**
|
||||
* \brief Sets multisample state
|
||||
* \param [in] state New state object
|
||||
*/
|
||||
void setMultisampleState(
|
||||
const Rc<DxvkMultisampleState>& state);
|
||||
|
||||
/**
|
||||
* \brief Sets depth stencil state
|
||||
* \param [in] state New state object
|
||||
*/
|
||||
void setDepthStencilState(
|
||||
const Rc<DxvkDepthStencilState>& state);
|
||||
|
||||
/**
|
||||
* \brief Sets color blend state
|
||||
* \param [in] state New state object
|
||||
*/
|
||||
void setBlendState(
|
||||
const Rc<DxvkBlendState>& state);
|
||||
|
||||
private:
|
||||
|
||||
const Rc<DxvkDevice> m_device;
|
||||
|
@ -9,7 +9,7 @@ namespace dxvk {
|
||||
|
||||
size_t DxvkGraphicsPipelineStateInfo::hash() const {
|
||||
DxvkHashState state;
|
||||
state.add(hashPtr(this->inputAssembly.ptr()));
|
||||
state.add(hashPtr(this->inputAssemblyState.ptr()));
|
||||
state.add(hashPtr(this->inputLayout.ptr()));
|
||||
state.add(hashPtr(this->rasterizerState.ptr()));
|
||||
state.add(hashPtr(this->multisampleState.ptr()));
|
||||
@ -22,7 +22,7 @@ namespace dxvk {
|
||||
|
||||
|
||||
bool DxvkGraphicsPipelineStateInfo::operator == (const DxvkGraphicsPipelineStateInfo& other) const {
|
||||
return this->inputAssembly == other.inputAssembly
|
||||
return this->inputAssemblyState == other.inputAssemblyState
|
||||
&& this->inputLayout == other.inputLayout
|
||||
&& this->rasterizerState == other.rasterizerState
|
||||
&& this->multisampleState == other.multisampleState
|
||||
|
@ -19,7 +19,7 @@ namespace dxvk {
|
||||
* the current pipeline state vector.
|
||||
*/
|
||||
struct DxvkGraphicsPipelineStateInfo {
|
||||
Rc<DxvkInputAssemblyState> inputAssembly;
|
||||
Rc<DxvkInputAssemblyState> inputAssemblyState;
|
||||
Rc<DxvkInputLayout> inputLayout;
|
||||
Rc<DxvkRasterizerState> rasterizerState;
|
||||
Rc<DxvkMultisampleState> multisampleState;
|
||||
|
Loading…
x
Reference in New Issue
Block a user