Merge branch 'master' into ARB_uniform_buffer_object

This commit is contained in:
John Kessenich 2019-12-29 21:32:41 -07:00 committed by GitHub
commit 930403e5b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 451 additions and 394 deletions

View file

@ -5178,19 +5178,25 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"flat in int gl_PrimitiveID;"
);
if (version >= 400) {
if (version >= 130) { // ARB_sample_shading
stageBuiltins[EShLangFragment].append(
"flat in int gl_SampleID;"
" in vec2 gl_SamplePosition;"
"flat in int gl_SampleMaskIn[];"
" out int gl_SampleMask[];"
);
if (spvVersion.spv == 0)
if (spvVersion.spv == 0) {
stageBuiltins[EShLangFragment].append(
"uniform int gl_NumSamples;"
);
);
}
}
if (version >= 400)
stageBuiltins[EShLangFragment].append(
"flat in int gl_SampleMaskIn[];"
);
if (version >= 430)
stageBuiltins[EShLangFragment].append(
"flat in int gl_Layer;"
@ -7422,18 +7428,29 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_FragStencilRefARB", EbvFragStencilRef, symbolTable);
}
if ((profile != EEsProfile && version >= 400) ||
if ((profile != EEsProfile && version >= 130) ||
(profile == EEsProfile && version >= 310)) {
BuiltInVariable("gl_SampleID", EbvSampleId, symbolTable);
BuiltInVariable("gl_SamplePosition", EbvSamplePosition, symbolTable);
BuiltInVariable("gl_SampleMaskIn", EbvSampleMask, symbolTable);
BuiltInVariable("gl_SampleMask", EbvSampleMask, symbolTable);
if (profile == EEsProfile && version < 320) {
symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_OES_sample_variables);
symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_OES_sample_variables);
symbolTable.setVariableExtensions("gl_SampleMaskIn", 1, &E_GL_OES_sample_variables);
symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_OES_sample_variables);
symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_OES_sample_variables);
BuiltInVariable("gl_SampleID", EbvSampleId, symbolTable);
BuiltInVariable("gl_SamplePosition", EbvSamplePosition, symbolTable);
BuiltInVariable("gl_SampleMask", EbvSampleMask, symbolTable);
if (profile != EEsProfile && version < 400) {
BuiltInVariable("gl_NumSamples", EbvSampleMask, symbolTable);
symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_ARB_sample_shading);
symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_ARB_sample_shading);
symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_ARB_sample_shading);
symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_ARB_sample_shading);
} else {
BuiltInVariable("gl_SampleMaskIn", EbvSampleMask, symbolTable);
if (profile == EEsProfile && version < 320) {
symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_OES_sample_variables);
symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_OES_sample_variables);
symbolTable.setVariableExtensions("gl_SampleMaskIn", 1, &E_GL_OES_sample_variables);
symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_OES_sample_variables);
symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_OES_sample_variables);
}
}
}

View file

@ -6035,6 +6035,10 @@ void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol)
offset = qualifier.layoutOffset;
else
offset = atomicUintOffsets[qualifier.layoutBinding];
if (offset % 4 != 0)
error(loc, "atomic counters offset should align based on 4:", "offset", "%d", offset);
symbol.getWritableType().getQualifier().layoutOffset = offset;
// Check for overlap

View file

@ -1421,6 +1421,9 @@ int TScanContext::tokenizeIdentifier()
afterType = true;
if (parseContext.isEsProfile() && parseContext.version >= 310)
return keyword;
if (!parseContext.isEsProfile() && (parseContext.version > 140 ||
(parseContext.version == 140 && parseContext.extensionsTurnedOn(1, &E_GL_ARB_texture_multisample))))
return keyword;
return es30ReservedFromGLSL(150);
case SAMPLER2DMSARRAY:
@ -1430,6 +1433,9 @@ int TScanContext::tokenizeIdentifier()
if ((parseContext.isEsProfile() && parseContext.version >= 320) ||
parseContext.extensionsTurnedOn(1, &E_GL_OES_texture_storage_multisample_2d_array))
return keyword;
if (!parseContext.isEsProfile() && (parseContext.version > 140 ||
(parseContext.version == 140 && parseContext.extensionsTurnedOn(1, &E_GL_ARB_texture_multisample))))
return keyword;
return es30ReservedFromGLSL(150);
case SAMPLER1D:

View file

@ -172,6 +172,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_ARB_tessellation_shader] = EBhDisable;
extensionBehavior[E_GL_ARB_enhanced_layouts] = EBhDisable;
extensionBehavior[E_GL_ARB_texture_cube_map_array] = EBhDisable;
extensionBehavior[E_GL_ARB_texture_multisample] = EBhDisable;
extensionBehavior[E_GL_ARB_shader_texture_lod] = EBhDisable;
extensionBehavior[E_GL_ARB_explicit_attrib_location] = EBhDisable;
extensionBehavior[E_GL_ARB_explicit_uniform_location] = EBhDisable;
@ -193,6 +194,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_ARB_fragment_shader_interlock] = EBhDisable;
extensionBehavior[E_GL_ARB_shader_clock] = EBhDisable;
extensionBehavior[E_GL_ARB_uniform_buffer_object] = EBhDisable;
extensionBehavior[E_GL_ARB_sample_shading] = EBhDisable;
extensionBehavior[E_GL_KHR_shader_subgroup_basic] = EBhDisable;
extensionBehavior[E_GL_KHR_shader_subgroup_vote] = EBhDisable;
@ -380,6 +382,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_ARB_tessellation_shader 1\n"
"#define GL_ARB_enhanced_layouts 1\n"
"#define GL_ARB_texture_cube_map_array 1\n"
"#define GL_ARB_texture_multisample 1\n"
"#define GL_ARB_shader_texture_lod 1\n"
"#define GL_ARB_explicit_attrib_location 1\n"
"#define GL_ARB_explicit_uniform_location 1\n"
@ -395,6 +398,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_ARB_sparse_texture2 1\n"
"#define GL_ARB_sparse_texture_clamp 1\n"
"#define GL_ARB_shader_stencil_export 1\n"
"#define GL_ARB_sample_shading 1\n"
// "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members
"#define GL_ARB_post_depth_coverage 1\n"
"#define GL_ARB_fragment_shader_interlock 1\n"

View file

@ -124,6 +124,7 @@ const char* const E_GL_ARB_compute_shader = "GL_ARB_compute_shader
const char* const E_GL_ARB_tessellation_shader = "GL_ARB_tessellation_shader";
const char* const E_GL_ARB_enhanced_layouts = "GL_ARB_enhanced_layouts";
const char* const E_GL_ARB_texture_cube_map_array = "GL_ARB_texture_cube_map_array";
const char* const E_GL_ARB_texture_multisample = "GL_ARB_texture_multisample";
const char* const E_GL_ARB_shader_texture_lod = "GL_ARB_shader_texture_lod";
const char* const E_GL_ARB_explicit_attrib_location = "GL_ARB_explicit_attrib_location";
const char* const E_GL_ARB_explicit_uniform_location = "GL_ARB_explicit_uniform_location";
@ -145,6 +146,7 @@ const char* const E_GL_ARB_shader_viewport_layer_array = "GL_ARB_shader_viewpor
const char* const E_GL_ARB_fragment_shader_interlock = "GL_ARB_fragment_shader_interlock";
const char* const E_GL_ARB_shader_clock = "GL_ARB_shader_clock";
const char* const E_GL_ARB_uniform_buffer_object = "GL_ARB_uniform_buffer_object";
const char* const E_GL_ARB_sample_shading = "GL_ARB_sample_shading";
const char* const E_GL_KHR_shader_subgroup_basic = "GL_KHR_shader_subgroup_basic";
const char* const E_GL_KHR_shader_subgroup_vote = "GL_KHR_shader_subgroup_vote";