mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-12 22:08:59 +01:00
[d3d11] Add reset method to more context state
This commit is contained in:
parent
4e1f6e5efd
commit
95ab1465ab
@ -3892,49 +3892,19 @@ namespace dxvk {
|
||||
m_state.ps.shader = nullptr;
|
||||
m_state.cs.shader = nullptr;
|
||||
|
||||
// Reset render state
|
||||
m_state.id.reset();
|
||||
m_state.ia.reset();
|
||||
m_state.om.reset();
|
||||
m_state.rs.reset();
|
||||
m_state.so.reset();
|
||||
m_state.pr.reset();
|
||||
|
||||
// Reset resource bindings
|
||||
m_state.cbv.reset();
|
||||
m_state.srv.reset();
|
||||
m_state.uav.reset();
|
||||
m_state.samplers.reset();
|
||||
m_state.om.reset();
|
||||
|
||||
// Default ID state
|
||||
m_state.id.argBuffer = nullptr;
|
||||
|
||||
// Default IA state
|
||||
m_state.ia.inputLayout = nullptr;
|
||||
m_state.ia.primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
|
||||
|
||||
for (uint32_t i = 0; i < D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; i++) {
|
||||
m_state.ia.vertexBuffers[i].buffer = nullptr;
|
||||
m_state.ia.vertexBuffers[i].offset = 0;
|
||||
m_state.ia.vertexBuffers[i].stride = 0;
|
||||
}
|
||||
|
||||
m_state.ia.indexBuffer.buffer = nullptr;
|
||||
m_state.ia.indexBuffer.offset = 0;
|
||||
m_state.ia.indexBuffer.format = DXGI_FORMAT_UNKNOWN;
|
||||
|
||||
// Default RS state
|
||||
m_state.rs.state = nullptr;
|
||||
m_state.rs.numViewports = 0;
|
||||
m_state.rs.numScissors = 0;
|
||||
|
||||
for (uint32_t i = 0; i < D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; i++) {
|
||||
m_state.rs.viewports[i] = D3D11_VIEWPORT { };
|
||||
m_state.rs.scissors [i] = D3D11_RECT { };
|
||||
}
|
||||
|
||||
// Default SO state
|
||||
for (uint32_t i = 0; i < D3D11_SO_BUFFER_SLOT_COUNT; i++) {
|
||||
m_state.so.targets[i].buffer = nullptr;
|
||||
m_state.so.targets[i].offset = 0;
|
||||
}
|
||||
|
||||
// Default predication
|
||||
m_state.pr.predicateObject = nullptr;
|
||||
m_state.pr.predicateValue = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -154,33 +154,41 @@ namespace dxvk {
|
||||
Com<D3D11ComputeShader> shader = nullptr;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Input assembly state
|
||||
*
|
||||
* Stores vertex buffers, the index buffer, the
|
||||
* input layout, and the dynamic primitive topology.
|
||||
*/
|
||||
struct D3D11VertexBufferBinding {
|
||||
Com<D3D11Buffer> buffer = nullptr;
|
||||
UINT offset = 0;
|
||||
UINT stride = 0;
|
||||
};
|
||||
|
||||
|
||||
struct D3D11IndexBufferBinding {
|
||||
Com<D3D11Buffer> buffer = nullptr;
|
||||
UINT offset = 0;
|
||||
DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN;
|
||||
};
|
||||
|
||||
|
||||
struct D3D11ContextStateID {
|
||||
Com<D3D11Buffer> argBuffer = nullptr;
|
||||
Com<D3D11Buffer> cntBuffer = nullptr;
|
||||
};
|
||||
|
||||
|
||||
struct D3D11ContextStateIA {
|
||||
Com<D3D11InputLayout> inputLayout = nullptr;
|
||||
D3D11_PRIMITIVE_TOPOLOGY primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
|
||||
|
||||
std::array<D3D11VertexBufferBinding, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT> vertexBuffers = { };
|
||||
D3D11IndexBufferBinding indexBuffer = { };
|
||||
|
||||
void reset() {
|
||||
inputLayout = nullptr;
|
||||
|
||||
primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED;
|
||||
|
||||
for (uint32_t i = 0; i < vertexBuffers.size(); i++)
|
||||
vertexBuffers[i] = D3D11VertexBufferBinding();
|
||||
|
||||
indexBuffer = D3D11IndexBufferBinding();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@ -231,7 +239,27 @@ namespace dxvk {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Indirect draw state
|
||||
*
|
||||
* Stores the current indirct draw
|
||||
* argument and draw count buffer.
|
||||
*/
|
||||
struct D3D11ContextStateID {
|
||||
Com<D3D11Buffer> argBuffer = nullptr;
|
||||
Com<D3D11Buffer> cntBuffer = nullptr;
|
||||
|
||||
void reset() {
|
||||
argBuffer = nullptr;
|
||||
cntBuffer = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Rasterizer state
|
||||
*
|
||||
* Stores viewport info and the rasterizer state object.
|
||||
*/
|
||||
struct D3D11ContextStateRS {
|
||||
uint32_t numViewports = 0;
|
||||
uint32_t numScissors = 0;
|
||||
@ -240,26 +268,55 @@ namespace dxvk {
|
||||
std::array<D3D11_RECT, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE> scissors = { };
|
||||
|
||||
D3D11RasterizerState* state = nullptr;
|
||||
|
||||
void reset() {
|
||||
for (uint32_t i = 0; i < numViewports; i++)
|
||||
viewports[i] = D3D11_VIEWPORT();
|
||||
|
||||
for (uint32_t i = 0; i < numScissors; i++)
|
||||
scissors[i] = D3D11_RECT();
|
||||
|
||||
numViewports = 0;
|
||||
numScissors = 0;
|
||||
|
||||
state = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Stream output binding
|
||||
*
|
||||
* Stores stream output buffers with offset.
|
||||
*/
|
||||
struct D3D11ContextSoTarget {
|
||||
Com<D3D11Buffer> buffer = nullptr;
|
||||
UINT offset = 0;
|
||||
};
|
||||
|
||||
|
||||
struct D3D11ContextStateSO {
|
||||
std::array<D3D11ContextSoTarget, D3D11_SO_BUFFER_SLOT_COUNT> targets = { };
|
||||
|
||||
void reset() {
|
||||
for (uint32_t i = 0; i < targets.size(); i++)
|
||||
targets[i] = D3D11ContextSoTarget();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Predication state
|
||||
*
|
||||
* Stores predication info.
|
||||
*/
|
||||
struct D3D11ContextStatePR {
|
||||
Com<D3D11Query> predicateObject = nullptr;
|
||||
BOOL predicateValue = FALSE;
|
||||
BOOL predicateValue = false;
|
||||
|
||||
void reset() {
|
||||
predicateObject = nullptr;
|
||||
predicateValue = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Context state
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user