浏览代码

Merge branch 'release/1.10.x'

rdb 3 年之前
父节点
当前提交
316b0009ae

+ 7 - 0
direct/src/filter/CommonFilters.py

@@ -466,6 +466,13 @@ class CommonFilters:
             return task.cont
 
     def setMSAA(self, samples):
+        """Enables multisample anti-aliasing on the render-to-texture buffer.
+        If you enable this, it is recommended to leave any multisample request
+        on the main framebuffer OFF (ie. don't set framebuffer-multisample true
+        in Config.prc), since it would be a waste of resources otherwise.
+
+        .. versionadded:: 1.10.13
+        """
         fullrebuild = "MSAA" not in self.configuration or self.configuration["MSAA"].samples != samples
         newconfig = FilterConfig()
         newconfig.samples = samples

+ 1 - 0
dtool/src/dtoolbase/deletedBufferChain.cxx

@@ -52,6 +52,7 @@ allocate(size_t size, TypeHandle type_handle) {
 #ifdef USE_DELETED_CHAIN
   // TAU_PROFILE("void *DeletedBufferChain::allocate(size_t, TypeHandle)", "
   // ", TAU_USER);
+  // If this triggers, maybe you forgot ALLOC_DELETED_CHAIN in a subclass?
   assert(size <= _buffer_size);
 
   // Determine how much space to allocate.

+ 2 - 0
makepanda/makepanda.py

@@ -290,6 +290,8 @@ def parseopts(args):
         OSX_ARCHS.append("arm64")
     elif target_archs:
         OSX_ARCHS = target_archs
+    elif platform.machine() == 'arm64':
+        OSX_ARCHS = ('arm64',)
 
     try:
         SetOptimize(int(optimize))

+ 31 - 2
panda/src/cocoadisplay/cocoaGraphicsWindow.mm

@@ -207,8 +207,13 @@ begin_frame(FrameMode mode, Thread *current_thread) {
 
   // Update the context if necessary, to make it reallocate buffers etc.
   if (_context_needs_update) {
-    [cocoagsg->_context update];
-    _context_needs_update = false;
+    if ([NSThread isMainThread]) {
+      [cocoagsg->_context update];
+      _context_needs_update = false;
+    } else {
+      cocoagsg->unlock_context();
+      return false;
+    }
   }
 
   // Lock the view for drawing.
@@ -349,6 +354,18 @@ process_events() {
   }
 
   [pool release];
+
+  if (_context_needs_update && _gsg != nullptr) {
+    CocoaGraphicsStateGuardian *cocoagsg;
+    DCAST_INTO_V(cocoagsg, _gsg);
+
+    if (cocoagsg != nullptr && cocoagsg->_context != nil) {
+      cocoagsg->lock_context();
+      _context_needs_update = false;
+      [cocoagsg->_context update];
+      cocoagsg->unlock_context();
+    }
+  }
 }
 
 /**
@@ -1116,6 +1133,18 @@ set_properties_now(WindowProperties &properties) {
       break;
     }
   }
+
+  if (_context_needs_update && _gsg != nullptr) {
+    CocoaGraphicsStateGuardian *cocoagsg;
+    DCAST_INTO_V(cocoagsg, _gsg);
+
+    if (cocoagsg != nullptr && cocoagsg->_context != nil) {
+      cocoagsg->lock_context();
+      _context_needs_update = false;
+      [cocoagsg->_context update];
+      cocoagsg->unlock_context();
+    }
+  }
 }
 
 /**

+ 1 - 1
tests/display/glsl_bad.vert

@@ -1,4 +1,4 @@
-#version 130
+#version 150
 
 // Uniform inputs
 uniform mat4 p3d_ModelViewProjectionMatrix;

+ 12 - 0
tests/display/glsl_bad_legacy.vert

@@ -0,0 +1,12 @@
+#version 120
+
+// Uniform inputs
+uniform mat4 p3d_ModelViewProjectionMatrix;
+
+// Vertex inputs
+attribute vec4 p3d_Vertex;
+
+void main() {
+  gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex;
+  does_not_exist = p3d_Vertex;
+}

+ 5 - 2
tests/display/glsl_include.vert

@@ -1,6 +1,9 @@
-#version 130
+#version 150
 
-#pragma include "glsl_include_inputs.vert"
+#pragma include "glsl_include_inputs.glsl"
+
+// Vertex inputs
+in vec4 p3d_Vertex;
 
 void main() {
   gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex;

+ 0 - 3
tests/display/glsl_include_inputs.vert → tests/display/glsl_include_inputs.glsl

@@ -1,5 +1,2 @@
 // Uniform inputs
 uniform mat4 p3d_ModelViewProjectionMatrix;
-
-// Vertex inputs
-in vec4 p3d_Vertex;

+ 10 - 0
tests/display/glsl_include_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;
+}

+ 4 - 2
tests/display/glsl_simple.frag

@@ -1,5 +1,7 @@
-#version 130
+#version 150
+
+out vec4 p3d_FragColor;
 
 void main() {
-  gl_FragColor = vec4(0, 0, 0, 1);
+  p3d_FragColor = vec4(0, 0, 0, 1);
 }

+ 1 - 1
tests/display/glsl_simple.vert

@@ -1,4 +1,4 @@
-#version 130
+#version 150
 
 // Uniform inputs
 uniform mat4 p3d_ModelViewProjectionMatrix;

+ 5 - 0
tests/display/glsl_simple_legacy.frag

@@ -0,0 +1,5 @@
+#version 120
+
+void main() {
+  gl_FragColor = vec4(0, 0, 0, 1);
+}

+ 11 - 0
tests/display/glsl_simple_legacy.vert

@@ -0,0 +1,11 @@
+#version 120
+
+// Uniform inputs
+uniform mat4 p3d_ModelViewProjectionMatrix;
+
+// Vertex inputs
+attribute vec4 p3d_Vertex;
+
+void main() {
+  gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex;
+}

+ 18 - 6
tests/display/test_glsl_shader.py

@@ -111,6 +111,9 @@ def run_glsl_compile_check(gsg, vert_path, frag_path, expect_fail=False):
     shader = core.Shader.load(core.Shader.SL_GLSL, vert_path, frag_path)
     assert shader is not None
 
+    if not gsg.supports_glsl:
+        expect_fail = True
+
     shader.prepare_now(gsg.prepared_objects, gsg)
     assert shader.is_prepared(gsg.prepared_objects)
     if expect_fail:
@@ -546,20 +549,29 @@ def test_glsl_write_extract_image_buffer(gsg):
 
 def test_glsl_compile_error(gsg):
     """Test getting compile errors from bad shaders"""
-    vert_path = core.Filename(SHADERS_DIR, 'glsl_bad.vert')
-    frag_path = core.Filename(SHADERS_DIR, 'glsl_simple.frag')
+    suffix = ''
+    if (gsg.driver_shader_version_major, gsg.driver_shader_version_minor) < (1, 50):
+        suffix = '_legacy'
+    vert_path = core.Filename(SHADERS_DIR, 'glsl_bad' + suffix + '.vert')
+    frag_path = core.Filename(SHADERS_DIR, 'glsl_simple' + suffix + '.frag')
     run_glsl_compile_check(gsg, vert_path, frag_path, expect_fail=True)
 
 
 def test_glsl_from_file(gsg):
     """Test compiling GLSL shaders from files"""
-    vert_path = core.Filename(SHADERS_DIR, 'glsl_simple.vert')
-    frag_path = core.Filename(SHADERS_DIR, 'glsl_simple.frag')
+    suffix = ''
+    if (gsg.driver_shader_version_major, gsg.driver_shader_version_minor) < (1, 50):
+        suffix = '_legacy'
+    vert_path = core.Filename(SHADERS_DIR, 'glsl_simple' + 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(gsg):
     """Test preprocessing includes in GLSL shaders"""
-    vert_path = core.Filename(SHADERS_DIR, 'glsl_include.vert')
-    frag_path = core.Filename(SHADERS_DIR, 'glsl_simple.frag')
+    suffix = ''
+    if (gsg.driver_shader_version_major, gsg.driver_shader_version_minor) < (1, 50):
+        suffix = '_legacy'
+    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)

+ 1 - 0
tests/display/test_window.py

@@ -11,6 +11,7 @@ def test_window_basic(window):
     default_props.set_origin(current_props.get_origin())
     default_props.set_minimized(False)
     default_props.foreground = current_props.foreground
+    default_props.z_order = current_props.z_order
 
     # The rest should be the same
     assert current_props == default_props