diff options
author | Samuel Pitoiset <[email protected]> | 2017-07-18 12:47:47 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-07-31 13:53:39 +0200 |
commit | 698ae2f0ef5929f00085fd0c7b81058bb5d3fc54 (patch) | |
tree | 500e0bb8f37137846051cdc80b85c67e4c21e66f /src/mesa/main/samplerobj.c | |
parent | 2af699a2c7bfcc93bbd15a32aaea24dccd7aee0f (diff) |
mesa: add bind_samplers() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main/samplerobj.c')
-rw-r--r-- | src/mesa/main/samplerobj.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index 74464410862..77496ed8499 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -326,25 +326,11 @@ _mesa_BindSampler(GLuint unit, GLuint sampler) } -void GLAPIENTRY -_mesa_BindSamplers(GLuint first, GLsizei count, const GLuint *samplers) +static ALWAYS_INLINE void +bind_samplers(struct gl_context *ctx, GLuint first, GLsizei count, + const GLuint *samplers, 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, - "glBindSamplers(first=%u + count=%d > the value of " - "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS=%u)", - first, count, ctx->Const.MaxCombinedTextureImageUnits); - return; - } + GLsizei i; FLUSH_VERTICES(ctx, 0); @@ -388,7 +374,7 @@ _mesa_BindSamplers(GLuint first, GLsizei count, const GLuint *samplers) * in <samplers> is not zero or the name of an existing * sampler object (per binding)." */ - if (!sampObj) { + if (!no_error && !sampObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindSamplers(samplers[%d]=%u is not zero or " "the name of an existing sampler object)", @@ -425,6 +411,29 @@ _mesa_BindSamplers(GLuint first, GLsizei count, const GLuint *samplers) } +void GLAPIENTRY +_mesa_BindSamplers(GLuint first, GLsizei count, const GLuint *samplers) +{ + 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, + "glBindSamplers(first=%u + count=%d > the value of " + "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS=%u)", + first, count, ctx->Const.MaxCombinedTextureImageUnits); + return; + } + + bind_samplers(ctx, first, count, samplers, false); +} + + /** * Check if a coordinate wrap mode is legal. * \return GL_TRUE if legal, GL_FALSE otherwise |