samplerobj.h revision 848b8605
1848b8605Smrg/* 2848b8605Smrg * Mesa 3-D graphics library 3848b8605Smrg * 4848b8605Smrg * Copyright (C) 2011 VMware, Inc. All Rights Reserved. 5848b8605Smrg * 6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 7848b8605Smrg * copy of this software and associated documentation files (the "Software"), 8848b8605Smrg * to deal in the Software without restriction, including without limitation 9848b8605Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10848b8605Smrg * and/or sell copies of the Software, and to permit persons to whom the 11848b8605Smrg * Software is furnished to do so, subject to the following conditions: 12848b8605Smrg * 13848b8605Smrg * The above copyright notice and this permission notice shall be included 14848b8605Smrg * in all copies or substantial portions of the Software. 15848b8605Smrg * 16848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18848b8605Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19848b8605Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20848b8605Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21848b8605Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22848b8605Smrg * OTHER DEALINGS IN THE SOFTWARE. 23848b8605Smrg */ 24848b8605Smrg 25848b8605Smrg 26848b8605Smrg 27848b8605Smrg#ifndef SAMPLEROBJ_H 28848b8605Smrg#define SAMPLEROBJ_H 29848b8605Smrg 30848b8605Smrgstruct dd_function_table; 31848b8605Smrg 32848b8605Smrgstatic inline struct gl_sampler_object * 33848b8605Smrg_mesa_get_samplerobj(struct gl_context *ctx, GLuint unit) 34848b8605Smrg{ 35848b8605Smrg if (ctx->Texture.Unit[unit].Sampler) 36848b8605Smrg return ctx->Texture.Unit[unit].Sampler; 37848b8605Smrg else if (ctx->Texture.Unit[unit]._Current) 38848b8605Smrg return &ctx->Texture.Unit[unit]._Current->Sampler; 39848b8605Smrg else 40848b8605Smrg return NULL; 41848b8605Smrg} 42848b8605Smrg 43848b8605Smrg 44848b8605Smrg/** Does the given filter state do mipmap filtering? */ 45848b8605Smrgstatic inline GLboolean 46848b8605Smrg_mesa_is_mipmap_filter(const struct gl_sampler_object *samp) 47848b8605Smrg{ 48848b8605Smrg return samp->MinFilter != GL_NEAREST && samp->MinFilter != GL_LINEAR; 49848b8605Smrg} 50848b8605Smrg 51848b8605Smrg 52848b8605Smrgextern void 53848b8605Smrg_mesa_reference_sampler_object_(struct gl_context *ctx, 54848b8605Smrg struct gl_sampler_object **ptr, 55848b8605Smrg struct gl_sampler_object *samp); 56848b8605Smrg 57848b8605Smrgstatic inline void 58848b8605Smrg_mesa_reference_sampler_object(struct gl_context *ctx, 59848b8605Smrg struct gl_sampler_object **ptr, 60848b8605Smrg struct gl_sampler_object *samp) 61848b8605Smrg{ 62848b8605Smrg if (*ptr != samp) 63848b8605Smrg _mesa_reference_sampler_object_(ctx, ptr, samp); 64848b8605Smrg} 65848b8605Smrg 66848b8605Smrgextern struct gl_sampler_object * 67848b8605Smrg_mesa_lookup_samplerobj(struct gl_context *ctx, GLuint name); 68848b8605Smrg 69848b8605Smrgextern struct gl_sampler_object * 70848b8605Smrg_mesa_new_sampler_object(struct gl_context *ctx, GLuint name); 71848b8605Smrg 72848b8605Smrgextern void 73848b8605Smrg_mesa_init_sampler_object_functions(struct dd_function_table *driver); 74848b8605Smrg 75848b8605Smrgvoid GLAPIENTRY 76848b8605Smrg_mesa_GenSamplers(GLsizei count, GLuint *samplers); 77848b8605Smrgvoid GLAPIENTRY 78848b8605Smrg_mesa_DeleteSamplers(GLsizei count, const GLuint *samplers); 79848b8605SmrgGLboolean GLAPIENTRY 80848b8605Smrg_mesa_IsSampler(GLuint sampler); 81848b8605Smrgvoid GLAPIENTRY 82848b8605Smrg_mesa_BindSampler(GLuint unit, GLuint sampler); 83848b8605Smrgvoid GLAPIENTRY 84848b8605Smrg_mesa_BindSamplers(GLuint first, GLsizei count, const GLuint *samplers); 85848b8605Smrgvoid GLAPIENTRY 86848b8605Smrg_mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param); 87848b8605Smrgvoid GLAPIENTRY 88848b8605Smrg_mesa_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param); 89848b8605Smrgvoid GLAPIENTRY 90848b8605Smrg_mesa_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params); 91848b8605Smrgvoid GLAPIENTRY 92848b8605Smrg_mesa_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params); 93848b8605Smrgvoid GLAPIENTRY 94848b8605Smrg_mesa_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params); 95848b8605Smrgvoid GLAPIENTRY 96848b8605Smrg_mesa_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params); 97848b8605Smrgvoid GLAPIENTRY 98848b8605Smrg_mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params); 99848b8605Smrgvoid GLAPIENTRY 100848b8605Smrg_mesa_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params); 101848b8605Smrgvoid GLAPIENTRY 102848b8605Smrg_mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params); 103848b8605Smrgvoid GLAPIENTRY 104848b8605Smrg_mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params); 105848b8605Smrg 106848b8605Smrg#endif /* SAMPLEROBJ_H */ 107