@@ -1256,7 +1256,15 @@ var LibraryWebGPU = {
12561256 { { { gpu . makeCheckDescriptor ( 'descriptor' ) } } }
12571257 function makePrimitiveState ( rsPtr ) {
12581258 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+
12601268 return {
12611269 "topology" : WebGPU . PrimitiveTopology [
12621270 { { { gpu . makeGetU32 ( 'rsPtr' , C_STRUCTS . WGPUPrimitiveState . topology ) } } } ] ,
@@ -1266,6 +1274,7 @@ var LibraryWebGPU = {
12661274 { { { gpu . makeGetU32 ( 'rsPtr' , C_STRUCTS . WGPUPrimitiveState . frontFace ) } } } ] ,
12671275 "cullMode" : WebGPU . CullMode [
12681276 { { { gpu . makeGetU32 ( 'rsPtr' , C_STRUCTS . WGPUPrimitiveState . cullMode ) } } } ] ,
1277+ "unclippedDepth" : sType === { { { gpu . SType . PrimitiveDepthClipControl } } } && { { { gpu . makeGetBool ( 'nextInChainPtr' , C_STRUCTS . WGPUPrimitiveDepthClipControl . unclippedDepth ) } } } ,
12691278 } ;
12701279 }
12711280
0 commit comments