glgsg: Fix texture format selection when using T_half_float component type

This commit is contained in:
rdb 2022-06-29 15:15:02 +02:00
parent 9ab460c900
commit c325eabb9d

View File

@ -10249,7 +10249,8 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
case Texture::F_rgba:
case Texture::F_rgbm:
#ifndef OPENGLES_1
if (component_type == Texture::T_float) {
if (component_type == Texture::T_float ||
component_type == Texture::T_half_float) {
return GL_RGBA16F;
} else
#endif
@ -10315,7 +10316,8 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
#endif // OPENGLES
#ifndef OPENGLES
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;
} else if (Texture::is_unsigned(component_type)) {
return GL_RGBA16;
@ -10335,6 +10337,7 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
case Texture::F_rgb:
switch (component_type) {
case Texture::T_float: return GL_RGB16F;
case Texture::T_half_float: return GL_RGB16F;
#ifndef OPENGLES
case Texture::T_unsigned_short: return GL_RGB16;
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:
return GL_RGB12;
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;
} else if (Texture::is_unsigned(component_type)) {
return GL_RGB16;
@ -10394,7 +10398,8 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
return GL_RG16F_EXT;
#elif !defined(OPENGLES_1)
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;
} else if (Texture::is_unsigned(component_type)) {
return GL_R16;
@ -10402,7 +10407,8 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
return GL_R16_SNORM;
}
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;
} else if (Texture::is_unsigned(component_type)) {
return GL_RG16;