 035cbbe3d0
			
		
	
	
		035cbbe3d0
		
	
	
	
	
		
			
			Apart from allowing redeclaration of gl_MeshPerVertexNV and gl_MeshPerPrimitiveNV blocks, this change also - - Resize clip/cull perview distances based on static index use - Error out use of both single-view and per-view builtins - Add new gtests with redeclared blocks and edit existing test output - Fix couple of typos
		
			
				
	
	
		
			67 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			67 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| #version 460
 | |
| 
 | |
| #define MAX_VER  81
 | |
| #define MAX_PRIM 32
 | |
| 
 | |
| #define BARRIER() \
 | |
|     memoryBarrierShared(); \
 | |
|     barrier();
 | |
| 
 | |
| #extension GL_NV_mesh_shader : enable
 | |
| 
 | |
| layout(local_size_x = 32) in;
 | |
| 
 | |
| layout(max_vertices=MAX_VER) out;
 | |
| layout(max_primitives=MAX_PRIM) out;
 | |
| layout(triangles) out;
 | |
| 
 | |
| // test use of redeclared single-view builtins in mesh shaders:
 | |
| 
 | |
| out gl_MeshPerVertexNV {
 | |
|     vec4 gl_Position;
 | |
|     float gl_PointSize;
 | |
|     float gl_ClipDistance[4];
 | |
|     float gl_CullDistance[4];
 | |
| } gl_MeshVerticesNV[];
 | |
| 
 | |
| perprimitiveNV out gl_MeshPerPrimitiveNV {
 | |
|     int gl_PrimitiveID;
 | |
|     int gl_Layer;
 | |
|     int gl_ViewportIndex;
 | |
|     int gl_ViewportMask[];
 | |
| } gl_MeshPrimitivesNV[];
 | |
| 
 | |
| void main()
 | |
| {
 | |
|     uint iid = gl_LocalInvocationID.x;
 | |
|     uint gid = gl_WorkGroupID.x;
 | |
| 
 | |
|     gl_MeshVerticesNV[iid].gl_Position = vec4(1.0);
 | |
|     gl_MeshVerticesNV[iid].gl_PointSize = 2.0;
 | |
|     gl_MeshVerticesNV[iid].gl_ClipDistance[3] = 3.0;
 | |
|     gl_MeshVerticesNV[iid].gl_CullDistance[2] = 4.0;
 | |
| 
 | |
|     BARRIER();
 | |
| 
 | |
|     gl_MeshVerticesNV[iid+1].gl_Position = gl_MeshVerticesNV[iid].gl_Position;
 | |
|     gl_MeshVerticesNV[iid+1].gl_PointSize = gl_MeshVerticesNV[iid].gl_PointSize;
 | |
|     gl_MeshVerticesNV[iid+1].gl_ClipDistance[3] = gl_MeshVerticesNV[iid].gl_ClipDistance[3];
 | |
|     gl_MeshVerticesNV[iid+1].gl_CullDistance[2] = gl_MeshVerticesNV[iid].gl_CullDistance[2];
 | |
| 
 | |
|     BARRIER();
 | |
| 
 | |
|     gl_MeshPrimitivesNV[iid].gl_PrimitiveID = 6;
 | |
|     gl_MeshPrimitivesNV[iid].gl_Layer = 7;
 | |
|     gl_MeshPrimitivesNV[iid].gl_ViewportIndex = 8;
 | |
|     gl_MeshPrimitivesNV[iid].gl_ViewportMask[0] = 9;
 | |
| 
 | |
|     BARRIER();
 | |
| 
 | |
|     gl_MeshPrimitivesNV[iid+1].gl_PrimitiveID = gl_MeshPrimitivesNV[iid].gl_PrimitiveID;
 | |
|     gl_MeshPrimitivesNV[iid+1].gl_Layer = gl_MeshPrimitivesNV[iid].gl_Layer;
 | |
|     gl_MeshPrimitivesNV[iid+1].gl_ViewportIndex = gl_MeshPrimitivesNV[iid].gl_ViewportIndex;
 | |
|     gl_MeshPrimitivesNV[iid+1].gl_ViewportMask[0] = gl_MeshPrimitivesNV[iid].gl_ViewportMask[0];
 | |
| 
 | |
|     BARRIER();
 | |
| }
 |