Merge branch 'release/1.10.x'

This commit is contained in:
rdb 2024-01-04 16:29:24 +01:00
commit 9145b6c729
13 changed files with 77 additions and 35 deletions

View File

@ -471,7 +471,9 @@ class build_apps(setuptools.Command):
if self.bam_model_extensions: if self.bam_model_extensions:
for ext in self.bam_model_extensions: for ext in self.bam_model_extensions:
ext = '.' + ext.lstrip('.') ext = '.' + ext.lstrip('.')
assert ext not in self.file_handlers, \ handler = self.file_handlers.get(ext)
if handler != _model_to_bam:
assert handler is None, \
'Extension {} occurs in both file_handlers and bam_model_extensions!'.format(ext) 'Extension {} occurs in both file_handlers and bam_model_extensions!'.format(ext)
self.file_handlers[ext] = _model_to_bam self.file_handlers[ext] = _model_to_bam

View File

@ -88,7 +88,12 @@ contact_added_callback(btManifoldPoint &cp,
BulletManifoldPoint mp(cp); BulletManifoldPoint mp(cp);
BulletContactCallbackData cbdata(mp, node0, node1, id0, id1, index0, index1); BulletContactCallbackData cbdata(mp, node0, node1, id0, id1, index0, index1);
// Release the world mutex object so that bullet methods can be called from the callback.
LightMutex &mutex = BulletWorld::get_global_lock();
mutex.release();
bullet_contact_added_callback->do_callback(&cbdata); bullet_contact_added_callback->do_callback(&cbdata);
mutex.acquire();
} }
} }

View File

@ -69,7 +69,7 @@ do_transmit_data(DataGraphTraverser *, const DataNodeTransmit &,
const ButtonEvent &event = bel->get_event(i); const ButtonEvent &event = bel->get_event(i);
if (event._type == ButtonEvent::T_down) { if (event._type == ButtonEvent::T_down) {
_button_states[event._button] = true; _button_states[event._button] = true;
} else if (event._type == ButtonEvent::T_down) { } else if (event._type == ButtonEvent::T_up) {
_button_states[event._button] = false; _button_states[event._button] = false;
} }
} }

View File

@ -3178,7 +3178,7 @@ reset() {
_max_image_units = 0; _max_image_units = 0;
#ifndef OPENGLES_1 #ifndef OPENGLES_1
#ifdef OPENGLES #ifdef OPENGLES
if (is_at_least_gl_version(3, 1)) { if (is_at_least_gles_version(3, 1) && gl_immutable_texture_storage) {
#else #else
if (is_at_least_gl_version(4, 2) || has_extension("GL_ARB_shader_image_load_store")) { if (is_at_least_gl_version(4, 2) || has_extension("GL_ARB_shader_image_load_store")) {
#endif #endif
@ -14284,7 +14284,8 @@ upload_texture_image(CLP(TextureContext) *gtc, int view, bool needs_reload,
GLCAT.debug() GLCAT.debug()
<< "allocating storage for texture " << tex->get_name() << ", " << "allocating storage for texture " << tex->get_name() << ", "
<< width << " x " << height << " x " << depth << ", mipmaps " << width << " x " << height << " x " << depth << ", mipmaps "
<< num_levels << "\n"; << num_levels << ", internal_format = 0x" << std::hex
<< internal_format << std::dec << "\n";
} }
switch (texture_type) { switch (texture_type) {

View File

@ -1708,17 +1708,35 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
case GL_UNSIGNED_INT_IMAGE_BUFFER: case GL_UNSIGNED_INT_IMAGE_BUFFER:
// This won't really change at runtime, so we might as well bind once // This won't really change at runtime, so we might as well bind once
// and then forget about it. // and then forget about it.
// Note that OpenGL ES doesn't support changing this at runtime, so we
// rely on the shader using a layout declaration.
#ifndef OPENGLES
_glgsg->_glUniform1i(p, _glsl_img_inputs.size());
#endif
{ {
#ifdef OPENGLES
// In OpenGL ES, we can't choose our own binding, but we can ask the
// driver what it assigned (or what the shader specified).
GLint binding = 0;
glGetUniformiv(_glsl_program, p, &binding);
if (GLCAT.is_debug()) {
GLCAT.debug()
<< "Active uniform " << param_name
<< " is bound to image unit " << binding << "\n";
}
if (binding >= _glsl_img_inputs.size()) {
_glsl_img_inputs.resize(binding + 1);
}
ImageInput &input = _glsl_img_inputs[binding];
input._name = InternalName::make(param_name);
#else
if (GLCAT.is_debug()) {
GLCAT.debug()
<< "Binding image uniform " << param_name
<< " to image unit " << _glsl_img_inputs.size() << "\n";
}
_glgsg->_glUniform1i(p, _glsl_img_inputs.size());
ImageInput input; ImageInput input;
input._name = InternalName::make(param_name); input._name = InternalName::make(param_name);
input._writable = false; _glsl_img_inputs.push_back(std::move(input));
input._gtc = nullptr; #endif
_glsl_img_inputs.push_back(input);
} }
return; return;
default: default:
@ -2676,6 +2694,10 @@ update_shader_texture_bindings(ShaderContext *prev) {
const ParamTextureImage *param = nullptr; const ParamTextureImage *param = nullptr;
Texture *tex; Texture *tex;
if (input._name == nullptr) {
continue;
}
const ShaderInput &sinp = _glgsg->_target_shader->get_shader_input(input._name); const ShaderInput &sinp = _glgsg->_target_shader->get_shader_input(input._name);
switch (sinp.get_value_type()) { switch (sinp.get_value_type()) {
case ShaderInput::M_texture_image: case ShaderInput::M_texture_image:
@ -2729,6 +2751,16 @@ update_shader_texture_bindings(ShaderContext *prev) {
// TODO: automatically convert to sized type instead of plain GL_RGBA // TODO: automatically convert to sized type instead of plain GL_RGBA
// If a base type is used, it will crash. // If a base type is used, it will crash.
GLenum internal_format = gtc->_internal_format; GLenum internal_format = gtc->_internal_format;
#ifdef OPENGLES
if (!gtc->_immutable) {
static bool error_shown = false;
if (!error_shown) {
error_shown = true;
GLCAT.error()
<< "Enable gl-immutable-texture-storage to use image textures in OpenGL ES.\n";
}
}
#endif
if (internal_format == GL_RGBA || internal_format == GL_RGB) { if (internal_format == GL_RGBA || internal_format == GL_RGB) {
GLCAT.error() GLCAT.error()
<< "Texture " << tex->get_name() << " has an unsized format. Textures bound " << "Texture " << tex->get_name() << " has an unsized format. Textures bound "

View File

@ -107,8 +107,8 @@ private:
struct ImageInput { struct ImageInput {
CPT(InternalName) _name; CPT(InternalName) _name;
CLP(TextureContext) *_gtc; CLP(TextureContext) *_gtc = nullptr;
bool _writable; bool _writable = false;
}; };
pvector<ImageInput> _glsl_img_inputs; pvector<ImageInput> _glsl_img_inputs;

View File

@ -416,6 +416,11 @@ void MeshDrawer::geometry(NodePath draw_node) {
/** /**
* Stars or continues linked segment. Control position, frame, thickness and * Stars or continues linked segment. Control position, frame, thickness and
* color with parameters. Frame contains u,v,u-size,v-size quadruple. * color with parameters. Frame contains u,v,u-size,v-size quadruple.
* Note that for the first two calls to this method, the "frame" parameter is
* ignored; it first takes effect as of the third call.
* Similarly, note that in the second call to this method, the "color" parameter
* is ignored; it only has effect in the first call and calls from the third
* onwards.
*/ */
void MeshDrawer:: void MeshDrawer::
link_segment(const LVector3 &pos, const LVector4 &frame, link_segment(const LVector3 &pos, const LVector4 &frame,

View File

@ -119,7 +119,8 @@ set_lens_active(int index, bool flag) {
/** /**
* Returns true if the given point is within the bounds of the lens of the * Returns true if the given point is within the bounds of the lens of the
* LensNode (i.e. if the camera can see the point). * LensNode (i.e. if the camera can see the point). The point is assumed to
* be relative to the LensNode itself.
*/ */
bool LensNode:: bool LensNode::
is_in_view(int index, const LPoint3 &pos) { is_in_view(int index, const LPoint3 &pos) {

View File

@ -228,11 +228,9 @@ make_from_bam(const FactoryParams &params) {
RecorderBase *MouseRecorder:: RecorderBase *MouseRecorder::
make_recorder(const FactoryParams &params) { make_recorder(const FactoryParams &params) {
MouseRecorder *node = new MouseRecorder(""); MouseRecorder *node = new MouseRecorder("");
DatagramIterator scan; BamReaderParam *param = DCAST(BamReaderParam, params.get_param(0));
BamReader *manager;
parse_params(params, scan, manager); node->fillin_recorder((DatagramIterator &)param->get_iterator(), param->get_manager());
node->fillin_recorder(scan, manager);
return node; return node;
} }

View File

@ -113,11 +113,9 @@ write_recorder(BamWriter *manager, Datagram &dg) {
RecorderBase *SocketStreamRecorder:: RecorderBase *SocketStreamRecorder::
make_recorder(const FactoryParams &params) { make_recorder(const FactoryParams &params) {
SocketStreamRecorder *node = new SocketStreamRecorder; SocketStreamRecorder *node = new SocketStreamRecorder;
DatagramIterator scan; BamReaderParam *param = DCAST(BamReaderParam, params.get_param(0));
BamReader *manager;
parse_params(params, scan, manager); node->fillin_recorder((DatagramIterator &)param->get_iterator(), param->get_manager());
node->fillin_recorder(scan, manager);
return node; return node;
} }

View File

@ -676,18 +676,18 @@ initialize_input_devices() {
_input = device; _input = device;
// Get the number of devices. // Get the number of devices.
if (GetRawInputDeviceList(nullptr, &nInputDevices, sizeof(RAWINPUTDEVICELIST)) != 0) { if ((int)GetRawInputDeviceList(nullptr, &nInputDevices, sizeof(RAWINPUTDEVICELIST)) != 0) {
return; return;
} }
// Allocate the array to hold the DeviceList // Allocate the array to hold the DeviceList
pRawInputDeviceList = (PRAWINPUTDEVICELIST)alloca(sizeof(RAWINPUTDEVICELIST) * nInputDevices); pRawInputDeviceList = (PRAWINPUTDEVICELIST)alloca(sizeof(RAWINPUTDEVICELIST) * nInputDevices);
if (pRawInputDeviceList==0) { if (pRawInputDeviceList == nullptr) {
return; return;
} }
// Fill the Array // Fill the Array
if (GetRawInputDeviceList(pRawInputDeviceList, &nInputDevices, sizeof(RAWINPUTDEVICELIST)) == -1) { if ((int)GetRawInputDeviceList(pRawInputDeviceList, &nInputDevices, sizeof(RAWINPUTDEVICELIST)) == -1) {
return; return;
} }
@ -696,13 +696,13 @@ initialize_input_devices() {
if (pRawInputDeviceList[i].dwType == RIM_TYPEMOUSE) { if (pRawInputDeviceList[i].dwType == RIM_TYPEMOUSE) {
// Fetch information about specified mouse device. // Fetch information about specified mouse device.
UINT nSize; UINT nSize;
if (GetRawInputDeviceInfoA(pRawInputDeviceList[i].hDevice, RIDI_DEVICENAME, (LPVOID)0, &nSize) != 0) { if ((int)GetRawInputDeviceInfoA(pRawInputDeviceList[i].hDevice, RIDI_DEVICENAME, (LPVOID)nullptr, &nSize) != 0) {
return; continue;
} }
char *psName = (char*)alloca(sizeof(TCHAR) * nSize); char *psName = (char*)alloca(sizeof(TCHAR) * nSize);
if (psName == 0) return; if (psName == nullptr) continue;
if (GetRawInputDeviceInfoA(pRawInputDeviceList[i].hDevice, RIDI_DEVICENAME, (LPVOID)psName, &nSize) < 0) { if ((int)GetRawInputDeviceInfoA(pRawInputDeviceList[i].hDevice, RIDI_DEVICENAME, (LPVOID)psName, &nSize) < 0) {
return; continue;
} }
// If it's not an RDP mouse, add it to the list of raw mice. // If it's not an RDP mouse, add it to the list of raw mice.

View File

@ -92,7 +92,7 @@ post_load(Texture *tex) {
egg_tex->set_alpha_mode(tex_image.get_alpha_mode()); egg_tex->set_alpha_mode(tex_image.get_alpha_mode());
egg_tex->set_format(props._format); egg_tex->set_format(props._format);
egg_tex->set_minfilter(props._minfilter); egg_tex->set_minfilter(props._minfilter);
egg_tex->set_minfilter(props._magfilter); egg_tex->set_magfilter(props._magfilter);
egg_tex->set_anisotropic_degree(props._anisotropic_degree); egg_tex->set_anisotropic_degree(props._anisotropic_degree);
tex->set_aux_data("egg", egg_tex); tex->set_aux_data("egg", egg_tex);

View File

@ -18,14 +18,14 @@ def run_cg_compile_check(gsg, shader_path, expect_fail=False):
assert shader is not None assert shader is not None
@pytest.mark.skipif(platform.machine().lower() == 'arm64', reason="Cg not supported on arm64") @pytest.mark.skipif(platform.machine().lower() in ('arm64', 'aarch64'), reason="Cg not supported on arm64")
def test_cg_compile_error(gsg): def test_cg_compile_error(gsg):
"""Test getting compile errors from bad Cg shaders""" """Test getting compile errors from bad Cg shaders"""
shader_path = core.Filename(SHADERS_DIR, 'cg_bad.sha') shader_path = core.Filename(SHADERS_DIR, 'cg_bad.sha')
run_cg_compile_check(gsg, shader_path, expect_fail=True) run_cg_compile_check(gsg, shader_path, expect_fail=True)
@pytest.mark.skipif(platform.machine().lower() == 'arm64', reason="Cg not supported on arm64") @pytest.mark.skipif(platform.machine().lower() in ('arm64', 'aarch64'), reason="Cg not supported on arm64")
def test_cg_from_file(gsg): def test_cg_from_file(gsg):
"""Test compiling Cg shaders from files""" """Test compiling Cg shaders from files"""
shader_path = core.Filename(SHADERS_DIR, 'cg_simple.sha') shader_path = core.Filename(SHADERS_DIR, 'cg_simple.sha')