Browse Source

glgsg: Fix texture format selection when using `T_half_float` component type

rdb 3 years ago
parent
commit
c325eabb9d
1 changed files with 11 additions and 5 deletions
  1. 11 5
      panda/src/glstuff/glGraphicsStateGuardian_src.cxx

+ 11 - 5
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -10249,7 +10249,8 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
   case Texture::F_rgba:
   case Texture::F_rgba:
   case Texture::F_rgbm:
   case Texture::F_rgbm:
 #ifndef OPENGLES_1
 #ifndef OPENGLES_1
-    if (component_type == Texture::T_float) {
+    if (component_type == Texture::T_float ||
+        component_type == Texture::T_half_float) {
       return GL_RGBA16F;
       return GL_RGBA16F;
     } else
     } else
 #endif
 #endif
@@ -10315,7 +10316,8 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
 #endif  // OPENGLES
 #endif  // OPENGLES
 #ifndef OPENGLES
 #ifndef OPENGLES
   case Texture::F_rgba16:
   case Texture::F_rgba16:
-    if (component_type == Texture::T_float) {
+    if (component_type == Texture::T_float ||
+        component_type == Texture::T_half_float) {
       return GL_RGBA16F;
       return GL_RGBA16F;
     } else if (Texture::is_unsigned(component_type)) {
     } else if (Texture::is_unsigned(component_type)) {
       return GL_RGBA16;
       return GL_RGBA16;
@@ -10335,6 +10337,7 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
   case Texture::F_rgb:
   case Texture::F_rgb:
     switch (component_type) {
     switch (component_type) {
     case Texture::T_float: return GL_RGB16F;
     case Texture::T_float: return GL_RGB16F;
+    case Texture::T_half_float: return GL_RGB16F;
 #ifndef OPENGLES
 #ifndef OPENGLES
     case Texture::T_unsigned_short: return GL_RGB16;
     case Texture::T_unsigned_short: return GL_RGB16;
     case Texture::T_short: return GL_RGB16_SNORM;
     case Texture::T_short: return GL_RGB16_SNORM;
@@ -10371,7 +10374,8 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
   case Texture::F_rgb12:
   case Texture::F_rgb12:
     return GL_RGB12;
     return GL_RGB12;
   case Texture::F_rgb16:
   case Texture::F_rgb16:
-    if (component_type == Texture::T_float) {
+    if (component_type == Texture::T_float ||
+        component_type == Texture::T_half_float) {
       return GL_RGB16F;
       return GL_RGB16F;
     } else if (Texture::is_unsigned(component_type)) {
     } else if (Texture::is_unsigned(component_type)) {
       return GL_RGB16;
       return GL_RGB16;
@@ -10394,7 +10398,8 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
     return GL_RG16F_EXT;
     return GL_RG16F_EXT;
 #elif !defined(OPENGLES_1)
 #elif !defined(OPENGLES_1)
   case Texture::F_r16:
   case Texture::F_r16:
-    if (component_type == Texture::T_float) {
+    if (component_type == Texture::T_float ||
+        component_type == Texture::T_half_float) {
       return GL_R16F;
       return GL_R16F;
     } else if (Texture::is_unsigned(component_type)) {
     } else if (Texture::is_unsigned(component_type)) {
       return GL_R16;
       return GL_R16;
@@ -10402,7 +10407,8 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
       return GL_R16_SNORM;
       return GL_R16_SNORM;
     }
     }
   case Texture::F_rg16:
   case Texture::F_rg16:
-    if (component_type == Texture::T_float) {
+    if (component_type == Texture::T_float ||
+        component_type == Texture::T_half_float) {
       return GL_RG16F;
       return GL_RG16F;
     } else if (Texture::is_unsigned(component_type)) {
     } else if (Texture::is_unsigned(component_type)) {
       return GL_RG16;
       return GL_RG16;