Properly advertise GL_ARB_bindless_texture as being unavailable when generating SPIR-V

This commit is contained in:
Samuel Bourasseau 2023-12-06 11:19:58 +01:00 committed by arcady-lunarg
parent 6200ac47a9
commit 3bc462c5bc
2 changed files with 8 additions and 2 deletions

View file

@ -1663,7 +1663,9 @@ TIntermNode* TParseContext::handleReturnValue(const TSourceLoc& loc, TIntermType
}
} else {
if (value->getType().isTexture() || value->getType().isImage()) {
if (!extensionTurnedOn(E_GL_ARB_bindless_texture))
if (spvVersion.spv != 0)
error(loc, "sampler or image cannot be used as return type when generating SPIR-V", "return", "");
else if (!extensionTurnedOn(E_GL_ARB_bindless_texture))
error(loc, "sampler or image can be used as return type only when the extension GL_ARB_bindless_texture enabled", "return", "");
}
branch = intermediate.addBranch(EOpReturn, value, loc);

View file

@ -487,7 +487,7 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_ARB_vertex_attrib_64bit 1\n"
"#define GL_ARB_draw_instanced 1\n"
"#define GL_ARB_fragment_coord_conventions 1\n"
"#define GL_ARB_bindless_texture 1\n"
"#define GL_EXT_shader_non_constant_global_initializers 1\n"
"#define GL_EXT_shader_image_load_formatted 1\n"
"#define GL_EXT_post_depth_coverage 1\n"
@ -582,6 +582,10 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_EXT_fragment_shader_barycentric 1\n"
;
if (spvVersion.spv == 0) {
preamble += "#define GL_ARB_bindless_texture 1\n";
}
if (version >= 150) {
// define GL_core_profile and GL_compatibility_profile
preamble += "#define GL_core_profile 1\n";