@@ -253,7 +253,12 @@ public async Task InitializeAsync(IModContext ctx, CancellationToken ct = defaul
253
253
logger . LogInformation ( "Reading Khronos XML from \" {}\" ..." , specPath ) ;
254
254
await using var fs = File . OpenRead ( specPath ) ;
255
255
var xml = await XDocument . LoadAsync ( fs , LoadOptions . None , default ) ;
256
+
256
257
var ( apiSets , supportedApiProfiles ) = EvaluateProfiles ( xml ) ;
258
+ job . ApiSets = apiSets ;
259
+ job . SupportedApiProfiles = supportedApiProfiles ;
260
+
261
+ var profiles = supportedApiProfiles . SelectMany ( x => x . Value ) . Select ( x => x . Profile ) . ToHashSet ( ) ;
257
262
job . Vendors =
258
263
[
259
264
.. xml . Element ( "registry" )
@@ -264,12 +269,20 @@ .. xml.Element("registry")
264
269
.. xml . Element ( "registry" )
265
270
? . Element ( "extensions" )
266
271
? . Elements ( "extension" )
272
+ // Only include vendors who have extensions that match a declared profile
273
+ // This is mainly to exclude extensions that are declared as supported="disabled"
274
+ . Where ( ext => {
275
+ var supportedProfiles = ext . Attribute ( "supported" ) ? . Value . Split ( "|" ) ?? [ ] ;
276
+ return profiles . Intersect ( supportedProfiles ) . Any ( ) ;
277
+ } )
267
278
. Attributes ( "name" )
268
- . Select ( x => x . Value . Split ( '_' ) [ 1 ] . ToUpper ( ) ) ?? Enumerable . Empty < string > ( )
279
+ // Extract the second part from the extension name
280
+ // Eg: GL_NV_command_list -> NV
281
+ . Select ( name => name . Value . Split ( '_' ) [ 1 ] . ToUpper ( ) ) ?? Enumerable . Empty < string > ( )
269
282
] ;
270
- job . ApiSets = apiSets ;
271
- job . SupportedApiProfiles = supportedApiProfiles ;
283
+
272
284
ReadGroups ( xml , job , job . Vendors ) ;
285
+
273
286
foreach ( var typeElement in xml . Elements ( "registry" ) . Elements ( "types" ) . Elements ( "type" ) )
274
287
{
275
288
var type = typeElement . Element ( "name" ) ? . Value ;
0 commit comments