gallium/osmesa: Move 565 format selection checks where the rest are.
authorEric Anholt <eric@anholt.net>
Wed, 3 Jul 2019 19:04:26 +0000 (12:04 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 4 Sep 2019 23:43:36 +0000 (16:43 -0700)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/gallium/state_trackers/osmesa/osmesa.c

index 8854987496609cdb9b1aa71085aa62cfc0ec347a..4660a53bfd23c18408abac8caa8d48612e8fd66d 100644 (file)
@@ -266,6 +266,8 @@ osmesa_choose_format(GLenum format, GLenum type)
       /* No gallium format for this one */
       return PIPE_FORMAT_NONE;
    case OSMESA_RGB_565:
+      if (type != GL_UNSIGNED_SHORT_5_6_5)
+         return PIPE_FORMAT_NONE;
       return PIPE_FORMAT_B5G6R5_UNORM;
    default:
       ; /* fall-through */
@@ -772,10 +774,6 @@ OSMesaMakeCurrent(OSMesaContext osmesa, void *buffer, GLenum type,
       return GL_FALSE;
    }
 
-   if (osmesa->format == OSMESA_RGB_565 && type != GL_UNSIGNED_SHORT_5_6_5) {
-      return GL_FALSE;
-   }
-
    color_format = osmesa_choose_format(osmesa->format, type);
    if (color_format == PIPE_FORMAT_NONE) {
       fprintf(stderr, "OSMesaMakeCurrent(unsupported format/type)\n");