You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wireframe = true; Forces the drawIndexed / drawIndirectIndexed path even if the geometry does not have an index attribute.
This is because of this function in: renderers/common/Geometries.js
getIndex( renderObject ) {
const { geometry, material } = renderObject;
let index = geometry.index;
if ( material.wireframe === true ) {
const wireframes = this.wireframes;
let wireframeAttribute = wireframes.get( geometry );
if ( wireframeAttribute === undefined ) {
wireframeAttribute = getWireframeIndex( geometry );
wireframes.set( geometry, wireframeAttribute );
} else if ( wireframeAttribute.version !== getWireframeVersion( geometry ) ) {
this.attributes.delete( wireframeAttribute );
wireframeAttribute = getWireframeIndex( geometry );
wireframes.set( geometry, wireframeAttribute );
}
index = wireframeAttribute;
}
return index;
}
Because of drawIndirect, I experimented with a threejs example to find the cause of the error in my app. To do this, I installed a console command in the draw function in each of the 4 possible branches (draw, drawIndirect, drawIndexed, drawIndexedIndirect) in the WebGPUBackend.js to see which path is called.
The error has nothing to do with drawIndirect or drawIndexedIndirect. It's due to wireframe = true, because wireframe = true creates indexes and this forces the indexed draw path. This applies to draw and drawIndirect in the same way. Now that's nothing critical. Since I as a user now that I know this, I can compensate accordingly on the user side. Plus, I don't think anyone else will stumble upon it any time soon. But it would be best if wirefrae = true does not change the draw / drawIndirect path desired by the user to drawIndexed / drawIndexedIndirect, because that is problematic if you don't know how to compensate for it.
Reproduction steps
1.In WebGPUBackend.js, add an indicator to each draw path console.log("draw"), console.log("drawIndexed"), console.log("drawIndirect"), console.log(" drawIndexedIndirect") to see which branch is chosen by the system.
2. Using my codePen example locally. Once with and once without material.wireframe = true; Let it run and look in the console which draw branch is used in the backend.
3. If a user uses drawIndirect for his unindexed geometry, the draw path change forced by wireframe = true then results in an error.
The text was updated successfully, but these errors were encountered:
Spiri0
changed the title
wireframe = true; Forces the drawIndexed / drawIndirecIndexed path
wireframe = true; Forces the drawIndexed / drawIndirectIndexed path
Oct 21, 2024
Description
wireframe = true; Forces the drawIndexed / drawIndirectIndexed path even if the geometry does not have an index attribute.
This is because of this function in:
renderers/common/Geometries.js
Because of drawIndirect, I experimented with a threejs example to find the cause of the error in my app. To do this, I installed a console command in the draw function in each of the 4 possible branches (draw, drawIndirect, drawIndexed, drawIndexedIndirect) in the WebGPUBackend.js to see which path is called.
The error has nothing to do with drawIndirect or drawIndexedIndirect. It's due to wireframe = true, because wireframe = true creates indexes and this forces the indexed draw path. This applies to draw and drawIndirect in the same way. Now that's nothing critical. Since I as a user now that I know this, I can compensate accordingly on the user side. Plus, I don't think anyone else will stumble upon it any time soon. But it would be best if wirefrae = true does not change the draw / drawIndirect path desired by the user to drawIndexed / drawIndexedIndirect, because that is problematic if you don't know how to compensate for it.
Reproduction steps
1.In WebGPUBackend.js, add an indicator to each draw path console.log("draw"), console.log("drawIndexed"), console.log("drawIndirect"), console.log(" drawIndexedIndirect") to see which branch is chosen by the system.
2. Using my codePen example locally. Once with and once without material.wireframe = true; Let it run and look in the console which draw branch is used in the backend.
3. If a user uses drawIndirect for his unindexed geometry, the draw path change forced by wireframe = true then results in an error.
Code
see live example
Live example
](https://codepen.io/Spiri0/pen/zYgzgJR)
Screenshots
No response
Version
r169
Device
No response
Browser
No response
OS
No response
The text was updated successfully, but these errors were encountered: