From 5fe83f4286767318a6ff73aa43bfc0bc05af7978 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 21 Nov 2020 14:19:22 +0100 Subject: [PATCH 1/4] makepanda: Don't fail building installer if models dir is empty --- makepanda/installer.nsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makepanda/installer.nsi b/makepanda/installer.nsi index f800fa222c..83b5182b5f 100644 --- a/makepanda/installer.nsi +++ b/makepanda/installer.nsi @@ -253,7 +253,7 @@ SectionGroup "Panda3D Libraries" SetDetailsPrint listonly SetOutPath $INSTDIR\models - File /r /x CVS "${BUILT}\models\*" + File /nonfatal /r /x CVS "${BUILT}\models\*" SetDetailsPrint both DetailPrint "Installing optional components..." From d1e8554fdee15cae47fee5b45b9f1e972496633d Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 21 Nov 2020 14:19:52 +0100 Subject: [PATCH 2/4] glgsg: Fix error message if vtx_normal is declred as float4 in Cg --- panda/src/glstuff/glCgShaderContext_src.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/glstuff/glCgShaderContext_src.cxx b/panda/src/glstuff/glCgShaderContext_src.cxx index 8d90d1cd50..1691d10ca7 100644 --- a/panda/src/glstuff/glCgShaderContext_src.cxx +++ b/panda/src/glstuff/glCgShaderContext_src.cxx @@ -166,7 +166,7 @@ CLP(CgShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderConte if (cgGetParameterSemantic(p)) { GLCAT.error(false) << " : " << cgGetParameterSemantic(p); } - GLCAT.error(false) << " should be declared as float4, not float3!\n"; + GLCAT.error(false) << " should be declared as float3, not float4!\n"; } break; case 3: // gl_Color From b12fcec0997a176db656c33c051ca05843bc59ef Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 21 Nov 2020 14:20:45 +0100 Subject: [PATCH 3/4] glgsg: Fix handling of sized rgba formats in OpenGL ES --- .../glstuff/glGraphicsStateGuardian_src.cxx | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index dd3e2e25b4..bb2dfdc6fb 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -9555,15 +9555,22 @@ get_external_image_format(Texture *tex) const { case Texture::F_rgba: case Texture::F_rgbm: - case Texture::F_rgba4: - case Texture::F_rgba5: case Texture::F_rgba8: case Texture::F_rgba12: + return _supports_bgr ? GL_BGRA : GL_RGBA; + + case Texture::F_rgba4: + case Texture::F_rgba5: case Texture::F_rgba16: case Texture::F_rgba32: case Texture::F_srgb_alpha: case Texture::F_rgb10_a2: +#ifdef OPENGLES + // OpenGL ES doesn't have sized BGRA formats. + return GL_RGBA; +#else return _supports_bgr ? GL_BGRA : GL_RGBA; +#endif case Texture::F_luminance: #ifdef OPENGLES @@ -10084,9 +10091,9 @@ get_internal_image_format(Texture *tex, bool force_sized) const { #ifdef OPENGLES case Texture::F_rgba8: - return GL_RGBA8_OES; + return _supports_bgr ? GL_BGRA : GL_RGBA8_OES; case Texture::F_rgba12: - return force_sized ? GL_RGBA8 : GL_RGBA; + return _supports_bgr ? GL_BGRA : (force_sized ? GL_RGBA8 : GL_RGBA); #else case Texture::F_rgba8: if (Texture::is_unsigned(tex->get_component_type())) { @@ -13564,7 +13571,11 @@ upload_simple_texture(CLP(TextureContext) *gtc) { Texture *tex = gtc->get_texture(); nassertr(tex != nullptr, false); +#ifdef OPENGLES + GLenum internal_format = GL_BGRA; +#else GLenum internal_format = GL_RGBA; +#endif GLenum external_format = GL_BGRA; const unsigned char *image_ptr = tex->get_simple_ram_image(); @@ -13578,6 +13589,9 @@ upload_simple_texture(CLP(TextureContext) *gtc) { // If the GL doesn't claim to support BGR, we may have to reverse the // component ordering of the image. external_format = GL_RGBA; +#ifdef OPENGLES + internal_format = GL_RGBA; +#endif image_ptr = fix_component_ordering(bgr_image, image_ptr, image_size, external_format, tex); } From 61a089ad59082dba51e946bb8d268002ac42bf7a Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 22 Nov 2020 14:23:46 +0100 Subject: [PATCH 4/4] ShaderGenerator: don't output unused attr_ambient input variable --- panda/src/pgraphnodes/shaderGenerator.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/panda/src/pgraphnodes/shaderGenerator.cxx b/panda/src/pgraphnodes/shaderGenerator.cxx index f0e14baa06..6c9b9b8a03 100644 --- a/panda/src/pgraphnodes/shaderGenerator.cxx +++ b/panda/src/pgraphnodes/shaderGenerator.cxx @@ -1094,7 +1094,9 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) { text << "\t uniform float4 clipplane_" << i << ",\n"; } - text << "\t uniform float4 attr_ambient,\n"; + if (key._lighting) { + text << "\t uniform float4 attr_ambient,\n"; + } text << "\t uniform float4 attr_colorscale\n"; text << ") {\n";