From 3af93e547a983095557cbafec3a7f70f0e05c453 Mon Sep 17 00:00:00 2001 From: Triang3l Date: Fri, 2 Nov 2018 09:57:35 +0300 Subject: [PATCH] [D3D12] Fix triangle fan winding order --- src/xenia/gpu/d3d12/primitive_converter.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/xenia/gpu/d3d12/primitive_converter.cc b/src/xenia/gpu/d3d12/primitive_converter.cc index 6453751dd..4a6128c9f 100644 --- a/src/xenia/gpu/d3d12/primitive_converter.cc +++ b/src/xenia/gpu/d3d12/primitive_converter.cc @@ -84,8 +84,8 @@ bool PrimitiveConverter::Initialize() { uint16_t* static_ib_data_triangle_fan = &static_ib_data[kStaticIBTriangleFanOffset]; for (uint32_t i = 2; i < kMaxNonIndexedVertices; ++i) { - *(static_ib_data_triangle_fan++) = i; *(static_ib_data_triangle_fan++) = i - 1; + *(static_ib_data_triangle_fan++) = i; *(static_ib_data_triangle_fan++) = 0; } static_ib_upload_->Unmap(0, nullptr); @@ -445,8 +445,8 @@ PrimitiveConverter::ConversionResult PrimitiveConverter::ConvertPrimitives( current_fan_first_index = index; } if (++current_fan_index_count >= 3) { - *(target_32++) = index; *(target_32++) = source_32[i - 1]; + *(target_32++) = index; *(target_32++) = current_fan_first_index; } } @@ -462,8 +462,8 @@ PrimitiveConverter::ConversionResult PrimitiveConverter::ConvertPrimitives( current_fan_first_index = index; } if (++current_fan_index_count >= 3) { - *(target_16++) = index; *(target_16++) = source_16[i - 1]; + *(target_16++) = index; *(target_16++) = uint16_t(current_fan_first_index); } } @@ -472,15 +472,15 @@ PrimitiveConverter::ConversionResult PrimitiveConverter::ConvertPrimitives( if (index_format == IndexFormat::kInt32) { uint32_t* target_32 = reinterpret_cast(target); for (uint32_t i = 2; i < index_count; ++i) { - *(target_32++) = source_32[i]; *(target_32++) = source_32[i - 1]; + *(target_32++) = source_32[i]; *(target_32++) = source_32[0]; } } else { uint16_t* target_16 = reinterpret_cast(target); for (uint32_t i = 2; i < index_count; ++i) { - *(target_16++) = source_16[i]; *(target_16++) = source_16[i - 1]; + *(target_16++) = source_16[i]; *(target_16++) = source_16[0]; } }