2
0
Эх сурвалжийг харах

Merge remote-tracking branch 'origin/master' into webgl-port

rdb 10 жил өмнө
parent
commit
8012ccf8e6

+ 3 - 0
direct/src/task/Task.py

@@ -483,6 +483,9 @@ class TaskManager:
         """Starts the task manager running.  Does not return until an
         """Starts the task manager running.  Does not return until an
         exception is encountered (including KeyboardInterrupt). """
         exception is encountered (including KeyboardInterrupt). """
 
 
+        if PandaSystem.getPlatform() == 'emscripten':
+            return
+
         # Set the clock to have last frame's time in case we were
         # Set the clock to have last frame's time in case we were
         # Paused at the prompt for a long time
         # Paused at the prompt for a long time
         t = self.globalClock.getFrameTime()
         t = self.globalClock.getFrameTime()

+ 1 - 1
dtool/src/interrogate/interfaceMakerPythonNative.cxx

@@ -2896,7 +2896,7 @@ write_module_class(ostream &out, Object *obj) {
   // struct PyMethodDef *tp_methods;
   // struct PyMethodDef *tp_methods;
   out << "    Dtool_Methods_" << ClassName << ",\n";
   out << "    Dtool_Methods_" << ClassName << ",\n";
   // struct PyMemberDef *tp_members;
   // struct PyMemberDef *tp_members;
-  out << "    standard_type_members,\n";
+  out << "    0, // tp_members\n";
 
 
   // struct PyGetSetDef *tp_getset;
   // struct PyGetSetDef *tp_getset;
   if (num_getset > 0) {
   if (num_getset > 0) {

+ 6 - 0
dtool/src/pystub/pystub.cxx

@@ -61,6 +61,7 @@ extern "C" {
   EXPCL_PYSTUB int PyGILState_Ensure(...);
   EXPCL_PYSTUB int PyGILState_Ensure(...);
   EXPCL_PYSTUB int PyGILState_Release(...);
   EXPCL_PYSTUB int PyGILState_Release(...);
   EXPCL_PYSTUB int PyImport_GetModuleDict(...);
   EXPCL_PYSTUB int PyImport_GetModuleDict(...);
+  EXPCL_PYSTUB int PyImport_ImportModule(...);
   EXPCL_PYSTUB int PyInt_AsLong(...);
   EXPCL_PYSTUB int PyInt_AsLong(...);
   EXPCL_PYSTUB int PyInt_AsSsize_t(...);
   EXPCL_PYSTUB int PyInt_AsSsize_t(...);
   EXPCL_PYSTUB int PyInt_FromLong(...);
   EXPCL_PYSTUB int PyInt_FromLong(...);
@@ -169,6 +170,7 @@ extern "C" {
   EXPCL_PYSTUB int PyUnicode_InternInPlace(...);
   EXPCL_PYSTUB int PyUnicode_InternInPlace(...);
   EXPCL_PYSTUB int PyUnicode_Type(...);
   EXPCL_PYSTUB int PyUnicode_Type(...);
   EXPCL_PYSTUB int Py_BuildValue(...);
   EXPCL_PYSTUB int Py_BuildValue(...);
+  EXPCL_PYSTUB int Py_GetVersion(...);
   EXPCL_PYSTUB int Py_InitModule4(...);
   EXPCL_PYSTUB int Py_InitModule4(...);
   EXPCL_PYSTUB int Py_InitModule4_64(...);
   EXPCL_PYSTUB int Py_InitModule4_64(...);
   EXPCL_PYSTUB int Py_InitModule4TraceRefs(...);
   EXPCL_PYSTUB int Py_InitModule4TraceRefs(...);
@@ -195,6 +197,7 @@ extern "C" {
   EXPCL_PYSTUB extern void *PyExc_ConnectionError;
   EXPCL_PYSTUB extern void *PyExc_ConnectionError;
   EXPCL_PYSTUB extern void *PyExc_Exception;
   EXPCL_PYSTUB extern void *PyExc_Exception;
   EXPCL_PYSTUB extern void *PyExc_FutureWarning;
   EXPCL_PYSTUB extern void *PyExc_FutureWarning;
+  EXPCL_PYSTUB extern void *PyExc_ImportError;
   EXPCL_PYSTUB extern void *PyExc_IndexError;
   EXPCL_PYSTUB extern void *PyExc_IndexError;
   EXPCL_PYSTUB extern void *PyExc_OSError;
   EXPCL_PYSTUB extern void *PyExc_OSError;
   EXPCL_PYSTUB extern void *PyExc_RuntimeError;
   EXPCL_PYSTUB extern void *PyExc_RuntimeError;
@@ -258,6 +261,7 @@ int PyGen_Type(...) { return 0; }
 int PyGILState_Ensure(...) { return 0; }
 int PyGILState_Ensure(...) { return 0; }
 int PyGILState_Release(...) { return 0; }
 int PyGILState_Release(...) { return 0; }
 int PyImport_GetModuleDict(...) { return 0; }
 int PyImport_GetModuleDict(...) { return 0; }
+int PyImport_ImportModule(...) { return 0; }
 int PyInt_AsLong(...) { return 0; }
 int PyInt_AsLong(...) { return 0; }
 int PyInt_AsSsize_t(...) { return 0; }
 int PyInt_AsSsize_t(...) { return 0; }
 int PyInt_FromLong(...) { return 0; }
 int PyInt_FromLong(...) { return 0; }
@@ -365,6 +369,7 @@ int PyUnicode_GetSize(...) { return 0; }
 int PyUnicode_InternFromString(...) { return 0; }
 int PyUnicode_InternFromString(...) { return 0; }
 int PyUnicode_InternInPlace(...) { return 0; }
 int PyUnicode_InternInPlace(...) { return 0; }
 int PyUnicode_Type(...) { return 0; }
 int PyUnicode_Type(...) { return 0; }
+int Py_GetVersion(...) { return 0; }
 int Py_BuildValue(...) { return 0; }
 int Py_BuildValue(...) { return 0; }
 int Py_InitModule4(...) { return 0; }
 int Py_InitModule4(...) { return 0; }
 int Py_InitModule4_64(...) { return 0; }
 int Py_InitModule4_64(...) { return 0; }
@@ -397,6 +402,7 @@ void *PyExc_BufferError = (void *)NULL;
 void *PyExc_ConnectionError = (void *)NULL;
 void *PyExc_ConnectionError = (void *)NULL;
 void *PyExc_Exception = (void *)NULL;
 void *PyExc_Exception = (void *)NULL;
 void *PyExc_FutureWarning = (void *)NULL;
 void *PyExc_FutureWarning = (void *)NULL;
+void *PyExc_ImportError = (void *)NULL;
 void *PyExc_IndexError = (void *)NULL;
 void *PyExc_IndexError = (void *)NULL;
 void *PyExc_OSError = (void *)NULL;
 void *PyExc_OSError = (void *)NULL;
 void *PyExc_RuntimeError = (void *)NULL;
 void *PyExc_RuntimeError = (void *)NULL;

+ 9 - 5
makepanda/makepanda.py

@@ -457,7 +457,6 @@ SdkLocateMaya()
 SdkLocateMax()
 SdkLocateMax()
 SdkLocateMacOSX(OSXTARGET)
 SdkLocateMacOSX(OSXTARGET)
 SdkLocatePython(RTDIST)
 SdkLocatePython(RTDIST)
-SdkLocateVisualStudio(MSVC_VERSION)
 SdkLocateWindows(WINDOWS_SDK)
 SdkLocateWindows(WINDOWS_SDK)
 SdkLocatePhysX()
 SdkLocatePhysX()
 SdkLocateSpeedTree()
 SdkLocateSpeedTree()
@@ -496,6 +495,7 @@ if RUNTIME and not HOST_URL:
 
 
 if GetHost() == 'windows' and GetTarget() == 'windows':
 if GetHost() == 'windows' and GetTarget() == 'windows':
     COMPILER = "MSVC"
     COMPILER = "MSVC"
+    SdkLocateVisualStudio(MSVC_VERSION)
 else:
 else:
     COMPILER = "GCC"
     COMPILER = "GCC"
 
 
@@ -737,6 +737,9 @@ if (COMPILER=="GCC"):
             IncDirectory("ALWAYS", "/usr/PCBSD/local/include")
             IncDirectory("ALWAYS", "/usr/PCBSD/local/include")
             LibDirectory("ALWAYS", "/usr/PCBSD/local/lib")
             LibDirectory("ALWAYS", "/usr/PCBSD/local/lib")
 
 
+    if GetTarget() != "windows":
+        PkgDisable("DIRECTCAM")
+
     fcollada_libs = ("FColladaD", "FColladaSD", "FColladaS")
     fcollada_libs = ("FColladaD", "FColladaSD", "FColladaS")
     # WARNING! The order of the ffmpeg libraries matters!
     # WARNING! The order of the ffmpeg libraries matters!
     ffmpeg_libs = ("libavformat", "libavcodec", "libavutil")
     ffmpeg_libs = ("libavformat", "libavcodec", "libavutil")
@@ -1174,7 +1177,7 @@ def CompileCxx(obj,src,opts):
             if (opt=="ALWAYS") or (opt in opts): cmd += ' -D' + var + '=' + val
             if (opt=="ALWAYS") or (opt in opts): cmd += ' -D' + var + '=' + val
         for x in ipath: cmd += ' -I' + x
         for x in ipath: cmd += ' -I' + x
 
 
-        if not GetLinkAllStatic():
+        if not GetLinkAllStatic() and 'NOHIDDEN' not in opts:
             cmd += ' -fvisibility=hidden'
             cmd += ' -fvisibility=hidden'
 
 
         # Mac-specific flags.
         # Mac-specific flags.
@@ -1636,7 +1639,8 @@ def CompileLink(dll, obj, opts):
                 cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp'
                 cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp'
             else:
             else:
                 cmd = cxx + ' -shared'
                 cmd = cxx + ' -shared'
-                if ("MODULE" not in opts): cmd += " -Wl,-soname=" + os.path.basename(dll)
+                if "MODULE" not in opts or GetTarget() == 'android':
+                    cmd += " -Wl,-soname=" + os.path.basename(dll)
                 cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp'
                 cmd += ' -o ' + dll + ' -L' + GetOutputDir() + '/lib -L' + GetOutputDir() + '/tmp'
 
 
         if GetTarget() == 'emscripten' and GetOrigExt(dll) != ".exe":
         if GetTarget() == 'emscripten' and GetOrigExt(dll) != ".exe":
@@ -4378,7 +4382,7 @@ if (GetTarget() == 'windows' and not RUNTIME):
 # DIRECTORY: panda/metalibs/pandadx9/
 # DIRECTORY: panda/metalibs/pandadx9/
 #
 #
 
 
-if PkgSkip("DX9")==0 and not RUNTIME:
+if GetTarget() == 'windows' and PkgSkip("DX9")==0 and not RUNTIME:
   OPTS=['DIR:panda/src/dxgsg9', 'BUILDING:PANDADX', 'DX9',  'NVIDIACG', 'CGDX9']
   OPTS=['DIR:panda/src/dxgsg9', 'BUILDING:PANDADX', 'DX9',  'NVIDIACG', 'CGDX9']
   TargetAdd('p3dxgsg9_dxGraphicsStateGuardian9.obj', opts=OPTS, input='dxGraphicsStateGuardian9.cxx')
   TargetAdd('p3dxgsg9_dxGraphicsStateGuardian9.obj', opts=OPTS, input='dxGraphicsStateGuardian9.cxx')
   TargetAdd('p3dxgsg9_composite1.obj', opts=OPTS, input='p3dxgsg9_composite1.cxx')
   TargetAdd('p3dxgsg9_composite1.obj', opts=OPTS, input='p3dxgsg9_composite1.cxx')
@@ -4876,7 +4880,7 @@ if (not RUNTIME and GetTarget() == 'android'):
   TargetAdd('libp3android.dll', input=COMMON_PANDA_LIBS)
   TargetAdd('libp3android.dll', input=COMMON_PANDA_LIBS)
   TargetAdd('libp3android.dll', opts=['JNIGRAPHICS'])
   TargetAdd('libp3android.dll', opts=['JNIGRAPHICS'])
 
 
-  TargetAdd('android_native_app_glue.obj', opts=OPTS, input='android_native_app_glue.c')
+  TargetAdd('android_native_app_glue.obj', opts=OPTS + ['NOHIDDEN'], input='android_native_app_glue.c')
   TargetAdd('android_main.obj', opts=OPTS, input='android_main.cxx')
   TargetAdd('android_main.obj', opts=OPTS, input='android_main.cxx')
 
 
   if (not RTDIST and PkgSkip("PVIEW")==0):
   if (not RTDIST and PkgSkip("PVIEW")==0):

+ 2 - 1
makepanda/makepandacore.py

@@ -2018,7 +2018,8 @@ def SdkLocateVisualStudio(version=10):
         print("Using Visual Studio %s" % (version))
         print("Using Visual Studio %s" % (version))
 
 
 def SdkLocateWindows(version = '7.1'):
 def SdkLocateWindows(version = '7.1'):
-    if (GetHost() != "windows"): return
+    if GetTarget() != "windows" or GetHost() != "windows":
+        return
 
 
     version = version.upper()
     version = version.upper()
 
 

+ 2 - 2
panda/src/android/config_android.h

@@ -23,10 +23,10 @@
 
 
 #include <jni.h>
 #include <jni.h>
 
 
-NotifyCategoryDeclNoExport(android);
+NotifyCategoryDecl(android, EXPORT_CLASS, EXPORT_TEMPL);
 extern void init_libandroid();
 extern void init_libandroid();
 
 
-extern struct android_app* panda_android_app;
+extern EXPORT_CLASS struct android_app* panda_android_app;
 
 
 extern jclass    jni_PandaActivity;
 extern jclass    jni_PandaActivity;
 extern jmethodID jni_PandaActivity_readBitmapHeader;
 extern jmethodID jni_PandaActivity_readBitmapHeader;

+ 9 - 3
panda/src/android/jni_NativeIStream.cxx

@@ -16,13 +16,19 @@
 
 
 #include <istream>
 #include <istream>
 
 
+#if __GNUC__ >= 4
+#define EXPORT_JNI extern "C" __attribute__((visibility("default")))
+#else
+#define EXPORT_JNI extern "C"
+#endif
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: NativeIStream::nativeGet
 //     Function: NativeIStream::nativeGet
 //       Access: Private, Static
 //       Access: Private, Static
 //  Description: Reads a single character from the istream.
 //  Description: Reads a single character from the istream.
 //               Should return -1 on EOF.
 //               Should return -1 on EOF.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
-extern "C" jint
+EXPORT_JNI jint
 Java_org_panda3d_android_NativeIStream_nativeGet(JNIEnv *env, jclass clazz, jlong ptr) {
 Java_org_panda3d_android_NativeIStream_nativeGet(JNIEnv *env, jclass clazz, jlong ptr) {
   std::istream *stream = (std::istream *) ptr;
   std::istream *stream = (std::istream *) ptr;
 
 
@@ -37,7 +43,7 @@ Java_org_panda3d_android_NativeIStream_nativeGet(JNIEnv *env, jclass clazz, jlon
 //               the actual number of bytes that were read.
 //               the actual number of bytes that were read.
 //               Should return -1 on EOF.
 //               Should return -1 on EOF.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
-extern "C" jint
+EXPORT_JNI jint
 Java_org_panda3d_android_NativeIStream_nativeRead(JNIEnv *env, jclass clazz, jlong ptr, jbyteArray byte_array, jint offset, jint length) {
 Java_org_panda3d_android_NativeIStream_nativeRead(JNIEnv *env, jclass clazz, jlong ptr, jbyteArray byte_array, jint offset, jint length) {
   std::istream *stream = (std::istream *) ptr;
   std::istream *stream = (std::istream *) ptr;
   jbyte *buffer = (jbyte *) env->GetPrimitiveArrayCritical(byte_array, NULL);
   jbyte *buffer = (jbyte *) env->GetPrimitiveArrayCritical(byte_array, NULL);
@@ -63,7 +69,7 @@ Java_org_panda3d_android_NativeIStream_nativeRead(JNIEnv *env, jclass clazz, jlo
 //  Description: Skips ahead N bytes in the stream.  Returns the
 //  Description: Skips ahead N bytes in the stream.  Returns the
 //               actual number of skipped bytes.
 //               actual number of skipped bytes.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
-extern "C" jlong
+EXPORT_JNI jlong
 Java_org_panda3d_android_NativeIStream_nativeIgnore(JNIEnv *env, jclass clazz, jlong ptr, jlong offset) {
 Java_org_panda3d_android_NativeIStream_nativeIgnore(JNIEnv *env, jclass clazz, jlong ptr, jlong offset) {
   std::istream *stream = (std::istream *) ptr;
   std::istream *stream = (std::istream *) ptr;
   stream->ignore(offset);
   stream->ignore(offset);

+ 1 - 1
panda/src/androiddisplay/androidGraphicsWindow.cxx

@@ -30,7 +30,7 @@
 #include <android/window.h>
 #include <android/window.h>
 #include <android/log.h>
 #include <android/log.h>
 
 
-extern struct android_app* panda_android_app;
+extern IMPORT_CLASS struct android_app* panda_android_app;
 
 
 TypeHandle AndroidGraphicsWindow::_type_handle;
 TypeHandle AndroidGraphicsWindow::_type_handle;
 
 

+ 14 - 0
panda/src/display/graphicsStateGuardian.cxx

@@ -1239,6 +1239,20 @@ fetch_specified_part(Shader::ShaderMatInput part, InternalName *name,
       return &LMatrix4::ident_mat();
       return &LMatrix4::ident_mat();
     }
     }
   }
   }
+  case Shader::SMO_tex_is_alpha_i: {
+    // This is a hack so we can support both F_alpha and other
+    // formats in the default shader, to fix font rendering in GLES2
+    const TextureAttrib *ta;
+    if (_target_rs->get_attrib(ta) &&
+        index < ta->get_num_on_stages()) {
+      TextureStage *ts = ta->get_on_stage(index);
+      PN_stdfloat v = (ta->get_on_texture(ts)->get_format() == Texture::F_alpha);
+      t = LMatrix4(0,0,0,0,0,0,0,0,0,0,0,0,v,v,v,0);
+      return &t;
+    } else {
+      return &LMatrix4::zeros_mat();
+    }
+  }
   case Shader::SMO_plane_x: {
   case Shader::SMO_plane_x: {
     const NodePath &np = _target_shader->get_shader_input_nodepath(name);
     const NodePath &np = _target_shader->get_shader_input_nodepath(name);
     nassertr(!np.is_empty(), &LMatrix4::zeros_mat());
     nassertr(!np.is_empty(), &LMatrix4::zeros_mat());

+ 33 - 15
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -155,14 +155,14 @@ static const string default_vshader =
   "attribute vec4 p3d_Color;\n"
   "attribute vec4 p3d_Color;\n"
   "attribute vec2 p3d_MultiTexCoord0;\n"
   "attribute vec2 p3d_MultiTexCoord0;\n"
   "varying vec2 texcoord;\n"
   "varying vec2 texcoord;\n"
-  "varying vec4 color;\n"
+  "varying lowp vec4 color;\n"
 #endif
 #endif
   "uniform mat4 p3d_ModelViewProjectionMatrix;\n"
   "uniform mat4 p3d_ModelViewProjectionMatrix;\n"
   "uniform vec4 p3d_ColorScale;\n"
   "uniform vec4 p3d_ColorScale;\n"
   "void main(void) {\n"
   "void main(void) {\n"
   "  gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex;\n"
   "  gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex;\n"
   "  texcoord = p3d_MultiTexCoord0;\n"
   "  texcoord = p3d_MultiTexCoord0;\n"
-  "  color = p3d_Color * p3d_ColorScale;\n"
+  "  color = p3d_Color;\n"
   "}\n";
   "}\n";
 
 
 static const string default_fshader =
 static const string default_fshader =
@@ -171,18 +171,23 @@ static const string default_fshader =
   "in vec2 texcoord;\n"
   "in vec2 texcoord;\n"
   "in vec4 color;\n"
   "in vec4 color;\n"
   "out vec4 p3d_FragColor;"
   "out vec4 p3d_FragColor;"
+  "uniform sampler2D p3d_Texture0;\n"
+  "uniform vec4 p3d_TexAlphaOnly;\n"
 #else
 #else
   "precision mediump float;\n"
   "precision mediump float;\n"
   "varying vec2 texcoord;\n"
   "varying vec2 texcoord;\n"
-  "varying vec4 color;\n"
+  "varying lowp vec4 color;\n"
+  "uniform lowp sampler2D p3d_Texture0;\n"
+  "uniform lowp vec4 p3d_TexAlphaOnly;\n"
 #endif
 #endif
-  "uniform sampler2D p3d_Texture0;\n"
   "void main(void) {\n"
   "void main(void) {\n"
 #ifndef OPENGLES
 #ifndef OPENGLES
   "  p3d_FragColor = texture(p3d_Texture0, texcoord);\n"
   "  p3d_FragColor = texture(p3d_Texture0, texcoord);\n"
-  "  p3d_FragColor *= color;\n"
+  "  p3d_FragColor += p3d_TexAlphaOnly;\n" // Hack for text rendering
+  "  p3d_FragColor = color;\n"
 #else
 #else
   "  gl_FragColor = texture2D(p3d_Texture0, texcoord).bgra;\n"
   "  gl_FragColor = texture2D(p3d_Texture0, texcoord).bgra;\n"
+  "  gl_FragColor += p3d_TexAlphaOnly;\n" // Hack for text rendering
   "  gl_FragColor *= color;\n"
   "  gl_FragColor *= color;\n"
 #endif
 #endif
   "}\n";
   "}\n";
@@ -6596,9 +6601,12 @@ do_issue_depth_test() {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void CLP(GraphicsStateGuardian)::
 void CLP(GraphicsStateGuardian)::
 do_issue_alpha_test() {
 do_issue_alpha_test() {
+#ifndef OPENGLES_1
   if (_target_shader->get_flag(ShaderAttrib::F_subsume_alpha_test)) {
   if (_target_shader->get_flag(ShaderAttrib::F_subsume_alpha_test)) {
     enable_alpha_test(false);
     enable_alpha_test(false);
-  } else {
+  } else
+#endif
+  {
     const AlphaTestAttrib *target_alpha_test;
     const AlphaTestAttrib *target_alpha_test;
     _target_rs->get_attrib_def(target_alpha_test);
     _target_rs->get_attrib_def(target_alpha_test);
 
 
@@ -6859,9 +6867,13 @@ do_issue_blending() {
 
 
   unsigned int color_channels =
   unsigned int color_channels =
     target_color_write->get_channels() & _color_write_mask;
     target_color_write->get_channels() & _color_write_mask;
+
+#ifndef OPENGLES_1
   if (_target_shader->get_flag(ShaderAttrib::F_disable_alpha_write)) {
   if (_target_shader->get_flag(ShaderAttrib::F_disable_alpha_write)) {
     color_channels &= ~(ColorWriteAttrib::C_alpha);
     color_channels &= ~(ColorWriteAttrib::C_alpha);
   }
   }
+#endif
+
   if (color_channels == ColorWriteAttrib::C_off) {
   if (color_channels == ColorWriteAttrib::C_off) {
     int color_write_slot = ColorWriteAttrib::get_class_slot();
     int color_write_slot = ColorWriteAttrib::get_class_slot();
     enable_multisample_alpha_one(false);
     enable_multisample_alpha_one(false);
@@ -9897,9 +9909,12 @@ set_state_and_transform(const RenderState *target,
 #ifdef SUPPORT_FIXED_FUNCTION
 #ifdef SUPPORT_FIXED_FUNCTION
   int alpha_test_slot = AlphaTestAttrib::get_class_slot();
   int alpha_test_slot = AlphaTestAttrib::get_class_slot();
   if (_target_rs->get_attrib(alpha_test_slot) != _state_rs->get_attrib(alpha_test_slot) ||
   if (_target_rs->get_attrib(alpha_test_slot) != _state_rs->get_attrib(alpha_test_slot) ||
-      !_state_mask.get_bit(alpha_test_slot) ||
-      (_target_shader->get_flag(ShaderAttrib::F_subsume_alpha_test) !=
-       _state_shader->get_flag(ShaderAttrib::F_subsume_alpha_test))) {
+      !_state_mask.get_bit(alpha_test_slot)
+#ifndef OPENGLES_1
+      || (_target_shader->get_flag(ShaderAttrib::F_subsume_alpha_test) !=
+          _state_shader->get_flag(ShaderAttrib::F_subsume_alpha_test))
+#endif
+      ) {
     //PStatGPUTimer timer(this, _draw_set_state_alpha_test_pcollector);
     //PStatGPUTimer timer(this, _draw_set_state_alpha_test_pcollector);
     do_issue_alpha_test();
     do_issue_alpha_test();
     _state_mask.set_bit(alpha_test_slot);
     _state_mask.set_bit(alpha_test_slot);
@@ -10003,9 +10018,12 @@ set_state_and_transform(const RenderState *target,
       _target_rs->get_attrib(color_blend_slot) != _state_rs->get_attrib(color_blend_slot) ||
       _target_rs->get_attrib(color_blend_slot) != _state_rs->get_attrib(color_blend_slot) ||
       !_state_mask.get_bit(transparency_slot) ||
       !_state_mask.get_bit(transparency_slot) ||
       !_state_mask.get_bit(color_write_slot) ||
       !_state_mask.get_bit(color_write_slot) ||
-      !_state_mask.get_bit(color_blend_slot) ||
-      (_target_shader->get_flag(ShaderAttrib::F_disable_alpha_write) !=
-       _state_shader->get_flag(ShaderAttrib::F_disable_alpha_write))) {
+      !_state_mask.get_bit(color_blend_slot)
+#ifndef OPENGLES_1
+      || (_target_shader->get_flag(ShaderAttrib::F_disable_alpha_write) !=
+          _state_shader->get_flag(ShaderAttrib::F_disable_alpha_write))
+#endif
+      ) {
     //PStatGPUTimer timer(this, _draw_set_state_blending_pcollector);
     //PStatGPUTimer timer(this, _draw_set_state_blending_pcollector);
     do_issue_blending();
     do_issue_blending();
     _state_mask.set_bit(transparency_slot);
     _state_mask.set_bit(transparency_slot);
@@ -11558,9 +11576,9 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
     // texture formats?
     // texture formats?
     switch (tex->get_format()) {
     switch (tex->get_format()) {
     case Texture::F_alpha:
     case Texture::F_alpha:
-      glTexParameteri(target, GL_TEXTURE_SWIZZLE_R, GL_ONE);
-      glTexParameteri(target, GL_TEXTURE_SWIZZLE_G, GL_ONE);
-      glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, GL_ONE);
+      glTexParameteri(target, GL_TEXTURE_SWIZZLE_R, GL_ZERO);
+      glTexParameteri(target, GL_TEXTURE_SWIZZLE_G, GL_ZERO);
+      glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, GL_ZERO);
       glTexParameteri(target, GL_TEXTURE_SWIZZLE_A, GL_RED);
       glTexParameteri(target, GL_TEXTURE_SWIZZLE_A, GL_RED);
       break;
       break;
 
 

+ 20 - 0
panda/src/glstuff/glShaderContext_src.cxx

@@ -1198,6 +1198,22 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
       _slider_table_size = param_size;
       _slider_table_size = param_size;
       return;
       return;
     }
     }
+    if (noprefix == "TexAlphaOnly") {
+      Shader::ShaderMatSpec bind;
+      bind._id = arg_id;
+      bind._func = Shader::SMF_first;
+      bind._index = 0;
+      bind._part[0] = Shader::SMO_tex_is_alpha_i;
+      bind._arg[0] = NULL;
+      bind._dep[0] = Shader::SSD_general | Shader::SSD_texture | Shader::SSD_frame;
+      bind._part[1] = Shader::SMO_identity;
+      bind._arg[1] = NULL;
+      bind._dep[1] = Shader::SSD_NONE;
+      bind._piece = Shader::SMP_row3;
+      _shader->_mat_spec.push_back(bind);
+      _shader->_mat_deps |= bind._dep[0] | bind._dep[1];
+      return;
+    }
     GLCAT.error() << "Unrecognized uniform name '" << param_name << "'!\n";
     GLCAT.error() << "Unrecognized uniform name '" << param_name << "'!\n";
     return;
     return;
 
 
@@ -1850,6 +1866,10 @@ set_state_and_transform(const RenderState *target_rs,
         target_rs->get_attrib(TexMatrixAttrib::get_class_slot())) {
         target_rs->get_attrib(TexMatrixAttrib::get_class_slot())) {
       altered |= Shader::SSD_tex_matrix;
       altered |= Shader::SSD_tex_matrix;
     }
     }
+    if (_state_rs->get_attrib(TextureAttrib::get_class_slot()) !=
+        target_rs->get_attrib(TextureAttrib::get_class_slot())) {
+      altered |= Shader::SSD_texture;
+    }
     _state_rs = target_rs;
     _state_rs = target_rs;
   }
   }
 
 

+ 3 - 0
panda/src/gobj/shader.cxx

@@ -509,6 +509,9 @@ cp_dependency(ShaderMatInput inp) {
       (inp == SMO_apiclip_to_apiview)) {
       (inp == SMO_apiclip_to_apiview)) {
     dep |= SSD_projection;
     dep |= SSD_projection;
   }
   }
+  if (inp == SMO_tex_is_alpha_i) {
+    dep |= SSD_texture | SSD_frame;
+  }
 
 
   return dep;
   return dep;
 }
 }

+ 4 - 0
panda/src/gobj/shader.h

@@ -201,6 +201,9 @@ public:
     // Additional properties for PBR materials
     // Additional properties for PBR materials
     SMO_attr_material2,
     SMO_attr_material2,
 
 
+    // Hack for text rendering.  Don't use in user shaders.
+    SMO_tex_is_alpha_i,
+
     SMO_INVALID
     SMO_INVALID
   };
   };
 
 
@@ -297,6 +300,7 @@ public:
     SSD_tex_matrix    = 0x200,
     SSD_tex_matrix    = 0x200,
     SSD_frame         = 0x400,
     SSD_frame         = 0x400,
     SSD_projection    = 0x800,
     SSD_projection    = 0x800,
+    SSD_texture      = 0x1000,
   };
   };
 
 
   enum ShaderBug {
   enum ShaderBug {

+ 4 - 0
panda/src/linmath/lpoint3_src.h

@@ -42,6 +42,10 @@ PUBLISHED:
   INLINE_LINMATH FLOATNAME(LPoint2) get_xz() const;
   INLINE_LINMATH FLOATNAME(LPoint2) get_xz() const;
   INLINE_LINMATH FLOATNAME(LPoint2) get_yz() const;
   INLINE_LINMATH FLOATNAME(LPoint2) get_yz() const;
 
 
+  MAKE_PROPERTY(xy, get_xy);
+  MAKE_PROPERTY(xz, get_xz);
+  MAKE_PROPERTY(yz, get_yz);
+
   INLINE_LINMATH FLOATNAME(LPoint3) operator - () const;
   INLINE_LINMATH FLOATNAME(LPoint3) operator - () const;
 
 
   INLINE_LINMATH FLOATNAME(LVecBase3)
   INLINE_LINMATH FLOATNAME(LVecBase3)

+ 22 - 0
panda/src/linmath/lpoint4_src.I

@@ -105,6 +105,28 @@ unit_w() {
   return (const FLOATNAME(LPoint4) &)FLOATNAME(LVecBase4)::unit_w();
   return (const FLOATNAME(LPoint4) &)FLOATNAME(LVecBase4)::unit_w();
 }
 }
 
 
+
+////////////////////////////////////////////////////////////////////
+//     Function: LPoint4::get_xyz
+//       Access: Published
+//  Description: Returns the x, y and z component of this vector
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(LPoint3) FLOATNAME(LPoint4)::
+get_xyz() const {
+  return FLOATNAME(LPoint3)(_v(0), _v(1), _v(2));
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LPoint4::get_xy
+//       Access: Published
+//  Description: Returns the x and y component of this vector
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(LPoint2) FLOATNAME(LPoint4)::
+get_xy() const {
+  return FLOATNAME(LPoint2)(_v(0), _v(1));
+}
+
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: LPoint4::unary -
 //     Function: LPoint4::unary -
 //       Access: Public
 //       Access: Public

+ 6 - 0
panda/src/linmath/lpoint4_src.h

@@ -33,6 +33,12 @@ PUBLISHED:
   INLINE_LINMATH static const FLOATNAME(LPoint4) &unit_z();
   INLINE_LINMATH static const FLOATNAME(LPoint4) &unit_z();
   INLINE_LINMATH static const FLOATNAME(LPoint4) &unit_w();
   INLINE_LINMATH static const FLOATNAME(LPoint4) &unit_w();
 
 
+  INLINE_LINMATH FLOATNAME(LPoint3) get_xyz() const;
+  INLINE_LINMATH FLOATNAME(LPoint2) get_xy() const;
+
+  MAKE_PROPERTY(xyz, get_xyz);
+  MAKE_PROPERTY(xy, get_xy);
+
   INLINE_LINMATH FLOATNAME(LPoint4) operator - () const;
   INLINE_LINMATH FLOATNAME(LPoint4) operator - () const;
 
 
   INLINE_LINMATH FLOATNAME(LVecBase4)
   INLINE_LINMATH FLOATNAME(LVecBase4)

+ 2 - 0
panda/src/linmath/lvecBase3_src.h

@@ -74,6 +74,8 @@ PUBLISHED:
   MAKE_PROPERTY(y, get_y, set_y);
   MAKE_PROPERTY(y, get_y, set_y);
   MAKE_PROPERTY(z, get_z, set_z);
   MAKE_PROPERTY(z, get_z, set_z);
   MAKE_PROPERTY(xy, get_xy);
   MAKE_PROPERTY(xy, get_xy);
+  MAKE_PROPERTY(xz, get_xz);
+  MAKE_PROPERTY(yz, get_yz);
 
 
   // These next functions add to an existing value.
   // These next functions add to an existing value.
   // i.e. foo.set_x(foo.get_x() + value)
   // i.e. foo.set_x(foo.get_x() + value)

+ 2 - 1
panda/src/linmath/lvecBase4_src.h

@@ -84,8 +84,9 @@ PUBLISHED:
   MAKE_PROPERTY(x, get_x, set_x);
   MAKE_PROPERTY(x, get_x, set_x);
   MAKE_PROPERTY(y, get_y, set_y);
   MAKE_PROPERTY(y, get_y, set_y);
   MAKE_PROPERTY(z, get_z, set_z);
   MAKE_PROPERTY(z, get_z, set_z);
-  MAKE_PROPERTY(xy, get_xy);
+
   MAKE_PROPERTY(xyz, get_xyz);
   MAKE_PROPERTY(xyz, get_xyz);
+  MAKE_PROPERTY(xy, get_xy);
 
 
   // These next functions add to an existing value.
   // These next functions add to an existing value.
   // i.e. foo.set_x(foo.get_x() + value)
   // i.e. foo.set_x(foo.get_x() + value)

+ 5 - 0
panda/src/linmath/lvector3_src.h

@@ -42,6 +42,11 @@ PUBLISHED:
   INLINE_LINMATH FLOATNAME(LVector2) get_xz() const;
   INLINE_LINMATH FLOATNAME(LVector2) get_xz() const;
   INLINE_LINMATH FLOATNAME(LVector2) get_yz() const;
   INLINE_LINMATH FLOATNAME(LVector2) get_yz() const;
 
 
+  MAKE_PROPERTY(xy, get_xy);
+  MAKE_PROPERTY(xz, get_xz);
+  MAKE_PROPERTY(yz, get_yz);
+
+
   INLINE_LINMATH FLOATNAME(LVector3) operator - () const;
   INLINE_LINMATH FLOATNAME(LVector3) operator - () const;
 
 
   INLINE_LINMATH FLOATNAME(LVecBase3) operator + (const FLOATNAME(LVecBase3) &other) const;
   INLINE_LINMATH FLOATNAME(LVecBase3) operator + (const FLOATNAME(LVecBase3) &other) const;

+ 20 - 0
panda/src/linmath/lvector4_src.I

@@ -105,6 +105,26 @@ unit_w() {
   return (const FLOATNAME(LVector4) &)FLOATNAME(LVecBase4)::unit_w();
   return (const FLOATNAME(LVector4) &)FLOATNAME(LVecBase4)::unit_w();
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: LVector4::get_xyz
+//       Access: Published
+//  Description: Returns the x, y and z component of this vector
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector4)::
+get_xyz() const {
+  return FLOATNAME(LVector3)(_v(0), _v(1), _v(2));
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: LVector4::get_xy
+//       Access: Published
+//  Description: Returns the x and y component of this vector
+////////////////////////////////////////////////////////////////////
+INLINE_LINMATH FLOATNAME(LVector2) FLOATNAME(LVector4)::
+get_xy() const {
+  return FLOATNAME(LVector2)(_v(0), _v(1));
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: LVector4::unary -
 //     Function: LVector4::unary -
 //       Access: Public
 //       Access: Public

+ 6 - 0
panda/src/linmath/lvector4_src.h

@@ -33,6 +33,12 @@ PUBLISHED:
   INLINE_LINMATH static const FLOATNAME(LVector4) &unit_z();
   INLINE_LINMATH static const FLOATNAME(LVector4) &unit_z();
   INLINE_LINMATH static const FLOATNAME(LVector4) &unit_w();
   INLINE_LINMATH static const FLOATNAME(LVector4) &unit_w();
 
 
+  INLINE_LINMATH FLOATNAME(LVector3) get_xyz() const;
+  INLINE_LINMATH FLOATNAME(LVector2) get_xy() const;
+
+  MAKE_PROPERTY(xyz, get_xyz);
+  MAKE_PROPERTY(xy, get_xy);
+
   INLINE_LINMATH FLOATNAME(LVector4) operator - () const;
   INLINE_LINMATH FLOATNAME(LVector4) operator - () const;
 
 
   INLINE_LINMATH FLOATNAME(LVecBase4) operator + (const FLOATNAME(LVecBase4) &other) const;
   INLINE_LINMATH FLOATNAME(LVecBase4) operator + (const FLOATNAME(LVecBase4) &other) const;