OSDN Git Service

mesa: add bind_image_texture() helper
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 23 May 2017 21:45:48 +0000 (23:45 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 29 May 2017 08:11:41 +0000 (10:11 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/main/shaderimage.c

index ad9fdb0..19011d8 100644 (file)
@@ -586,13 +586,27 @@ set_image_binding(struct gl_image_unit *u, struct gl_texture_object *texObj,
    _mesa_reference_texobj(&u->TexObj, texObj);
 }
 
+static void
+bind_image_texture(struct gl_context *ctx, struct gl_texture_object *texObj,
+                   GLuint unit, GLint level, GLboolean layered, GLint layer,
+                   GLenum access, GLenum format)
+{
+   struct gl_image_unit *u;
+
+   u = &ctx->ImageUnits[unit];
+
+   FLUSH_VERTICES(ctx, 0);
+   ctx->NewDriverState |= ctx->DriverFlags.NewImageUnits;
+
+   set_image_binding(u, texObj, level, layered, layer, access, format);
+}
+
 void GLAPIENTRY
 _mesa_BindImageTexture(GLuint unit, GLuint texture, GLint level,
                        GLboolean layered, GLint layer, GLenum access,
                        GLenum format)
 {
    struct gl_texture_object *texObj = NULL;
-   struct gl_image_unit *u;
 
    GET_CURRENT_CONTEXT(ctx);
 
@@ -600,11 +614,6 @@ _mesa_BindImageTexture(GLuint unit, GLuint texture, GLint level,
                                     format))
       return;
 
-   u = &ctx->ImageUnits[unit];
-
-   FLUSH_VERTICES(ctx, 0);
-   ctx->NewDriverState |= ctx->DriverFlags.NewImageUnits;
-
    if (texture) {
       texObj = _mesa_lookup_texture(ctx, texture);
 
@@ -631,7 +640,7 @@ _mesa_BindImageTexture(GLuint unit, GLuint texture, GLint level,
       }
    }
 
-   set_image_binding(u, texObj, level, layered, layer, access, format);
+   bind_image_texture(ctx, texObj, unit, level, layered, layer, access, format);
 }
 
 void GLAPIENTRY