Explorar o código

Merge branch 'release/1.10.x'

rdb %!s(int64=3) %!d(string=hai) anos
pai
achega
e961ea99ac

+ 3 - 0
makepanda/makepanda.py

@@ -966,6 +966,9 @@ if (COMPILER=="GCC"):
             LibName("ARTOOLKIT", "-Wl,--exclude-libs,libAR.a")
             LibName("ARTOOLKIT", "-Wl,--exclude-libs,libARMulti.a")
 
+        if not PkgSkip("HARFBUZZ"):
+            LibName("HARFBUZZ", "-Wl,--exclude-libs,libharfbuzz.a")
+
         if not PkgSkip("MIMALLOC"):
             LibName("MIMALLOC", "-Wl,--exclude-libs,libmimalloc.a")
 

+ 1 - 1
panda/src/gobj/shader.cxx

@@ -2943,7 +2943,7 @@ r_preprocess_source(ostream &out, istream &in, const Filename &fn,
             source_dir = full_fn.get_dirname();
             incfn = incfile;
 
-          } else if (sscanf(line.c_str(), " # pragma%*[ \t]include <%2047[^\"]> %zn", incfile, &nread) == 1
+          } else if (sscanf(line.c_str(), " # pragma%*[ \t]include <%2047[^\>]> %zn", incfile, &nread) == 1
               && nread == line.size()) {
             // Angled includes are also OK, but we don't search in the directory
             // of the source file.

+ 30 - 12
panda/src/pgraph/geomNode.cxx

@@ -206,38 +206,56 @@ apply_attribs_to_vertices(const AccumulatedAttribs &attribs, int attrib_types,
           // effect on the GeomNode; this may not be true if there is a
           // texture that has been applied at a node above that from which we
           // started the flatten operation, but caveat programmer.
-          NameCount name_count;
+          pmap<InternalName *, pset<CPT(TransformState)> > name_transforms;
+
+          const TexMatrixAttrib *tma =
+            DCAST(TexMatrixAttrib, geom_attribs._tex_matrix);
+          int num_stages = tma->get_num_stages();
+          for (int i = 0; i < num_stages; i++) {
+            TextureStage *stage = tma->get_stage(i);
+            InternalName *name = stage->get_texcoord_name();
+            name_transforms[name].insert(tma->get_transform(stage)->get_unique());
+          }
 
           if (geom_attribs._texture != nullptr) {
+            // There may be stages without a TexMatrixAttrib, which implicitly
+            // use the identity transform.
             const TextureAttrib *ta = DCAST(TextureAttrib, geom_attribs._texture);
             int num_on_stages = ta->get_num_on_stages();
             for (int si = 0; si < num_on_stages; si++) {
               TextureStage *stage = ta->get_on_stage(si);
-              const InternalName *name = stage->get_texcoord_name();
-              count_name(name_count, name);
+              InternalName *name = stage->get_texcoord_name();
+              if (!tma->has_stage(stage)) {
+                name_transforms[name].insert(TransformState::make_identity());
+              }
             }
           }
 
-          const TexMatrixAttrib *tma =
-            DCAST(TexMatrixAttrib, geom_attribs._tex_matrix);
-
           CPT(TexMatrixAttrib) new_tma = DCAST(TexMatrixAttrib, TexMatrixAttrib::make());
 
-          int num_stages = tma->get_num_stages();
           for (int i = 0; i < num_stages; i++) {
             TextureStage *stage = tma->get_stage(i);
             InternalName *name = stage->get_texcoord_name();
-            if (get_name_count(name_count, name) > 1) {
+            auto it = name_transforms.find(name);
+            if (it == name_transforms.end()) {
+              // Already processed this set.
+            }
+            else if (it->second.size() != 1) {
               // We can't transform these texcoords, since the name is used by
               // more than one active stage.
               new_tma = DCAST(TexMatrixAttrib, new_tma->add_stage(stage, tma->get_transform(stage)));
-
-            } else {
+            }
+            else {
               // It's safe to transform these texcoords; the name is used by
-              // no more than one active stage.
-              if (transformer.transform_texcoords(new_geom, name, name, tma->get_mat(stage))) {
+              // no more than one active stage, or all these stages have the
+              // same transform.
+              const TransformState *transform = *(it->second.begin());
+              if (!transform->is_identity() &&
+                  transformer.transform_texcoords(new_geom, name, name, transform->get_mat())) {
                 any_changed = true;
               }
+              // Now make sure we don't transform this set more than once.
+              name_transforms.erase(it);
             }
           }
 

+ 10 - 0
tests/display/glsl_include_angle.vert

@@ -0,0 +1,10 @@
+#version 150
+
+#pragma include <glsl_include_inputs.glsl>
+
+// Vertex inputs
+in vec4 p3d_Vertex;
+
+void main() {
+  gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex;
+}

+ 10 - 0
tests/display/glsl_include_angle_legacy.vert

@@ -0,0 +1,10 @@
+#version 120
+
+#pragma include <glsl_include_inputs.glsl>
+
+// Vertex inputs
+attribute vec4 p3d_Vertex;
+
+void main() {
+  gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex;
+}

+ 28 - 0
tests/display/test_glsl_shader.py

@@ -575,3 +575,31 @@ def test_glsl_includes(gsg):
     vert_path = core.Filename(SHADERS_DIR, 'glsl_include' + suffix + '.vert')
     frag_path = core.Filename(SHADERS_DIR, 'glsl_simple' + suffix + '.frag')
     run_glsl_compile_check(gsg, vert_path, frag_path)
+
+
+def test_glsl_includes_angle_nodir(gsg):
+    """Test preprocessing includes with angle includes without model-path"""
+    suffix = ''
+    if (gsg.driver_shader_version_major, gsg.driver_shader_version_minor) < (1, 50):
+        suffix = '_legacy'
+    vert_path = core.Filename(SHADERS_DIR, 'glsl_include_angle' + suffix + '.vert')
+    frag_path = core.Filename(SHADERS_DIR, 'glsl_simple' + suffix + '.frag')
+    assert core.Shader.load(core.Shader.SL_GLSL, vert_path, frag_path) is None
+
+
[email protected]
+def with_current_dir_on_model_path():
+    model_path = core.get_model_path()
+    model_path.prepend_directory(core.Filename.from_os_specific(os.path.dirname(__file__)))
+    yield
+    model_path.clear_local_value()
+
+
+def test_glsl_includes_angle_withdir(gsg, with_current_dir_on_model_path):
+    """Test preprocessing includes with angle includes with model-path"""
+    suffix = ''
+    if (gsg.driver_shader_version_major, gsg.driver_shader_version_minor) < (1, 50):
+        suffix = '_legacy'
+    vert_path = core.Filename(SHADERS_DIR, 'glsl_include_angle' + suffix + '.vert')
+    frag_path = core.Filename(SHADERS_DIR, 'glsl_simple' + suffix + '.frag')
+    run_glsl_compile_check(gsg, vert_path, frag_path)