mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
Merge branch 'master' into deploy-ng
This commit is contained in:
commit
9da335ac42
@ -62,4 +62,12 @@ default_thread_consider_yield() {
|
|||||||
void (*global_thread_yield)() = default_thread_yield;
|
void (*global_thread_yield)() = default_thread_yield;
|
||||||
void (*global_thread_consider_yield)() = default_thread_consider_yield;
|
void (*global_thread_consider_yield)() = default_thread_consider_yield;
|
||||||
|
|
||||||
|
#ifdef HAVE_PYTHON
|
||||||
|
static PyThreadState *
|
||||||
|
default_thread_state_swap(PyThreadState *state) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
PyThreadState *(*global_thread_state_swap)(PyThreadState *tstate) = default_thread_state_swap;
|
||||||
|
#endif // HAVE_PYTHON
|
||||||
|
|
||||||
#endif // HAVE_THREADS && SIMPLE_THREADS
|
#endif // HAVE_THREADS && SIMPLE_THREADS
|
||||||
|
@ -233,6 +233,15 @@ INLINE void thread_consider_yield() {
|
|||||||
(*global_thread_consider_yield)();
|
(*global_thread_consider_yield)();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_PYTHON
|
||||||
|
typedef struct _ts PyThreadState;
|
||||||
|
extern EXPCL_DTOOL_DTOOLBASE PyThreadState *(*global_thread_state_swap)(PyThreadState *tstate);
|
||||||
|
|
||||||
|
INLINE PyThreadState *thread_state_swap(PyThreadState *tstate) {
|
||||||
|
return (*global_thread_state_swap)(tstate);
|
||||||
|
}
|
||||||
|
#endif // HAVE_PYTHON
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
INLINE void thread_yield() {
|
INLINE void thread_yield() {
|
||||||
|
@ -316,7 +316,7 @@ unicode_ispunct(char32_t character) {
|
|||||||
const UnicodeLatinMap::Entry *entry = UnicodeLatinMap::look_up(character);
|
const UnicodeLatinMap::Entry *entry = UnicodeLatinMap::look_up(character);
|
||||||
if (entry == nullptr) {
|
if (entry == nullptr) {
|
||||||
// Some punctuation marks aren't listed in the map.
|
// Some punctuation marks aren't listed in the map.
|
||||||
return (character >= 0 && character < 128 && ispunct(character));
|
return (character < 128 && ispunct(character));
|
||||||
}
|
}
|
||||||
return entry->_char_type == UnicodeLatinMap::CT_punct;
|
return entry->_char_type == UnicodeLatinMap::CT_punct;
|
||||||
}
|
}
|
||||||
|
@ -754,6 +754,11 @@ PyObject *Dtool_PyModuleInitHelper(LibraryDef *defs[], const char *modulename) {
|
|||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
}
|
}
|
||||||
initialized_main_dir = true;
|
initialized_main_dir = true;
|
||||||
|
|
||||||
|
// Also, while we are at it, initialize the thread swap hook.
|
||||||
|
#if defined(HAVE_THREADS) && defined(SIMPLE_THREADS)
|
||||||
|
global_thread_state_swap = PyThreadState_Swap;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
PyModule_AddIntConstant(module, "Dtool_PyNativeInterface", 1);
|
PyModule_AddIntConstant(module, "Dtool_PyNativeInterface", 1);
|
||||||
|
@ -28,7 +28,7 @@ typedef _typeobject PyTypeObject;
|
|||||||
typedef struct {} PyStringObject;
|
typedef struct {} PyStringObject;
|
||||||
typedef struct {} PyUnicodeObject;
|
typedef struct {} PyUnicodeObject;
|
||||||
|
|
||||||
class PyThreadState;
|
typedef struct _ts PyThreadState;
|
||||||
typedef int Py_ssize_t;
|
typedef int Py_ssize_t;
|
||||||
typedef struct bufferinfo Py_buffer;
|
typedef struct bufferinfo Py_buffer;
|
||||||
|
|
||||||
|
@ -1097,6 +1097,15 @@ bind_slot_multisample(bool rb_resize, Texture **attach, RenderTexturePlane slot,
|
|||||||
#endif
|
#endif
|
||||||
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, _rbm[slot]);
|
glgsg->_glBindRenderbuffer(GL_RENDERBUFFER_EXT, _rbm[slot]);
|
||||||
GLuint format = GL_DEPTH_COMPONENT;
|
GLuint format = GL_DEPTH_COMPONENT;
|
||||||
|
#ifndef OPENGLES
|
||||||
|
if (_fb_properties.get_float_depth()) {
|
||||||
|
if (!glgsg->_use_remapped_depth_range) {
|
||||||
|
format = GL_DEPTH_COMPONENT32F;
|
||||||
|
} else {
|
||||||
|
format = GL_DEPTH_COMPONENT32F_NV;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
if (tex) {
|
if (tex) {
|
||||||
switch (tex->get_format()) {
|
switch (tex->get_format()) {
|
||||||
case Texture::F_depth_component16:
|
case Texture::F_depth_component16:
|
||||||
|
@ -1619,8 +1619,8 @@ begin_frame(GraphicsStateGuardianBase *gsg, Thread *current_thread) {
|
|||||||
++qsi) {
|
++qsi) {
|
||||||
Shader *shader = qsi->first;
|
Shader *shader = qsi->first;
|
||||||
ShaderContext *sc = shader->prepare_now(this, gsg);
|
ShaderContext *sc = shader->prepare_now(this, gsg);
|
||||||
if (qti->second != nullptr) {
|
if (qsi->second != nullptr) {
|
||||||
qti->second->set_result(sc);
|
qsi->second->set_result(sc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ do_task() {
|
|||||||
// become a kind of a leak (if the texture is never rendered again on
|
// become a kind of a leak (if the texture is never rendered again on
|
||||||
// this GSG, we'll just end up carrying the texture memory in RAM
|
// this GSG, we'll just end up carrying the texture memory in RAM
|
||||||
// forever, instead of dumping it as soon as it gets prepared).
|
// forever, instead of dumping it as soon as it gets prepared).
|
||||||
_texture->prepare(_pgo);
|
_pgo->enqueue_texture(_texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +445,7 @@ do_flush() {
|
|||||||
if (data_sent > 0) {
|
if (data_sent > 0) {
|
||||||
total_sent += data_sent;
|
total_sent += data_sent;
|
||||||
}
|
}
|
||||||
double last_report = 0;
|
|
||||||
while (!okflag && tcp->Active() &&
|
while (!okflag && tcp->Active() &&
|
||||||
(data_sent > 0 || tcp->GetLastError() == LOCAL_BLOCKING_ERROR)) {
|
(data_sent > 0 || tcp->GetLastError() == LOCAL_BLOCKING_ERROR)) {
|
||||||
if (data_sent == 0) {
|
if (data_sent == 0) {
|
||||||
|
@ -11,14 +11,6 @@
|
|||||||
* @date 2007-06-20
|
* @date 2007-06-20
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
INLINE BlockerSimple::
|
|
||||||
BlockerSimple() {
|
|
||||||
_flags = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
class EXPCL_PANDA_PIPELINE BlockerSimple {
|
class EXPCL_PANDA_PIPELINE BlockerSimple {
|
||||||
protected:
|
protected:
|
||||||
INLINE BlockerSimple();
|
constexpr BlockerSimple() = default;
|
||||||
INLINE ~BlockerSimple();
|
INLINE ~BlockerSimple();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -38,7 +38,7 @@ protected:
|
|||||||
F_has_waiters = 0x40000000,
|
F_has_waiters = 0x40000000,
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned int _flags;
|
unsigned int _flags = 0;
|
||||||
|
|
||||||
friend class ThreadSimpleManager;
|
friend class ThreadSimpleManager;
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
/* Filename: contextSwitch_longjmp_src.c
|
/**
|
||||||
* Created by: drose (15Apr10)
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* PANDA 3D SOFTWARE
|
* PANDA 3D SOFTWARE
|
||||||
* Copyright (c) Carnegie Mellon University. All rights reserved.
|
* Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -10,7 +6,10 @@
|
|||||||
* license. You should have received a copy of this license along
|
* license. You should have received a copy of this license along
|
||||||
* with this source code in a file named "LICENSE."
|
* with this source code in a file named "LICENSE."
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* @file contextSwitch_longjmp_src.c
|
||||||
|
* @author drose
|
||||||
|
* @date 2010-04-15
|
||||||
|
*/
|
||||||
|
|
||||||
/* This is the implementation of user-space context switching using
|
/* This is the implementation of user-space context switching using
|
||||||
setmp() / longjmp(). This is the hackier implementation,
|
setmp() / longjmp(). This is the hackier implementation,
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
/* Filename: contextSwitch_posix_src.c
|
/**
|
||||||
* Created by: drose (15Apr10)
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* PANDA 3D SOFTWARE
|
* PANDA 3D SOFTWARE
|
||||||
* Copyright (c) Carnegie Mellon University. All rights reserved.
|
* Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -10,7 +6,10 @@
|
|||||||
* license. You should have received a copy of this license along
|
* license. You should have received a copy of this license along
|
||||||
* with this source code in a file named "LICENSE."
|
* with this source code in a file named "LICENSE."
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* @file contextSwitch_posix_src.c
|
||||||
|
* @author drose
|
||||||
|
* @date 2010-04-15
|
||||||
|
*/
|
||||||
|
|
||||||
/* This is the implementation of user-space context switching using
|
/* This is the implementation of user-space context switching using
|
||||||
posix threads to manage the different execution contexts. This
|
posix threads to manage the different execution contexts. This
|
||||||
@ -164,7 +163,7 @@ alloc_thread_context() {
|
|||||||
pthread_mutexattr_init(&attr);
|
pthread_mutexattr_init(&attr);
|
||||||
// The symbol PTHREAD_MUTEX_DEFAULT isn't always available?
|
// The symbol PTHREAD_MUTEX_DEFAULT isn't always available?
|
||||||
// pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_DEFAULT);
|
// pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_DEFAULT);
|
||||||
int result = pthread_mutex_init(&context->_ready_mutex, &attr);
|
pthread_mutex_init(&context->_ready_mutex, &attr);
|
||||||
pthread_mutexattr_destroy(&attr);
|
pthread_mutexattr_destroy(&attr);
|
||||||
|
|
||||||
pthread_cond_init(&context->_ready_cvar, NULL);
|
pthread_cond_init(&context->_ready_cvar, NULL);
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
/* Filename: contextSwitch_ucontext_src.c
|
/**
|
||||||
* Created by: drose (15Apr10)
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* PANDA 3D SOFTWARE
|
* PANDA 3D SOFTWARE
|
||||||
* Copyright (c) Carnegie Mellon University. All rights reserved.
|
* Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -10,7 +6,10 @@
|
|||||||
* license. You should have received a copy of this license along
|
* license. You should have received a copy of this license along
|
||||||
* with this source code in a file named "LICENSE."
|
* with this source code in a file named "LICENSE."
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* @file contextSwitch_ucontext_src.c
|
||||||
|
* @author drose
|
||||||
|
* @date 2010-04-15
|
||||||
|
*/
|
||||||
|
|
||||||
/* This is the implementation of user-space context switching using
|
/* This is the implementation of user-space context switching using
|
||||||
getcontext() / setcontext(). This is the preferred implementation,
|
getcontext() / setcontext(). This is the preferred implementation,
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
/* Filename: contextSwitch_windows_src.c
|
/**
|
||||||
* Created by: drose (15Apr10)
|
|
||||||
*
|
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
*
|
|
||||||
* PANDA 3D SOFTWARE
|
* PANDA 3D SOFTWARE
|
||||||
* Copyright (c) Carnegie Mellon University. All rights reserved.
|
* Copyright (c) Carnegie Mellon University. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -10,7 +6,10 @@
|
|||||||
* license. You should have received a copy of this license along
|
* license. You should have received a copy of this license along
|
||||||
* with this source code in a file named "LICENSE."
|
* with this source code in a file named "LICENSE."
|
||||||
*
|
*
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* @file contextSwitch_windows_src.c
|
||||||
|
* @author drose
|
||||||
|
* @date 2010-04-15
|
||||||
|
*/
|
||||||
|
|
||||||
/* This is the implementation of user-space context switching using
|
/* This is the implementation of user-space context switching using
|
||||||
native Windows threading constructs to manage the different
|
native Windows threading constructs to manage the different
|
||||||
|
@ -225,7 +225,7 @@ call_python_func(PyObject *function, PyObject *args) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// No exception. Restore the thread state normally.
|
// No exception. Restore the thread state normally.
|
||||||
PyThreadState *state = PyThreadState_Swap(orig_thread_state);
|
PyThreadState_Swap(orig_thread_state);
|
||||||
thread_states.push_back(new_thread_state);
|
thread_states.push_back(new_thread_state);
|
||||||
// PyThreadState_Clear(new_thread_state);
|
// PyThreadState_Clear(new_thread_state);
|
||||||
// PyThreadState_Delete(new_thread_state);
|
// PyThreadState_Delete(new_thread_state);
|
||||||
|
@ -51,14 +51,6 @@ is_threading_supported() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
INLINE bool ThreadSimpleImpl::
|
|
||||||
is_true_threads() {
|
|
||||||
return (is_os_threads != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -141,8 +141,8 @@ start(ThreadPriority priority, bool joinable) {
|
|||||||
|
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
// Query the current Python thread state.
|
// Query the current Python thread state.
|
||||||
_python_state = PyThreadState_Swap(nullptr);
|
_python_state = thread_state_swap(nullptr);
|
||||||
PyThreadState_Swap(_python_state);
|
thread_state_swap(_python_state);
|
||||||
#endif // HAVE_PYTHON
|
#endif // HAVE_PYTHON
|
||||||
|
|
||||||
init_thread_context(_context, _stack, _stack_size, st_begin_thread, this);
|
init_thread_context(_context, _stack, _stack_size, st_begin_thread, this);
|
||||||
@ -201,6 +201,14 @@ prepare_for_exit() {
|
|||||||
manager->prepare_for_exit();
|
manager->prepare_for_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
bool ThreadSimpleImpl::
|
||||||
|
is_true_threads() {
|
||||||
|
return (is_os_threads != 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -238,7 +246,7 @@ st_begin_thread(void *data) {
|
|||||||
void ThreadSimpleImpl::
|
void ThreadSimpleImpl::
|
||||||
begin_thread() {
|
begin_thread() {
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
PyThreadState_Swap(_python_state);
|
thread_state_swap(_python_state);
|
||||||
#endif // HAVE_PYTHON
|
#endif // HAVE_PYTHON
|
||||||
|
|
||||||
#ifdef HAVE_POSIX_THREADS
|
#ifdef HAVE_POSIX_THREADS
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
|
|
||||||
INLINE static void bind_thread(Thread *thread);
|
INLINE static void bind_thread(Thread *thread);
|
||||||
INLINE static bool is_threading_supported();
|
INLINE static bool is_threading_supported();
|
||||||
INLINE static bool is_true_threads();
|
static bool is_true_threads();
|
||||||
INLINE static bool is_simple_threads();
|
INLINE static bool is_simple_threads();
|
||||||
INLINE static void sleep(double seconds);
|
INLINE static void sleep(double seconds);
|
||||||
INLINE static void yield();
|
INLINE static void yield();
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
#include "mainThread.h"
|
#include "mainThread.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN 1
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -235,7 +237,7 @@ next_context() {
|
|||||||
|
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
// Save the current Python thread state.
|
// Save the current Python thread state.
|
||||||
_current_thread->_python_state = PyThreadState_Swap(nullptr);
|
_current_thread->_python_state = thread_state_swap(nullptr);
|
||||||
#endif // HAVE_PYTHON
|
#endif // HAVE_PYTHON
|
||||||
|
|
||||||
#ifdef DO_PSTATS
|
#ifdef DO_PSTATS
|
||||||
@ -256,7 +258,7 @@ next_context() {
|
|||||||
#endif // DO_PSTATS
|
#endif // DO_PSTATS
|
||||||
|
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
PyThreadState_Swap(_current_thread->_python_state);
|
thread_state_swap(_current_thread->_python_state);
|
||||||
#endif // HAVE_PYTHON
|
#endif // HAVE_PYTHON
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,16 +470,6 @@ init_pointers() {
|
|||||||
_pointers_initialized = true;
|
_pointers_initialized = true;
|
||||||
_global_ptr = new ThreadSimpleManager;
|
_global_ptr = new ThreadSimpleManager;
|
||||||
Thread::get_main_thread();
|
Thread::get_main_thread();
|
||||||
|
|
||||||
#ifdef HAVE_PYTHON
|
|
||||||
// Ensure that the Python threading system is initialized and ready to go.
|
|
||||||
|
|
||||||
#if PY_VERSION_HEX >= 0x03020000
|
|
||||||
Py_Initialize();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PyEval_InitThreads();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,13 +293,29 @@ set_properties_now(WindowProperties &properties) {
|
|||||||
_properties.set_fixed_size(properties.get_fixed_size());
|
_properties.set_fixed_size(properties.get_fixed_size());
|
||||||
properties.clear_fixed_size();
|
properties.clear_fixed_size();
|
||||||
}
|
}
|
||||||
|
// When switching undecorated mode, Windows will keep the window at the
|
||||||
|
// current outer size, whereas we want to keep it with the configured
|
||||||
|
// inner size. Store the current size and origin.
|
||||||
|
LPoint2i top_left = _properties.get_origin();
|
||||||
|
LPoint2i bottom_right = top_left + _properties.get_size();
|
||||||
|
|
||||||
DWORD window_style = make_style(_properties);
|
DWORD window_style = make_style(_properties);
|
||||||
SetWindowLong(_hWnd, GWL_STYLE, window_style);
|
SetWindowLong(_hWnd, GWL_STYLE, window_style);
|
||||||
|
|
||||||
|
// Now calculate the proper size and origin with the new window style.
|
||||||
|
RECT view_rect;
|
||||||
|
SetRect(&view_rect, top_left[0], top_left[1],
|
||||||
|
bottom_right[0], bottom_right[1]);
|
||||||
|
WINDOWINFO wi;
|
||||||
|
GetWindowInfo(_hWnd, &wi);
|
||||||
|
AdjustWindowRectEx(&view_rect, wi.dwStyle, FALSE, wi.dwExStyle);
|
||||||
|
|
||||||
// We need to call this to ensure that the style change takes effect.
|
// We need to call this to ensure that the style change takes effect.
|
||||||
SetWindowPos(_hWnd, HWND_NOTOPMOST, 0, 0, 0, 0,
|
SetWindowPos(_hWnd, HWND_NOTOPMOST, view_rect.left, view_rect.top,
|
||||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE |
|
view_rect.right - view_rect.left,
|
||||||
SWP_FRAMECHANGED | SWP_NOSENDCHANGING | SWP_SHOWWINDOW);
|
view_rect.bottom - view_rect.top,
|
||||||
|
SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED |
|
||||||
|
SWP_NOSENDCHANGING | SWP_SHOWWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (properties.has_title()) {
|
if (properties.has_title()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user