[GPU] Disable primitive reset for non-list types in primitive processor
This commit is contained in:
parent
70a3919f9f
commit
d00dd5a2bc
|
@ -1340,7 +1340,6 @@ bool PipelineCache::GetCurrentStateDescription(
|
|||
break;
|
||||
case xenos::PrimitiveType::kLineList:
|
||||
case xenos::PrimitiveType::kLineStrip:
|
||||
case xenos::PrimitiveType::kLineLoop:
|
||||
// Quads are emulated as line lists with adjacency.
|
||||
case xenos::PrimitiveType::kQuadList:
|
||||
case xenos::PrimitiveType::k2DLineStrip:
|
||||
|
|
|
@ -458,16 +458,34 @@ bool PrimitiveProcessor::Process(ProcessingResult& result_out) {
|
|||
}
|
||||
} else {
|
||||
if (regs.Get<reg::PA_SU_SC_MODE_CNTL>().multi_prim_ib_ena) {
|
||||
guest_primitive_reset_index_guest_endian = xenos::GpuSwap(
|
||||
regs.Get<reg::VGT_MULTI_PRIM_IB_RESET_INDX>().reset_indx,
|
||||
guest_index_endian);
|
||||
// - VGT, what does the guest say about its primitive reset index?
|
||||
// - It's over 0xFFFF!!!
|
||||
// - What!? 0xFFFF!? There's no way that can be stored in 16 bits!
|
||||
guest_primitive_reset_enabled =
|
||||
guest_index_format == xenos::IndexFormat::kInt16
|
||||
? guest_primitive_reset_index_guest_endian <= UINT16_MAX
|
||||
: true;
|
||||
switch (guest_primitive_type) {
|
||||
case xenos::PrimitiveType::kLineStrip:
|
||||
case xenos::PrimitiveType::kTriangleFan:
|
||||
case xenos::PrimitiveType::kTriangleStrip:
|
||||
case xenos::PrimitiveType::kLineLoop:
|
||||
case xenos::PrimitiveType::kQuadStrip:
|
||||
case xenos::PrimitiveType::kPolygon:
|
||||
case xenos::PrimitiveType::k2DLineStrip:
|
||||
case xenos::PrimitiveType::k2DTriStrip:
|
||||
guest_primitive_reset_index_guest_endian = xenos::GpuSwap(
|
||||
regs.Get<reg::VGT_MULTI_PRIM_IB_RESET_INDX>().reset_indx,
|
||||
guest_index_endian);
|
||||
// - VGT, what does the guest say about its primitive reset index?
|
||||
// - It's over 0xFFFF!!!
|
||||
// - What!? 0xFFFF!? There's no way that can be stored in 16 bits!
|
||||
guest_primitive_reset_enabled =
|
||||
guest_index_format == xenos::IndexFormat::kInt16
|
||||
? guest_primitive_reset_index_guest_endian <= UINT16_MAX
|
||||
: true;
|
||||
break;
|
||||
default:
|
||||
// Vulkan explicitly disallows primitive restart index for "list"
|
||||
// topologies. In Direct3D 12, it's valid for non-strips, but has
|
||||
// implementation-defined behavior. Make backend usage simpler by
|
||||
// explicitly filtering lists out, and hope the guest never uses
|
||||
// primitive reset for lists.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,8 @@ class PrimitiveProcessor {
|
|||
xenos::IndexFormat host_index_format;
|
||||
xenos::Endian host_index_endian;
|
||||
// The reset index, if enabled, is always 0xFFFF for host_index_format
|
||||
// kInt16 and 0xFFFFFFFF for kInt32.
|
||||
// kInt16 and 0xFFFFFFFF for kInt32. Never enabled for "list" primitive
|
||||
// types, thus safe for direct usage on Vulkan.
|
||||
bool host_primitive_reset_enabled;
|
||||
// Backend-specific handle for the index buffer valid for the current draw,
|
||||
// only valid for index_buffer_type kHostConverted and kHostBuiltin.
|
||||
|
|
Loading…
Reference in New Issue