mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxvk] Use packed input assembly state
This commit is contained in:
parent
8d09aa12da
commit
c0ae4e38eb
@ -2240,9 +2240,10 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
void DxvkContext::setInputAssemblyState(const DxvkInputAssemblyState& ia) {
|
void DxvkContext::setInputAssemblyState(const DxvkInputAssemblyState& ia) {
|
||||||
m_state.gp.state.iaPrimitiveTopology = ia.primitiveTopology;
|
m_state.gp.state.ia = DxvkIaInfo(
|
||||||
m_state.gp.state.iaPrimitiveRestart = ia.primitiveRestart;
|
ia.primitiveTopology,
|
||||||
m_state.gp.state.iaPatchVertexCount = ia.patchVertexCount;
|
ia.primitiveRestart,
|
||||||
|
ia.patchVertexCount);
|
||||||
|
|
||||||
m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
m_flags.set(DxvkContextFlag::GpDirtyPipelineState);
|
||||||
}
|
}
|
||||||
|
@ -288,14 +288,14 @@ namespace dxvk {
|
|||||||
iaInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
|
iaInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
|
||||||
iaInfo.pNext = nullptr;
|
iaInfo.pNext = nullptr;
|
||||||
iaInfo.flags = 0;
|
iaInfo.flags = 0;
|
||||||
iaInfo.topology = state.iaPrimitiveTopology;
|
iaInfo.topology = state.ia.primitiveTopology();
|
||||||
iaInfo.primitiveRestartEnable = state.iaPrimitiveRestart;
|
iaInfo.primitiveRestartEnable = state.ia.primitiveRestart();
|
||||||
|
|
||||||
VkPipelineTessellationStateCreateInfo tsInfo;
|
VkPipelineTessellationStateCreateInfo tsInfo;
|
||||||
tsInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
|
tsInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
|
||||||
tsInfo.pNext = nullptr;
|
tsInfo.pNext = nullptr;
|
||||||
tsInfo.flags = 0;
|
tsInfo.flags = 0;
|
||||||
tsInfo.patchControlPoints = state.iaPatchVertexCount;
|
tsInfo.patchControlPoints = state.ia.patchVertexCount();
|
||||||
|
|
||||||
VkPipelineViewportStateCreateInfo vpInfo;
|
VkPipelineViewportStateCreateInfo vpInfo;
|
||||||
vpInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
|
vpInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
|
||||||
@ -461,12 +461,12 @@ namespace dxvk {
|
|||||||
|
|
||||||
// If there are no tessellation shaders, we
|
// If there are no tessellation shaders, we
|
||||||
// obviously cannot use tessellation patches.
|
// obviously cannot use tessellation patches.
|
||||||
if ((state.iaPrimitiveTopology == VK_PRIMITIVE_TOPOLOGY_PATCH_LIST)
|
if ((state.ia.primitiveTopology() == VK_PRIMITIVE_TOPOLOGY_PATCH_LIST)
|
||||||
&& (m_shaders.tcs == nullptr || m_shaders.tes == nullptr))
|
&& (m_shaders.tcs == nullptr || m_shaders.tes == nullptr))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Filter out undefined primitive topologies
|
// Filter out undefined primitive topologies
|
||||||
if (state.iaPrimitiveTopology == VK_PRIMITIVE_TOPOLOGY_MAX_ENUM)
|
if (state.ia.primitiveTopology() == VK_PRIMITIVE_TOPOLOGY_MAX_ENUM)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Prevent unintended out-of-bounds access to the IL arrays
|
// Prevent unintended out-of-bounds access to the IL arrays
|
||||||
|
@ -6,6 +6,51 @@
|
|||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Packed input assembly state
|
||||||
|
*
|
||||||
|
* Stores the primitive topology
|
||||||
|
* and primitive restart info.
|
||||||
|
*/
|
||||||
|
class DxvkIaInfo {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DxvkIaInfo() = default;
|
||||||
|
|
||||||
|
DxvkIaInfo(
|
||||||
|
VkPrimitiveTopology primitiveTopology,
|
||||||
|
VkBool32 primitiveRestart,
|
||||||
|
uint32_t patchVertexCount)
|
||||||
|
: m_primitiveTopology (uint16_t(primitiveTopology)),
|
||||||
|
m_primitiveRestart (uint16_t(primitiveRestart)),
|
||||||
|
m_patchVertexCount (uint16_t(patchVertexCount)),
|
||||||
|
m_reserved (0) { }
|
||||||
|
|
||||||
|
VkPrimitiveTopology primitiveTopology() const {
|
||||||
|
return m_primitiveTopology <= VK_PRIMITIVE_TOPOLOGY_PATCH_LIST
|
||||||
|
? VkPrimitiveTopology(m_primitiveTopology)
|
||||||
|
: VK_PRIMITIVE_TOPOLOGY_MAX_ENUM;
|
||||||
|
}
|
||||||
|
|
||||||
|
VkBool32 primitiveRestart() const {
|
||||||
|
return VkBool32(m_primitiveRestart);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t patchVertexCount() const {
|
||||||
|
return m_patchVertexCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
uint16_t m_primitiveTopology : 4;
|
||||||
|
uint16_t m_primitiveRestart : 1;
|
||||||
|
uint16_t m_patchVertexCount : 6;
|
||||||
|
uint16_t m_reserved : 5;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Packed graphics pipeline state
|
* \brief Packed graphics pipeline state
|
||||||
*
|
*
|
||||||
@ -62,10 +107,7 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DxvkBindingMask bsBindingMask;
|
DxvkBindingMask bsBindingMask;
|
||||||
|
DxvkIaInfo ia;
|
||||||
VkPrimitiveTopology iaPrimitiveTopology;
|
|
||||||
VkBool32 iaPrimitiveRestart;
|
|
||||||
uint32_t iaPatchVertexCount;
|
|
||||||
|
|
||||||
uint32_t ilAttributeCount;
|
uint32_t ilAttributeCount;
|
||||||
uint32_t ilBindingCount;
|
uint32_t ilBindingCount;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user