Merge branch 'master' into cmake
This commit is contained in:
commit
58bd610b94
|
|
@ -101,11 +101,20 @@ def Dtool_PreloadDLL(module):
|
|||
# Nowadays, we can compile libpandaexpress with libpanda into a
|
||||
# .pyd file called panda3d/core.pyd which can be imported without
|
||||
# any difficulty. Let's see if this is the case.
|
||||
if Dtool_FindModule("panda3d.core"):
|
||||
from panda3d.core import *
|
||||
else:
|
||||
|
||||
# In order to support things like py2exe that play games with the
|
||||
# physical python files on disk, we can't entirely rely on
|
||||
# Dtool_FindModule to find our panda3d.core module. However, we
|
||||
# should be able to import it. To differentiate the old-style Panda
|
||||
# build (with .dll's) from the new-style Panda build (with .pyd's), we
|
||||
# first try to import libpandaexpress directly; if it succeeds we're
|
||||
# in an old-style build, and if it fails we must be in a new-style
|
||||
# build.
|
||||
try:
|
||||
Dtool_PreloadDLL("libpandaexpress")
|
||||
from libpandaexpress import *
|
||||
except ImportError:
|
||||
from panda3d.core import *
|
||||
|
||||
def Dtool_ObjectToDict(cls, name, obj):
|
||||
cls.DtoolClassDict[name] = obj;
|
||||
|
|
|
|||
|
|
@ -1383,7 +1383,7 @@ class PandaModuleFinder(modulefinder.ModuleFinder):
|
|||
# A special case: map a reference to the "panda3d.blah"
|
||||
# module into the appropriate Panda3D dll.
|
||||
m = getattr(panda3d, partname, None)
|
||||
if m:
|
||||
if m and hasattr(m, '__libraries__'):
|
||||
libname = m.__libraries__[-1]
|
||||
partname = libname
|
||||
fqname = libname
|
||||
|
|
|
|||
|
|
@ -553,28 +553,32 @@ reset() {
|
|||
}
|
||||
|
||||
#ifndef OPENGLES
|
||||
_primitive_restart_gl3 = false;
|
||||
_primitive_restart_nv = false;
|
||||
_glPrimitiveRestartIndex = NULL;
|
||||
|
||||
if (is_at_least_gl_version(4, 3) || has_extension("GL_ARB_ES3_compatibility")) {
|
||||
// As long as we enable this, OpenGL will always use the highest possible index
|
||||
// for a numeric type as strip cut index, which coincides with our convention.
|
||||
// This saves us a call to glPrimitiveRestartIndex.
|
||||
glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
|
||||
_supported_geom_rendering |= Geom::GR_strip_cut_index;
|
||||
if (gl_support_primitive_restart_index) {
|
||||
if (is_at_least_gl_version(4, 3) || has_extension("GL_ARB_ES3_compatibility")) {
|
||||
// As long as we enable this, OpenGL will always use the highest possible index
|
||||
// for a numeric type as strip cut index, which coincides with our convention.
|
||||
// This saves us a call to glPrimitiveRestartIndex.
|
||||
glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
|
||||
_supported_geom_rendering |= Geom::GR_strip_cut_index;
|
||||
|
||||
} else if (is_at_least_gl_version(3, 1)) {
|
||||
glEnable(GL_PRIMITIVE_RESTART);
|
||||
_supported_geom_rendering |= Geom::GR_strip_cut_index;
|
||||
} else if (is_at_least_gl_version(3, 1)) {
|
||||
_primitive_restart_gl3 = true;
|
||||
_supported_geom_rendering |= Geom::GR_strip_cut_index;
|
||||
|
||||
_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)
|
||||
get_extension_func("glPrimitiveRestartIndex");
|
||||
_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)
|
||||
get_extension_func("glPrimitiveRestartIndex");
|
||||
|
||||
} else if (has_extension("GL_NV_primitive_restart")) {
|
||||
glEnable(GL_PRIMITIVE_RESTART_NV);
|
||||
_supported_geom_rendering |= Geom::GR_strip_cut_index;
|
||||
} else if (has_extension("GL_NV_primitive_restart")) {
|
||||
_primitive_restart_nv = true;
|
||||
_supported_geom_rendering |= Geom::GR_strip_cut_index;
|
||||
|
||||
_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)
|
||||
get_extension_func("glPrimitiveRestartIndexNV");
|
||||
_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)
|
||||
get_extension_func("glPrimitiveRestartIndexNV");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -3888,10 +3892,15 @@ draw_linestrips(const GeomPrimitivePipelineReader *reader, bool force) {
|
|||
(_supported_geom_rendering & GeomEnums::GR_strip_cut_index) != 0) {
|
||||
// One long triangle strip, connected by strip cut indices.
|
||||
#ifndef OPENGLES
|
||||
if (_glPrimitiveRestartIndex != NULL) {
|
||||
if (_primitive_restart_gl3) {
|
||||
glEnable(GL_PRIMITIVE_RESTART);
|
||||
_glPrimitiveRestartIndex(reader->get_strip_cut_index());
|
||||
|
||||
} else if (_primitive_restart_nv) {
|
||||
glEnableClientState(GL_PRIMITIVE_RESTART_NV);
|
||||
_glPrimitiveRestartIndex(reader->get_strip_cut_index());
|
||||
}
|
||||
#endif
|
||||
#endif // !OPENGLES
|
||||
|
||||
int num_vertices = reader->get_num_vertices();
|
||||
_vertices_other_pcollector.add_level(num_vertices);
|
||||
|
|
@ -3907,7 +3916,7 @@ draw_linestrips(const GeomPrimitivePipelineReader *reader, bool force) {
|
|||
get_numeric_type(reader->get_index_type()),
|
||||
client_pointer, _instance_count);
|
||||
} else
|
||||
#endif
|
||||
#endif // !OPENGLES
|
||||
{
|
||||
_glDrawRangeElements(GL_LINE_STRIP,
|
||||
reader->get_min_vertex(),
|
||||
|
|
@ -3916,6 +3925,15 @@ draw_linestrips(const GeomPrimitivePipelineReader *reader, bool force) {
|
|||
get_numeric_type(reader->get_index_type()),
|
||||
client_pointer);
|
||||
}
|
||||
|
||||
#ifndef OPENGLES
|
||||
if (_primitive_restart_gl3) {
|
||||
glDisable(GL_PRIMITIVE_RESTART);
|
||||
|
||||
} else if (_primitive_restart_nv) {
|
||||
glDisableClientState(GL_PRIMITIVE_RESTART_NV);
|
||||
}
|
||||
#endif // !OPENGLES
|
||||
} else {
|
||||
// Send the individual line strips, stepping over the
|
||||
// strip-cut indices.
|
||||
|
|
@ -4357,18 +4375,31 @@ prepare_shader(Shader *se) {
|
|||
ShaderContext *result = NULL;
|
||||
|
||||
switch (se->get_language()) {
|
||||
#if defined(HAVE_CG) && !defined(OPENGLES)
|
||||
case Shader::SL_Cg:
|
||||
result = new CLP(CgShaderContext)(this, se);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case Shader::SL_GLSL:
|
||||
if (_supports_glsl) {
|
||||
result = new CLP(ShaderContext)(this, se);
|
||||
break;
|
||||
} else {
|
||||
GLCAT.error()
|
||||
<< "Tried to load GLSL shader, but GLSL shaders not supported.\n";
|
||||
return NULL;
|
||||
}
|
||||
// Fall through.
|
||||
|
||||
#if defined(HAVE_CG) && !defined(OPENGLES)
|
||||
case Shader::SL_Cg:
|
||||
if (_supports_basic_shaders) {
|
||||
result = new CLP(CgShaderContext)(this, se);
|
||||
break;
|
||||
} else {
|
||||
GLCAT.error()
|
||||
<< "Tried to load Cg shader, but basic shaders not supported.\n";
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
GLCAT.error()
|
||||
<< "Tried to load Cg shader, but Cg support not compiled in.\n";
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
default:
|
||||
GLCAT.error()
|
||||
|
|
@ -5157,7 +5188,9 @@ framebuffer_copy_to_texture(Texture *tex, int view, int z,
|
|||
}
|
||||
|
||||
if (uses_mipmaps && _glGenerateMipmap != NULL) {
|
||||
glEnable(target);
|
||||
_glGenerateMipmap(target);
|
||||
glDisable(target);
|
||||
}
|
||||
|
||||
gtc->_has_storage = true;
|
||||
|
|
@ -6668,7 +6701,6 @@ void CLP(GraphicsStateGuardian)::
|
|||
set_draw_buffer(int rbtype) {
|
||||
#ifndef OPENGLES // Draw buffers not supported by OpenGL ES.
|
||||
if (_current_fbo) {
|
||||
|
||||
GLuint buffers[16];
|
||||
int nbuffers = 0;
|
||||
int index = 0;
|
||||
|
|
@ -6705,7 +6737,6 @@ set_draw_buffer(int rbtype) {
|
|||
_glDrawBuffers(nbuffers, buffers);
|
||||
|
||||
} else {
|
||||
|
||||
switch (rbtype & RenderBuffer::T_color) {
|
||||
case RenderBuffer::T_front:
|
||||
glDrawBuffer(GL_FRONT);
|
||||
|
|
|
|||
|
|
@ -600,6 +600,8 @@ public:
|
|||
|
||||
#ifndef OPENGLES
|
||||
PFNGLPRIMITIVERESTARTINDEXPROC _glPrimitiveRestartIndex;
|
||||
bool _primitive_restart_gl3;
|
||||
bool _primitive_restart_nv;
|
||||
#endif
|
||||
|
||||
bool _supports_vertex_blend;
|
||||
|
|
|
|||
|
|
@ -244,6 +244,21 @@ ConfigVariableBool gl_enable_memory_barriers
|
|||
"this off may give a slight performance increase, but you "
|
||||
"have to know what you're doing."));
|
||||
|
||||
ConfigVariableBool gl_vertex_array_objects
|
||||
("gl-vertex-array-objects", true,
|
||||
PRC_DESC("Setting this causes Panda to make use of vertex array "
|
||||
"objects to more efficiently switch between sets of "
|
||||
"vertex arrays. This only has effect when vertex-arrays "
|
||||
"and vertex-buffers are both set. This should usually be "
|
||||
"true unless you suspect a bug in the implementation. "));
|
||||
|
||||
ConfigVariableBool gl_support_primitive_restart_index
|
||||
("gl-support-primitive-restart-index", true,
|
||||
PRC_DESC("Setting this causes Panda to make use of primitive "
|
||||
"restart indices to more efficiently render line "
|
||||
"segment primitives. Set to false if you suspect a bug "
|
||||
"in the driver implementation."));
|
||||
|
||||
extern ConfigVariableBool gl_parallel_arrays;
|
||||
|
||||
void CLP(init_classes)() {
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ extern ConfigVariableBool gl_dump_compiled_shaders;
|
|||
extern ConfigVariableBool gl_immutable_texture_storage;
|
||||
extern ConfigVariableBool gl_use_bindless_texture;
|
||||
extern ConfigVariableBool gl_enable_memory_barriers;
|
||||
extern ConfigVariableBool gl_vertex_array_objects;
|
||||
extern ConfigVariableBool gl_support_primitive_restart_index;
|
||||
|
||||
extern EXPCL_GL void CLP(init_classes)();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue