Implement GL_ARB_shader_texture_image_samples. Also add in gl_MaxSamples and the float imageAtomicExchange.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@27721 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
df1d81a958
commit
cd77f8e922
11 changed files with 290 additions and 45 deletions
|
|
@ -1697,6 +1697,18 @@ void TBuiltIns::addQueryFunctions(TSampler sampler, TString& typeName, int versi
|
|||
commonBuiltins.append(",int);\n");
|
||||
else
|
||||
commonBuiltins.append(");\n");
|
||||
|
||||
// GL_ARB_shader_texture_image_samples
|
||||
// TODO: spec issue? there are no memory qualifiers; how to query a writeonly/readonly image, etc?
|
||||
if (profile != EEsProfile && version >= 430 && sampler.ms) {
|
||||
commonBuiltins.append("int ");
|
||||
if (sampler.image)
|
||||
commonBuiltins.append("imageSamples(");
|
||||
else
|
||||
commonBuiltins.append("textureSamples(");
|
||||
commonBuiltins.append(typeName);
|
||||
commonBuiltins.append(");\n");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -1764,6 +1776,15 @@ void TBuiltIns::addImageFunctions(TSampler sampler, TString& typeName, int versi
|
|||
commonBuiltins.append(", ");
|
||||
commonBuiltins.append(dataType);
|
||||
commonBuiltins.append(");\n");
|
||||
} else {
|
||||
// not int or uint
|
||||
// GL_ARB_ES3_1_compatibility
|
||||
// TODO: spec issue: are there restrictions on the kind of layout() that can be used? what about dropping memory qualifiers?
|
||||
if (version >= 450) {
|
||||
commonBuiltins.append("float imageAtomicExchange(coherent ");
|
||||
commonBuiltins.append(imageParams);
|
||||
commonBuiltins.append(", float);\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2356,6 +2377,8 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
|
|||
s.append(builtInConstant);
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounterBuffers = %d;", resources. maxGeometryAtomicCounterBuffers);
|
||||
s.append(builtInConstant);
|
||||
|
||||
s.append("\n");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2380,16 +2403,24 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
|
|||
s.append(builtInConstant);
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounterBuffers = %d;", resources.maxComputeAtomicCounterBuffers);
|
||||
s.append(builtInConstant);
|
||||
|
||||
s.append("\n");
|
||||
}
|
||||
|
||||
// GL_ARB_cull_distance
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxCullDistances = %d;", resources.maxCullDistances);
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxCullDistances = %d;", resources.maxCullDistances);
|
||||
s.append(builtInConstant);
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedClipAndCullDistances = %d;", resources.maxCombinedClipAndCullDistances);
|
||||
s.append(builtInConstant);
|
||||
}
|
||||
|
||||
// GL_ARB_ES3_1_compatibility
|
||||
if (profile != EEsProfile && version >= 450) {
|
||||
snprintf(builtInConstant, maxSize, "const int gl_MaxSamples = %d;", resources.maxSamples);
|
||||
s.append(builtInConstant);
|
||||
}
|
||||
|
||||
s.append("\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1296,12 +1296,17 @@ void TParseContext::nonOpBuiltInCheck(TSourceLoc loc, const TFunction& fnCandida
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GL_ARB_shader_texture_image_samples
|
||||
if (fnCandidate.getName().compare(0, 14, "textureSamples") == 0 || fnCandidate.getName().compare(0, 12, "imageSamples") == 0)
|
||||
profileRequires(loc, ~EEsProfile, 450, GL_ARB_shader_texture_image_samples, "textureSamples and imageSamples");
|
||||
|
||||
if (fnCandidate.getName().compare(0, 11, "imageAtomic") == 0) {
|
||||
const TType& imageType = callNode.getSequence()[0]->getAsTyped()->getType();
|
||||
if (imageType.getSampler().type == EbtInt || imageType.getSampler().type == EbtUint) {
|
||||
if (imageType.getQualifier().layoutFormat != ElfR32i && imageType.getQualifier().layoutFormat != ElfR32ui)
|
||||
error(loc, "only supported on image with format r32i or r32ui", fnCandidate.getName().c_str(), "");
|
||||
} else
|
||||
} else if (fnCandidate.getName().compare(0, 19, "imageAtomicExchange") != 0)
|
||||
error(loc, "only supported on integer images", fnCandidate.getName().c_str(), "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,26 +149,27 @@ namespace glslang {
|
|||
//
|
||||
void TParseContext::initializeExtensionBehavior()
|
||||
{
|
||||
extensionBehavior[GL_OES_texture_3D] = EBhDisable;
|
||||
extensionBehavior[GL_OES_standard_derivatives] = EBhDisable;
|
||||
extensionBehavior[GL_EXT_frag_depth] = EBhDisable;
|
||||
extensionBehavior[GL_OES_EGL_image_external] = EBhDisable;
|
||||
extensionBehavior[GL_EXT_shader_texture_lod] = EBhDisable;
|
||||
|
||||
extensionBehavior[GL_ARB_texture_rectangle] = EBhDisable;
|
||||
extensionBehavior[GL_3DL_array_objects] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_shading_language_420pack] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_texture_gather] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_gpu_shader5] = EBhDisablePartial;
|
||||
extensionBehavior[GL_ARB_separate_shader_objects] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_tessellation_shader] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_enhanced_layouts] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_texture_cube_map_array] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_shader_texture_lod] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_explicit_attrib_location] = EBhDisablePartial; // "index" for fragment outputs is missing
|
||||
extensionBehavior[GL_ARB_shader_image_load_store] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_shader_atomic_counters] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_derivative_control] = EBhDisable;
|
||||
extensionBehavior[GL_OES_texture_3D] = EBhDisable;
|
||||
extensionBehavior[GL_OES_standard_derivatives] = EBhDisable;
|
||||
extensionBehavior[GL_EXT_frag_depth] = EBhDisable;
|
||||
extensionBehavior[GL_OES_EGL_image_external] = EBhDisable;
|
||||
extensionBehavior[GL_EXT_shader_texture_lod] = EBhDisable;
|
||||
|
||||
extensionBehavior[GL_ARB_texture_rectangle] = EBhDisable;
|
||||
extensionBehavior[GL_3DL_array_objects] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_shading_language_420pack] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_texture_gather] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_gpu_shader5] = EBhDisablePartial;
|
||||
extensionBehavior[GL_ARB_separate_shader_objects] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_tessellation_shader] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_enhanced_layouts] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_texture_cube_map_array] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_shader_texture_lod] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_explicit_attrib_location] = EBhDisablePartial; // "index" for fragment outputs is missing
|
||||
extensionBehavior[GL_ARB_shader_image_load_store] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_shader_atomic_counters] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_derivative_control] = EBhDisable;
|
||||
extensionBehavior[GL_ARB_shader_texture_image_samples] = EBhDisable;
|
||||
// extensionBehavior[GL_ARB_cull_distance] = EBhDisable; // present for 4.5, but need extension control over block members
|
||||
}
|
||||
|
||||
|
|
@ -213,6 +214,7 @@ const char* TParseContext::getPreamble()
|
|||
"#define GL_ARB_shader_image_load_store 1\n"
|
||||
"#define GL_ARB_shader_atomic_counters 1\n"
|
||||
"#define GL_ARB_derivative_control 1\n"
|
||||
"#define GL_ARB_shader_texture_image_samples 1\n"
|
||||
// "#define GL_ARB_cull_distance 1\n" // present for 4.5, but need extension control over block members
|
||||
;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,26 +73,27 @@ typedef enum {
|
|||
// Symbolic names for extensions. Strings may be directly used when calling the
|
||||
// functions, but better to have the compiler do spelling checks.
|
||||
//
|
||||
const char* const GL_OES_texture_3D = "GL_OES_texture_3D";
|
||||
const char* const GL_OES_standard_derivatives = "GL_OES_standard_derivatives";
|
||||
const char* const GL_EXT_frag_depth = "GL_EXT_frag_depth";
|
||||
const char* const GL_OES_EGL_image_external = "GL_OES_EGL_image_external";
|
||||
const char* const GL_EXT_shader_texture_lod = "GL_EXT_shader_texture_lod";
|
||||
const char* const GL_OES_texture_3D = "GL_OES_texture_3D";
|
||||
const char* const GL_OES_standard_derivatives = "GL_OES_standard_derivatives";
|
||||
const char* const GL_EXT_frag_depth = "GL_EXT_frag_depth";
|
||||
const char* const GL_OES_EGL_image_external = "GL_OES_EGL_image_external";
|
||||
const char* const GL_EXT_shader_texture_lod = "GL_EXT_shader_texture_lod";
|
||||
|
||||
const char* const GL_ARB_texture_rectangle = "GL_ARB_texture_rectangle";
|
||||
const char* const GL_3DL_array_objects = "GL_3DL_array_objects";
|
||||
const char* const GL_ARB_shading_language_420pack = "GL_ARB_shading_language_420pack";
|
||||
const char* const GL_ARB_texture_gather = "GL_ARB_texture_gather";
|
||||
const char* const GL_ARB_gpu_shader5 = "GL_ARB_gpu_shader5";
|
||||
const char* const GL_ARB_separate_shader_objects = "GL_ARB_separate_shader_objects";
|
||||
const char* const GL_ARB_tessellation_shader = "GL_ARB_tessellation_shader";
|
||||
const char* const GL_ARB_enhanced_layouts = "GL_ARB_enhanced_layouts";
|
||||
const char* const GL_ARB_texture_cube_map_array = "GL_ARB_texture_cube_map_array";
|
||||
const char* const GL_ARB_shader_texture_lod = "GL_ARB_shader_texture_lod";
|
||||
const char* const GL_ARB_explicit_attrib_location = "GL_ARB_explicit_attrib_location";
|
||||
const char* const GL_ARB_shader_image_load_store = "GL_ARB_shader_image_load_store";
|
||||
const char* const GL_ARB_shader_atomic_counters = "GL_ARB_shader_atomic_counters";
|
||||
const char* const GL_ARB_derivative_control = "GL_ARB_derivative_control";
|
||||
const char* const GL_ARB_texture_rectangle = "GL_ARB_texture_rectangle";
|
||||
const char* const GL_3DL_array_objects = "GL_3DL_array_objects";
|
||||
const char* const GL_ARB_shading_language_420pack = "GL_ARB_shading_language_420pack";
|
||||
const char* const GL_ARB_texture_gather = "GL_ARB_texture_gather";
|
||||
const char* const GL_ARB_gpu_shader5 = "GL_ARB_gpu_shader5";
|
||||
const char* const GL_ARB_separate_shader_objects = "GL_ARB_separate_shader_objects";
|
||||
const char* const GL_ARB_tessellation_shader = "GL_ARB_tessellation_shader";
|
||||
const char* const GL_ARB_enhanced_layouts = "GL_ARB_enhanced_layouts";
|
||||
const char* const GL_ARB_texture_cube_map_array = "GL_ARB_texture_cube_map_array";
|
||||
const char* const GL_ARB_shader_texture_lod = "GL_ARB_shader_texture_lod";
|
||||
const char* const GL_ARB_explicit_attrib_location = "GL_ARB_explicit_attrib_location";
|
||||
const char* const GL_ARB_shader_image_load_store = "GL_ARB_shader_image_load_store";
|
||||
const char* const GL_ARB_shader_atomic_counters = "GL_ARB_shader_atomic_counters";
|
||||
const char* const GL_ARB_derivative_control = "GL_ARB_derivative_control";
|
||||
const char* const GL_ARB_shader_texture_image_samples = "GL_ARB_shader_texture_image_samples";
|
||||
//const char* const GL_ARB_cull_distance = "GL_ARB_cull_distance"; // present for 4.5, but need extension control over block members
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue