2 * Mesa 3-D graphics library
4 * Copyright (C) 2011 VMware, Inc. All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
28 * \brief Functions for the GL_ARB_sampler_objects extension.
33 #include "main/glheader.h"
34 #include "main/context.h"
35 #include "main/dispatch.h"
36 #include "main/enums.h"
37 #include "main/hash.h"
38 #include "main/macros.h"
39 #include "main/mtypes.h"
40 #include "main/samplerobj.h"
43 struct gl_sampler_object
*
44 _mesa_lookup_samplerobj(struct gl_context
*ctx
, GLuint name
)
49 return (struct gl_sampler_object
*)
50 _mesa_HashLookup(ctx
->Shared
->SamplerObjects
, name
);
53 static inline struct gl_sampler_object
*
54 lookup_samplerobj_locked(struct gl_context
*ctx
, GLuint name
)
56 return (struct gl_sampler_object
*)
57 _mesa_HashLookupLocked(ctx
->Shared
->SamplerObjects
, name
);
61 delete_sampler_object(struct gl_context
*ctx
,
62 struct gl_sampler_object
*sampObj
)
64 mtx_destroy(&sampObj
->Mutex
);
70 * Handle reference counting.
73 _mesa_reference_sampler_object_(struct gl_context
*ctx
,
74 struct gl_sampler_object
**ptr
,
75 struct gl_sampler_object
*samp
)
77 assert(*ptr
!= samp
); /* The inline wrapper should prevent no-op calls */
80 /* Unreference the old sampler */
81 GLboolean deleteFlag
= GL_FALSE
;
82 struct gl_sampler_object
*oldSamp
= *ptr
;
84 mtx_lock(&oldSamp
->Mutex
);
85 assert(oldSamp
->RefCount
> 0);
87 deleteFlag
= (oldSamp
->RefCount
== 0);
88 mtx_unlock(&oldSamp
->Mutex
);
91 delete_sampler_object(ctx
, oldSamp
);
98 /* reference new sampler */
99 mtx_lock(&samp
->Mutex
);
100 assert(samp
->RefCount
> 0);
104 mtx_unlock(&samp
->Mutex
);
110 * Initialize the fields of the given sampler object.
113 _mesa_init_sampler_object(struct gl_sampler_object
*sampObj
, GLuint name
)
115 mtx_init(&sampObj
->Mutex
, mtx_plain
);
116 sampObj
->Name
= name
;
117 sampObj
->RefCount
= 1;
118 sampObj
->WrapS
= GL_REPEAT
;
119 sampObj
->WrapT
= GL_REPEAT
;
120 sampObj
->WrapR
= GL_REPEAT
;
121 sampObj
->MinFilter
= GL_NEAREST_MIPMAP_LINEAR
;
122 sampObj
->MagFilter
= GL_LINEAR
;
123 sampObj
->BorderColor
.f
[0] = 0.0;
124 sampObj
->BorderColor
.f
[1] = 0.0;
125 sampObj
->BorderColor
.f
[2] = 0.0;
126 sampObj
->BorderColor
.f
[3] = 0.0;
127 sampObj
->MinLod
= -1000.0F
;
128 sampObj
->MaxLod
= 1000.0F
;
129 sampObj
->LodBias
= 0.0F
;
130 sampObj
->MaxAnisotropy
= 1.0F
;
131 sampObj
->CompareMode
= GL_NONE
;
132 sampObj
->CompareFunc
= GL_LEQUAL
;
133 sampObj
->sRGBDecode
= GL_DECODE_EXT
;
134 sampObj
->CubeMapSeamless
= GL_FALSE
;
138 * Fallback for ctx->Driver.NewSamplerObject();
140 struct gl_sampler_object
*
141 _mesa_new_sampler_object(struct gl_context
*ctx
, GLuint name
)
143 struct gl_sampler_object
*sampObj
= CALLOC_STRUCT(gl_sampler_object
);
145 _mesa_init_sampler_object(sampObj
, name
);
151 create_samplers(struct gl_context
*ctx
, GLsizei count
, GLuint
*samplers
,
157 if (MESA_VERBOSE
& VERBOSE_API
)
158 _mesa_debug(ctx
, "%s(%d)\n", caller
, count
);
161 _mesa_error(ctx
, GL_INVALID_VALUE
, "%s(n<0)", caller
);
168 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
170 first
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->SamplerObjects
, count
);
172 /* Insert the ID and pointer to new sampler object into hash table */
173 for (i
= 0; i
< count
; i
++) {
174 struct gl_sampler_object
*sampObj
=
175 ctx
->Driver
.NewSamplerObject(ctx
, first
+ i
);
176 _mesa_HashInsertLocked(ctx
->Shared
->SamplerObjects
, first
+ i
, sampObj
);
177 samplers
[i
] = first
+ i
;
180 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
184 _mesa_GenSamplers(GLsizei count
, GLuint
*samplers
)
186 GET_CURRENT_CONTEXT(ctx
);
187 create_samplers(ctx
, count
, samplers
, "glGenSamplers");
191 _mesa_CreateSamplers(GLsizei count
, GLuint
*samplers
)
193 GET_CURRENT_CONTEXT(ctx
);
194 create_samplers(ctx
, count
, samplers
, "glCreateSamplers");
199 _mesa_DeleteSamplers(GLsizei count
, const GLuint
*samplers
)
201 GET_CURRENT_CONTEXT(ctx
);
204 FLUSH_VERTICES(ctx
, 0);
207 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteSamplers(count)");
211 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
213 for (i
= 0; i
< count
; i
++) {
216 struct gl_sampler_object
*sampObj
=
217 lookup_samplerobj_locked(ctx
, samplers
[i
]);
220 /* If the sampler is currently bound, unbind it. */
221 for (j
= 0; j
< ctx
->Const
.MaxCombinedTextureImageUnits
; j
++) {
222 if (ctx
->Texture
.Unit
[j
].Sampler
== sampObj
) {
223 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
224 _mesa_reference_sampler_object(ctx
, &ctx
->Texture
.Unit
[j
].Sampler
, NULL
);
228 /* The ID is immediately freed for re-use */
229 _mesa_HashRemoveLocked(ctx
->Shared
->SamplerObjects
, samplers
[i
]);
230 /* But the object exists until its reference count goes to zero */
231 _mesa_reference_sampler_object(ctx
, &sampObj
, NULL
);
236 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
241 _mesa_IsSampler(GLuint sampler
)
243 GET_CURRENT_CONTEXT(ctx
);
245 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
247 return _mesa_lookup_samplerobj(ctx
, sampler
) != NULL
;
251 _mesa_bind_sampler(struct gl_context
*ctx
, GLuint unit
,
252 struct gl_sampler_object
*sampObj
)
254 if (ctx
->Texture
.Unit
[unit
].Sampler
!= sampObj
) {
255 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
258 _mesa_reference_sampler_object(ctx
, &ctx
->Texture
.Unit
[unit
].Sampler
,
263 _mesa_BindSampler(GLuint unit
, GLuint sampler
)
265 struct gl_sampler_object
*sampObj
;
266 GET_CURRENT_CONTEXT(ctx
);
268 if (unit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
269 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindSampler(unit %u)", unit
);
274 /* Use the default sampler object, the one contained in the texture
280 /* user-defined sampler object */
281 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
283 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glBindSampler(sampler)");
288 /* bind new sampler */
289 _mesa_bind_sampler(ctx
, unit
, sampObj
);
294 _mesa_BindSamplers(GLuint first
, GLsizei count
, const GLuint
*samplers
)
296 GET_CURRENT_CONTEXT(ctx
);
299 /* The ARB_multi_bind spec says:
301 * "An INVALID_OPERATION error is generated if <first> + <count> is
302 * greater than the number of texture image units supported by
303 * the implementation."
305 if (first
+ count
> ctx
->Const
.MaxCombinedTextureImageUnits
) {
306 _mesa_error(ctx
, GL_INVALID_OPERATION
,
307 "glBindSamplers(first=%u + count=%d > the value of "
308 "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS=%u)",
309 first
, count
, ctx
->Const
.MaxCombinedTextureImageUnits
);
313 FLUSH_VERTICES(ctx
, 0);
316 /* Note that the error semantics for multi-bind commands differ from
317 * those of other GL commands.
319 * The Issues section in the ARB_multi_bind spec says:
321 * "(11) Typically, OpenGL specifies that if an error is generated by
322 * a command, that command has no effect. This is somewhat
323 * unfortunate for multi-bind commands, because it would require
324 * a first pass to scan the entire list of bound objects for
325 * errors and then a second pass to actually perform the
326 * bindings. Should we have different error semantics?
328 * RESOLVED: Yes. In this specification, when the parameters for
329 * one of the <count> binding points are invalid, that binding
330 * point is not updated and an error will be generated. However,
331 * other binding points in the same command will be updated if
332 * their parameters are valid and no other error occurs."
335 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
337 for (i
= 0; i
< count
; i
++) {
338 const GLuint unit
= first
+ i
;
339 struct gl_sampler_object
* const currentSampler
=
340 ctx
->Texture
.Unit
[unit
].Sampler
;
341 struct gl_sampler_object
*sampObj
;
343 if (samplers
[i
] != 0) {
344 if (currentSampler
&& currentSampler
->Name
== samplers
[i
])
345 sampObj
= currentSampler
;
347 sampObj
= lookup_samplerobj_locked(ctx
, samplers
[i
]);
349 /* The ARB_multi_bind spec says:
351 * "An INVALID_OPERATION error is generated if any value
352 * in <samplers> is not zero or the name of an existing
353 * sampler object (per binding)."
356 _mesa_error(ctx
, GL_INVALID_OPERATION
,
357 "glBindSamplers(samplers[%d]=%u is not zero or "
358 "the name of an existing sampler object)",
366 /* Bind the new sampler */
367 if (sampObj
!= currentSampler
) {
368 _mesa_reference_sampler_object(ctx
,
369 &ctx
->Texture
.Unit
[unit
].Sampler
,
371 ctx
->NewState
|= _NEW_TEXTURE_OBJECT
;
375 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
377 /* Unbind all samplers in the range <first> through <first>+<count>-1 */
378 for (i
= 0; i
< count
; i
++) {
379 const GLuint unit
= first
+ i
;
381 if (ctx
->Texture
.Unit
[unit
].Sampler
) {
382 _mesa_reference_sampler_object(ctx
,
383 &ctx
->Texture
.Unit
[unit
].Sampler
,
385 ctx
->NewState
|= _NEW_TEXTURE_OBJECT
;
393 * Check if a coordinate wrap mode is legal.
394 * \return GL_TRUE if legal, GL_FALSE otherwise
397 validate_texture_wrap_mode(struct gl_context
*ctx
, GLenum wrap
)
399 const struct gl_extensions
* const e
= &ctx
->Extensions
;
403 case GL_CLAMP_TO_EDGE
:
405 case GL_MIRRORED_REPEAT
:
407 case GL_CLAMP_TO_BORDER
:
408 return e
->ARB_texture_border_clamp
;
409 case GL_MIRROR_CLAMP_EXT
:
410 return e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
;
411 case GL_MIRROR_CLAMP_TO_EDGE_EXT
:
412 return e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
|| e
->ARB_texture_mirror_clamp_to_edge
;
413 case GL_MIRROR_CLAMP_TO_BORDER_EXT
:
414 return e
->EXT_texture_mirror_clamp
;
422 * This is called just prior to changing any sampler object state.
425 flush(struct gl_context
*ctx
)
427 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
431 _mesa_set_sampler_wrap(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
432 GLenum s
, GLenum t
, GLenum r
)
434 assert(validate_texture_wrap_mode(ctx
, s
));
435 assert(validate_texture_wrap_mode(ctx
, t
));
436 assert(validate_texture_wrap_mode(ctx
, r
));
438 if (samp
->WrapS
== s
&& samp
->WrapT
== t
&& samp
->WrapR
== r
)
447 #define INVALID_PARAM 0x100
448 #define INVALID_PNAME 0x101
449 #define INVALID_VALUE 0x102
452 set_sampler_wrap_s(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
455 if (samp
->WrapS
== param
)
457 if (validate_texture_wrap_mode(ctx
, param
)) {
462 return INVALID_PARAM
;
467 set_sampler_wrap_t(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
470 if (samp
->WrapT
== param
)
472 if (validate_texture_wrap_mode(ctx
, param
)) {
477 return INVALID_PARAM
;
482 set_sampler_wrap_r(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
485 if (samp
->WrapR
== param
)
487 if (validate_texture_wrap_mode(ctx
, param
)) {
492 return INVALID_PARAM
;
496 _mesa_set_sampler_filters(struct gl_context
*ctx
,
497 struct gl_sampler_object
*samp
,
498 GLenum min_filter
, GLenum mag_filter
)
500 assert(min_filter
== GL_NEAREST
||
501 min_filter
== GL_LINEAR
||
502 min_filter
== GL_NEAREST_MIPMAP_NEAREST
||
503 min_filter
== GL_LINEAR_MIPMAP_NEAREST
||
504 min_filter
== GL_NEAREST_MIPMAP_LINEAR
||
505 min_filter
== GL_LINEAR_MIPMAP_LINEAR
);
506 assert(mag_filter
== GL_NEAREST
||
507 mag_filter
== GL_LINEAR
);
509 if (samp
->MinFilter
== min_filter
&& samp
->MagFilter
== mag_filter
)
513 samp
->MinFilter
= min_filter
;
514 samp
->MagFilter
= mag_filter
;
518 set_sampler_min_filter(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
521 if (samp
->MinFilter
== param
)
527 case GL_NEAREST_MIPMAP_NEAREST
:
528 case GL_LINEAR_MIPMAP_NEAREST
:
529 case GL_NEAREST_MIPMAP_LINEAR
:
530 case GL_LINEAR_MIPMAP_LINEAR
:
532 samp
->MinFilter
= param
;
535 return INVALID_PARAM
;
541 set_sampler_mag_filter(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
544 if (samp
->MagFilter
== param
)
551 samp
->MagFilter
= param
;
554 return INVALID_PARAM
;
560 set_sampler_lod_bias(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
563 if (samp
->LodBias
== param
)
567 samp
->LodBias
= param
;
573 set_sampler_border_colorf(struct gl_context
*ctx
,
574 struct gl_sampler_object
*samp
,
575 const GLfloat params
[4])
578 samp
->BorderColor
.f
[RCOMP
] = params
[0];
579 samp
->BorderColor
.f
[GCOMP
] = params
[1];
580 samp
->BorderColor
.f
[BCOMP
] = params
[2];
581 samp
->BorderColor
.f
[ACOMP
] = params
[3];
587 set_sampler_border_colori(struct gl_context
*ctx
,
588 struct gl_sampler_object
*samp
,
589 const GLint params
[4])
592 samp
->BorderColor
.i
[RCOMP
] = params
[0];
593 samp
->BorderColor
.i
[GCOMP
] = params
[1];
594 samp
->BorderColor
.i
[BCOMP
] = params
[2];
595 samp
->BorderColor
.i
[ACOMP
] = params
[3];
601 set_sampler_border_colorui(struct gl_context
*ctx
,
602 struct gl_sampler_object
*samp
,
603 const GLuint params
[4])
606 samp
->BorderColor
.ui
[RCOMP
] = params
[0];
607 samp
->BorderColor
.ui
[GCOMP
] = params
[1];
608 samp
->BorderColor
.ui
[BCOMP
] = params
[2];
609 samp
->BorderColor
.ui
[ACOMP
] = params
[3];
615 set_sampler_min_lod(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
618 if (samp
->MinLod
== param
)
622 samp
->MinLod
= param
;
628 set_sampler_max_lod(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
631 if (samp
->MaxLod
== param
)
635 samp
->MaxLod
= param
;
641 set_sampler_compare_mode(struct gl_context
*ctx
,
642 struct gl_sampler_object
*samp
, GLint param
)
644 /* If GL_ARB_shadow is not supported, don't report an error. The
645 * sampler object extension spec isn't clear on this extension interaction.
646 * Silences errors with Wine on older GPUs such as R200.
648 if (!ctx
->Extensions
.ARB_shadow
)
651 if (samp
->CompareMode
== param
)
654 if (param
== GL_NONE
||
655 param
== GL_COMPARE_R_TO_TEXTURE_ARB
) {
657 samp
->CompareMode
= param
;
661 return INVALID_PARAM
;
666 set_sampler_compare_func(struct gl_context
*ctx
,
667 struct gl_sampler_object
*samp
, GLint param
)
669 /* If GL_ARB_shadow is not supported, don't report an error. The
670 * sampler object extension spec isn't clear on this extension interaction.
671 * Silences errors with Wine on older GPUs such as R200.
673 if (!ctx
->Extensions
.ARB_shadow
)
676 if (samp
->CompareFunc
== param
)
689 samp
->CompareFunc
= param
;
692 return INVALID_PARAM
;
698 set_sampler_max_anisotropy(struct gl_context
*ctx
,
699 struct gl_sampler_object
*samp
, GLfloat param
)
701 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
702 return INVALID_PNAME
;
704 if (samp
->MaxAnisotropy
== param
)
708 return INVALID_VALUE
;
711 /* clamp to max, that's what NVIDIA does */
712 samp
->MaxAnisotropy
= MIN2(param
, ctx
->Const
.MaxTextureMaxAnisotropy
);
718 set_sampler_cube_map_seamless(struct gl_context
*ctx
,
719 struct gl_sampler_object
*samp
, GLboolean param
)
721 if (!_mesa_is_desktop_gl(ctx
)
722 || !ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
723 return INVALID_PNAME
;
725 if (samp
->CubeMapSeamless
== param
)
728 if (param
!= GL_TRUE
&& param
!= GL_FALSE
)
729 return INVALID_VALUE
;
732 samp
->CubeMapSeamless
= param
;
737 _mesa_set_sampler_srgb_decode(struct gl_context
*ctx
,
738 struct gl_sampler_object
*samp
, GLenum param
)
740 assert(param
== GL_DECODE_EXT
|| param
== GL_SKIP_DECODE_EXT
);
743 samp
->sRGBDecode
= param
;
747 set_sampler_srgb_decode(struct gl_context
*ctx
,
748 struct gl_sampler_object
*samp
, GLenum param
)
750 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
751 return INVALID_PNAME
;
753 if (samp
->sRGBDecode
== param
)
756 if (param
!= GL_DECODE_EXT
&& param
!= GL_SKIP_DECODE_EXT
)
757 return INVALID_VALUE
;
760 samp
->sRGBDecode
= param
;
764 static struct gl_sampler_object
*
765 sampler_parameter_error_check(struct gl_context
*ctx
, GLuint sampler
,
768 struct gl_sampler_object
*sampObj
;
770 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
772 /* OpenGL 4.5 spec, section "8.2 Sampler Objects", page 176 of the PDF
775 * "An INVALID_OPERATION error is generated if sampler is not the name
776 * of a sampler object previously returned from a call to
779 _mesa_error(ctx
, GL_INVALID_OPERATION
, "%s(invalid sampler)", name
);
787 _mesa_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
789 struct gl_sampler_object
*sampObj
;
791 GET_CURRENT_CONTEXT(ctx
);
793 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
794 "glSamplerParameteri");
799 case GL_TEXTURE_WRAP_S
:
800 res
= set_sampler_wrap_s(ctx
, sampObj
, param
);
802 case GL_TEXTURE_WRAP_T
:
803 res
= set_sampler_wrap_t(ctx
, sampObj
, param
);
805 case GL_TEXTURE_WRAP_R
:
806 res
= set_sampler_wrap_r(ctx
, sampObj
, param
);
808 case GL_TEXTURE_MIN_FILTER
:
809 res
= set_sampler_min_filter(ctx
, sampObj
, param
);
811 case GL_TEXTURE_MAG_FILTER
:
812 res
= set_sampler_mag_filter(ctx
, sampObj
, param
);
814 case GL_TEXTURE_MIN_LOD
:
815 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) param
);
817 case GL_TEXTURE_MAX_LOD
:
818 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) param
);
820 case GL_TEXTURE_LOD_BIAS
:
821 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) param
);
823 case GL_TEXTURE_COMPARE_MODE
:
824 res
= set_sampler_compare_mode(ctx
, sampObj
, param
);
826 case GL_TEXTURE_COMPARE_FUNC
:
827 res
= set_sampler_compare_func(ctx
, sampObj
, param
);
829 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
830 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) param
);
832 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
833 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, param
);
835 case GL_TEXTURE_SRGB_DECODE_EXT
:
836 res
= set_sampler_srgb_decode(ctx
, sampObj
, param
);
838 case GL_TEXTURE_BORDER_COLOR
:
849 /* state change - we do nothing special at this time */
852 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteri(pname=%s)\n",
853 _mesa_enum_to_string(pname
));
856 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteri(param=%d)\n",
860 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameteri(param=%d)\n",
870 _mesa_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
872 struct gl_sampler_object
*sampObj
;
874 GET_CURRENT_CONTEXT(ctx
);
876 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
877 "glSamplerParameterf");
882 case GL_TEXTURE_WRAP_S
:
883 res
= set_sampler_wrap_s(ctx
, sampObj
, (GLint
) param
);
885 case GL_TEXTURE_WRAP_T
:
886 res
= set_sampler_wrap_t(ctx
, sampObj
, (GLint
) param
);
888 case GL_TEXTURE_WRAP_R
:
889 res
= set_sampler_wrap_r(ctx
, sampObj
, (GLint
) param
);
891 case GL_TEXTURE_MIN_FILTER
:
892 res
= set_sampler_min_filter(ctx
, sampObj
, (GLint
) param
);
894 case GL_TEXTURE_MAG_FILTER
:
895 res
= set_sampler_mag_filter(ctx
, sampObj
, (GLint
) param
);
897 case GL_TEXTURE_MIN_LOD
:
898 res
= set_sampler_min_lod(ctx
, sampObj
, param
);
900 case GL_TEXTURE_MAX_LOD
:
901 res
= set_sampler_max_lod(ctx
, sampObj
, param
);
903 case GL_TEXTURE_LOD_BIAS
:
904 res
= set_sampler_lod_bias(ctx
, sampObj
, param
);
906 case GL_TEXTURE_COMPARE_MODE
:
907 res
= set_sampler_compare_mode(ctx
, sampObj
, (GLint
) param
);
909 case GL_TEXTURE_COMPARE_FUNC
:
910 res
= set_sampler_compare_func(ctx
, sampObj
, (GLint
) param
);
912 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
913 res
= set_sampler_max_anisotropy(ctx
, sampObj
, param
);
915 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
916 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, (GLboolean
) param
);
918 case GL_TEXTURE_SRGB_DECODE_EXT
:
919 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) param
);
921 case GL_TEXTURE_BORDER_COLOR
:
932 /* state change - we do nothing special at this time */
935 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterf(pname=%s)\n",
936 _mesa_enum_to_string(pname
));
939 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterf(param=%f)\n",
943 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterf(param=%f)\n",
952 _mesa_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
954 struct gl_sampler_object
*sampObj
;
956 GET_CURRENT_CONTEXT(ctx
);
958 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
959 "glSamplerParameteriv");
964 case GL_TEXTURE_WRAP_S
:
965 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
967 case GL_TEXTURE_WRAP_T
:
968 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
970 case GL_TEXTURE_WRAP_R
:
971 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
973 case GL_TEXTURE_MIN_FILTER
:
974 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
976 case GL_TEXTURE_MAG_FILTER
:
977 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
979 case GL_TEXTURE_MIN_LOD
:
980 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
982 case GL_TEXTURE_MAX_LOD
:
983 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
985 case GL_TEXTURE_LOD_BIAS
:
986 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
988 case GL_TEXTURE_COMPARE_MODE
:
989 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
991 case GL_TEXTURE_COMPARE_FUNC
:
992 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
994 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
995 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
997 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
998 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1000 case GL_TEXTURE_SRGB_DECODE_EXT
:
1001 res
= set_sampler_srgb_decode(ctx
, sampObj
, params
[0]);
1003 case GL_TEXTURE_BORDER_COLOR
:
1006 c
[0] = INT_TO_FLOAT(params
[0]);
1007 c
[1] = INT_TO_FLOAT(params
[1]);
1008 c
[2] = INT_TO_FLOAT(params
[2]);
1009 c
[3] = INT_TO_FLOAT(params
[3]);
1010 res
= set_sampler_border_colorf(ctx
, sampObj
, c
);
1014 res
= INVALID_PNAME
;
1022 /* state change - we do nothing special at this time */
1025 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteriv(pname=%s)\n",
1026 _mesa_enum_to_string(pname
));
1029 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteriv(param=%d)\n",
1033 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameteriv(param=%d)\n",
1042 _mesa_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
1044 struct gl_sampler_object
*sampObj
;
1046 GET_CURRENT_CONTEXT(ctx
);
1048 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1049 "glSamplerParameterfv");
1054 case GL_TEXTURE_WRAP_S
:
1055 res
= set_sampler_wrap_s(ctx
, sampObj
, (GLint
) params
[0]);
1057 case GL_TEXTURE_WRAP_T
:
1058 res
= set_sampler_wrap_t(ctx
, sampObj
, (GLint
) params
[0]);
1060 case GL_TEXTURE_WRAP_R
:
1061 res
= set_sampler_wrap_r(ctx
, sampObj
, (GLint
) params
[0]);
1063 case GL_TEXTURE_MIN_FILTER
:
1064 res
= set_sampler_min_filter(ctx
, sampObj
, (GLint
) params
[0]);
1066 case GL_TEXTURE_MAG_FILTER
:
1067 res
= set_sampler_mag_filter(ctx
, sampObj
, (GLint
) params
[0]);
1069 case GL_TEXTURE_MIN_LOD
:
1070 res
= set_sampler_min_lod(ctx
, sampObj
, params
[0]);
1072 case GL_TEXTURE_MAX_LOD
:
1073 res
= set_sampler_max_lod(ctx
, sampObj
, params
[0]);
1075 case GL_TEXTURE_LOD_BIAS
:
1076 res
= set_sampler_lod_bias(ctx
, sampObj
, params
[0]);
1078 case GL_TEXTURE_COMPARE_MODE
:
1079 res
= set_sampler_compare_mode(ctx
, sampObj
, (GLint
) params
[0]);
1081 case GL_TEXTURE_COMPARE_FUNC
:
1082 res
= set_sampler_compare_func(ctx
, sampObj
, (GLint
) params
[0]);
1084 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1085 res
= set_sampler_max_anisotropy(ctx
, sampObj
, params
[0]);
1087 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1088 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, (GLboolean
) params
[0]);
1090 case GL_TEXTURE_SRGB_DECODE_EXT
:
1091 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1093 case GL_TEXTURE_BORDER_COLOR
:
1094 res
= set_sampler_border_colorf(ctx
, sampObj
, params
);
1097 res
= INVALID_PNAME
;
1105 /* state change - we do nothing special at this time */
1108 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterfv(pname=%s)\n",
1109 _mesa_enum_to_string(pname
));
1112 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterfv(param=%f)\n",
1116 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterfv(param=%f)\n",
1125 _mesa_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
1127 struct gl_sampler_object
*sampObj
;
1129 GET_CURRENT_CONTEXT(ctx
);
1131 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1132 "glSamplerParameterIiv");
1137 case GL_TEXTURE_WRAP_S
:
1138 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
1140 case GL_TEXTURE_WRAP_T
:
1141 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
1143 case GL_TEXTURE_WRAP_R
:
1144 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
1146 case GL_TEXTURE_MIN_FILTER
:
1147 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1149 case GL_TEXTURE_MAG_FILTER
:
1150 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1152 case GL_TEXTURE_MIN_LOD
:
1153 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1155 case GL_TEXTURE_MAX_LOD
:
1156 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1158 case GL_TEXTURE_LOD_BIAS
:
1159 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1161 case GL_TEXTURE_COMPARE_MODE
:
1162 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1164 case GL_TEXTURE_COMPARE_FUNC
:
1165 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1167 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1168 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1170 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1171 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1173 case GL_TEXTURE_SRGB_DECODE_EXT
:
1174 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1176 case GL_TEXTURE_BORDER_COLOR
:
1177 res
= set_sampler_border_colori(ctx
, sampObj
, params
);
1180 res
= INVALID_PNAME
;
1188 /* state change - we do nothing special at this time */
1191 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIiv(pname=%s)\n",
1192 _mesa_enum_to_string(pname
));
1195 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIiv(param=%d)\n",
1199 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterIiv(param=%d)\n",
1209 _mesa_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
1211 struct gl_sampler_object
*sampObj
;
1213 GET_CURRENT_CONTEXT(ctx
);
1215 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1216 "glSamplerParameterIuiv");
1221 case GL_TEXTURE_WRAP_S
:
1222 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
1224 case GL_TEXTURE_WRAP_T
:
1225 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
1227 case GL_TEXTURE_WRAP_R
:
1228 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
1230 case GL_TEXTURE_MIN_FILTER
:
1231 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1233 case GL_TEXTURE_MAG_FILTER
:
1234 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1236 case GL_TEXTURE_MIN_LOD
:
1237 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1239 case GL_TEXTURE_MAX_LOD
:
1240 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1242 case GL_TEXTURE_LOD_BIAS
:
1243 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1245 case GL_TEXTURE_COMPARE_MODE
:
1246 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1248 case GL_TEXTURE_COMPARE_FUNC
:
1249 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1251 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1252 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1254 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1255 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1257 case GL_TEXTURE_SRGB_DECODE_EXT
:
1258 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1260 case GL_TEXTURE_BORDER_COLOR
:
1261 res
= set_sampler_border_colorui(ctx
, sampObj
, params
);
1264 res
= INVALID_PNAME
;
1272 /* state change - we do nothing special at this time */
1275 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIuiv(pname=%s)\n",
1276 _mesa_enum_to_string(pname
));
1279 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIuiv(param=%u)\n",
1283 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterIuiv(param=%u)\n",
1293 _mesa_GetSamplerParameteriv(GLuint sampler
, GLenum pname
, GLint
*params
)
1295 struct gl_sampler_object
*sampObj
;
1296 GET_CURRENT_CONTEXT(ctx
);
1298 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1299 "glGetSamplerParameteriv");
1304 case GL_TEXTURE_WRAP_S
:
1305 *params
= sampObj
->WrapS
;
1307 case GL_TEXTURE_WRAP_T
:
1308 *params
= sampObj
->WrapT
;
1310 case GL_TEXTURE_WRAP_R
:
1311 *params
= sampObj
->WrapR
;
1313 case GL_TEXTURE_MIN_FILTER
:
1314 *params
= sampObj
->MinFilter
;
1316 case GL_TEXTURE_MAG_FILTER
:
1317 *params
= sampObj
->MagFilter
;
1319 case GL_TEXTURE_MIN_LOD
:
1320 /* GL spec 'Data Conversions' section specifies that floating-point
1321 * value in integer Get function is rounded to nearest integer
1323 *params
= IROUND(sampObj
->MinLod
);
1325 case GL_TEXTURE_MAX_LOD
:
1326 /* GL spec 'Data Conversions' section specifies that floating-point
1327 * value in integer Get function is rounded to nearest integer
1329 *params
= IROUND(sampObj
->MaxLod
);
1331 case GL_TEXTURE_LOD_BIAS
:
1332 /* GL spec 'Data Conversions' section specifies that floating-point
1333 * value in integer Get function is rounded to nearest integer
1335 *params
= IROUND(sampObj
->LodBias
);
1337 case GL_TEXTURE_COMPARE_MODE
:
1338 *params
= sampObj
->CompareMode
;
1340 case GL_TEXTURE_COMPARE_FUNC
:
1341 *params
= sampObj
->CompareFunc
;
1343 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1344 /* GL spec 'Data Conversions' section specifies that floating-point
1345 * value in integer Get function is rounded to nearest integer
1347 *params
= IROUND(sampObj
->MaxAnisotropy
);
1349 case GL_TEXTURE_BORDER_COLOR
:
1350 params
[0] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[0]);
1351 params
[1] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[1]);
1352 params
[2] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[2]);
1353 params
[3] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[3]);
1355 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1356 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1358 *params
= sampObj
->CubeMapSeamless
;
1360 case GL_TEXTURE_SRGB_DECODE_EXT
:
1361 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1363 *params
= (GLenum
) sampObj
->sRGBDecode
;
1371 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameteriv(pname=%s)",
1372 _mesa_enum_to_string(pname
));
1377 _mesa_GetSamplerParameterfv(GLuint sampler
, GLenum pname
, GLfloat
*params
)
1379 struct gl_sampler_object
*sampObj
;
1380 GET_CURRENT_CONTEXT(ctx
);
1382 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1383 "glGetSamplerParameterfv");
1388 case GL_TEXTURE_WRAP_S
:
1389 *params
= (GLfloat
) sampObj
->WrapS
;
1391 case GL_TEXTURE_WRAP_T
:
1392 *params
= (GLfloat
) sampObj
->WrapT
;
1394 case GL_TEXTURE_WRAP_R
:
1395 *params
= (GLfloat
) sampObj
->WrapR
;
1397 case GL_TEXTURE_MIN_FILTER
:
1398 *params
= (GLfloat
) sampObj
->MinFilter
;
1400 case GL_TEXTURE_MAG_FILTER
:
1401 *params
= (GLfloat
) sampObj
->MagFilter
;
1403 case GL_TEXTURE_MIN_LOD
:
1404 *params
= sampObj
->MinLod
;
1406 case GL_TEXTURE_MAX_LOD
:
1407 *params
= sampObj
->MaxLod
;
1409 case GL_TEXTURE_LOD_BIAS
:
1410 *params
= sampObj
->LodBias
;
1412 case GL_TEXTURE_COMPARE_MODE
:
1413 *params
= (GLfloat
) sampObj
->CompareMode
;
1415 case GL_TEXTURE_COMPARE_FUNC
:
1416 *params
= (GLfloat
) sampObj
->CompareFunc
;
1418 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1419 *params
= sampObj
->MaxAnisotropy
;
1421 case GL_TEXTURE_BORDER_COLOR
:
1422 params
[0] = sampObj
->BorderColor
.f
[0];
1423 params
[1] = sampObj
->BorderColor
.f
[1];
1424 params
[2] = sampObj
->BorderColor
.f
[2];
1425 params
[3] = sampObj
->BorderColor
.f
[3];
1427 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1428 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1430 *params
= (GLfloat
) sampObj
->CubeMapSeamless
;
1432 case GL_TEXTURE_SRGB_DECODE_EXT
:
1433 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1435 *params
= (GLfloat
) sampObj
->sRGBDecode
;
1443 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterfv(pname=%s)",
1444 _mesa_enum_to_string(pname
));
1449 _mesa_GetSamplerParameterIiv(GLuint sampler
, GLenum pname
, GLint
*params
)
1451 struct gl_sampler_object
*sampObj
;
1452 GET_CURRENT_CONTEXT(ctx
);
1454 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1455 "glGetSamplerParameterIiv");
1460 case GL_TEXTURE_WRAP_S
:
1461 *params
= sampObj
->WrapS
;
1463 case GL_TEXTURE_WRAP_T
:
1464 *params
= sampObj
->WrapT
;
1466 case GL_TEXTURE_WRAP_R
:
1467 *params
= sampObj
->WrapR
;
1469 case GL_TEXTURE_MIN_FILTER
:
1470 *params
= sampObj
->MinFilter
;
1472 case GL_TEXTURE_MAG_FILTER
:
1473 *params
= sampObj
->MagFilter
;
1475 case GL_TEXTURE_MIN_LOD
:
1476 *params
= (GLint
) sampObj
->MinLod
;
1478 case GL_TEXTURE_MAX_LOD
:
1479 *params
= (GLint
) sampObj
->MaxLod
;
1481 case GL_TEXTURE_LOD_BIAS
:
1482 *params
= (GLint
) sampObj
->LodBias
;
1484 case GL_TEXTURE_COMPARE_MODE
:
1485 *params
= sampObj
->CompareMode
;
1487 case GL_TEXTURE_COMPARE_FUNC
:
1488 *params
= sampObj
->CompareFunc
;
1490 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1491 *params
= (GLint
) sampObj
->MaxAnisotropy
;
1493 case GL_TEXTURE_BORDER_COLOR
:
1494 params
[0] = sampObj
->BorderColor
.i
[0];
1495 params
[1] = sampObj
->BorderColor
.i
[1];
1496 params
[2] = sampObj
->BorderColor
.i
[2];
1497 params
[3] = sampObj
->BorderColor
.i
[3];
1499 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1500 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1502 *params
= sampObj
->CubeMapSeamless
;
1504 case GL_TEXTURE_SRGB_DECODE_EXT
:
1505 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1507 *params
= (GLenum
) sampObj
->sRGBDecode
;
1515 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterIiv(pname=%s)",
1516 _mesa_enum_to_string(pname
));
1521 _mesa_GetSamplerParameterIuiv(GLuint sampler
, GLenum pname
, GLuint
*params
)
1523 struct gl_sampler_object
*sampObj
;
1524 GET_CURRENT_CONTEXT(ctx
);
1526 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1527 "glGetSamplerParameterIuiv");
1532 case GL_TEXTURE_WRAP_S
:
1533 *params
= sampObj
->WrapS
;
1535 case GL_TEXTURE_WRAP_T
:
1536 *params
= sampObj
->WrapT
;
1538 case GL_TEXTURE_WRAP_R
:
1539 *params
= sampObj
->WrapR
;
1541 case GL_TEXTURE_MIN_FILTER
:
1542 *params
= sampObj
->MinFilter
;
1544 case GL_TEXTURE_MAG_FILTER
:
1545 *params
= sampObj
->MagFilter
;
1547 case GL_TEXTURE_MIN_LOD
:
1548 *params
= (GLuint
) sampObj
->MinLod
;
1550 case GL_TEXTURE_MAX_LOD
:
1551 *params
= (GLuint
) sampObj
->MaxLod
;
1553 case GL_TEXTURE_LOD_BIAS
:
1554 *params
= (GLuint
) sampObj
->LodBias
;
1556 case GL_TEXTURE_COMPARE_MODE
:
1557 *params
= sampObj
->CompareMode
;
1559 case GL_TEXTURE_COMPARE_FUNC
:
1560 *params
= sampObj
->CompareFunc
;
1562 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1563 *params
= (GLuint
) sampObj
->MaxAnisotropy
;
1565 case GL_TEXTURE_BORDER_COLOR
:
1566 params
[0] = sampObj
->BorderColor
.ui
[0];
1567 params
[1] = sampObj
->BorderColor
.ui
[1];
1568 params
[2] = sampObj
->BorderColor
.ui
[2];
1569 params
[3] = sampObj
->BorderColor
.ui
[3];
1571 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1572 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1574 *params
= sampObj
->CubeMapSeamless
;
1576 case GL_TEXTURE_SRGB_DECODE_EXT
:
1577 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1579 *params
= (GLenum
) sampObj
->sRGBDecode
;
1587 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterIuiv(pname=%s)",
1588 _mesa_enum_to_string(pname
));
1593 _mesa_init_sampler_object_functions(struct dd_function_table
*driver
)
1595 driver
->NewSamplerObject
= _mesa_new_sampler_object
;