summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2017-07-21 11:03:09 +0200
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>2017-07-31 13:53:39 +0200
commit90f691b5be6ea8ac2d0d06e422a31519305059a0 (patch)
treea35d00c1ce5f90e3748e442fe55e53aa9da6a614 /src
parent9f1fab9533a84d35e7121ecc551b206af87f0f85 (diff)
mesa: add bind_textures() helper
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/texobj.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index bf48d7595d..aa3e4190f5 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1805,25 +1805,11 @@ _mesa_BindTextureUnit(GLuint unit, GLuint texture)
/**
* OpenGL 4.4 / GL_ARB_multi_bind glBindTextures().
*/
-void GLAPIENTRY
-_mesa_BindTextures(GLuint first, GLsizei count, const GLuint *textures)
+static ALWAYS_INLINE void
+bind_textures(struct gl_context *ctx, GLuint first, GLsizei count,
+ const GLuint *textures, bool no_error)
{
- GET_CURRENT_CONTEXT(ctx);
- GLint i;
-
- /* The ARB_multi_bind spec says:
- *
- * "An INVALID_OPERATION error is generated if <first> + <count>
- * is greater than the number of texture image units supported
- * by the implementation."
- */
- if (first + count > ctx->Const.MaxCombinedTextureImageUnits) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glBindTextures(first=%u + count=%d > the value of "
- "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS=%u)",
- first, count, ctx->Const.MaxCombinedTextureImageUnits);
- return;
- }
+ GLsizei i;
if (textures) {
/* Note that the error semantics for multi-bind commands differ from
@@ -1860,7 +1846,7 @@ _mesa_BindTextures(GLuint first, GLsizei count, const GLuint *textures)
if (texObj && texObj->Target != 0) {
bind_texture_object(ctx, first + i, texObj);
- } else {
+ } else if (!no_error) {
/* The ARB_multi_bind spec says:
*
* "An INVALID_OPERATION error is generated if any value
@@ -1886,6 +1872,29 @@ _mesa_BindTextures(GLuint first, GLsizei count, const GLuint *textures)
}
+void GLAPIENTRY
+_mesa_BindTextures(GLuint first, GLsizei count, const GLuint *textures)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ /* The ARB_multi_bind spec says:
+ *
+ * "An INVALID_OPERATION error is generated if <first> + <count>
+ * is greater than the number of texture image units supported
+ * by the implementation."
+ */
+ if (first + count > ctx->Const.MaxCombinedTextureImageUnits) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBindTextures(first=%u + count=%d > the value of "
+ "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS=%u)",
+ first, count, ctx->Const.MaxCombinedTextureImageUnits);
+ return;
+ }
+
+ bind_textures(ctx, first, count, textures, false);
+}
+
+
/**
* Set texture priorities.
*