gl_shader_cache: Enable extensions only when available

Silence GLSL compilation warnings.
master
ReinUsesLisp 2019-11-07 20:07:45 +07:00
parent cd66395944
commit 3ab0514698
No known key found for this signature in database
GPG Key ID: 2DFC508897B39CFE
1 changed files with 14 additions and 6 deletions

@ -275,17 +275,25 @@ CachedProgram BuildShader(const Device& device, u64 unique_identifier, ProgramTy
std::string source = fmt::format(R"(// {} std::string source = fmt::format(R"(// {}
#version 430 core #version 430 core
#extension GL_ARB_separate_shader_objects : enable #extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shader_ballot : enable
#extension GL_ARB_shader_viewport_layer_array : enable
#extension GL_EXT_shader_image_load_formatted : enable
#extension GL_NV_gpu_shader5 : enable
#extension GL_NV_shader_thread_group : enable
#extension GL_NV_shader_thread_shuffle : enable
)", )",
GetShaderId(unique_identifier, program_type)); GetShaderId(unique_identifier, program_type));
if (is_compute) { if (is_compute) {
source += "#extension GL_ARB_compute_variable_group_size : require\n"; source += "#extension GL_ARB_compute_variable_group_size : require\n";
} }
if (device.HasShaderBallot()) {
source += "#extension GL_ARB_shader_ballot : require\n";
}
if (device.HasVertexViewportLayer()) {
source += "#extension GL_ARB_shader_viewport_layer_array : require\n";
}
if (device.HasImageLoadFormatted()) {
source += "#extension GL_EXT_shader_image_load_formatted : require\n";
}
if (device.HasWarpIntrinsics()) {
source += "#extension GL_NV_gpu_shader5 : require\n"
"#extension GL_NV_shader_thread_group : require\n"
"#extension GL_NV_shader_thread_shuffle : require\n";
}
source += '\n'; source += '\n';
if (!is_compute) { if (!is_compute) {