Merge pull request #2549 from jeremy-lunarg/hayes-2479
Require fixed workgroup size declaration
This commit is contained in:
		
						commit
						00c6d2d4a7
					
				
							
								
								
									
										69
									
								
								Test/baseResults/negativeWorkGroupSize.comp.out
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								Test/baseResults/negativeWorkGroupSize.comp.out
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,69 @@ | |||||||
|  | negativeWorkGroupSize.comp | ||||||
|  | ERROR: 0:4: 'initializer' : can't read from gl_WorkGroupSize before a fixed workgroup size has been declared  | ||||||
|  | ERROR: 1 compilation errors.  No code generated. | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | Shader version: 460 | ||||||
|  | local_size = (64, 1, 1) | ||||||
|  | ERROR: node is still EOpNull! | ||||||
|  | 0:3  Function Definition: fn( ( global void) | ||||||
|  | 0:3    Function Parameters:  | ||||||
|  | 0:4    Sequence | ||||||
|  | 0:4      Sequence | ||||||
|  | 0:4        move second child to first child ( temp 3-component vector of uint) | ||||||
|  | 0:4          'wgs' ( temp 3-component vector of uint) | ||||||
|  | 0:4          Constant: | ||||||
|  | 0:4            1 (const uint) | ||||||
|  | 0:4            1 (const uint) | ||||||
|  | 0:4            1 (const uint) | ||||||
|  | 0:9  Function Definition: main( ( global void) | ||||||
|  | 0:9    Function Parameters:  | ||||||
|  | 0:10    Sequence | ||||||
|  | 0:10      Function Call: fn( ( global void) | ||||||
|  | 0:11      Sequence | ||||||
|  | 0:11        move second child to first child ( temp 3-component vector of uint) | ||||||
|  | 0:11          'wgs' ( temp 3-component vector of uint) | ||||||
|  | 0:11          Constant: | ||||||
|  | 0:11            64 (const uint) | ||||||
|  | 0:11            1 (const uint) | ||||||
|  | 0:11            1 (const uint) | ||||||
|  | 0:?   Linker Objects | ||||||
|  | 0:?     'gl_WorkGroupSize' ( const 3-component vector of uint WorkGroupSize) | ||||||
|  | 0:?       64 (const uint) | ||||||
|  | 0:?       1 (const uint) | ||||||
|  | 0:?       1 (const uint) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | Linked compute stage: | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | Shader version: 460 | ||||||
|  | local_size = (64, 1, 1) | ||||||
|  | ERROR: node is still EOpNull! | ||||||
|  | 0:3  Function Definition: fn( ( global void) | ||||||
|  | 0:3    Function Parameters:  | ||||||
|  | 0:4    Sequence | ||||||
|  | 0:4      Sequence | ||||||
|  | 0:4        move second child to first child ( temp 3-component vector of uint) | ||||||
|  | 0:4          'wgs' ( temp 3-component vector of uint) | ||||||
|  | 0:4          Constant: | ||||||
|  | 0:4            1 (const uint) | ||||||
|  | 0:4            1 (const uint) | ||||||
|  | 0:4            1 (const uint) | ||||||
|  | 0:9  Function Definition: main( ( global void) | ||||||
|  | 0:9    Function Parameters:  | ||||||
|  | 0:10    Sequence | ||||||
|  | 0:10      Function Call: fn( ( global void) | ||||||
|  | 0:11      Sequence | ||||||
|  | 0:11        move second child to first child ( temp 3-component vector of uint) | ||||||
|  | 0:11          'wgs' ( temp 3-component vector of uint) | ||||||
|  | 0:11          Constant: | ||||||
|  | 0:11            64 (const uint) | ||||||
|  | 0:11            1 (const uint) | ||||||
|  | 0:11            1 (const uint) | ||||||
|  | 0:?   Linker Objects | ||||||
|  | 0:?     'gl_WorkGroupSize' ( const 3-component vector of uint WorkGroupSize) | ||||||
|  | 0:?       64 (const uint) | ||||||
|  | 0:?       1 (const uint) | ||||||
|  | 0:?       1 (const uint) | ||||||
|  | 
 | ||||||
							
								
								
									
										12
									
								
								Test/negativeWorkGroupSize.comp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Test/negativeWorkGroupSize.comp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | |||||||
|  | #version 460 | ||||||
|  | 
 | ||||||
|  | void fn(){ | ||||||
|  |     uvec3 wgs = gl_WorkGroupSize; // error: fixed workgroup size has not been declared | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | layout(local_size_x = 64) in; // declare workgroup size | ||||||
|  | 
 | ||||||
|  | void main(){ | ||||||
|  |     fn(); | ||||||
|  |     uvec3 wgs = gl_WorkGroupSize; // valid | ||||||
|  | } | ||||||
| @ -2756,6 +2756,11 @@ void TParseContext::rValueErrorCheck(const TSourceLoc& loc, const char* op, TInt | |||||||
|     if (!(symNode && symNode->getQualifier().isWriteOnly())) // base class checks
 |     if (!(symNode && symNode->getQualifier().isWriteOnly())) // base class checks
 | ||||||
|         if (symNode && symNode->getQualifier().isExplicitInterpolation()) |         if (symNode && symNode->getQualifier().isExplicitInterpolation()) | ||||||
|             error(loc, "can't read from explicitly-interpolated object: ", op, symNode->getName().c_str()); |             error(loc, "can't read from explicitly-interpolated object: ", op, symNode->getName().c_str()); | ||||||
|  | 
 | ||||||
|  |     // local_size_{xyz} must be assigned or specialized before gl_WorkGroupSize can be assigned. 
 | ||||||
|  |     if(node->getQualifier().builtIn == EbvWorkGroupSize && | ||||||
|  |        !(intermediate.isLocalSizeSet() || intermediate.isLocalSizeSpecialized())) | ||||||
|  |         error(loc, "can't read from gl_WorkGroupSize before a fixed workgroup size has been declared", op, ""); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //
 | //
 | ||||||
|  | |||||||
| @ -550,6 +550,11 @@ public: | |||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|     unsigned int getLocalSize(int dim) const { return localSize[dim]; } |     unsigned int getLocalSize(int dim) const { return localSize[dim]; } | ||||||
|  |     bool isLocalSizeSet() const | ||||||
|  |     { | ||||||
|  |         // Return true if any component has been set (i.e. any component is not default).
 | ||||||
|  |         return localSizeNotDefault[0] || localSizeNotDefault[1] || localSizeNotDefault[2]; | ||||||
|  |     } | ||||||
|     bool setLocalSizeSpecId(int dim, int id) |     bool setLocalSizeSpecId(int dim, int id) | ||||||
|     { |     { | ||||||
|         if (localSizeSpecId[dim] != TQualifier::layoutNotSet) |         if (localSizeSpecId[dim] != TQualifier::layoutNotSet) | ||||||
| @ -558,6 +563,13 @@ public: | |||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|     int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; } |     int getLocalSizeSpecId(int dim) const { return localSizeSpecId[dim]; } | ||||||
|  |     bool isLocalSizeSpecialized() const | ||||||
|  |     { | ||||||
|  |         // Return true if any component has been specialized.
 | ||||||
|  |         return localSizeSpecId[0] != TQualifier::layoutNotSet || | ||||||
|  |                localSizeSpecId[1] != TQualifier::layoutNotSet || | ||||||
|  |                localSizeSpecId[2] != TQualifier::layoutNotSet; | ||||||
|  |     } | ||||||
| #ifdef GLSLANG_WEB | #ifdef GLSLANG_WEB | ||||||
|     void output(TInfoSink&, bool tree) { } |     void output(TInfoSink&, bool tree) { } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -280,6 +280,7 @@ INSTANTIATE_TEST_SUITE_P( | |||||||
|         "glsl.es320.subgroupVote.comp", |         "glsl.es320.subgroupVote.comp", | ||||||
|         "terminate.frag", |         "terminate.frag", | ||||||
|         "terminate.vert", |         "terminate.vert", | ||||||
|  |         "negativeWorkGroupSize.comp", | ||||||
|     })), |     })), | ||||||
|     FileNameAsCustomTestSuffix |     FileNameAsCustomTestSuffix | ||||||
| ); | ); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 greg-lunarg
						greg-lunarg