From c966a6898c65365340ea1f88f70b0ae4864f7422 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 31 Aug 2022 09:22:40 +0200 Subject: [PATCH 1/6] makepanda: Fix naming of wheels for macOS 12.0 --- makepanda/makepanda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index afff30627a..b44e6a72b0 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -451,7 +451,7 @@ elif target == 'darwin': else: maj, min = platform.mac_ver()[0].split('.')[:2] osxver = int(maj), int(min) - if osxver[0] == 11: + if osxver[0] >= 11: # I think Python pins minor version to 0 from macOS 11 onward osxver = (osxver[0], 0) From 8617eb917c9009f1a540b4d789e261a50e3a5387 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 31 Aug 2022 10:28:08 +0200 Subject: [PATCH 2/6] makepanda: Force DT_RPATH instead of DT_RUNPATH for deploy-stub Fixes #1358 --- makepanda/makepanda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index b44e6a72b0..f8ff2e1725 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -6979,7 +6979,7 @@ if PkgSkip("PYTHON") == 0: if GetTarget() == 'linux' or GetTarget() == 'freebsd': # Setup rpath so libs can be found in the same directory as the deployed game - LibName('DEPLOYSTUB', "-Wl,-rpath,\\$ORIGIN") + LibName('DEPLOYSTUB', "-Wl,--disable-new-dtags,-rpath,\\$ORIGIN") LibName('DEPLOYSTUB', "-Wl,-z,origin") LibName('DEPLOYSTUB', "-rdynamic") PyTargetAdd('deploy-stub.exe', input='deploy-stub.obj') From 3e220e4fb442775b123f03a27a4db4f051d16b15 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 31 Aug 2022 11:15:27 +0200 Subject: [PATCH 3/6] deploy-stub: Set `Py_OptimizeFlag` to 2 for Python 3.2+ This fixes the value of `sys.flags.optimize`, as we always build Python code with `optimize=2` in Python 3.2 and above In the long run we need a better solution, see #1363 Closes #1359 Fixes #1343 --- pandatool/src/deploy-stub/deploy-stub.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandatool/src/deploy-stub/deploy-stub.c b/pandatool/src/deploy-stub/deploy-stub.c index 1bcbdc1cad..fcd9e59e6f 100644 --- a/pandatool/src/deploy-stub/deploy-stub.c +++ b/pandatool/src/deploy-stub/deploy-stub.c @@ -441,6 +441,10 @@ int Py_FrozenMain(int argc, char **argv) Py_NoSiteFlag = 0; Py_NoUserSiteDirectory = 1; +#if PY_VERSION_HEX >= 0x03020000 + Py_OptimizeFlag = 2; +#endif + #ifndef NDEBUG if ((p = Py_GETENV("PYTHONINSPECT")) && *p != '\0') inspect = 1; From 899cbb9fff3f7e77bb69f6d62d1247884d6891c0 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 31 Aug 2022 11:37:49 +0200 Subject: [PATCH 4/6] shadow: Add shadow-cube-map-filter setting, disabled by default Enabling this will enable the `FT_shadow` filter for cube maps, which doesn't work with Cg shaders (incl. shader generator) but does with custom GLSL shaders This will be enabled by default once the shaderpipeline branch is merged Fixes #1332 --- panda/src/display/config_display.cxx | 6 ++++++ panda/src/display/config_display.h | 1 + panda/src/display/graphicsStateGuardian.cxx | 11 +++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/panda/src/display/config_display.cxx b/panda/src/display/config_display.cxx index 2cb2f40c27..58caa6af2a 100644 --- a/panda/src/display/config_display.cxx +++ b/panda/src/display/config_display.cxx @@ -463,6 +463,12 @@ ConfigVariableInt shadow_depth_bits PRC_DESC("The minimum number of depth buffer bits requested when rendering " "shadow maps. Set this to 32 for more depth resolution in shadow " "maps.")); +ConfigVariableBool shadow_cube_map_filter +("shadow-cube-map-filter", false, + PRC_DESC("If true, Panda enables hardware depth map comparison mode for " + "point lights, if supported. If false, does not. Keep this set to " + "false if you want the shader generator to work correctly for point " + "light shadows.")); ConfigVariableColor background_color ("background-color", "0.41 0.41 0.41 0.0", diff --git a/panda/src/display/config_display.h b/panda/src/display/config_display.h index fb4da08b8d..a76c473c91 100644 --- a/panda/src/display/config_display.h +++ b/panda/src/display/config_display.h @@ -103,6 +103,7 @@ extern EXPCL_PANDA_DISPLAY ConfigVariableInt accum_bits; extern EXPCL_PANDA_DISPLAY ConfigVariableInt multisamples; extern EXPCL_PANDA_DISPLAY ConfigVariableInt back_buffers; extern EXPCL_PANDA_DISPLAY ConfigVariableInt shadow_depth_bits; +extern EXPCL_PANDA_DISPLAY ConfigVariableBool shadow_cube_map_filter; extern EXPCL_PANDA_DISPLAY ConfigVariableDouble pixel_zoom; diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index 9ea3ab1f90..b1f0961658 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -3580,8 +3580,15 @@ get_dummy_shadow_map(Texture::TextureType texture_type) const { dummy_cube->setup_cube_map(1, Texture::T_unsigned_byte, Texture::F_depth_component); dummy_cube->set_clear_color(1); // Note: cube map shadow filtering doesn't seem to work in Cg. - dummy_cube->set_minfilter(SamplerState::FT_linear); - dummy_cube->set_magfilter(SamplerState::FT_linear); + // That is why it is currently disabled by default, but it can be + // overridden in Config.prc for apps that have custom GLSL shaders. + if (shadow_cube_map_filter && get_supports_shadow_filter()) { + dummy_cube->set_minfilter(SamplerState::FT_shadow); + dummy_cube->set_magfilter(SamplerState::FT_shadow); + } else { + dummy_cube->set_minfilter(SamplerState::FT_linear); + dummy_cube->set_magfilter(SamplerState::FT_linear); + } } return dummy_cube; } From d7c602d2030e5cda1990b0cafafaeeac831caa55 Mon Sep 17 00:00:00 2001 From: Disyer Date: Tue, 26 Jul 2022 18:22:13 +0300 Subject: [PATCH 5/6] ffmpeg: Resolve segmentation fault when statically linking ffmpeg Closes #1340 --- panda/src/ffmpeg/ffmpegAudio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/ffmpeg/ffmpegAudio.h b/panda/src/ffmpeg/ffmpegAudio.h index 6559f59ff5..fe22f93c23 100644 --- a/panda/src/ffmpeg/ffmpegAudio.h +++ b/panda/src/ffmpeg/ffmpegAudio.h @@ -38,7 +38,7 @@ public: return _type_handle; } static void init_type() { - TypedWritableReferenceCount::init_type(); + MovieAudio::init_type(); register_type(_type_handle, "FfmpegAudio", MovieAudio::get_class_type()); } From 813490b2c7f0ed39d1893c093698691e9afa083c Mon Sep 17 00:00:00 2001 From: WMOkiishi Date: Wed, 31 Aug 2022 11:52:18 +0200 Subject: [PATCH 6/6] interrogatedb: Add functions to interrogate_interface.h: - `interrogate_function_is_unary_op` - `interrogate_function_is_operator_typecast` - `interrogate_type_is_array` - `interrogate_type_array_size` Closes #1362 --- dtool/metalibs/dtoolconfig/pydtool.cxx | 108 ++++++++++++++++++ .../interrogatedb/interrogate_interface.cxx | 25 ++++ .../src/interrogatedb/interrogate_interface.h | 6 + 3 files changed, 139 insertions(+) diff --git a/dtool/metalibs/dtoolconfig/pydtool.cxx b/dtool/metalibs/dtoolconfig/pydtool.cxx index 5eca11ea8c..fa5474a18c 100644 --- a/dtool/metalibs/dtoolconfig/pydtool.cxx +++ b/dtool/metalibs/dtoolconfig/pydtool.cxx @@ -60,6 +60,8 @@ static PyObject *_inP07ytISgV(PyObject *self, PyObject *args); static PyObject *_inP07ytH3bx(PyObject *self, PyObject *args); static PyObject *_inP07ytzeUk(PyObject *self, PyObject *args); static PyObject *_inP07ytUeI5(PyObject *self, PyObject *args); +static PyObject *_inP07ytbmxJ(PyObject *self, PyObject *args); +static PyObject *_inP07ytY8Lc(PyObject *self, PyObject *args); static PyObject *_inP07ytJAAI(PyObject *self, PyObject *args); static PyObject *_inP07yt0UXw(PyObject *self, PyObject *args); static PyObject *_inP07ytuSvx(PyObject *self, PyObject *args); @@ -95,6 +97,8 @@ static PyObject *_inP07ytiytI(PyObject *self, PyObject *args); static PyObject *_inP07ytZc07(PyObject *self, PyObject *args); static PyObject *_inP07ytfaH0(PyObject *self, PyObject *args); static PyObject *_inP07ytGB9D(PyObject *self, PyObject *args); +static PyObject *_inP07ytrppS(PyObject *self, PyObject *args); +static PyObject *_inP07ytO50x(PyObject *self, PyObject *args); static PyObject *_inP07ytsxxs(PyObject *self, PyObject *args); static PyObject *_inP07ytMT0z(PyObject *self, PyObject *args); static PyObject *_inP07ytiW3v(PyObject *self, PyObject *args); @@ -126,6 +130,8 @@ static PyObject *_inP07ytDyRd(PyObject *self, PyObject *args); static PyObject *_inP07ytMnKa(PyObject *self, PyObject *args); static PyObject *_inP07ytRtji(PyObject *self, PyObject *args); static PyObject *_inP07ytCnbQ(PyObject *self, PyObject *args); +static PyObject *_inP07ytoxqc(PyObject *self, PyObject *args); +static PyObject *_inP07ytZQIS(PyObject *self, PyObject *args); static PyObject *_inP07ytdUVN(PyObject *self, PyObject *args); static PyObject *_inP07ytZtNk(PyObject *self, PyObject *args); static PyObject *_inP07ytihbt(PyObject *self, PyObject *args); @@ -828,6 +834,34 @@ _inP07ytUeI5(PyObject *, PyObject *args) { return nullptr; } +/* + * Python simple wrapper for + * bool interrogate_function_is_unary_op(FunctionIndex function) + */ +static PyObject * +_inP07ytbmxJ(PyObject *, PyObject *args) { + int param0; + if (PyArg_ParseTuple(args, "i", ¶m0)) { + bool return_value = (::interrogate_function_is_unary_op)((FunctionIndex)param0); + return PyBool_FromLong(return_value); + } + return nullptr; +} + +/* + * Python simple wrapper for + * bool interrogate_function_is_operator_typecast(FunctionIndex function) + */ +static PyObject * +_inP07ytY8Lc(PyObject *, PyObject *args) { + int param0; + if (PyArg_ParseTuple(args, "i", ¶m0)) { + bool return_value = (::interrogate_function_is_operator_typecast)((FunctionIndex)param0); + return PyBool_FromLong(return_value); + } + return nullptr; +} + /* * Python simple wrapper for * bool interrogate_function_is_constructor(FunctionIndex function) @@ -1405,6 +1439,42 @@ _inP07ytGB9D(PyObject *, PyObject *args) { return nullptr; } +/* + * Python simple wrapper for + * FunctionIndex interrogate_make_seq_num_getter(MakeSeqIndex make_seq) + */ +static PyObject * +_inP07ytrppS(PyObject *, PyObject *args) { + int param0; + if (PyArg_ParseTuple(args, "i", ¶m0)) { + FunctionIndex return_value = (::interrogate_make_seq_num_getter)((MakeSeqIndex)param0); +#if PY_MAJOR_VERSION >= 3 + return PyLong_FromLong(return_value); +#else + return PyInt_FromLong(return_value); +#endif + } + return nullptr; +} + +/* + * Python simple wrapper for + * FunctionIndex interrogate_make_seq_element_getter(MakeSeqIndex make_seq) + */ +static PyObject * +_inP07ytO50x(PyObject *, PyObject *args) { + int param0; + if (PyArg_ParseTuple(args, "i", ¶m0)) { + FunctionIndex return_value = (::interrogate_make_seq_element_getter)((MakeSeqIndex)param0); +#if PY_MAJOR_VERSION >= 3 + return PyLong_FromLong(return_value); +#else + return PyInt_FromLong(return_value); +#endif + } + return nullptr; +} + /* * Python simple wrapper for * int interrogate_number_of_global_types(void) @@ -1901,6 +1971,38 @@ _inP07ytCnbQ(PyObject *, PyObject *args) { return nullptr; } +/* + * Python simple wrapper for + * bool interrogate_type_is_array(TypeIndex type) + */ +static PyObject * +_inP07ytoxqc(PyObject *, PyObject *args) { + int param0; + if (PyArg_ParseTuple(args, "i", ¶m0)) { + bool return_value = (::interrogate_type_is_array)((TypeIndex)param0); + return PyBool_FromLong(return_value); + } + return nullptr; +} + +/* + * Python simple wrapper for + * int interrogate_type_array_size(TypeIndex type) + */ +static PyObject * +_inP07ytZQIS(PyObject *, PyObject *args) { + int param0; + if (PyArg_ParseTuple(args, "i", ¶m0)) { + int return_value = (::interrogate_type_array_size)((TypeIndex)param0); +#if PY_MAJOR_VERSION >= 3 + return PyLong_FromLong(return_value); +#else + return PyInt_FromLong(return_value); +#endif + } + return nullptr; +} + /* * Python simple wrapper for * bool interrogate_type_is_enum(TypeIndex type) @@ -2565,6 +2667,8 @@ static PyMethodDef python_simple_funcs[] = { { "interrogate_function_prototype", &_inP07ytH3bx, METH_VARARGS }, { "interrogate_function_is_method", &_inP07ytzeUk, METH_VARARGS }, { "interrogate_function_class", &_inP07ytUeI5, METH_VARARGS }, + { "interrogate_function_is_unary_op", &_inP07ytbmxJ, METH_VARARGS }, + { "interrogate_function_is_operator_typecast", &_inP07ytY8Lc, METH_VARARGS }, { "interrogate_function_is_constructor", &_inP07ytJAAI, METH_VARARGS }, { "interrogate_function_is_destructor", &_inP07yt0UXw, METH_VARARGS }, { "interrogate_function_has_module_name", &_inP07ytuSvx, METH_VARARGS }, @@ -2600,6 +2704,8 @@ static PyMethodDef python_simple_funcs[] = { { "interrogate_make_seq_comment", &_inP07ytZc07, METH_VARARGS }, { "interrogate_make_seq_num_name", &_inP07ytfaH0, METH_VARARGS }, { "interrogate_make_seq_element_name", &_inP07ytGB9D, METH_VARARGS }, + { "interrogate_make_seq_num_getter", &_inP07ytrppS, METH_VARARGS }, + { "interrogate_make_seq_element_getter", &_inP07ytO50x, METH_VARARGS }, { "interrogate_number_of_global_types", &_inP07ytsxxs, METH_VARARGS }, { "interrogate_get_global_type", &_inP07ytMT0z, METH_VARARGS }, { "interrogate_number_of_types", &_inP07ytiW3v, METH_VARARGS }, @@ -2631,6 +2737,8 @@ static PyMethodDef python_simple_funcs[] = { { "interrogate_type_is_const", &_inP07ytMnKa, METH_VARARGS }, { "interrogate_type_is_typedef", &_inP07ytRtji, METH_VARARGS }, { "interrogate_type_wrapped_type", &_inP07ytCnbQ, METH_VARARGS }, + { "interrogate_type_is_array", &_inP07ytoxqc, METH_VARARGS }, + { "interrogate_type_array_size", &_inP07ytZQIS, METH_VARARGS }, { "interrogate_type_is_enum", &_inP07ytdUVN, METH_VARARGS }, { "interrogate_type_is_scoped_enum", &_inP07ytZtNk, METH_VARARGS }, { "interrogate_type_number_of_enum_values", &_inP07ytihbt, METH_VARARGS }, diff --git a/dtool/src/interrogatedb/interrogate_interface.cxx b/dtool/src/interrogatedb/interrogate_interface.cxx index 38f03bad11..d7f4ce58dd 100644 --- a/dtool/src/interrogatedb/interrogate_interface.cxx +++ b/dtool/src/interrogatedb/interrogate_interface.cxx @@ -266,6 +266,19 @@ interrogate_function_class(FunctionIndex function) { return InterrogateDatabase::get_ptr()->get_function(function).get_class(); } +bool +interrogate_function_is_unary_op(FunctionIndex function) { + // cerr << "interrogate_function_is_unary_op(" << function << ")\n"; + return InterrogateDatabase::get_ptr()->get_function(function).is_unary_op(); +} + +bool +interrogate_function_is_operator_typecast(FunctionIndex function) { + // cerr << "interrogate_function_is_operator_typecast(" << function << + // ")\n"; + return InterrogateDatabase::get_ptr()->get_function(function).is_operator_typecast(); +} + bool interrogate_function_is_constructor(FunctionIndex function) { // cerr << "interrogate_function_is_constructor(" << function << ")\n"; @@ -697,6 +710,18 @@ interrogate_type_wrapped_type(TypeIndex type) { return InterrogateDatabase::get_ptr()->get_type(type).get_wrapped_type(); } +bool +interrogate_type_is_array(TypeIndex type) { + // cerr << "interrogate_type_is_array(" << type << ")\n"; + return InterrogateDatabase::get_ptr()->get_type(type).is_array(); +} + +int +interrogate_type_array_size(TypeIndex type) { + // cerr << "interrogate_type_array_size(" << type << ")\n"; + return InterrogateDatabase::get_ptr()->get_type(type).get_array_size(); +} + bool interrogate_type_is_enum(TypeIndex type) { // cerr << "interrogate_type_is_enum(" << type << ")\n"; diff --git a/dtool/src/interrogatedb/interrogate_interface.h b/dtool/src/interrogatedb/interrogate_interface.h index fa44a00f2c..a44f9fef92 100644 --- a/dtool/src/interrogatedb/interrogate_interface.h +++ b/dtool/src/interrogatedb/interrogate_interface.h @@ -210,6 +210,8 @@ EXPCL_INTERROGATEDB const char *interrogate_function_prototype(FunctionIndex fun // if the function is a class method. EXPCL_INTERROGATEDB bool interrogate_function_is_method(FunctionIndex function); EXPCL_INTERROGATEDB TypeIndex interrogate_function_class(FunctionIndex function); +EXPCL_INTERROGATEDB bool interrogate_function_is_unary_op(FunctionIndex function); +EXPCL_INTERROGATEDB bool interrogate_function_is_operator_typecast(FunctionIndex function); EXPCL_INTERROGATEDB bool interrogate_function_is_constructor(FunctionIndex function); EXPCL_INTERROGATEDB bool interrogate_function_is_destructor(FunctionIndex function); @@ -424,6 +426,10 @@ EXPCL_INTERROGATEDB bool interrogate_type_is_const(TypeIndex type); EXPCL_INTERROGATEDB bool interrogate_type_is_typedef(TypeIndex type); EXPCL_INTERROGATEDB TypeIndex interrogate_type_wrapped_type(TypeIndex type); +// If interrogate_type_is_array() returns true, this is an array type. +EXPCL_INTERROGATEDB bool interrogate_type_is_array(TypeIndex type); +EXPCL_INTERROGATEDB int interrogate_type_array_size(TypeIndex type); + // If interrogate_type_is_enum() returns true, this is an enumerated type, // which means it may take any one of a number of named integer values. EXPCL_INTERROGATEDB bool interrogate_type_is_enum(TypeIndex type);