summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2016-01-13 01:20:09 -0800
committerIan Romanick <[email protected]>2018-01-02 16:23:50 -0800
commit594d02892e794b585df31ee75d5c1e2a0e312c25 (patch)
treed30770549fbcce6442618eae39ed95b85ca58b6e /src/mesa
parente6cef4b0818d014e140f3b17e8603c384066bcf8 (diff)
mesa: Add _mesa_bind_texture method
Light-weight glBindTexture for internal use. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/texobj.c24
-rw-r--r--src/mesa/main/texobj.h4
2 files changed, 26 insertions, 2 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index db405988239..5dc5cb8e1a9 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1692,6 +1692,29 @@ bind_texture_object(struct gl_context *ctx, unsigned unit,
}
}
+/**
+ * Light-weight bind texture for internal users
+ *
+ * This is really just \c finish_texture_init plus \c bind_texture_object.
+ * This is intended to be used by internal Mesa functions that use
+ * \c _mesa_CreateTexture and need to bind textures (e.g., meta).
+ */
+void
+_mesa_bind_texture(struct gl_context *ctx, GLenum target,
+ struct gl_texture_object *tex_obj)
+{
+ const GLint targetIndex = _mesa_tex_target_to_index(ctx, target);
+
+ assert(targetIndex >= 0 && targetIndex < NUM_TEXTURE_TARGETS);
+
+ if (tex_obj->Target == 0)
+ finish_texture_init(ctx, target, tex_obj, targetIndex);
+
+ assert(tex_obj->Target == target);
+ assert(tex_obj->TargetIndex == targetIndex);
+
+ bind_texture_object(ctx, ctx->Texture.CurrentUnit, tex_obj);
+}
/**
* Implement glBindTexture(). Do error checking, look-up or create a new
@@ -1764,7 +1787,6 @@ bind_texture(struct gl_context *ctx, GLenum target, GLuint texName,
bind_texture_object(ctx, ctx->Texture.CurrentUnit, newTexObj);
}
-
void GLAPIENTRY
_mesa_BindTexture_no_error(GLenum target, GLuint texName)
{
diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h
index 8dea85303d6..f2d78aca0dc 100644
--- a/src/mesa/main/texobj.h
+++ b/src/mesa/main/texobj.h
@@ -175,7 +175,9 @@ extern void
_mesa_delete_nameless_texture(struct gl_context *ctx,
struct gl_texture_object *texObj);
-
+extern void
+_mesa_bind_texture(struct gl_context *ctx, GLenum target,
+ struct gl_texture_object *tex_obj);
/*@}*/
/**