浏览代码

WebGPURenderer: Fix strip index format (#27279)

sunag 1 年之前
父节点
当前提交
84424e4f2e
共有 1 个文件被更改,包括 2 次插入3 次删除
  1. 2 3
      examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js

+ 2 - 3
examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js

@@ -456,10 +456,9 @@ class WebGPUPipelineUtils {
 
 
 		descriptor.topology = utils.getPrimitiveTopology( object, material );
 		descriptor.topology = utils.getPrimitiveTopology( object, material );
 
 
-		if ( object.isLine === true && object.isLineSegments !== true ) {
+		if ( geometry.index !== null && object.isLine === true && object.isLineSegments !== true ) {
 
 
-			const count = ( geometry.index ) ? geometry.index.count : geometry.attributes.position.count;
-			descriptor.stripIndexFormat = ( count > 65535 ) ? GPUIndexFormat.Uint32 : GPUIndexFormat.Uint16; // define data type for primitive restart value
+			descriptor.stripIndexFormat = ( geometry.index.array instanceof Uint16Array ) ? GPUIndexFormat.Uint16 : GPUIndexFormat.Uint32;
 
 
 		}
 		}