We previously use createOp() in SPV builder to create type declaration. However, all type declarations should be placed in const-type-variable declaration section. And duplicated type defintions ought to be avoided. We now make a method in SPV builder to perform this operation with a more general solution: makeGenericType().
		
			
				
	
	
		
			15 lines
		
	
	
		
			266 B
		
	
	
	
		
			GLSL
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			266 B
		
	
	
	
		
			GLSL
		
	
	
	
	
	
#version 460 core
 | 
						|
 | 
						|
#extension GL_EXT_spirv_intrinsics: enable
 | 
						|
 | 
						|
layout(constant_id = 9) const int size = 9;
 | 
						|
 | 
						|
#define EmptyStruct spirv_type(id = 30)
 | 
						|
void func(EmptyStruct emptyStruct) {}
 | 
						|
 | 
						|
void main()
 | 
						|
{
 | 
						|
    EmptyStruct dummy[size];
 | 
						|
    func(dummy[1]);
 | 
						|
}
 |