diff options
author | Samuel Pitoiset <[email protected]> | 2017-07-18 18:51:30 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-07-31 13:53:39 +0200 |
commit | 6fd8255c2a3a4edd8ed59e6e9249afabbd2b1754 (patch) | |
tree | c44a8d959d26172be7ee49753a03847d18585578 /src | |
parent | 18bd5d2c8c32897a0d549ea55a874a3832935f6f (diff) |
mesa: add bind_sampler() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/samplerobj.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index cdfd753a8b9..260cff6450a 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -295,27 +295,20 @@ _mesa_bind_sampler(struct gl_context *ctx, GLuint unit, sampObj); } -void GLAPIENTRY -_mesa_BindSampler(GLuint unit, GLuint sampler) +static ALWAYS_INLINE void +bind_sampler(struct gl_context *ctx, GLuint unit, GLuint sampler, bool no_error) { struct gl_sampler_object *sampObj; - GET_CURRENT_CONTEXT(ctx); - - if (unit >= ctx->Const.MaxCombinedTextureImageUnits) { - _mesa_error(ctx, GL_INVALID_VALUE, "glBindSampler(unit %u)", unit); - return; - } if (sampler == 0) { /* Use the default sampler object, the one contained in the texture * object. */ sampObj = NULL; - } - else { + } else { /* user-defined sampler object */ sampObj = _mesa_lookup_samplerobj(ctx, sampler); - if (!sampObj) { + if (!no_error && !sampObj) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindSampler(sampler)"); return; } @@ -325,6 +318,19 @@ _mesa_BindSampler(GLuint unit, GLuint sampler) _mesa_bind_sampler(ctx, unit, sampObj); } +void GLAPIENTRY +_mesa_BindSampler(GLuint unit, GLuint sampler) +{ + GET_CURRENT_CONTEXT(ctx); + + if (unit >= ctx->Const.MaxCombinedTextureImageUnits) { + _mesa_error(ctx, GL_INVALID_VALUE, "glBindSampler(unit %u)", unit); + return; + } + + bind_sampler(ctx, unit, sampler, false); +} + static ALWAYS_INLINE void bind_samplers(struct gl_context *ctx, GLuint first, GLsizei count, |