@@ -1256,7 +1256,15 @@ var LibraryWebGPU = {
1256
1256
{ { { gpu . makeCheckDescriptor ( 'descriptor' ) } } }
1257
1257
function makePrimitiveState ( rsPtr ) {
1258
1258
if ( ! rsPtr ) return undefined ;
1259
- { { { gpu . makeCheckDescriptor ( 'rsPtr' ) } } }
1259
+ { { { gpu . makeCheck ( 'rsPtr' ) } } }
1260
+
1261
+ // TODO: This small hack assumes that there's only one type that can be in the chain of
1262
+ // WGPUPrimitiveState. The correct thing would be to traverse the chain, but unclippedDepth
1263
+ // is going to move into the core object soon, so we'll just do this for now. See:
1264
+ // https://github.com/webgpu-native/webgpu-headers/issues/212#issuecomment-1682801259
1265
+ var nextInChainPtr = { { { makeGetValue ( 'rsPtr' , C_STRUCTS . WGPUPrimitiveState . nextInChain , '*' ) } } } ;
1266
+ var sType = nextInChainPtr ? { { { gpu . makeGetU32 ( 'nextInChainPtr' , C_STRUCTS . WGPUChainedStruct . sType ) } } } : 0 ;
1267
+
1260
1268
return {
1261
1269
"topology" : WebGPU . PrimitiveTopology [
1262
1270
{ { { gpu . makeGetU32 ( 'rsPtr' , C_STRUCTS . WGPUPrimitiveState . topology ) } } } ] ,
@@ -1266,6 +1274,7 @@ var LibraryWebGPU = {
1266
1274
{ { { gpu . makeGetU32 ( 'rsPtr' , C_STRUCTS . WGPUPrimitiveState . frontFace ) } } } ] ,
1267
1275
"cullMode" : WebGPU . CullMode [
1268
1276
{ { { gpu . makeGetU32 ( 'rsPtr' , C_STRUCTS . WGPUPrimitiveState . cullMode ) } } } ] ,
1277
+ "unclippedDepth" : sType === { { { gpu . SType . PrimitiveDepthClipControl } } } && { { { gpu . makeGetBool ( 'nextInChainPtr' , C_STRUCTS . WGPUPrimitiveDepthClipControl . unclippedDepth ) } } } ,
1269
1278
} ;
1270
1279
}
1271
1280
0 commit comments