Declare and use gl_PerVertex block for VTG per-vertex built-ins (#5576)

* Declare and use gl_PerVertex block for VTG per-vertex built-ins

* Shader cache version bump
This commit is contained in:
gdkchan 2023-08-16 18:16:25 -03:00 committed by GitHub
parent 0c445184c1
commit 17354d59d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 176 additions and 3 deletions

View file

@ -28,6 +28,7 @@ namespace Spv.Generator
// In the declaration block.
private readonly Dictionary<TypeDeclarationKey, Instruction> _typeDeclarations;
private readonly List<Instruction> _typeDeclarationsList;
// In the declaration block.
private readonly List<Instruction> _globals;
// In the declaration block.
@ -54,6 +55,7 @@ namespace Spv.Generator
_debug = new List<Instruction>();
_annotations = new List<Instruction>();
_typeDeclarations = new Dictionary<TypeDeclarationKey, Instruction>();
_typeDeclarationsList = new List<Instruction>();
_constants = new Dictionary<ConstantKey, Instruction>();
_globals = new List<Instruction>();
_functionsDeclarations = new List<Instruction>();
@ -126,7 +128,8 @@ namespace Spv.Generator
instruction.SetId(GetNewId());
_typeDeclarations.Add(key, instruction);
_typeDeclarations[key] = instruction;
_typeDeclarationsList.Add(instruction);
}
public void AddEntryPoint(ExecutionModel executionModel, Instruction function, string name, params Instruction[] interfaces)
@ -330,7 +333,7 @@ namespace Spv.Generator
// Ensure that everything is in the right order in the declarations section.
List<Instruction> declarations = new();
declarations.AddRange(_typeDeclarations.Values);
declarations.AddRange(_typeDeclarationsList);
declarations.AddRange(_globals);
declarations.AddRange(_constants.Values);
declarations.Sort((Instruction x, Instruction y) => x.Id.CompareTo(y.Id));