Add support for ARB_sample_shading
Version : >= 130 Extension Name: ARB_sample_shading Builtin-variables: "gl_SampleID" "gl_SamplePosition" "gl_SampleMask" "gl_NumSamples" Reference: https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_sample_shading.txt
This commit is contained in:
parent
bd97b6f9f2
commit
78b1180466
5 changed files with 270 additions and 236 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ void TParseVersions::initializeExtensionBehavior()
|
|||
extensionBehavior[E_GL_ARB_shader_viewport_layer_array] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_fragment_shader_interlock] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_shader_clock] = EBhDisable;
|
||||
extensionBehavior[E_GL_ARB_sample_shading] = EBhDisable;
|
||||
|
||||
extensionBehavior[E_GL_KHR_shader_subgroup_basic] = EBhDisable;
|
||||
extensionBehavior[E_GL_KHR_shader_subgroup_vote] = EBhDisable;
|
||||
|
|
@ -394,6 +395,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"
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ const char* const E_GL_ARB_post_depth_coverage = "GL_ARB_post_depth_cov
|
|||
const char* const E_GL_ARB_shader_viewport_layer_array = "GL_ARB_shader_viewport_layer_array";
|
||||
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_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";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue