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 struct gl_sampler_object
*
54 _mesa_lookup_samplerobj_locked(struct gl_context
*ctx
, GLuint name
)
59 return (struct gl_sampler_object
*)
60 _mesa_HashLookupLocked(ctx
->Shared
->SamplerObjects
, name
);
64 begin_samplerobj_lookups(struct gl_context
*ctx
)
66 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
71 end_samplerobj_lookups(struct gl_context
*ctx
)
73 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
77 static inline struct gl_sampler_object
*
78 lookup_samplerobj_locked(struct gl_context
*ctx
, GLuint name
)
80 return (struct gl_sampler_object
*)
81 _mesa_HashLookupLocked(ctx
->Shared
->SamplerObjects
, name
);
85 delete_sampler_object(struct gl_context
*ctx
,
86 struct gl_sampler_object
*sampObj
)
88 mtx_destroy(&sampObj
->Mutex
);
94 * Handle reference counting.
97 _mesa_reference_sampler_object_(struct gl_context
*ctx
,
98 struct gl_sampler_object
**ptr
,
99 struct gl_sampler_object
*samp
)
101 assert(*ptr
!= samp
); /* The inline wrapper should prevent no-op calls */
104 /* Unreference the old sampler */
105 GLboolean deleteFlag
= GL_FALSE
;
106 struct gl_sampler_object
*oldSamp
= *ptr
;
108 mtx_lock(&oldSamp
->Mutex
);
109 assert(oldSamp
->RefCount
> 0);
111 deleteFlag
= (oldSamp
->RefCount
== 0);
112 mtx_unlock(&oldSamp
->Mutex
);
115 delete_sampler_object(ctx
, oldSamp
);
122 /* reference new sampler */
123 mtx_lock(&samp
->Mutex
);
124 if (samp
->RefCount
== 0) {
125 /* this sampler's being deleted (look just above) */
126 /* Not sure this can every really happen. Warn if it does. */
127 _mesa_problem(NULL
, "referencing deleted sampler object");
134 mtx_unlock(&samp
->Mutex
);
140 * Initialize the fields of the given sampler object.
143 _mesa_init_sampler_object(struct gl_sampler_object
*sampObj
, GLuint name
)
145 mtx_init(&sampObj
->Mutex
, mtx_plain
);
146 sampObj
->Name
= name
;
147 sampObj
->RefCount
= 1;
148 sampObj
->WrapS
= GL_REPEAT
;
149 sampObj
->WrapT
= GL_REPEAT
;
150 sampObj
->WrapR
= GL_REPEAT
;
151 sampObj
->MinFilter
= GL_NEAREST_MIPMAP_LINEAR
;
152 sampObj
->MagFilter
= GL_LINEAR
;
153 sampObj
->BorderColor
.f
[0] = 0.0;
154 sampObj
->BorderColor
.f
[1] = 0.0;
155 sampObj
->BorderColor
.f
[2] = 0.0;
156 sampObj
->BorderColor
.f
[3] = 0.0;
157 sampObj
->MinLod
= -1000.0F
;
158 sampObj
->MaxLod
= 1000.0F
;
159 sampObj
->LodBias
= 0.0F
;
160 sampObj
->MaxAnisotropy
= 1.0F
;
161 sampObj
->CompareMode
= GL_NONE
;
162 sampObj
->CompareFunc
= GL_LEQUAL
;
163 sampObj
->sRGBDecode
= GL_DECODE_EXT
;
164 sampObj
->CubeMapSeamless
= GL_FALSE
;
168 * Fallback for ctx->Driver.NewSamplerObject();
170 struct gl_sampler_object
*
171 _mesa_new_sampler_object(struct gl_context
*ctx
, GLuint name
)
173 struct gl_sampler_object
*sampObj
= CALLOC_STRUCT(gl_sampler_object
);
175 _mesa_init_sampler_object(sampObj
, name
);
181 create_samplers(struct gl_context
*ctx
, GLsizei count
, GLuint
*samplers
,
187 if (MESA_VERBOSE
& VERBOSE_API
)
188 _mesa_debug(ctx
, "%s(%d)\n", caller
, count
);
191 _mesa_error(ctx
, GL_INVALID_VALUE
, "%s(n<0)", caller
);
198 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
200 first
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->SamplerObjects
, count
);
202 /* Insert the ID and pointer to new sampler object into hash table */
203 for (i
= 0; i
< count
; i
++) {
204 struct gl_sampler_object
*sampObj
=
205 ctx
->Driver
.NewSamplerObject(ctx
, first
+ i
);
206 _mesa_HashInsertLocked(ctx
->Shared
->SamplerObjects
, first
+ i
, sampObj
);
207 samplers
[i
] = first
+ i
;
210 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
214 _mesa_GenSamplers(GLsizei count
, GLuint
*samplers
)
216 GET_CURRENT_CONTEXT(ctx
);
217 create_samplers(ctx
, count
, samplers
, "glGenSamplers");
221 _mesa_CreateSamplers(GLsizei count
, GLuint
*samplers
)
223 GET_CURRENT_CONTEXT(ctx
);
224 create_samplers(ctx
, count
, samplers
, "glCreateSamplers");
229 _mesa_DeleteSamplers(GLsizei count
, const GLuint
*samplers
)
231 GET_CURRENT_CONTEXT(ctx
);
234 FLUSH_VERTICES(ctx
, 0);
237 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteSamplers(count)");
241 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
243 for (i
= 0; i
< count
; i
++) {
246 struct gl_sampler_object
*sampObj
=
247 _mesa_lookup_samplerobj_locked(ctx
, samplers
[i
]);
250 /* If the sampler is currently bound, unbind it. */
251 for (j
= 0; j
< ctx
->Const
.MaxCombinedTextureImageUnits
; j
++) {
252 if (ctx
->Texture
.Unit
[j
].Sampler
== sampObj
) {
253 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
254 _mesa_reference_sampler_object(ctx
, &ctx
->Texture
.Unit
[j
].Sampler
, NULL
);
258 /* The ID is immediately freed for re-use */
259 _mesa_HashRemoveLocked(ctx
->Shared
->SamplerObjects
, samplers
[i
]);
260 /* But the object exists until its reference count goes to zero */
261 _mesa_reference_sampler_object(ctx
, &sampObj
, NULL
);
266 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
271 _mesa_IsSampler(GLuint sampler
)
273 GET_CURRENT_CONTEXT(ctx
);
275 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
277 return _mesa_lookup_samplerobj(ctx
, sampler
) != NULL
;
281 _mesa_bind_sampler(struct gl_context
*ctx
, GLuint unit
,
282 struct gl_sampler_object
*sampObj
)
284 if (ctx
->Texture
.Unit
[unit
].Sampler
!= sampObj
) {
285 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
288 _mesa_reference_sampler_object(ctx
, &ctx
->Texture
.Unit
[unit
].Sampler
,
293 _mesa_BindSampler(GLuint unit
, GLuint sampler
)
295 struct gl_sampler_object
*sampObj
;
296 GET_CURRENT_CONTEXT(ctx
);
298 if (unit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
299 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindSampler(unit %u)", unit
);
304 /* Use the default sampler object, the one contained in the texture
310 /* user-defined sampler object */
311 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
313 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glBindSampler(sampler)");
318 /* bind new sampler */
319 _mesa_bind_sampler(ctx
, unit
, sampObj
);
324 _mesa_BindSamplers(GLuint first
, GLsizei count
, const GLuint
*samplers
)
326 GET_CURRENT_CONTEXT(ctx
);
329 /* The ARB_multi_bind spec says:
331 * "An INVALID_OPERATION error is generated if <first> + <count> is
332 * greater than the number of texture image units supported by
333 * the implementation."
335 if (first
+ count
> ctx
->Const
.MaxCombinedTextureImageUnits
) {
336 _mesa_error(ctx
, GL_INVALID_OPERATION
,
337 "glBindSamplers(first=%u + count=%d > the value of "
338 "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS=%u)",
339 first
, count
, ctx
->Const
.MaxCombinedTextureImageUnits
);
343 FLUSH_VERTICES(ctx
, 0);
346 /* Note that the error semantics for multi-bind commands differ from
347 * those of other GL commands.
349 * The Issues section in the ARB_multi_bind spec says:
351 * "(11) Typically, OpenGL specifies that if an error is generated by
352 * a command, that command has no effect. This is somewhat
353 * unfortunate for multi-bind commands, because it would require
354 * a first pass to scan the entire list of bound objects for
355 * errors and then a second pass to actually perform the
356 * bindings. Should we have different error semantics?
358 * RESOLVED: Yes. In this specification, when the parameters for
359 * one of the <count> binding points are invalid, that binding
360 * point is not updated and an error will be generated. However,
361 * other binding points in the same command will be updated if
362 * their parameters are valid and no other error occurs."
365 begin_samplerobj_lookups(ctx
);
367 for (i
= 0; i
< count
; i
++) {
368 const GLuint unit
= first
+ i
;
369 struct gl_sampler_object
* const currentSampler
=
370 ctx
->Texture
.Unit
[unit
].Sampler
;
371 struct gl_sampler_object
*sampObj
;
373 if (samplers
[i
] != 0) {
374 if (currentSampler
&& currentSampler
->Name
== samplers
[i
])
375 sampObj
= currentSampler
;
377 sampObj
= lookup_samplerobj_locked(ctx
, samplers
[i
]);
379 /* The ARB_multi_bind spec says:
381 * "An INVALID_OPERATION error is generated if any value
382 * in <samplers> is not zero or the name of an existing
383 * sampler object (per binding)."
386 _mesa_error(ctx
, GL_INVALID_OPERATION
,
387 "glBindSamplers(samplers[%d]=%u is not zero or "
388 "the name of an existing sampler object)",
396 /* Bind the new sampler */
397 if (sampObj
!= currentSampler
) {
398 _mesa_reference_sampler_object(ctx
,
399 &ctx
->Texture
.Unit
[unit
].Sampler
,
401 ctx
->NewState
|= _NEW_TEXTURE
;
405 end_samplerobj_lookups(ctx
);
407 /* Unbind all samplers in the range <first> through <first>+<count>-1 */
408 for (i
= 0; i
< count
; i
++) {
409 const GLuint unit
= first
+ i
;
411 if (ctx
->Texture
.Unit
[unit
].Sampler
) {
412 _mesa_reference_sampler_object(ctx
,
413 &ctx
->Texture
.Unit
[unit
].Sampler
,
415 ctx
->NewState
|= _NEW_TEXTURE
;
423 * Check if a coordinate wrap mode is legal.
424 * \return GL_TRUE if legal, GL_FALSE otherwise
427 validate_texture_wrap_mode(struct gl_context
*ctx
, GLenum wrap
)
429 const struct gl_extensions
* const e
= &ctx
->Extensions
;
433 case GL_CLAMP_TO_EDGE
:
435 case GL_MIRRORED_REPEAT
:
437 case GL_CLAMP_TO_BORDER
:
438 return e
->ARB_texture_border_clamp
;
439 case GL_MIRROR_CLAMP_EXT
:
440 return e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
;
441 case GL_MIRROR_CLAMP_TO_EDGE_EXT
:
442 return e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
|| e
->ARB_texture_mirror_clamp_to_edge
;
443 case GL_MIRROR_CLAMP_TO_BORDER_EXT
:
444 return e
->EXT_texture_mirror_clamp
;
452 * This is called just prior to changing any sampler object state.
455 flush(struct gl_context
*ctx
)
457 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
461 _mesa_set_sampler_wrap(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
462 GLenum s
, GLenum t
, GLenum r
)
464 assert(validate_texture_wrap_mode(ctx
, s
));
465 assert(validate_texture_wrap_mode(ctx
, t
));
466 assert(validate_texture_wrap_mode(ctx
, r
));
468 if (samp
->WrapS
== s
&& samp
->WrapT
== t
&& samp
->WrapR
== r
)
477 #define INVALID_PARAM 0x100
478 #define INVALID_PNAME 0x101
479 #define INVALID_VALUE 0x102
482 set_sampler_wrap_s(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
485 if (samp
->WrapS
== param
)
487 if (validate_texture_wrap_mode(ctx
, param
)) {
492 return INVALID_PARAM
;
497 set_sampler_wrap_t(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
500 if (samp
->WrapT
== param
)
502 if (validate_texture_wrap_mode(ctx
, param
)) {
507 return INVALID_PARAM
;
512 set_sampler_wrap_r(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
515 if (samp
->WrapR
== param
)
517 if (validate_texture_wrap_mode(ctx
, param
)) {
522 return INVALID_PARAM
;
526 _mesa_set_sampler_filters(struct gl_context
*ctx
,
527 struct gl_sampler_object
*samp
,
528 GLenum min_filter
, GLenum mag_filter
)
530 assert(min_filter
== GL_NEAREST
||
531 min_filter
== GL_LINEAR
||
532 min_filter
== GL_NEAREST_MIPMAP_NEAREST
||
533 min_filter
== GL_LINEAR_MIPMAP_NEAREST
||
534 min_filter
== GL_NEAREST_MIPMAP_LINEAR
||
535 min_filter
== GL_LINEAR_MIPMAP_LINEAR
);
536 assert(mag_filter
== GL_NEAREST
||
537 mag_filter
== GL_LINEAR
);
539 if (samp
->MinFilter
== min_filter
&& samp
->MagFilter
== mag_filter
)
543 samp
->MinFilter
= min_filter
;
544 samp
->MagFilter
= mag_filter
;
548 set_sampler_min_filter(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
551 if (samp
->MinFilter
== param
)
557 case GL_NEAREST_MIPMAP_NEAREST
:
558 case GL_LINEAR_MIPMAP_NEAREST
:
559 case GL_NEAREST_MIPMAP_LINEAR
:
560 case GL_LINEAR_MIPMAP_LINEAR
:
562 samp
->MinFilter
= param
;
565 return INVALID_PARAM
;
571 set_sampler_mag_filter(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
574 if (samp
->MagFilter
== param
)
581 samp
->MagFilter
= param
;
584 return INVALID_PARAM
;
590 set_sampler_lod_bias(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
593 if (samp
->LodBias
== param
)
597 samp
->LodBias
= param
;
603 set_sampler_border_colorf(struct gl_context
*ctx
,
604 struct gl_sampler_object
*samp
,
605 const GLfloat params
[4])
608 samp
->BorderColor
.f
[RCOMP
] = params
[0];
609 samp
->BorderColor
.f
[GCOMP
] = params
[1];
610 samp
->BorderColor
.f
[BCOMP
] = params
[2];
611 samp
->BorderColor
.f
[ACOMP
] = params
[3];
617 set_sampler_border_colori(struct gl_context
*ctx
,
618 struct gl_sampler_object
*samp
,
619 const GLint params
[4])
622 samp
->BorderColor
.i
[RCOMP
] = params
[0];
623 samp
->BorderColor
.i
[GCOMP
] = params
[1];
624 samp
->BorderColor
.i
[BCOMP
] = params
[2];
625 samp
->BorderColor
.i
[ACOMP
] = params
[3];
631 set_sampler_border_colorui(struct gl_context
*ctx
,
632 struct gl_sampler_object
*samp
,
633 const GLuint params
[4])
636 samp
->BorderColor
.ui
[RCOMP
] = params
[0];
637 samp
->BorderColor
.ui
[GCOMP
] = params
[1];
638 samp
->BorderColor
.ui
[BCOMP
] = params
[2];
639 samp
->BorderColor
.ui
[ACOMP
] = params
[3];
645 set_sampler_min_lod(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
648 if (samp
->MinLod
== param
)
652 samp
->MinLod
= param
;
658 set_sampler_max_lod(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
661 if (samp
->MaxLod
== param
)
665 samp
->MaxLod
= param
;
671 set_sampler_compare_mode(struct gl_context
*ctx
,
672 struct gl_sampler_object
*samp
, GLint param
)
674 /* If GL_ARB_shadow is not supported, don't report an error. The
675 * sampler object extension spec isn't clear on this extension interaction.
676 * Silences errors with Wine on older GPUs such as R200.
678 if (!ctx
->Extensions
.ARB_shadow
)
681 if (samp
->CompareMode
== param
)
684 if (param
== GL_NONE
||
685 param
== GL_COMPARE_R_TO_TEXTURE_ARB
) {
687 samp
->CompareMode
= param
;
691 return INVALID_PARAM
;
696 set_sampler_compare_func(struct gl_context
*ctx
,
697 struct gl_sampler_object
*samp
, GLint param
)
699 /* If GL_ARB_shadow is not supported, don't report an error. The
700 * sampler object extension spec isn't clear on this extension interaction.
701 * Silences errors with Wine on older GPUs such as R200.
703 if (!ctx
->Extensions
.ARB_shadow
)
706 if (samp
->CompareFunc
== param
)
719 samp
->CompareFunc
= param
;
722 return INVALID_PARAM
;
728 set_sampler_max_anisotropy(struct gl_context
*ctx
,
729 struct gl_sampler_object
*samp
, GLfloat param
)
731 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
732 return INVALID_PNAME
;
734 if (samp
->MaxAnisotropy
== param
)
738 return INVALID_VALUE
;
741 /* clamp to max, that's what NVIDIA does */
742 samp
->MaxAnisotropy
= MIN2(param
, ctx
->Const
.MaxTextureMaxAnisotropy
);
748 set_sampler_cube_map_seamless(struct gl_context
*ctx
,
749 struct gl_sampler_object
*samp
, GLboolean param
)
751 if (!_mesa_is_desktop_gl(ctx
)
752 || !ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
753 return INVALID_PNAME
;
755 if (samp
->CubeMapSeamless
== param
)
758 if (param
!= GL_TRUE
&& param
!= GL_FALSE
)
759 return INVALID_VALUE
;
762 samp
->CubeMapSeamless
= param
;
767 _mesa_set_sampler_srgb_decode(struct gl_context
*ctx
,
768 struct gl_sampler_object
*samp
, GLenum param
)
770 assert(param
== GL_DECODE_EXT
|| param
== GL_SKIP_DECODE_EXT
);
773 samp
->sRGBDecode
= param
;
777 set_sampler_srgb_decode(struct gl_context
*ctx
,
778 struct gl_sampler_object
*samp
, GLenum param
)
780 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
781 return INVALID_PNAME
;
783 if (samp
->sRGBDecode
== param
)
786 if (param
!= GL_DECODE_EXT
&& param
!= GL_SKIP_DECODE_EXT
)
787 return INVALID_VALUE
;
790 samp
->sRGBDecode
= param
;
794 static struct gl_sampler_object
*
795 sampler_parameter_error_check(struct gl_context
*ctx
, GLuint sampler
,
798 struct gl_sampler_object
*sampObj
;
800 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
802 /* OpenGL 4.5 spec, section "8.2 Sampler Objects", page 176 of the PDF
805 * "An INVALID_OPERATION error is generated if sampler is not the name
806 * of a sampler object previously returned from a call to
809 _mesa_error(ctx
, GL_INVALID_OPERATION
, "%s(invalid sampler)", name
);
817 _mesa_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
819 struct gl_sampler_object
*sampObj
;
821 GET_CURRENT_CONTEXT(ctx
);
823 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
824 "glSamplerParameteri");
829 case GL_TEXTURE_WRAP_S
:
830 res
= set_sampler_wrap_s(ctx
, sampObj
, param
);
832 case GL_TEXTURE_WRAP_T
:
833 res
= set_sampler_wrap_t(ctx
, sampObj
, param
);
835 case GL_TEXTURE_WRAP_R
:
836 res
= set_sampler_wrap_r(ctx
, sampObj
, param
);
838 case GL_TEXTURE_MIN_FILTER
:
839 res
= set_sampler_min_filter(ctx
, sampObj
, param
);
841 case GL_TEXTURE_MAG_FILTER
:
842 res
= set_sampler_mag_filter(ctx
, sampObj
, param
);
844 case GL_TEXTURE_MIN_LOD
:
845 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) param
);
847 case GL_TEXTURE_MAX_LOD
:
848 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) param
);
850 case GL_TEXTURE_LOD_BIAS
:
851 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) param
);
853 case GL_TEXTURE_COMPARE_MODE
:
854 res
= set_sampler_compare_mode(ctx
, sampObj
, param
);
856 case GL_TEXTURE_COMPARE_FUNC
:
857 res
= set_sampler_compare_func(ctx
, sampObj
, param
);
859 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
860 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) param
);
862 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
863 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, param
);
865 case GL_TEXTURE_SRGB_DECODE_EXT
:
866 res
= set_sampler_srgb_decode(ctx
, sampObj
, param
);
868 case GL_TEXTURE_BORDER_COLOR
:
879 /* state change - we do nothing special at this time */
882 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteri(pname=%s)\n",
883 _mesa_enum_to_string(pname
));
886 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteri(param=%d)\n",
890 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameteri(param=%d)\n",
900 _mesa_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
902 struct gl_sampler_object
*sampObj
;
904 GET_CURRENT_CONTEXT(ctx
);
906 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
907 "glSamplerParameterf");
912 case GL_TEXTURE_WRAP_S
:
913 res
= set_sampler_wrap_s(ctx
, sampObj
, (GLint
) param
);
915 case GL_TEXTURE_WRAP_T
:
916 res
= set_sampler_wrap_t(ctx
, sampObj
, (GLint
) param
);
918 case GL_TEXTURE_WRAP_R
:
919 res
= set_sampler_wrap_r(ctx
, sampObj
, (GLint
) param
);
921 case GL_TEXTURE_MIN_FILTER
:
922 res
= set_sampler_min_filter(ctx
, sampObj
, (GLint
) param
);
924 case GL_TEXTURE_MAG_FILTER
:
925 res
= set_sampler_mag_filter(ctx
, sampObj
, (GLint
) param
);
927 case GL_TEXTURE_MIN_LOD
:
928 res
= set_sampler_min_lod(ctx
, sampObj
, param
);
930 case GL_TEXTURE_MAX_LOD
:
931 res
= set_sampler_max_lod(ctx
, sampObj
, param
);
933 case GL_TEXTURE_LOD_BIAS
:
934 res
= set_sampler_lod_bias(ctx
, sampObj
, param
);
936 case GL_TEXTURE_COMPARE_MODE
:
937 res
= set_sampler_compare_mode(ctx
, sampObj
, (GLint
) param
);
939 case GL_TEXTURE_COMPARE_FUNC
:
940 res
= set_sampler_compare_func(ctx
, sampObj
, (GLint
) param
);
942 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
943 res
= set_sampler_max_anisotropy(ctx
, sampObj
, param
);
945 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
946 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, (GLboolean
) param
);
948 case GL_TEXTURE_SRGB_DECODE_EXT
:
949 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) param
);
951 case GL_TEXTURE_BORDER_COLOR
:
962 /* state change - we do nothing special at this time */
965 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterf(pname=%s)\n",
966 _mesa_enum_to_string(pname
));
969 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterf(param=%f)\n",
973 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterf(param=%f)\n",
982 _mesa_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
984 struct gl_sampler_object
*sampObj
;
986 GET_CURRENT_CONTEXT(ctx
);
988 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
989 "glSamplerParameteriv");
994 case GL_TEXTURE_WRAP_S
:
995 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
997 case GL_TEXTURE_WRAP_T
:
998 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
1000 case GL_TEXTURE_WRAP_R
:
1001 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
1003 case GL_TEXTURE_MIN_FILTER
:
1004 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1006 case GL_TEXTURE_MAG_FILTER
:
1007 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1009 case GL_TEXTURE_MIN_LOD
:
1010 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1012 case GL_TEXTURE_MAX_LOD
:
1013 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1015 case GL_TEXTURE_LOD_BIAS
:
1016 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1018 case GL_TEXTURE_COMPARE_MODE
:
1019 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1021 case GL_TEXTURE_COMPARE_FUNC
:
1022 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1024 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1025 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1027 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1028 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1030 case GL_TEXTURE_SRGB_DECODE_EXT
:
1031 res
= set_sampler_srgb_decode(ctx
, sampObj
, params
[0]);
1033 case GL_TEXTURE_BORDER_COLOR
:
1036 c
[0] = INT_TO_FLOAT(params
[0]);
1037 c
[1] = INT_TO_FLOAT(params
[1]);
1038 c
[2] = INT_TO_FLOAT(params
[2]);
1039 c
[3] = INT_TO_FLOAT(params
[3]);
1040 res
= set_sampler_border_colorf(ctx
, sampObj
, c
);
1044 res
= INVALID_PNAME
;
1052 /* state change - we do nothing special at this time */
1055 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteriv(pname=%s)\n",
1056 _mesa_enum_to_string(pname
));
1059 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteriv(param=%d)\n",
1063 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameteriv(param=%d)\n",
1072 _mesa_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
1074 struct gl_sampler_object
*sampObj
;
1076 GET_CURRENT_CONTEXT(ctx
);
1078 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1079 "glSamplerParameterfv");
1084 case GL_TEXTURE_WRAP_S
:
1085 res
= set_sampler_wrap_s(ctx
, sampObj
, (GLint
) params
[0]);
1087 case GL_TEXTURE_WRAP_T
:
1088 res
= set_sampler_wrap_t(ctx
, sampObj
, (GLint
) params
[0]);
1090 case GL_TEXTURE_WRAP_R
:
1091 res
= set_sampler_wrap_r(ctx
, sampObj
, (GLint
) params
[0]);
1093 case GL_TEXTURE_MIN_FILTER
:
1094 res
= set_sampler_min_filter(ctx
, sampObj
, (GLint
) params
[0]);
1096 case GL_TEXTURE_MAG_FILTER
:
1097 res
= set_sampler_mag_filter(ctx
, sampObj
, (GLint
) params
[0]);
1099 case GL_TEXTURE_MIN_LOD
:
1100 res
= set_sampler_min_lod(ctx
, sampObj
, params
[0]);
1102 case GL_TEXTURE_MAX_LOD
:
1103 res
= set_sampler_max_lod(ctx
, sampObj
, params
[0]);
1105 case GL_TEXTURE_LOD_BIAS
:
1106 res
= set_sampler_lod_bias(ctx
, sampObj
, params
[0]);
1108 case GL_TEXTURE_COMPARE_MODE
:
1109 res
= set_sampler_compare_mode(ctx
, sampObj
, (GLint
) params
[0]);
1111 case GL_TEXTURE_COMPARE_FUNC
:
1112 res
= set_sampler_compare_func(ctx
, sampObj
, (GLint
) params
[0]);
1114 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1115 res
= set_sampler_max_anisotropy(ctx
, sampObj
, params
[0]);
1117 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1118 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, (GLboolean
) params
[0]);
1120 case GL_TEXTURE_SRGB_DECODE_EXT
:
1121 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1123 case GL_TEXTURE_BORDER_COLOR
:
1124 res
= set_sampler_border_colorf(ctx
, sampObj
, params
);
1127 res
= INVALID_PNAME
;
1135 /* state change - we do nothing special at this time */
1138 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterfv(pname=%s)\n",
1139 _mesa_enum_to_string(pname
));
1142 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterfv(param=%f)\n",
1146 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterfv(param=%f)\n",
1155 _mesa_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
1157 struct gl_sampler_object
*sampObj
;
1159 GET_CURRENT_CONTEXT(ctx
);
1161 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1162 "glSamplerParameterIiv");
1167 case GL_TEXTURE_WRAP_S
:
1168 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
1170 case GL_TEXTURE_WRAP_T
:
1171 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
1173 case GL_TEXTURE_WRAP_R
:
1174 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
1176 case GL_TEXTURE_MIN_FILTER
:
1177 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1179 case GL_TEXTURE_MAG_FILTER
:
1180 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1182 case GL_TEXTURE_MIN_LOD
:
1183 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1185 case GL_TEXTURE_MAX_LOD
:
1186 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1188 case GL_TEXTURE_LOD_BIAS
:
1189 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1191 case GL_TEXTURE_COMPARE_MODE
:
1192 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1194 case GL_TEXTURE_COMPARE_FUNC
:
1195 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1197 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1198 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1200 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1201 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1203 case GL_TEXTURE_SRGB_DECODE_EXT
:
1204 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1206 case GL_TEXTURE_BORDER_COLOR
:
1207 res
= set_sampler_border_colori(ctx
, sampObj
, params
);
1210 res
= INVALID_PNAME
;
1218 /* state change - we do nothing special at this time */
1221 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIiv(pname=%s)\n",
1222 _mesa_enum_to_string(pname
));
1225 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIiv(param=%d)\n",
1229 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterIiv(param=%d)\n",
1239 _mesa_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
1241 struct gl_sampler_object
*sampObj
;
1243 GET_CURRENT_CONTEXT(ctx
);
1245 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1246 "glSamplerParameterIuiv");
1251 case GL_TEXTURE_WRAP_S
:
1252 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
1254 case GL_TEXTURE_WRAP_T
:
1255 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
1257 case GL_TEXTURE_WRAP_R
:
1258 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
1260 case GL_TEXTURE_MIN_FILTER
:
1261 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1263 case GL_TEXTURE_MAG_FILTER
:
1264 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1266 case GL_TEXTURE_MIN_LOD
:
1267 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1269 case GL_TEXTURE_MAX_LOD
:
1270 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1272 case GL_TEXTURE_LOD_BIAS
:
1273 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1275 case GL_TEXTURE_COMPARE_MODE
:
1276 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1278 case GL_TEXTURE_COMPARE_FUNC
:
1279 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1281 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1282 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1284 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1285 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1287 case GL_TEXTURE_SRGB_DECODE_EXT
:
1288 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1290 case GL_TEXTURE_BORDER_COLOR
:
1291 res
= set_sampler_border_colorui(ctx
, sampObj
, params
);
1294 res
= INVALID_PNAME
;
1302 /* state change - we do nothing special at this time */
1305 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIuiv(pname=%s)\n",
1306 _mesa_enum_to_string(pname
));
1309 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIuiv(param=%u)\n",
1313 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterIuiv(param=%u)\n",
1323 _mesa_GetSamplerParameteriv(GLuint sampler
, GLenum pname
, GLint
*params
)
1325 struct gl_sampler_object
*sampObj
;
1326 GET_CURRENT_CONTEXT(ctx
);
1328 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1329 "glGetSamplerParameteriv");
1334 case GL_TEXTURE_WRAP_S
:
1335 *params
= sampObj
->WrapS
;
1337 case GL_TEXTURE_WRAP_T
:
1338 *params
= sampObj
->WrapT
;
1340 case GL_TEXTURE_WRAP_R
:
1341 *params
= sampObj
->WrapR
;
1343 case GL_TEXTURE_MIN_FILTER
:
1344 *params
= sampObj
->MinFilter
;
1346 case GL_TEXTURE_MAG_FILTER
:
1347 *params
= sampObj
->MagFilter
;
1349 case GL_TEXTURE_MIN_LOD
:
1350 /* GL spec 'Data Conversions' section specifies that floating-point
1351 * value in integer Get function is rounded to nearest integer
1353 *params
= IROUND(sampObj
->MinLod
);
1355 case GL_TEXTURE_MAX_LOD
:
1356 /* GL spec 'Data Conversions' section specifies that floating-point
1357 * value in integer Get function is rounded to nearest integer
1359 *params
= IROUND(sampObj
->MaxLod
);
1361 case GL_TEXTURE_LOD_BIAS
:
1362 /* GL spec 'Data Conversions' section specifies that floating-point
1363 * value in integer Get function is rounded to nearest integer
1365 *params
= IROUND(sampObj
->LodBias
);
1367 case GL_TEXTURE_COMPARE_MODE
:
1368 *params
= sampObj
->CompareMode
;
1370 case GL_TEXTURE_COMPARE_FUNC
:
1371 *params
= sampObj
->CompareFunc
;
1373 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1374 /* GL spec 'Data Conversions' section specifies that floating-point
1375 * value in integer Get function is rounded to nearest integer
1377 *params
= IROUND(sampObj
->MaxAnisotropy
);
1379 case GL_TEXTURE_BORDER_COLOR
:
1380 params
[0] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[0]);
1381 params
[1] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[1]);
1382 params
[2] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[2]);
1383 params
[3] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[3]);
1385 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1386 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1388 *params
= sampObj
->CubeMapSeamless
;
1390 case GL_TEXTURE_SRGB_DECODE_EXT
:
1391 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1393 *params
= (GLenum
) sampObj
->sRGBDecode
;
1401 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameteriv(pname=%s)",
1402 _mesa_enum_to_string(pname
));
1407 _mesa_GetSamplerParameterfv(GLuint sampler
, GLenum pname
, GLfloat
*params
)
1409 struct gl_sampler_object
*sampObj
;
1410 GET_CURRENT_CONTEXT(ctx
);
1412 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1413 "glGetSamplerParameterfv");
1418 case GL_TEXTURE_WRAP_S
:
1419 *params
= (GLfloat
) sampObj
->WrapS
;
1421 case GL_TEXTURE_WRAP_T
:
1422 *params
= (GLfloat
) sampObj
->WrapT
;
1424 case GL_TEXTURE_WRAP_R
:
1425 *params
= (GLfloat
) sampObj
->WrapR
;
1427 case GL_TEXTURE_MIN_FILTER
:
1428 *params
= (GLfloat
) sampObj
->MinFilter
;
1430 case GL_TEXTURE_MAG_FILTER
:
1431 *params
= (GLfloat
) sampObj
->MagFilter
;
1433 case GL_TEXTURE_MIN_LOD
:
1434 *params
= sampObj
->MinLod
;
1436 case GL_TEXTURE_MAX_LOD
:
1437 *params
= sampObj
->MaxLod
;
1439 case GL_TEXTURE_LOD_BIAS
:
1440 *params
= sampObj
->LodBias
;
1442 case GL_TEXTURE_COMPARE_MODE
:
1443 *params
= (GLfloat
) sampObj
->CompareMode
;
1445 case GL_TEXTURE_COMPARE_FUNC
:
1446 *params
= (GLfloat
) sampObj
->CompareFunc
;
1448 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1449 *params
= sampObj
->MaxAnisotropy
;
1451 case GL_TEXTURE_BORDER_COLOR
:
1452 params
[0] = sampObj
->BorderColor
.f
[0];
1453 params
[1] = sampObj
->BorderColor
.f
[1];
1454 params
[2] = sampObj
->BorderColor
.f
[2];
1455 params
[3] = sampObj
->BorderColor
.f
[3];
1457 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1458 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1460 *params
= (GLfloat
) sampObj
->CubeMapSeamless
;
1462 case GL_TEXTURE_SRGB_DECODE_EXT
:
1463 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1465 *params
= (GLfloat
) sampObj
->sRGBDecode
;
1473 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterfv(pname=%s)",
1474 _mesa_enum_to_string(pname
));
1479 _mesa_GetSamplerParameterIiv(GLuint sampler
, GLenum pname
, GLint
*params
)
1481 struct gl_sampler_object
*sampObj
;
1482 GET_CURRENT_CONTEXT(ctx
);
1484 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1485 "glGetSamplerParameterIiv");
1490 case GL_TEXTURE_WRAP_S
:
1491 *params
= sampObj
->WrapS
;
1493 case GL_TEXTURE_WRAP_T
:
1494 *params
= sampObj
->WrapT
;
1496 case GL_TEXTURE_WRAP_R
:
1497 *params
= sampObj
->WrapR
;
1499 case GL_TEXTURE_MIN_FILTER
:
1500 *params
= sampObj
->MinFilter
;
1502 case GL_TEXTURE_MAG_FILTER
:
1503 *params
= sampObj
->MagFilter
;
1505 case GL_TEXTURE_MIN_LOD
:
1506 *params
= (GLint
) sampObj
->MinLod
;
1508 case GL_TEXTURE_MAX_LOD
:
1509 *params
= (GLint
) sampObj
->MaxLod
;
1511 case GL_TEXTURE_LOD_BIAS
:
1512 *params
= (GLint
) sampObj
->LodBias
;
1514 case GL_TEXTURE_COMPARE_MODE
:
1515 *params
= sampObj
->CompareMode
;
1517 case GL_TEXTURE_COMPARE_FUNC
:
1518 *params
= sampObj
->CompareFunc
;
1520 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1521 *params
= (GLint
) sampObj
->MaxAnisotropy
;
1523 case GL_TEXTURE_BORDER_COLOR
:
1524 params
[0] = sampObj
->BorderColor
.i
[0];
1525 params
[1] = sampObj
->BorderColor
.i
[1];
1526 params
[2] = sampObj
->BorderColor
.i
[2];
1527 params
[3] = sampObj
->BorderColor
.i
[3];
1529 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1530 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1532 *params
= sampObj
->CubeMapSeamless
;
1534 case GL_TEXTURE_SRGB_DECODE_EXT
:
1535 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1537 *params
= (GLenum
) sampObj
->sRGBDecode
;
1545 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterIiv(pname=%s)",
1546 _mesa_enum_to_string(pname
));
1551 _mesa_GetSamplerParameterIuiv(GLuint sampler
, GLenum pname
, GLuint
*params
)
1553 struct gl_sampler_object
*sampObj
;
1554 GET_CURRENT_CONTEXT(ctx
);
1556 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1557 "glGetSamplerParameterIuiv");
1562 case GL_TEXTURE_WRAP_S
:
1563 *params
= sampObj
->WrapS
;
1565 case GL_TEXTURE_WRAP_T
:
1566 *params
= sampObj
->WrapT
;
1568 case GL_TEXTURE_WRAP_R
:
1569 *params
= sampObj
->WrapR
;
1571 case GL_TEXTURE_MIN_FILTER
:
1572 *params
= sampObj
->MinFilter
;
1574 case GL_TEXTURE_MAG_FILTER
:
1575 *params
= sampObj
->MagFilter
;
1577 case GL_TEXTURE_MIN_LOD
:
1578 *params
= (GLuint
) sampObj
->MinLod
;
1580 case GL_TEXTURE_MAX_LOD
:
1581 *params
= (GLuint
) sampObj
->MaxLod
;
1583 case GL_TEXTURE_LOD_BIAS
:
1584 *params
= (GLuint
) sampObj
->LodBias
;
1586 case GL_TEXTURE_COMPARE_MODE
:
1587 *params
= sampObj
->CompareMode
;
1589 case GL_TEXTURE_COMPARE_FUNC
:
1590 *params
= sampObj
->CompareFunc
;
1592 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1593 *params
= (GLuint
) sampObj
->MaxAnisotropy
;
1595 case GL_TEXTURE_BORDER_COLOR
:
1596 params
[0] = sampObj
->BorderColor
.ui
[0];
1597 params
[1] = sampObj
->BorderColor
.ui
[1];
1598 params
[2] = sampObj
->BorderColor
.ui
[2];
1599 params
[3] = sampObj
->BorderColor
.ui
[3];
1601 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1602 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1604 *params
= sampObj
->CubeMapSeamless
;
1606 case GL_TEXTURE_SRGB_DECODE_EXT
:
1607 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1609 *params
= (GLenum
) sampObj
->sRGBDecode
;
1617 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterIuiv(pname=%s)",
1618 _mesa_enum_to_string(pname
));
1623 _mesa_init_sampler_object_functions(struct dd_function_table
*driver
)
1625 driver
->NewSamplerObject
= _mesa_new_sampler_object
;