From 14bd7d061fbf2783b0239d645c97d1c1e1c18e8f Mon Sep 17 00:00:00 2001 From: ArthasMenethil Date: Tue, 20 Feb 2024 20:24:05 +0700 Subject: [PATCH] Fix shader cache with transform feedback on some android devices (cherry picked from commit d31d3e503e2a0b5719f6de57b2b350ed7b4160a0) --- drivers/gles3/shader_gles3.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index e1a9588d87d..241fb231d7e 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -584,6 +584,19 @@ bool ShaderGLES3::_load_from_cache(Version *p_version) { Version::Specialization specialization; specialization.id = glCreateProgram(); + if (feedback_count) { + Vector feedback; + for (int feedback_index = 0; feedback_index < feedback_count; feedback_index++) { + if (feedbacks[feedback_index].specialization == 0 || (feedbacks[feedback_index].specialization & specialization_key)) { + // Specialization for this feedback is enabled. + feedback.push_back(feedbacks[feedback_index].name); + } + } + + if (!feedback.is_empty()) { + glTransformFeedbackVaryings(specialization.id, feedback.size(), feedback.ptr(), GL_INTERLEAVED_ATTRIBS); + } + } glProgramBinary(specialization.id, variant_format, variant_bytes.ptr(), variant_bytes.size()); GLint link_status = 0;