mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-18 22:00:25 +01:00
dzn: Use driver-implemented triangle fans if available
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20346>
This commit is contained in:
parent
e1ea140d77
commit
e24468803e
1 changed files with 8 additions and 4 deletions
|
|
@ -1046,7 +1046,7 @@ to_prim_topology_type(VkPrimitiveTopology in)
|
|||
}
|
||||
|
||||
static D3D12_PRIMITIVE_TOPOLOGY
|
||||
to_prim_topology(VkPrimitiveTopology in, unsigned patch_control_points)
|
||||
to_prim_topology(VkPrimitiveTopology in, unsigned patch_control_points, bool support_triangle_fan)
|
||||
{
|
||||
switch (in) {
|
||||
case VK_PRIMITIVE_TOPOLOGY_POINT_LIST: return D3D_PRIMITIVE_TOPOLOGY_POINTLIST;
|
||||
|
|
@ -1057,7 +1057,8 @@ to_prim_topology(VkPrimitiveTopology in, unsigned patch_control_points)
|
|||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
|
||||
/* Triangle fans are emulated using an intermediate index buffer. */
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN: return support_triangle_fan ?
|
||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLEFAN : D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ;
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ;
|
||||
case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
|
||||
|
|
@ -1073,6 +1074,8 @@ dzn_graphics_pipeline_translate_ia(struct dzn_device *device,
|
|||
D3D12_PIPELINE_STATE_STREAM_DESC *out,
|
||||
const VkGraphicsPipelineCreateInfo *in)
|
||||
{
|
||||
struct dzn_physical_device *pdev =
|
||||
container_of(device->vk.physical, struct dzn_physical_device, vk);
|
||||
const VkPipelineInputAssemblyStateCreateInfo *in_ia =
|
||||
in->pInputAssemblyState;
|
||||
bool has_tes = false;
|
||||
|
|
@ -1089,9 +1092,10 @@ dzn_graphics_pipeline_translate_ia(struct dzn_device *device,
|
|||
|
||||
d3d12_gfx_pipeline_state_stream_new_desc(out, PRIMITIVE_TOPOLOGY, D3D12_PRIMITIVE_TOPOLOGY_TYPE, prim_top_type);
|
||||
*prim_top_type = to_prim_topology_type(in_ia->topology);
|
||||
pipeline->ia.triangle_fan = in_ia->topology == VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN;
|
||||
pipeline->ia.triangle_fan = in_ia->topology == VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN && !pdev->options15.TriangleFanSupported;
|
||||
pipeline->ia.topology =
|
||||
to_prim_topology(in_ia->topology, in_tes ? in_tes->patchControlPoints : 0);
|
||||
to_prim_topology(in_ia->topology, in_tes ? in_tes->patchControlPoints : 0,
|
||||
pdev->options15.TriangleFanSupported);
|
||||
|
||||
if (in_ia->primitiveRestartEnable) {
|
||||
d3d12_gfx_pipeline_state_stream_new_desc(out, IB_STRIP_CUT_VALUE, D3D12_INDEX_BUFFER_STRIP_CUT_VALUE, ib_strip_cut);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue