Merge branch 'release/1.10.x'

This commit is contained in:
rdb 2022-05-10 16:12:36 +02:00
commit ecf4d19e83
44 changed files with 481 additions and 231 deletions

View File

@ -323,7 +323,7 @@ class FilterManager(DirectObject):
props.setAuxRgba(1)
if auxtex1 is not None:
props.setAuxRgba(2)
buffer=base.graphicsEngine.makeOutput(
buffer=self.engine.makeOutput(
self.win.getPipe(), name, -1,
props, winprops, GraphicsPipe.BFRefuseWindow | GraphicsPipe.BFResizeable,
self.win.getGsg(), self.win)

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
#include "selectThreadImpl.h"
#if defined(_WIN32) && !defined(CPPPARSER)
#ifdef _WIN32
#include "mutexWin32Impl.h"

View File

@ -327,6 +327,9 @@ make_wrapper_entry(FunctionIndex function_index) {
if ((*pi)._has_name) {
param._parameter_flags |= InterrogateFunctionWrapper::PF_has_name;
}
if ((*pi)._remap->has_default_value()) {
param._parameter_flags |= InterrogateFunctionWrapper::PF_is_optional;
}
iwrapper._parameters.push_back(param);
}

View File

@ -1071,6 +1071,10 @@ scan_function(CPPInstance *function) {
return;
}
if (TypeManager::involves_rvalue_reference(ftype)) {
return;
}
get_function(function, "",
nullptr, scope,
InterrogateFunction::F_global);
@ -1770,6 +1774,16 @@ get_function(CPPInstance *function, string description,
ifunction->_flags |= InterrogateFunction::F_operator_typecast;
}
if (ftype->_flags & CPPFunctionType::F_constructor) {
// This is a constructor.
ifunction->_flags |= InterrogateFunction::F_constructor;
}
if (ftype->_flags & CPPFunctionType::F_destructor) {
// This is a destructor.
ifunction->_flags |= InterrogateFunction::F_destructor;
}
if (function->_storage_class & CPPInstance::SC_virtual) {
// This is a virtual function.
ifunction->_flags |= InterrogateFunction::F_virtual;
@ -2747,7 +2761,8 @@ define_struct_type(InterrogateType &itype, CPPStructType *cpptype,
function->_storage_class |= CPPInstance::SC_inline | CPPInstance::SC_defaulted;
function->_vis = V_published;
FunctionIndex index = get_function(function, "", cpptype, cpptype->get_scope(), 0);
FunctionIndex index = get_function(function, "", cpptype, cpptype->get_scope(),
InterrogateFunction::F_constructor);
if (find(itype._constructors.begin(), itype._constructors.end(),
index) == itype._constructors.end()) {
itype._constructors.push_back(index);
@ -2773,7 +2788,8 @@ define_struct_type(InterrogateType &itype, CPPStructType *cpptype,
function->_storage_class |= CPPInstance::SC_inline | CPPInstance::SC_defaulted;
function->_vis = V_published;
FunctionIndex index = get_function(function, "", cpptype, cpptype->get_scope(), 0);
FunctionIndex index = get_function(function, "", cpptype, cpptype->get_scope(),
InterrogateFunction::F_constructor);
if (find(itype._constructors.begin(), itype._constructors.end(),
index) == itype._constructors.end()) {
itype._constructors.push_back(index);
@ -2814,7 +2830,7 @@ define_struct_type(InterrogateType &itype, CPPStructType *cpptype,
itype._destructor = get_function(function, "",
cpptype, cpptype->get_scope(),
0);
InterrogateFunction::F_destructor);
itype._flags |= InterrogateType::F_implicit_destructor;
}
}
@ -2988,6 +3004,9 @@ define_method(CPPInstance *function, InterrogateType &itype,
// If it isn't, we should publish this method anyway.
}
if (TypeManager::involves_rvalue_reference(ftype)) {
return;
}
FunctionIndex index = get_function(function, "", struct_type, scope, 0);
if (index != 0) {

View File

@ -2017,6 +2017,46 @@ involves_protected(CPPType *type) {
}
}
/**
* Returns true if the type involves an rvalue reference.
*/
bool TypeManager::
involves_rvalue_reference(CPPType *type) {
switch (type->get_subtype()) {
case CPPDeclaration::ST_const:
return involves_rvalue_reference(type->as_const_type()->_wrapped_around);
case CPPDeclaration::ST_reference:
return type->as_reference_type()->_value_category == CPPReferenceType::VC_rvalue;
case CPPDeclaration::ST_pointer:
return involves_rvalue_reference(type->as_pointer_type()->_pointing_at);
case CPPDeclaration::ST_function:
{
CPPFunctionType *ftype = type->as_function_type();
if (involves_rvalue_reference(ftype->_return_type)) {
return true;
}
const CPPParameterList::Parameters &params =
ftype->_parameters->_parameters;
CPPParameterList::Parameters::const_iterator pi;
for (pi = params.begin(); pi != params.end(); ++pi) {
if (involves_rvalue_reference((*pi)->_type)) {
return true;
}
}
return false;
}
case CPPDeclaration::ST_typedef:
return involves_rvalue_reference(type->as_typedef_type()->_type);
default:
return false;
}
}
/**
* Returns the type this pointer type points to.
*/

View File

@ -118,6 +118,7 @@ public:
static bool is_handle(CPPType *type);
static bool involves_unpublished(CPPType *type);
static bool involves_protected(CPPType *type);
static bool involves_rvalue_reference(CPPType *type);
static bool is_ostream(CPPType *type);
static bool is_pointer_to_ostream(CPPType *type);

View File

@ -968,6 +968,17 @@ read_new(std::istream &in, InterrogateModuleDef *def) {
add_type(index, type);
num_types--;
// Older versions of interrogate were not setting these flags.
const InterrogateType &itype = get_type(index);
FunctionIndex dtor = itype.get_destructor();
if (dtor != 0) {
update_function(dtor)._flags |= InterrogateFunction::F_destructor;
}
for (int i = 0; i < itype.number_of_constructors(); ++i) {
FunctionIndex ctor = itype.get_constructor(i);
update_function(ctor)._flags |= InterrogateFunction::F_constructor;
}
}
}

View File

@ -54,6 +54,22 @@ is_operator_typecast() const {
return (_flags & F_operator_typecast) != 0;
}
/**
* Returns true if the function is a constructor.
*/
INLINE bool InterrogateFunction::
is_constructor() const {
return (_flags & F_constructor) != 0;
}
/**
* Returns true if the function is a destructor.
*/
INLINE bool InterrogateFunction::
is_destructor() const {
return (_flags & F_destructor) != 0;
}
/**
* Return the class that owns the method, if is_method() returns true.
*/

View File

@ -38,6 +38,8 @@ public:
INLINE bool is_method() const;
INLINE bool is_unary_op() const;
INLINE bool is_operator_typecast() const;
INLINE bool is_constructor() const;
INLINE bool is_destructor() const;
INLINE TypeIndex get_class() const;
INLINE bool has_scoped_name() const;
@ -70,7 +72,9 @@ private:
F_setter = 0x0020,
F_unary_op = 0x0040,
F_operator_typecast = 0x0080,
F_item_assignment = 0x0100,
F_constructor = 0x0100,
F_destructor = 0x0200,
F_item_assignment = 0x0400,
};
int _flags;
@ -98,6 +102,7 @@ public:
std::string _expression;
friend class InterrogateBuilder;
friend class InterrogateDatabase;
friend class InterfaceMakerC;
friend class InterfaceMakerPythonSimple;
friend class InterfaceMakerPythonNative;

View File

@ -148,6 +148,17 @@ parameter_is_this(int n) const {
return false;
}
/**
*
*/
INLINE bool InterrogateFunctionWrapper::
parameter_is_optional(int n) const {
if (n >= 0 && n < (int)_parameters.size()) {
return (_parameters[n]._parameter_flags & PF_is_optional) != 0;
}
return false;
}
/**
*
*/

View File

@ -45,6 +45,7 @@ public:
INLINE bool parameter_has_name(int n) const;
INLINE const std::string &parameter_get_name(int n) const;
INLINE bool parameter_is_this(int n) const;
INLINE bool parameter_is_optional(int n) const;
INLINE const std::string &get_unique_name() const;
@ -66,6 +67,7 @@ private:
enum ParameterFlags {
PF_has_name = 0x0001,
PF_is_this = 0x0002,
PF_is_optional = 0x0004,
};
int _flags;

View File

@ -266,6 +266,18 @@ interrogate_function_class(FunctionIndex function) {
return InterrogateDatabase::get_ptr()->get_function(function).get_class();
}
bool
interrogate_function_is_constructor(FunctionIndex function) {
// cerr << "interrogate_function_is_constructor(" << function << ")\n";
return InterrogateDatabase::get_ptr()->get_function(function).is_constructor();
}
bool
interrogate_function_is_destructor(FunctionIndex function) {
// cerr << "interrogate_function_is_destructor(" << function << ")\n";
return InterrogateDatabase::get_ptr()->get_function(function).is_destructor();
}
bool
interrogate_function_has_module_name(FunctionIndex function) {
// cerr << "interrogate_function_has_module_name(" << function << ")\n";
@ -411,6 +423,12 @@ interrogate_wrapper_parameter_is_this(FunctionWrapperIndex wrapper, int n) {
return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).parameter_is_this(n);
}
bool
interrogate_wrapper_parameter_is_optional(FunctionWrapperIndex wrapper, int n) {
// cerr << "interrogate_wrapper_is_optional(" << wrapper << ", " << n << ")\n";
return InterrogateDatabase::get_ptr()->get_wrapper(wrapper).parameter_is_optional(n);
}
bool
interrogate_wrapper_has_pointer(FunctionWrapperIndex wrapper) {
// cerr << "interrogate_wrapper_has_pointer(" << wrapper << ")\n";
@ -674,6 +692,12 @@ interrogate_type_is_enum(TypeIndex type) {
return InterrogateDatabase::get_ptr()->get_type(type).is_enum();
}
bool
interrogate_type_is_scoped_enum(TypeIndex type) {
// cerr << "interrogate_type_is_scoped_enum(" << type << ")\n";
return InterrogateDatabase::get_ptr()->get_type(type).is_scoped_enum();
}
int
interrogate_type_number_of_enum_values(TypeIndex type) {
// cerr << "interrogate_type_number_of_enum_values(" << type << ")\n";
@ -828,6 +852,12 @@ interrogate_type_get_derivation(TypeIndex type, int n) {
return InterrogateDatabase::get_ptr()->get_type(type).get_derivation(n);
}
bool
interrogate_type_is_final(TypeIndex type) {
// cerr << "interrogate_type_is_final(" << type << ")\n";
return InterrogateDatabase::get_ptr()->get_type(type).is_final();
}
bool
interrogate_type_derivation_has_upcast(TypeIndex type, int n) {
// cerr << "interrogate_type_derivation_has_upcast(" << type << ", " << n <<

View File

@ -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_constructor(FunctionIndex function);
EXPCL_INTERROGATEDB bool interrogate_function_is_destructor(FunctionIndex function);
// This returns the module name reported for the function, if available.
EXPCL_INTERROGATEDB bool interrogate_function_has_module_name(FunctionIndex function);
@ -299,6 +301,7 @@ EXPCL_INTERROGATEDB TypeIndex interrogate_wrapper_parameter_type(FunctionWrapper
EXPCL_INTERROGATEDB bool interrogate_wrapper_parameter_has_name(FunctionWrapperIndex wrapper, int n);
EXPCL_INTERROGATEDB const char *interrogate_wrapper_parameter_name(FunctionWrapperIndex wrapper, int n);
EXPCL_INTERROGATEDB bool interrogate_wrapper_parameter_is_this(FunctionWrapperIndex wrapper, int n);
EXPCL_INTERROGATEDB bool interrogate_wrapper_parameter_is_optional(FunctionWrapperIndex wrapper, int n);
// This returns a pointer to a function that may be called to invoke the
// function, if the -fptrs option to return function pointers was specified to
@ -423,6 +426,7 @@ EXPCL_INTERROGATEDB TypeIndex interrogate_type_wrapped_type(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);
EXPCL_INTERROGATEDB bool interrogate_type_is_scoped_enum(TypeIndex type);
EXPCL_INTERROGATEDB int interrogate_type_number_of_enum_values(TypeIndex type);
EXPCL_INTERROGATEDB const char *interrogate_type_enum_value_name(TypeIndex type, int n);
EXPCL_INTERROGATEDB const char *interrogate_type_enum_value_scoped_name(TypeIndex type, int n);
@ -499,6 +503,7 @@ EXPCL_INTERROGATEDB FunctionIndex interrogate_type_get_cast(TypeIndex type, int
// list of base classes for this particular type.
EXPCL_INTERROGATEDB int interrogate_type_number_of_derivations(TypeIndex type);
EXPCL_INTERROGATEDB TypeIndex interrogate_type_get_derivation(TypeIndex type, int n);
EXPCL_INTERROGATEDB bool interrogate_type_is_final(TypeIndex type);
// For each base class, we might need to define an explicit upcast or downcast
// operation to convert the pointer to the derived class to an appropriate

View File

@ -49,7 +49,7 @@ set_severity(NotifySeverity severity) {
_severity = severity;
#else
// enforce the no-debug, no-spam rule.
_severity = std::max(severity, NS_info);
_severity = (std::max)(severity, NS_info);
#endif
invalidate_cache();
}

View File

@ -5023,8 +5023,10 @@ if GetTarget() == 'android' and not PkgSkip("EGL") and not PkgSkip("GLES2"):
# DIRECTORY: panda/src/tinydisplay/
#
if (GetTarget() in ('windows', 'darwin') or not PkgSkip("X11")) and not PkgSkip("TINYDISPLAY"):
if not PkgSkip("TINYDISPLAY"):
OPTS=['DIR:panda/src/tinydisplay', 'BUILDING:TINYDISPLAY', 'X11']
if not PkgSkip("X11"):
OPTS += ['X11']
TargetAdd('p3tinydisplay_composite1.obj', opts=OPTS, input='p3tinydisplay_composite1.cxx')
TargetAdd('p3tinydisplay_composite2.obj', opts=OPTS, input='p3tinydisplay_composite2.cxx')
TargetAdd('p3tinydisplay_ztriangle_1.obj', opts=OPTS, input='ztriangle_1.cxx')
@ -5035,7 +5037,7 @@ if (GetTarget() in ('windows', 'darwin') or not PkgSkip("X11")) and not PkgSkip(
if GetTarget() == 'windows':
TargetAdd('libp3tinydisplay.dll', input='libp3windisplay.dll')
TargetAdd('libp3tinydisplay.dll', opts=['WINIMM', 'WINGDI', 'WINKERNEL', 'WINOLDNAMES', 'WINUSER', 'WINMM'])
elif GetTarget() != 'darwin':
elif GetTarget() != 'darwin' and not PkgSkip("X11"):
TargetAdd('libp3tinydisplay.dll', input='p3x11display_composite1.obj')
TargetAdd('libp3tinydisplay.dll', opts=['X11'])
TargetAdd('libp3tinydisplay.dll', input='p3tinydisplay_composite1.obj')

View File

@ -344,7 +344,7 @@ is_axis_known(size_t index) const {
INLINE void InputDevice::
set_vibration(double strong, double weak) {
LightMutexHolder holder(_lock);
do_set_vibration(std::max(std::min(strong, 1.0), 0.0), std::max(std::min(weak, 1.0), 0.0));
do_set_vibration((std::max)((std::min)(strong, 1.0), 0.0), (std::max)((std::min)(weak, 1.0), 0.0));
}
/**

View File

@ -242,7 +242,7 @@ INLINE void DrawableRegion::
update_pixel_factor() {
PN_stdfloat new_pixel_factor;
if (supports_pixel_zoom()) {
new_pixel_factor = (PN_stdfloat)1 / sqrt(std::max(_pixel_zoom, (PN_stdfloat)1.0));
new_pixel_factor = (PN_stdfloat)1 / sqrt((std::max)(_pixel_zoom, (PN_stdfloat)1.0));
} else {
new_pixel_factor = 1;
}

View File

@ -57,10 +57,11 @@ get_depth_bits() const {
*/
INLINE int FrameBufferProperties::
get_color_bits() const {
return std::max(_property[FBP_color_bits],
_property[FBP_red_bits] +
_property[FBP_green_bits] +
_property[FBP_blue_bits]);
return (std::max)(
_property[FBP_color_bits],
_property[FBP_red_bits] +
_property[FBP_green_bits] +
_property[FBP_blue_bits]);
}
/**

View File

@ -167,8 +167,8 @@ get_y_size() const {
*/
INLINE LVecBase2i GraphicsOutput::
get_fb_size() const {
return LVecBase2i(std::max(int(_size.get_x() * get_pixel_factor()), 1),
std::max(int(_size.get_y() * get_pixel_factor()), 1));
return LVecBase2i((std::max)(int(_size.get_x() * get_pixel_factor()), 1),
(std::max)(int(_size.get_y() * get_pixel_factor()), 1));
}
/**
@ -178,7 +178,7 @@ get_fb_size() const {
*/
INLINE int GraphicsOutput::
get_fb_x_size() const {
return std::max(int(_size.get_x() * get_pixel_factor()), 1);
return (std::max)(int(_size.get_x() * get_pixel_factor()), 1);
}
/**
@ -188,7 +188,7 @@ get_fb_x_size() const {
*/
INLINE int GraphicsOutput::
get_fb_y_size() const {
return std::max(int(_size.get_y() * get_pixel_factor()), 1);
return (std::max)(int(_size.get_y() * get_pixel_factor()), 1);
}
/**
@ -200,8 +200,8 @@ INLINE LVecBase2i GraphicsOutput::
get_sbs_left_size() const {
PN_stdfloat left_w = _sbs_left_dimensions[1] - _sbs_left_dimensions[0];
PN_stdfloat left_h = _sbs_left_dimensions[3] - _sbs_left_dimensions[2];
return LVecBase2i(std::max(int(_size.get_x() * left_w), 1),
std::max(int(_size.get_y() * left_h), 1));
return LVecBase2i((std::max)(int(_size.get_x() * left_w), 1),
(std::max)(int(_size.get_y() * left_h), 1));
}
/**
@ -212,7 +212,7 @@ get_sbs_left_size() const {
INLINE int GraphicsOutput::
get_sbs_left_x_size() const {
PN_stdfloat left_w = _sbs_left_dimensions[1] - _sbs_left_dimensions[0];
return std::max(int(_size.get_x() * left_w), 1);
return (std::max)(int(_size.get_x() * left_w), 1);
}
/**
@ -223,7 +223,7 @@ get_sbs_left_x_size() const {
INLINE int GraphicsOutput::
get_sbs_left_y_size() const {
PN_stdfloat left_h = _sbs_left_dimensions[3] - _sbs_left_dimensions[2];
return std::max(int(_size.get_y() * left_h), 1);
return (std::max)(int(_size.get_y() * left_h), 1);
}
/**
@ -235,8 +235,8 @@ INLINE LVecBase2i GraphicsOutput::
get_sbs_right_size() const {
PN_stdfloat right_w = _sbs_right_dimensions[1] - _sbs_right_dimensions[0];
PN_stdfloat right_h = _sbs_right_dimensions[3] - _sbs_right_dimensions[2];
return LVecBase2i(std::max(int(_size.get_x() * right_w), 1),
std::max(int(_size.get_y() * right_h), 1));
return LVecBase2i((std::max)(int(_size.get_x() * right_w), 1),
(std::max)(int(_size.get_y() * right_h), 1));
}
/**
@ -247,7 +247,7 @@ get_sbs_right_size() const {
INLINE int GraphicsOutput::
get_sbs_right_x_size() const {
PN_stdfloat right_w = _sbs_right_dimensions[1] - _sbs_right_dimensions[0];
return std::max(int(_size.get_x() * right_w), 1);
return (std::max)(int(_size.get_x() * right_w), 1);
}
/**
@ -258,7 +258,7 @@ get_sbs_right_x_size() const {
INLINE int GraphicsOutput::
get_sbs_right_y_size() const {
PN_stdfloat right_h = _sbs_right_dimensions[3] - _sbs_right_dimensions[2];
return std::max(int(_size.get_y() * right_h), 1);
return (std::max)(int(_size.get_y() * right_h), 1);
}
/**

View File

@ -258,7 +258,7 @@ get_max_vertices_per_primitive() const {
INLINE int GraphicsStateGuardian::
get_max_texture_stages() const {
if (max_texture_stages > 0) {
return std::min(_max_texture_stages, (int)max_texture_stages);
return (std::min)(_max_texture_stages, (int)max_texture_stages);
}
return _max_texture_stages;
}
@ -695,7 +695,7 @@ get_timer_queries_active() const {
INLINE int GraphicsStateGuardian::
get_max_color_targets() const {
if (max_color_targets > 0) {
return std::min(_max_color_targets, (int)max_color_targets);
return (std::min)(_max_color_targets, (int)max_color_targets);
}
return _max_color_targets;
}

View File

@ -46,7 +46,7 @@ matches(const EggMesherEdge &other) const {
*/
INLINE EggMesherEdge *EggMesherEdge::
common_ptr() {
return std::min(this, _opposite);
return (std::min)(this, _opposite);
}
/**

View File

@ -431,6 +431,6 @@ is_cert_special() const {
*/
INLINE std::streampos Multifile::Subfile::
get_last_byte_pos() const {
return std::max(_index_start + (std::streampos)_index_length,
return (std::max)(_index_start + (std::streampos)_index_length,
_data_start + (std::streampos)_data_length) - (std::streampos)1;
}

View File

@ -471,9 +471,9 @@ set_data(const std::string &data) {
template<class Element>
INLINE std::string PointerToArray<Element>::
get_subdata(size_type n, size_type count) const {
n = std::min(n, size());
count = std::max(count, n);
count = std::min(count, size() - n);
n = (std::min)(n, size());
count = (std::max)(count, n);
count = (std::min)(count, size() - n);
return std::string((const char *)(p() + n), sizeof(Element) * count);
}
@ -965,9 +965,9 @@ get_data() const {
template<class Element>
INLINE std::string ConstPointerToArray<Element>::
get_subdata(size_type n, size_type count) const {
n = std::min(n, size());
count = std::max(count, n);
count = std::min(count, size() - n);
n = (std::min)(n, size());
count = (std::max)(count, n);
count = (std::min)(count, size() - n);
return std::string((const char *)(p() + n), sizeof(Element) * count);
}

View File

@ -213,9 +213,9 @@ set_data(PyObject *data) {
template<class Element>
INLINE PyObject *Extension<PointerToArray<Element> >::
get_subdata(size_t n, size_t count) const {
n = std::min(n, this->_this->size());
count = std::max(count, n);
count = std::min(count, this->_this->size() - n);
n = (std::min)(n, this->_this->size());
count = (std::max)(count, n);
count = (std::min)(count, this->_this->size() - n);
return PyBytes_FromStringAndSize((char *)(this->_this->p() + n), sizeof(Element) * count);
}
@ -269,9 +269,9 @@ get_data() const {
template<class Element>
INLINE PyObject *Extension<ConstPointerToArray<Element> >::
get_subdata(size_t n, size_t count) const {
n = std::min(n, this->_this->size());
count = std::max(count, n);
count = std::min(count, this->_this->size() - n);
n = (std::min)(n, this->_this->size());
count = (std::max)(count, n);
count = (std::min)(count, this->_this->size() - n);
return PyBytes_FromStringAndSize((char *)(this->_this->p() + n), sizeof(Element) * count);
}

View File

@ -855,6 +855,26 @@ bind_slot(int layer, bool rb_resize, Texture **attach, RenderTexturePlane slot,
gl_format = GL_DEPTH_COMPONENT16;
}
break;
#ifndef OPENGLES_1
case RTP_aux_hrgba_0:
case RTP_aux_hrgba_1:
case RTP_aux_hrgba_2:
case RTP_aux_hrgba_3:
case RTP_aux_float_0:
case RTP_aux_float_1:
case RTP_aux_float_2:
case RTP_aux_float_3:
if (glgsg->has_extension("GL_EXT_color_buffer_float")) {
if (slot >= RTP_aux_float_0 && slot <= RTP_aux_float_3) {
gl_format = GL_RGBA32F;
} else {
gl_format = GL_RGBA16F;
}
}
else if (glgsg->has_extension("GL_EXT_color_buffer_half_float")) {
gl_format = GL_RGBA16F_EXT;
}
#endif
// NB: we currently use RTP_stencil to store the right eye for stereo.
// case RTP_stencil: gl_format = GL_STENCIL_INDEX8; break
default:
@ -912,9 +932,12 @@ bind_slot(int layer, bool rb_resize, Texture **attach, RenderTexturePlane slot,
}
#ifndef OPENGLES_1
} else if (_fb_properties.get_float_color() &&
_fb_properties.get_color_bits() > 16 * 3 &&
glgsg->has_extension("GL_EXT_color_buffer_float")) {
gl_format = GL_RGBA32F_EXT;
if (_fb_properties.get_color_bits() > 16 * 3) {
gl_format = GL_RGBA32F;
} else {
gl_format = GL_RGBA16F;
}
} else if (_fb_properties.get_float_color() &&
glgsg->has_extension("GL_EXT_color_buffer_half_float")) {
gl_format = GL_RGBA16F_EXT;

View File

@ -535,8 +535,8 @@ get_data() const {
INLINE vector_uchar GeomVertexArrayDataHandle::
get_subdata(size_t start, size_t size) const {
mark_used();
start = std::min(start, _cdata->_buffer.get_size());
size = std::min(size, _cdata->_buffer.get_size() - start);
start = (std::min)(start, _cdata->_buffer.get_size());
size = (std::min)(size, _cdata->_buffer.get_size() - start);
const unsigned char *ptr = _cdata->_buffer.get_read_pointer(true) + start;
return vector_uchar(ptr, ptr + size);
}

View File

@ -1383,13 +1383,13 @@ inc_add_pointer() {
_handle = nullptr;
GeomVertexDataPipelineWriter writer(_vertex_data, true, _current_thread);
writer.check_array_writers();
writer.set_num_rows(std::max(write_row + 1, writer.get_num_rows()));
writer.set_num_rows((std::max)(write_row + 1, writer.get_num_rows()));
_handle = writer.get_array_writer(_array);
} else {
// Otherwise, we can get away with modifying only the one array we're
// using.
_handle->set_num_rows(std::max(write_row + 1, _handle->get_num_rows()));
_handle->set_num_rows((std::max)(write_row + 1, _handle->get_num_rows()));
}
set_pointer(write_row);

View File

@ -55,7 +55,7 @@ INLINE ParamTextureImage::
ParamTextureImage(Texture *tex, bool read, bool write, int z, int n) :
_texture(tex),
_access(0),
_bind_level(std::min(n, 127)),
_bind_level((std::min)(n, 127)),
_bind_layer(z)
{
if (read) {

View File

@ -122,7 +122,7 @@ mark_loaded() {
// _data_size_bytes = _data->get_texture_size_bytes();
_properties_modified = get_texture()->get_properties_modified();
_image_modified = get_texture()->get_image_modified();
update_modified(std::max(_properties_modified, _image_modified));
update_modified((std::max)(_properties_modified, _image_modified));
// Assume the texture is now resident.
set_resident(true);

View File

@ -483,8 +483,8 @@ get_border_stitching() {
*/
INLINE double GeoMipTerrain::
get_pixel_value(int x, int y) {
x = std::max(std::min(x,int(_xsize-1)),0);
y = std::max(std::min(y,int(_ysize-1)),0);
x = (std::max)((std::min)(x,int(_xsize-1)),0);
y = (std::max)((std::min)(y,int(_ysize-1)),0);
if (_heightfield.is_grayscale()) {
return double(_heightfield.get_bright(x, y));
} else {

View File

@ -183,10 +183,10 @@ angle_rad(const FLOATNAME(LVector3) &other) const {
// poorly as dot(other) approaches 1.0.
if (dot(other) < 0.0f) {
FLOATTYPE a = ((*this)+other).length() / 2.0f;
return MathNumbers::cpi((FLOATTYPE)0.0f) - 2.0f * casin(std::min(a, (FLOATTYPE)1.0));
return MathNumbers::cpi((FLOATTYPE)0.0f) - 2.0f * casin((std::min)(a, (FLOATTYPE)1.0));
} else {
FLOATTYPE a = ((*this)-other).length() / 2.0f;
return 2.0f * casin(std::min(a, (FLOATTYPE)1.0));
return 2.0f * casin((std::min)(a, (FLOATTYPE)1.0));
}
}

View File

@ -110,5 +110,5 @@ scale_t(int segment, PN_stdfloat t) const {
PN_stdfloat from = _segments[segment]._from;
PN_stdfloat to = _segments[segment]._to;
t = (t - from) / (to - from);
return std::min(std::max(t, (PN_stdfloat)0.0), (PN_stdfloat)1.0);
return (std::min)((std::max)(t, (PN_stdfloat)0.0), (PN_stdfloat)1.0);
}

View File

@ -42,7 +42,7 @@ get_curve(int index) const {
*/
INLINE void ParametricCurveCollection::
add_curve(ParametricCurve *curve, int index) {
insert_curve(std::max(index, 0), curve);
insert_curve((std::max)(index, 0), curve);
}
/**

View File

@ -97,7 +97,7 @@ get_cur_alpha(BaseParticle* bp) {
return bp->get_parameterized_age();
case PR_ALPHA_IN_OUT:
return 2.0 * std::min(bp->get_parameterized_age(),
return 2.0 * (std::min)(bp->get_parameterized_age(),
1.0f - bp->get_parameterized_age());
case PR_ALPHA_USER:

View File

@ -558,7 +558,7 @@ set_wtext(const std::wstring &wtext) {
update_text();
}
#endif
set_cursor_position(std::min(_cursor_position, _text.get_num_characters()));
set_cursor_position((std::min)(_cursor_position, _text.get_num_characters()));
return ret;
}

View File

@ -381,7 +381,7 @@ get_adjust_event() const {
*/
INLINE void PGSliderBar::
internal_set_ratio(PN_stdfloat ratio) {
_ratio = std::max(std::min(ratio, (PN_stdfloat)1.0), (PN_stdfloat)0.0);
_ratio = (std::max)((std::min)(ratio, (PN_stdfloat)1.0), (PN_stdfloat)0.0);
_needs_reposition = true;
adjust();
}

View File

@ -27,7 +27,7 @@ get_render_pipeline() {
*/
INLINE void Pipeline::
set_min_stages(int min_stages) {
set_num_stages(std::max(min_stages, get_num_stages()));
set_num_stages((std::max)(min_stages, get_num_stages()));
}
/**

View File

@ -75,7 +75,7 @@ get_pipeline_stage() const {
*/
INLINE void Thread::
set_min_pipeline_stage(int min_pipeline_stage) {
set_pipeline_stage(std::max(_pipeline_stage, min_pipeline_stage));
set_pipeline_stage((std::max)(_pipeline_stage, min_pipeline_stage));
}
/**

View File

@ -44,8 +44,8 @@ INLINE unsigned char decode_sRGB_uchar(unsigned char val) {
*/
INLINE unsigned char decode_sRGB_uchar(float val) {
return (val <= 0.04045f)
? (unsigned char)(std::max(0.f, val) * (255.f / 12.92f) + 0.5f)
: (unsigned char)(cpow((std::min(val, 1.f) + 0.055f) * (1.f / 1.055f), 2.4f) * 255.f + 0.5f);
? (unsigned char)((std::max)(0.f, val) * (255.f / 12.92f) + 0.5f)
: (unsigned char)(cpow(((std::min)(val, 1.f) + 0.055f) * (1.f / 1.055f), 2.4f) * 255.f + 0.5f);
}
/**
@ -99,8 +99,8 @@ encode_sRGB_uchar(float val) {
return encode_sRGB_uchar_sse2(val);
#else
return (val < 0.0031308f)
? (unsigned char) (std::max(0.f, val) * 3294.6f + 0.5f)
: (unsigned char) (269.025f * cpow(std::min(val, 1.f), 0.41666f) - 13.525f);
? (unsigned char) ((std::max)(0.f, val) * 3294.6f + 0.5f)
: (unsigned char) (269.025f * cpow((std::min)(val, 1.f), 0.41666f) - 13.525f);
#endif
}

View File

@ -587,12 +587,12 @@ setup_sub_image(const PfmFile &copy, int &xto, int &yto,
yto = 0;
}
x_size = std::min(x_size, copy.get_x_size() - xfrom);
y_size = std::min(y_size, copy.get_y_size() - yfrom);
x_size = (std::min)(x_size, copy.get_x_size() - xfrom);
y_size = (std::min)(y_size, copy.get_y_size() - yfrom);
xmin = xto;
ymin = yto;
xmax = std::min(xmin + x_size, get_x_size());
ymax = std::min(ymin + y_size, get_y_size());
xmax = (std::min)(xmin + x_size, get_x_size());
ymax = (std::min)(ymin + y_size, get_y_size());
}

View File

@ -68,7 +68,7 @@ INLINE PNMImage::
*/
INLINE xelval PNMImage::
clamp_val(int input_value) const {
return (xelval)std::min(std::max(0, input_value), (int)get_maxval());
return (xelval)(std::min)((std::max)(0, input_value), (int)get_maxval());
}
/**
@ -113,9 +113,9 @@ to_val(const LRGBColorf &value) const {
case XE_scRGB_alpha:
{
LRGBColorf scaled = value * 8192.f + 4096.5f;
col.r = std::min(std::max(0, (int)scaled[0]), 65535);
col.g = std::min(std::max(0, (int)scaled[1]), 65535);
col.b = std::min(std::max(0, (int)scaled[2]), 65535);
col.r = (std::min)((std::max)(0, (int)scaled[0]), 65535);
col.g = (std::min)((std::max)(0, (int)scaled[1]), 65535);
col.b = (std::min)((std::max)(0, (int)scaled[2]), 65535);
}
break;
}
@ -131,7 +131,7 @@ to_val(float input_value) const {
switch (_xel_encoding) {
case XE_generic:
case XE_generic_alpha:
return (int)(std::min(1.0f, std::max(0.0f, input_value)) * get_maxval() + 0.5f);
return (int)((std::min)(1.0f, (std::max)(0.0f, input_value)) * get_maxval() + 0.5f);
case XE_generic_sRGB:
case XE_generic_sRGB_alpha:
@ -148,7 +148,7 @@ to_val(float input_value) const {
case XE_scRGB:
case XE_scRGB_alpha:
return std::min(std::max(0, (int)((8192 * input_value) + 4096.5f)), 65535);
return (std::min)((std::max)(0, (int)((8192 * input_value) + 4096.5f)), 65535);
default:
return 0;
@ -210,7 +210,7 @@ from_val(xelval input_value) const {
switch (_xel_encoding) {
case XE_generic:
case XE_generic_alpha:
return std::min((float)input_value * _inv_maxval, 1.0f);
return (std::min)((float)input_value * _inv_maxval, 1.0f);
case XE_generic_sRGB:
case XE_generic_sRGB_alpha:
@ -735,19 +735,19 @@ set_xel_a(int x, int y, const LColorf &value) {
case XE_scRGB:
{
LColorf scaled = value * 8192.0f + 4096.5f;
col.r = std::min(std::max(0, (int)scaled[0]), 65535);
col.g = std::min(std::max(0, (int)scaled[1]), 65535);
col.b = std::min(std::max(0, (int)scaled[2]), 65535);
col.r = (std::min)((std::max)(0, (int)scaled[0]), 65535);
col.g = (std::min)((std::max)(0, (int)scaled[1]), 65535);
col.b = (std::min)((std::max)(0, (int)scaled[2]), 65535);
}
break;
case XE_scRGB_alpha:
{
LColorf scaled = value * 8192.0f + 4096.5f;
col.r = std::min(std::max(0, (int)scaled[0]), 65535);
col.g = std::min(std::max(0, (int)scaled[1]), 65535);
col.b = std::min(std::max(0, (int)scaled[2]), 65535);
alpha_row(y)[x] = std::min(std::max(0, (int)(value[3] * 65535 + 0.5f)), 65535);
col.r = (std::min)((std::max)(0, (int)scaled[0]), 65535);
col.g = (std::min)((std::max)(0, (int)scaled[1]), 65535);
col.b = (std::min)((std::max)(0, (int)scaled[2]), 65535);
alpha_row(y)[x] = (std::min)((std::max)(0, (int)(value[3] * 65535 + 0.5f)), 65535);
}
break;
}
@ -1224,14 +1224,14 @@ setup_sub_image(const PNMImage &copy, int &xto, int &yto,
yto = 0;
}
x_size = std::min(x_size, copy.get_x_size() - xfrom);
y_size = std::min(y_size, copy.get_y_size() - yfrom);
x_size = (std::min)(x_size, copy.get_x_size() - xfrom);
y_size = (std::min)(y_size, copy.get_y_size() - yfrom);
xmin = xto;
ymin = yto;
xmax = std::min(xmin + x_size, get_x_size());
ymax = std::min(ymin + y_size, get_y_size());
xmax = (std::min)(xmin + x_size, get_x_size());
ymax = (std::min)(ymin + y_size, get_y_size());
}
/**

View File

@ -110,7 +110,7 @@ INLINE double ClockObject::
get_dt(Thread *current_thread) const {
CDReader cdata(_cycler, current_thread);
if (_max_dt > 0.0) {
return std::min(_max_dt, cdata->_dt);
return (std::min)(_max_dt, cdata->_dt);
}
return cdata->_dt;
}

View File

@ -18,7 +18,7 @@
INLINE void PStatTimeline::
set_horizontal_scale(double time_width) {
double max_time_width = (_highest_end_time - _lowest_start_time) * 2.0;
time_width = std::min(time_width, max_time_width);
time_width = (std::min)(time_width, max_time_width);
double scale = time_width / get_xsize();
if (_time_scale != scale) {
@ -44,7 +44,7 @@ get_horizontal_scale() const {
*/
INLINE void PStatTimeline::
set_horizontal_scroll(double start_time) {
start_time = std::max(std::min(start_time, _highest_end_time), _lowest_start_time);
start_time = (std::max)((std::min)(start_time, _highest_end_time), _lowest_start_time);
if (_start_time != start_time) {
_start_time = start_time;
_target_start_time = start_time;
@ -71,7 +71,7 @@ zoom_to(double time_width, double center) {
// Don't allow zooming out to beyond 2x the size of the entire timeline.
// There's a limit of zooming beyond 1 ns per bar, there's just no point...
double max_time_width = (_highest_end_time - _lowest_start_time) * 2.0;
time_width = std::min(std::max(1e-7, time_width), max_time_width);
time_width = (std::min)((std::max)(1e-7, time_width), max_time_width);
_target_time_scale = time_width / get_xsize();
_zoom_center = center;
@ -93,7 +93,7 @@ zoom_by(double amount, double center) {
*/
INLINE void PStatTimeline::
scroll_to(double start_time) {
_target_start_time = std::max(std::min(start_time, _highest_end_time), _lowest_start_time);
_target_start_time = (std::max)((std::min)(start_time, _highest_end_time), _lowest_start_time);
}
/**