Unverified Commit 01aee059 by John Kessenich Committed by GitHub

Merge pull request #1995 from ShchchowAMD/ARB_sample_shading_support

Add support for ARB_sample_shading
parents 5de15a25 78b11804
...@@ -62,12 +62,14 @@ void bar2() ...@@ -62,12 +62,14 @@ void bar2()
b3 < b3; // ERROR b3 < b3; // ERROR
uv3 > uv3; // ERROR uv3 > uv3; // ERROR
uvec2(2, 3) >= uvec2(3,3); // ERROR uvec2(2, 3) >= uvec2(3,3); // ERROR
int samples = gl_NumSamples; // ERROR
int(bl4) <= int(bl4); // true int(bl4) <= int(bl4); // true
int(bl4.x) > int(bl4.y); // false int(bl4.x) > int(bl4.y); // false
} }
#extension GL_ARB_texture_gather : enable #extension GL_ARB_texture_gather : enable
#extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_rectangle : enable
#extension GL_ARB_sample_shading : enable
uniform sampler2D samp2D; uniform sampler2D samp2D;
uniform sampler2DShadow samp2DS; uniform sampler2DShadow samp2DS;
...@@ -83,6 +85,7 @@ void bar23() ...@@ -83,6 +85,7 @@ void bar23()
s = textureGatherOffset(samp2DA, vec3(0.3), ivec2(1)); s = textureGatherOffset(samp2DA, vec3(0.3), ivec2(1));
s = textureGatherOffset(samp2DS, vec2(0.3), 1.3, ivec2(1)); // ERROR s = textureGatherOffset(samp2DS, vec2(0.3), 1.3, ivec2(1)); // ERROR
s = textureGatherOffset(samp2D, vec2(0.3), ivec2(1), 2); // ERROR s = textureGatherOffset(samp2D, vec2(0.3), ivec2(1), 2); // ERROR
int samples = gl_NumSamples;
} }
#extension GL_ARB_gpu_shader5 : enable #extension GL_ARB_gpu_shader5 : enable
......
...@@ -5178,19 +5178,25 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV ...@@ -5178,19 +5178,25 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"flat in int gl_PrimitiveID;" "flat in int gl_PrimitiveID;"
); );
if (version >= 400) { if (version >= 130) { // ARB_sample_shading
stageBuiltins[EShLangFragment].append( stageBuiltins[EShLangFragment].append(
"flat in int gl_SampleID;" "flat in int gl_SampleID;"
" in vec2 gl_SamplePosition;" " in vec2 gl_SamplePosition;"
"flat in int gl_SampleMaskIn[];"
" out int gl_SampleMask[];" " out int gl_SampleMask[];"
); );
if (spvVersion.spv == 0)
if (spvVersion.spv == 0) {
stageBuiltins[EShLangFragment].append( stageBuiltins[EShLangFragment].append(
"uniform int gl_NumSamples;" "uniform int gl_NumSamples;"
); );
}
} }
if (version >= 400)
stageBuiltins[EShLangFragment].append(
"flat in int gl_SampleMaskIn[];"
);
if (version >= 430) if (version >= 430)
stageBuiltins[EShLangFragment].append( stageBuiltins[EShLangFragment].append(
"flat in int gl_Layer;" "flat in int gl_Layer;"
...@@ -7422,18 +7428,29 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion ...@@ -7422,18 +7428,29 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_FragStencilRefARB", EbvFragStencilRef, symbolTable); BuiltInVariable("gl_FragStencilRefARB", EbvFragStencilRef, symbolTable);
} }
if ((profile != EEsProfile && version >= 400) || if ((profile != EEsProfile && version >= 130) ||
(profile == EEsProfile && version >= 310)) { (profile == EEsProfile && version >= 310)) {
BuiltInVariable("gl_SampleID", EbvSampleId, symbolTable); BuiltInVariable("gl_SampleID", EbvSampleId, symbolTable);
BuiltInVariable("gl_SamplePosition", EbvSamplePosition, symbolTable); BuiltInVariable("gl_SamplePosition", EbvSamplePosition, symbolTable);
BuiltInVariable("gl_SampleMaskIn", EbvSampleMask, symbolTable); BuiltInVariable("gl_SampleMask", EbvSampleMask, symbolTable);
BuiltInVariable("gl_SampleMask", EbvSampleMask, symbolTable);
if (profile == EEsProfile && version < 320) { if (profile != EEsProfile && version < 400) {
symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_OES_sample_variables); BuiltInVariable("gl_NumSamples", EbvSampleMask, symbolTable);
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_ARB_sample_shading);
symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_OES_sample_variables); symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_ARB_sample_shading);
symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_OES_sample_variables); 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() ...@@ -192,6 +192,7 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_ARB_shader_viewport_layer_array] = EBhDisable; extensionBehavior[E_GL_ARB_shader_viewport_layer_array] = EBhDisable;
extensionBehavior[E_GL_ARB_fragment_shader_interlock] = EBhDisable; extensionBehavior[E_GL_ARB_fragment_shader_interlock] = EBhDisable;
extensionBehavior[E_GL_ARB_shader_clock] = 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_basic] = EBhDisable;
extensionBehavior[E_GL_KHR_shader_subgroup_vote] = EBhDisable; extensionBehavior[E_GL_KHR_shader_subgroup_vote] = EBhDisable;
...@@ -394,6 +395,7 @@ void TParseVersions::getPreamble(std::string& preamble) ...@@ -394,6 +395,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_ARB_sparse_texture2 1\n" "#define GL_ARB_sparse_texture2 1\n"
"#define GL_ARB_sparse_texture_clamp 1\n" "#define GL_ARB_sparse_texture_clamp 1\n"
"#define GL_ARB_shader_stencil_export 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_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_post_depth_coverage 1\n"
"#define GL_ARB_fragment_shader_interlock 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 ...@@ -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_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_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_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_basic = "GL_KHR_shader_subgroup_basic";
const char* const E_GL_KHR_shader_subgroup_vote = "GL_KHR_shader_subgroup_vote"; const char* const E_GL_KHR_shader_subgroup_vote = "GL_KHR_shader_subgroup_vote";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment