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"
41 #include "main/texturebindless.h"
44 struct gl_sampler_object
*
45 _mesa_lookup_samplerobj(struct gl_context
*ctx
, GLuint name
)
50 return (struct gl_sampler_object
*)
51 _mesa_HashLookup(ctx
->Shared
->SamplerObjects
, name
);
54 static inline struct gl_sampler_object
*
55 lookup_samplerobj_locked(struct gl_context
*ctx
, GLuint name
)
57 return (struct gl_sampler_object
*)
58 _mesa_HashLookupLocked(ctx
->Shared
->SamplerObjects
, name
);
62 delete_sampler_object(struct gl_context
*ctx
,
63 struct gl_sampler_object
*sampObj
)
65 _mesa_delete_sampler_handles(ctx
, sampObj
);
66 mtx_destroy(&sampObj
->Mutex
);
72 * Handle reference counting.
75 _mesa_reference_sampler_object_(struct gl_context
*ctx
,
76 struct gl_sampler_object
**ptr
,
77 struct gl_sampler_object
*samp
)
79 assert(*ptr
!= samp
); /* The inline wrapper should prevent no-op calls */
82 /* Unreference the old sampler */
83 GLboolean deleteFlag
= GL_FALSE
;
84 struct gl_sampler_object
*oldSamp
= *ptr
;
86 mtx_lock(&oldSamp
->Mutex
);
87 assert(oldSamp
->RefCount
> 0);
89 deleteFlag
= (oldSamp
->RefCount
== 0);
90 mtx_unlock(&oldSamp
->Mutex
);
93 delete_sampler_object(ctx
, oldSamp
);
100 /* reference new sampler */
101 mtx_lock(&samp
->Mutex
);
102 assert(samp
->RefCount
> 0);
106 mtx_unlock(&samp
->Mutex
);
112 * Initialize the fields of the given sampler object.
115 _mesa_init_sampler_object(struct gl_sampler_object
*sampObj
, GLuint name
)
117 mtx_init(&sampObj
->Mutex
, mtx_plain
);
118 sampObj
->Name
= name
;
119 sampObj
->RefCount
= 1;
120 sampObj
->WrapS
= GL_REPEAT
;
121 sampObj
->WrapT
= GL_REPEAT
;
122 sampObj
->WrapR
= GL_REPEAT
;
123 sampObj
->MinFilter
= GL_NEAREST_MIPMAP_LINEAR
;
124 sampObj
->MagFilter
= GL_LINEAR
;
125 sampObj
->BorderColor
.f
[0] = 0.0;
126 sampObj
->BorderColor
.f
[1] = 0.0;
127 sampObj
->BorderColor
.f
[2] = 0.0;
128 sampObj
->BorderColor
.f
[3] = 0.0;
129 sampObj
->MinLod
= -1000.0F
;
130 sampObj
->MaxLod
= 1000.0F
;
131 sampObj
->LodBias
= 0.0F
;
132 sampObj
->MaxAnisotropy
= 1.0F
;
133 sampObj
->CompareMode
= GL_NONE
;
134 sampObj
->CompareFunc
= GL_LEQUAL
;
135 sampObj
->sRGBDecode
= GL_DECODE_EXT
;
136 sampObj
->CubeMapSeamless
= GL_FALSE
;
137 sampObj
->HandleAllocated
= GL_FALSE
;
139 /* GL_ARB_bindless_texture */
140 _mesa_init_sampler_handles(sampObj
);
144 * Fallback for ctx->Driver.NewSamplerObject();
146 struct gl_sampler_object
*
147 _mesa_new_sampler_object(struct gl_context
*ctx
, GLuint name
)
149 struct gl_sampler_object
*sampObj
= CALLOC_STRUCT(gl_sampler_object
);
151 _mesa_init_sampler_object(sampObj
, name
);
157 create_samplers(struct gl_context
*ctx
, GLsizei count
, GLuint
*samplers
)
165 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
167 first
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->SamplerObjects
, count
);
169 /* Insert the ID and pointer to new sampler object into hash table */
170 for (i
= 0; i
< count
; i
++) {
171 struct gl_sampler_object
*sampObj
=
172 ctx
->Driver
.NewSamplerObject(ctx
, first
+ i
);
173 _mesa_HashInsertLocked(ctx
->Shared
->SamplerObjects
, first
+ i
, sampObj
);
174 samplers
[i
] = first
+ i
;
177 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
181 create_samplers_err(struct gl_context
*ctx
, GLsizei count
, GLuint
*samplers
,
185 if (MESA_VERBOSE
& VERBOSE_API
)
186 _mesa_debug(ctx
, "%s(%d)\n", caller
, count
);
189 _mesa_error(ctx
, GL_INVALID_VALUE
, "%s(n<0)", caller
);
193 create_samplers(ctx
, count
, samplers
);
197 _mesa_GenSamplers(GLsizei count
, GLuint
*samplers
)
199 GET_CURRENT_CONTEXT(ctx
);
200 create_samplers_err(ctx
, count
, samplers
, "glGenSamplers");
204 _mesa_CreateSamplers(GLsizei count
, GLuint
*samplers
)
206 GET_CURRENT_CONTEXT(ctx
);
207 create_samplers_err(ctx
, count
, samplers
, "glCreateSamplers");
212 _mesa_DeleteSamplers(GLsizei count
, const GLuint
*samplers
)
214 GET_CURRENT_CONTEXT(ctx
);
217 FLUSH_VERTICES(ctx
, 0);
220 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteSamplers(count)");
224 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
226 for (i
= 0; i
< count
; i
++) {
229 struct gl_sampler_object
*sampObj
=
230 lookup_samplerobj_locked(ctx
, samplers
[i
]);
233 /* If the sampler is currently bound, unbind it. */
234 for (j
= 0; j
< ctx
->Const
.MaxCombinedTextureImageUnits
; j
++) {
235 if (ctx
->Texture
.Unit
[j
].Sampler
== sampObj
) {
236 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
237 _mesa_reference_sampler_object(ctx
, &ctx
->Texture
.Unit
[j
].Sampler
, NULL
);
241 /* The ID is immediately freed for re-use */
242 _mesa_HashRemoveLocked(ctx
->Shared
->SamplerObjects
, samplers
[i
]);
243 /* But the object exists until its reference count goes to zero */
244 _mesa_reference_sampler_object(ctx
, &sampObj
, NULL
);
249 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
254 _mesa_IsSampler(GLuint sampler
)
256 GET_CURRENT_CONTEXT(ctx
);
258 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
260 return _mesa_lookup_samplerobj(ctx
, sampler
) != NULL
;
264 _mesa_bind_sampler(struct gl_context
*ctx
, GLuint unit
,
265 struct gl_sampler_object
*sampObj
)
267 if (ctx
->Texture
.Unit
[unit
].Sampler
!= sampObj
) {
268 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
271 _mesa_reference_sampler_object(ctx
, &ctx
->Texture
.Unit
[unit
].Sampler
,
276 _mesa_BindSampler(GLuint unit
, GLuint sampler
)
278 struct gl_sampler_object
*sampObj
;
279 GET_CURRENT_CONTEXT(ctx
);
281 if (unit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
282 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindSampler(unit %u)", unit
);
287 /* Use the default sampler object, the one contained in the texture
293 /* user-defined sampler object */
294 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
296 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glBindSampler(sampler)");
301 /* bind new sampler */
302 _mesa_bind_sampler(ctx
, unit
, sampObj
);
307 _mesa_BindSamplers(GLuint first
, GLsizei count
, const GLuint
*samplers
)
309 GET_CURRENT_CONTEXT(ctx
);
312 /* The ARB_multi_bind spec says:
314 * "An INVALID_OPERATION error is generated if <first> + <count> is
315 * greater than the number of texture image units supported by
316 * the implementation."
318 if (first
+ count
> ctx
->Const
.MaxCombinedTextureImageUnits
) {
319 _mesa_error(ctx
, GL_INVALID_OPERATION
,
320 "glBindSamplers(first=%u + count=%d > the value of "
321 "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS=%u)",
322 first
, count
, ctx
->Const
.MaxCombinedTextureImageUnits
);
326 FLUSH_VERTICES(ctx
, 0);
329 /* Note that the error semantics for multi-bind commands differ from
330 * those of other GL commands.
332 * The Issues section in the ARB_multi_bind spec says:
334 * "(11) Typically, OpenGL specifies that if an error is generated by
335 * a command, that command has no effect. This is somewhat
336 * unfortunate for multi-bind commands, because it would require
337 * a first pass to scan the entire list of bound objects for
338 * errors and then a second pass to actually perform the
339 * bindings. Should we have different error semantics?
341 * RESOLVED: Yes. In this specification, when the parameters for
342 * one of the <count> binding points are invalid, that binding
343 * point is not updated and an error will be generated. However,
344 * other binding points in the same command will be updated if
345 * their parameters are valid and no other error occurs."
348 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
350 for (i
= 0; i
< count
; i
++) {
351 const GLuint unit
= first
+ i
;
352 struct gl_sampler_object
* const currentSampler
=
353 ctx
->Texture
.Unit
[unit
].Sampler
;
354 struct gl_sampler_object
*sampObj
;
356 if (samplers
[i
] != 0) {
357 if (currentSampler
&& currentSampler
->Name
== samplers
[i
])
358 sampObj
= currentSampler
;
360 sampObj
= lookup_samplerobj_locked(ctx
, samplers
[i
]);
362 /* The ARB_multi_bind spec says:
364 * "An INVALID_OPERATION error is generated if any value
365 * in <samplers> is not zero or the name of an existing
366 * sampler object (per binding)."
369 _mesa_error(ctx
, GL_INVALID_OPERATION
,
370 "glBindSamplers(samplers[%d]=%u is not zero or "
371 "the name of an existing sampler object)",
379 /* Bind the new sampler */
380 if (sampObj
!= currentSampler
) {
381 _mesa_reference_sampler_object(ctx
,
382 &ctx
->Texture
.Unit
[unit
].Sampler
,
384 ctx
->NewState
|= _NEW_TEXTURE_OBJECT
;
388 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
390 /* Unbind all samplers in the range <first> through <first>+<count>-1 */
391 for (i
= 0; i
< count
; i
++) {
392 const GLuint unit
= first
+ i
;
394 if (ctx
->Texture
.Unit
[unit
].Sampler
) {
395 _mesa_reference_sampler_object(ctx
,
396 &ctx
->Texture
.Unit
[unit
].Sampler
,
398 ctx
->NewState
|= _NEW_TEXTURE_OBJECT
;
406 * Check if a coordinate wrap mode is legal.
407 * \return GL_TRUE if legal, GL_FALSE otherwise
410 validate_texture_wrap_mode(struct gl_context
*ctx
, GLenum wrap
)
412 const struct gl_extensions
* const e
= &ctx
->Extensions
;
416 case GL_CLAMP_TO_EDGE
:
418 case GL_MIRRORED_REPEAT
:
420 case GL_CLAMP_TO_BORDER
:
421 return e
->ARB_texture_border_clamp
;
422 case GL_MIRROR_CLAMP_EXT
:
423 return e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
;
424 case GL_MIRROR_CLAMP_TO_EDGE_EXT
:
425 return e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
|| e
->ARB_texture_mirror_clamp_to_edge
;
426 case GL_MIRROR_CLAMP_TO_BORDER_EXT
:
427 return e
->EXT_texture_mirror_clamp
;
435 * This is called just prior to changing any sampler object state.
438 flush(struct gl_context
*ctx
)
440 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
444 _mesa_set_sampler_wrap(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
445 GLenum s
, GLenum t
, GLenum r
)
447 assert(validate_texture_wrap_mode(ctx
, s
));
448 assert(validate_texture_wrap_mode(ctx
, t
));
449 assert(validate_texture_wrap_mode(ctx
, r
));
451 if (samp
->WrapS
== s
&& samp
->WrapT
== t
&& samp
->WrapR
== r
)
460 #define INVALID_PARAM 0x100
461 #define INVALID_PNAME 0x101
462 #define INVALID_VALUE 0x102
465 set_sampler_wrap_s(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
468 if (samp
->WrapS
== param
)
470 if (validate_texture_wrap_mode(ctx
, param
)) {
475 return INVALID_PARAM
;
480 set_sampler_wrap_t(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
483 if (samp
->WrapT
== param
)
485 if (validate_texture_wrap_mode(ctx
, param
)) {
490 return INVALID_PARAM
;
495 set_sampler_wrap_r(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
498 if (samp
->WrapR
== param
)
500 if (validate_texture_wrap_mode(ctx
, param
)) {
505 return INVALID_PARAM
;
509 _mesa_set_sampler_filters(struct gl_context
*ctx
,
510 struct gl_sampler_object
*samp
,
511 GLenum min_filter
, GLenum mag_filter
)
513 assert(min_filter
== GL_NEAREST
||
514 min_filter
== GL_LINEAR
||
515 min_filter
== GL_NEAREST_MIPMAP_NEAREST
||
516 min_filter
== GL_LINEAR_MIPMAP_NEAREST
||
517 min_filter
== GL_NEAREST_MIPMAP_LINEAR
||
518 min_filter
== GL_LINEAR_MIPMAP_LINEAR
);
519 assert(mag_filter
== GL_NEAREST
||
520 mag_filter
== GL_LINEAR
);
522 if (samp
->MinFilter
== min_filter
&& samp
->MagFilter
== mag_filter
)
526 samp
->MinFilter
= min_filter
;
527 samp
->MagFilter
= mag_filter
;
531 set_sampler_min_filter(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
534 if (samp
->MinFilter
== param
)
540 case GL_NEAREST_MIPMAP_NEAREST
:
541 case GL_LINEAR_MIPMAP_NEAREST
:
542 case GL_NEAREST_MIPMAP_LINEAR
:
543 case GL_LINEAR_MIPMAP_LINEAR
:
545 samp
->MinFilter
= param
;
548 return INVALID_PARAM
;
554 set_sampler_mag_filter(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
557 if (samp
->MagFilter
== param
)
564 samp
->MagFilter
= param
;
567 return INVALID_PARAM
;
573 set_sampler_lod_bias(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
576 if (samp
->LodBias
== param
)
580 samp
->LodBias
= param
;
586 set_sampler_border_colorf(struct gl_context
*ctx
,
587 struct gl_sampler_object
*samp
,
588 const GLfloat params
[4])
591 samp
->BorderColor
.f
[RCOMP
] = params
[0];
592 samp
->BorderColor
.f
[GCOMP
] = params
[1];
593 samp
->BorderColor
.f
[BCOMP
] = params
[2];
594 samp
->BorderColor
.f
[ACOMP
] = params
[3];
600 set_sampler_border_colori(struct gl_context
*ctx
,
601 struct gl_sampler_object
*samp
,
602 const GLint params
[4])
605 samp
->BorderColor
.i
[RCOMP
] = params
[0];
606 samp
->BorderColor
.i
[GCOMP
] = params
[1];
607 samp
->BorderColor
.i
[BCOMP
] = params
[2];
608 samp
->BorderColor
.i
[ACOMP
] = params
[3];
614 set_sampler_border_colorui(struct gl_context
*ctx
,
615 struct gl_sampler_object
*samp
,
616 const GLuint params
[4])
619 samp
->BorderColor
.ui
[RCOMP
] = params
[0];
620 samp
->BorderColor
.ui
[GCOMP
] = params
[1];
621 samp
->BorderColor
.ui
[BCOMP
] = params
[2];
622 samp
->BorderColor
.ui
[ACOMP
] = params
[3];
628 set_sampler_min_lod(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
631 if (samp
->MinLod
== param
)
635 samp
->MinLod
= param
;
641 set_sampler_max_lod(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
644 if (samp
->MaxLod
== param
)
648 samp
->MaxLod
= param
;
654 set_sampler_compare_mode(struct gl_context
*ctx
,
655 struct gl_sampler_object
*samp
, GLint param
)
657 /* If GL_ARB_shadow is not supported, don't report an error. The
658 * sampler object extension spec isn't clear on this extension interaction.
659 * Silences errors with Wine on older GPUs such as R200.
661 if (!ctx
->Extensions
.ARB_shadow
)
664 if (samp
->CompareMode
== param
)
667 if (param
== GL_NONE
||
668 param
== GL_COMPARE_R_TO_TEXTURE_ARB
) {
670 samp
->CompareMode
= param
;
674 return INVALID_PARAM
;
679 set_sampler_compare_func(struct gl_context
*ctx
,
680 struct gl_sampler_object
*samp
, GLint param
)
682 /* If GL_ARB_shadow is not supported, don't report an error. The
683 * sampler object extension spec isn't clear on this extension interaction.
684 * Silences errors with Wine on older GPUs such as R200.
686 if (!ctx
->Extensions
.ARB_shadow
)
689 if (samp
->CompareFunc
== param
)
702 samp
->CompareFunc
= param
;
705 return INVALID_PARAM
;
711 set_sampler_max_anisotropy(struct gl_context
*ctx
,
712 struct gl_sampler_object
*samp
, GLfloat param
)
714 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
715 return INVALID_PNAME
;
717 if (samp
->MaxAnisotropy
== param
)
721 return INVALID_VALUE
;
724 /* clamp to max, that's what NVIDIA does */
725 samp
->MaxAnisotropy
= MIN2(param
, ctx
->Const
.MaxTextureMaxAnisotropy
);
731 set_sampler_cube_map_seamless(struct gl_context
*ctx
,
732 struct gl_sampler_object
*samp
, GLboolean param
)
734 if (!_mesa_is_desktop_gl(ctx
)
735 || !ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
736 return INVALID_PNAME
;
738 if (samp
->CubeMapSeamless
== param
)
741 if (param
!= GL_TRUE
&& param
!= GL_FALSE
)
742 return INVALID_VALUE
;
745 samp
->CubeMapSeamless
= param
;
750 _mesa_set_sampler_srgb_decode(struct gl_context
*ctx
,
751 struct gl_sampler_object
*samp
, GLenum param
)
753 assert(param
== GL_DECODE_EXT
|| param
== GL_SKIP_DECODE_EXT
);
756 samp
->sRGBDecode
= param
;
760 set_sampler_srgb_decode(struct gl_context
*ctx
,
761 struct gl_sampler_object
*samp
, GLenum param
)
763 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
764 return INVALID_PNAME
;
766 if (samp
->sRGBDecode
== param
)
769 if (param
!= GL_DECODE_EXT
&& param
!= GL_SKIP_DECODE_EXT
)
770 return INVALID_VALUE
;
773 samp
->sRGBDecode
= param
;
777 static struct gl_sampler_object
*
778 sampler_parameter_error_check(struct gl_context
*ctx
, GLuint sampler
,
779 bool get
, const char *name
)
781 struct gl_sampler_object
*sampObj
;
783 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
785 /* OpenGL 4.5 spec, section "8.2 Sampler Objects", page 176 of the PDF
788 * "An INVALID_OPERATION error is generated if sampler is not the name
789 * of a sampler object previously returned from a call to
792 _mesa_error(ctx
, GL_INVALID_OPERATION
, "%s(invalid sampler)", name
);
796 if (!get
&& sampObj
->HandleAllocated
) {
797 /* The ARB_bindless_texture spec says:
799 * "The error INVALID_OPERATION is generated by SamplerParameter* if
800 * <sampler> identifies a sampler object referenced by one or more
803 _mesa_error(ctx
, GL_INVALID_OPERATION
, "%s(immutable sampler)", name
);
811 _mesa_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
813 struct gl_sampler_object
*sampObj
;
815 GET_CURRENT_CONTEXT(ctx
);
817 sampObj
= sampler_parameter_error_check(ctx
, sampler
, false,
818 "glSamplerParameteri");
823 case GL_TEXTURE_WRAP_S
:
824 res
= set_sampler_wrap_s(ctx
, sampObj
, param
);
826 case GL_TEXTURE_WRAP_T
:
827 res
= set_sampler_wrap_t(ctx
, sampObj
, param
);
829 case GL_TEXTURE_WRAP_R
:
830 res
= set_sampler_wrap_r(ctx
, sampObj
, param
);
832 case GL_TEXTURE_MIN_FILTER
:
833 res
= set_sampler_min_filter(ctx
, sampObj
, param
);
835 case GL_TEXTURE_MAG_FILTER
:
836 res
= set_sampler_mag_filter(ctx
, sampObj
, param
);
838 case GL_TEXTURE_MIN_LOD
:
839 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) param
);
841 case GL_TEXTURE_MAX_LOD
:
842 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) param
);
844 case GL_TEXTURE_LOD_BIAS
:
845 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) param
);
847 case GL_TEXTURE_COMPARE_MODE
:
848 res
= set_sampler_compare_mode(ctx
, sampObj
, param
);
850 case GL_TEXTURE_COMPARE_FUNC
:
851 res
= set_sampler_compare_func(ctx
, sampObj
, param
);
853 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
854 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) param
);
856 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
857 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, param
);
859 case GL_TEXTURE_SRGB_DECODE_EXT
:
860 res
= set_sampler_srgb_decode(ctx
, sampObj
, param
);
862 case GL_TEXTURE_BORDER_COLOR
:
873 /* state change - we do nothing special at this time */
876 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteri(pname=%s)\n",
877 _mesa_enum_to_string(pname
));
880 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteri(param=%d)\n",
884 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameteri(param=%d)\n",
894 _mesa_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
896 struct gl_sampler_object
*sampObj
;
898 GET_CURRENT_CONTEXT(ctx
);
900 sampObj
= sampler_parameter_error_check(ctx
, sampler
, false,
901 "glSamplerParameterf");
906 case GL_TEXTURE_WRAP_S
:
907 res
= set_sampler_wrap_s(ctx
, sampObj
, (GLint
) param
);
909 case GL_TEXTURE_WRAP_T
:
910 res
= set_sampler_wrap_t(ctx
, sampObj
, (GLint
) param
);
912 case GL_TEXTURE_WRAP_R
:
913 res
= set_sampler_wrap_r(ctx
, sampObj
, (GLint
) param
);
915 case GL_TEXTURE_MIN_FILTER
:
916 res
= set_sampler_min_filter(ctx
, sampObj
, (GLint
) param
);
918 case GL_TEXTURE_MAG_FILTER
:
919 res
= set_sampler_mag_filter(ctx
, sampObj
, (GLint
) param
);
921 case GL_TEXTURE_MIN_LOD
:
922 res
= set_sampler_min_lod(ctx
, sampObj
, param
);
924 case GL_TEXTURE_MAX_LOD
:
925 res
= set_sampler_max_lod(ctx
, sampObj
, param
);
927 case GL_TEXTURE_LOD_BIAS
:
928 res
= set_sampler_lod_bias(ctx
, sampObj
, param
);
930 case GL_TEXTURE_COMPARE_MODE
:
931 res
= set_sampler_compare_mode(ctx
, sampObj
, (GLint
) param
);
933 case GL_TEXTURE_COMPARE_FUNC
:
934 res
= set_sampler_compare_func(ctx
, sampObj
, (GLint
) param
);
936 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
937 res
= set_sampler_max_anisotropy(ctx
, sampObj
, param
);
939 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
940 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, (GLboolean
) param
);
942 case GL_TEXTURE_SRGB_DECODE_EXT
:
943 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) param
);
945 case GL_TEXTURE_BORDER_COLOR
:
956 /* state change - we do nothing special at this time */
959 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterf(pname=%s)\n",
960 _mesa_enum_to_string(pname
));
963 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterf(param=%f)\n",
967 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterf(param=%f)\n",
976 _mesa_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
978 struct gl_sampler_object
*sampObj
;
980 GET_CURRENT_CONTEXT(ctx
);
982 sampObj
= sampler_parameter_error_check(ctx
, sampler
, false,
983 "glSamplerParameteriv");
988 case GL_TEXTURE_WRAP_S
:
989 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
991 case GL_TEXTURE_WRAP_T
:
992 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
994 case GL_TEXTURE_WRAP_R
:
995 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
997 case GL_TEXTURE_MIN_FILTER
:
998 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1000 case GL_TEXTURE_MAG_FILTER
:
1001 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1003 case GL_TEXTURE_MIN_LOD
:
1004 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1006 case GL_TEXTURE_MAX_LOD
:
1007 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1009 case GL_TEXTURE_LOD_BIAS
:
1010 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1012 case GL_TEXTURE_COMPARE_MODE
:
1013 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1015 case GL_TEXTURE_COMPARE_FUNC
:
1016 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1018 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1019 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1021 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1022 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1024 case GL_TEXTURE_SRGB_DECODE_EXT
:
1025 res
= set_sampler_srgb_decode(ctx
, sampObj
, params
[0]);
1027 case GL_TEXTURE_BORDER_COLOR
:
1030 c
[0] = INT_TO_FLOAT(params
[0]);
1031 c
[1] = INT_TO_FLOAT(params
[1]);
1032 c
[2] = INT_TO_FLOAT(params
[2]);
1033 c
[3] = INT_TO_FLOAT(params
[3]);
1034 res
= set_sampler_border_colorf(ctx
, sampObj
, c
);
1038 res
= INVALID_PNAME
;
1046 /* state change - we do nothing special at this time */
1049 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteriv(pname=%s)\n",
1050 _mesa_enum_to_string(pname
));
1053 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteriv(param=%d)\n",
1057 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameteriv(param=%d)\n",
1066 _mesa_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
1068 struct gl_sampler_object
*sampObj
;
1070 GET_CURRENT_CONTEXT(ctx
);
1072 sampObj
= sampler_parameter_error_check(ctx
, sampler
, false,
1073 "glSamplerParameterfv");
1078 case GL_TEXTURE_WRAP_S
:
1079 res
= set_sampler_wrap_s(ctx
, sampObj
, (GLint
) params
[0]);
1081 case GL_TEXTURE_WRAP_T
:
1082 res
= set_sampler_wrap_t(ctx
, sampObj
, (GLint
) params
[0]);
1084 case GL_TEXTURE_WRAP_R
:
1085 res
= set_sampler_wrap_r(ctx
, sampObj
, (GLint
) params
[0]);
1087 case GL_TEXTURE_MIN_FILTER
:
1088 res
= set_sampler_min_filter(ctx
, sampObj
, (GLint
) params
[0]);
1090 case GL_TEXTURE_MAG_FILTER
:
1091 res
= set_sampler_mag_filter(ctx
, sampObj
, (GLint
) params
[0]);
1093 case GL_TEXTURE_MIN_LOD
:
1094 res
= set_sampler_min_lod(ctx
, sampObj
, params
[0]);
1096 case GL_TEXTURE_MAX_LOD
:
1097 res
= set_sampler_max_lod(ctx
, sampObj
, params
[0]);
1099 case GL_TEXTURE_LOD_BIAS
:
1100 res
= set_sampler_lod_bias(ctx
, sampObj
, params
[0]);
1102 case GL_TEXTURE_COMPARE_MODE
:
1103 res
= set_sampler_compare_mode(ctx
, sampObj
, (GLint
) params
[0]);
1105 case GL_TEXTURE_COMPARE_FUNC
:
1106 res
= set_sampler_compare_func(ctx
, sampObj
, (GLint
) params
[0]);
1108 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1109 res
= set_sampler_max_anisotropy(ctx
, sampObj
, params
[0]);
1111 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1112 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, (GLboolean
) params
[0]);
1114 case GL_TEXTURE_SRGB_DECODE_EXT
:
1115 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1117 case GL_TEXTURE_BORDER_COLOR
:
1118 res
= set_sampler_border_colorf(ctx
, sampObj
, params
);
1121 res
= INVALID_PNAME
;
1129 /* state change - we do nothing special at this time */
1132 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterfv(pname=%s)\n",
1133 _mesa_enum_to_string(pname
));
1136 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterfv(param=%f)\n",
1140 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterfv(param=%f)\n",
1149 _mesa_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
1151 struct gl_sampler_object
*sampObj
;
1153 GET_CURRENT_CONTEXT(ctx
);
1155 sampObj
= sampler_parameter_error_check(ctx
, sampler
, false,
1156 "glSamplerParameterIiv");
1161 case GL_TEXTURE_WRAP_S
:
1162 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
1164 case GL_TEXTURE_WRAP_T
:
1165 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
1167 case GL_TEXTURE_WRAP_R
:
1168 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
1170 case GL_TEXTURE_MIN_FILTER
:
1171 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1173 case GL_TEXTURE_MAG_FILTER
:
1174 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1176 case GL_TEXTURE_MIN_LOD
:
1177 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1179 case GL_TEXTURE_MAX_LOD
:
1180 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1182 case GL_TEXTURE_LOD_BIAS
:
1183 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1185 case GL_TEXTURE_COMPARE_MODE
:
1186 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1188 case GL_TEXTURE_COMPARE_FUNC
:
1189 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1191 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1192 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1194 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1195 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1197 case GL_TEXTURE_SRGB_DECODE_EXT
:
1198 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1200 case GL_TEXTURE_BORDER_COLOR
:
1201 res
= set_sampler_border_colori(ctx
, sampObj
, params
);
1204 res
= INVALID_PNAME
;
1212 /* state change - we do nothing special at this time */
1215 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIiv(pname=%s)\n",
1216 _mesa_enum_to_string(pname
));
1219 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIiv(param=%d)\n",
1223 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterIiv(param=%d)\n",
1233 _mesa_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
1235 struct gl_sampler_object
*sampObj
;
1237 GET_CURRENT_CONTEXT(ctx
);
1239 sampObj
= sampler_parameter_error_check(ctx
, sampler
, false,
1240 "glSamplerParameterIuiv");
1245 case GL_TEXTURE_WRAP_S
:
1246 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
1248 case GL_TEXTURE_WRAP_T
:
1249 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
1251 case GL_TEXTURE_WRAP_R
:
1252 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
1254 case GL_TEXTURE_MIN_FILTER
:
1255 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1257 case GL_TEXTURE_MAG_FILTER
:
1258 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1260 case GL_TEXTURE_MIN_LOD
:
1261 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1263 case GL_TEXTURE_MAX_LOD
:
1264 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1266 case GL_TEXTURE_LOD_BIAS
:
1267 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1269 case GL_TEXTURE_COMPARE_MODE
:
1270 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1272 case GL_TEXTURE_COMPARE_FUNC
:
1273 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1275 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1276 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1278 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1279 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1281 case GL_TEXTURE_SRGB_DECODE_EXT
:
1282 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1284 case GL_TEXTURE_BORDER_COLOR
:
1285 res
= set_sampler_border_colorui(ctx
, sampObj
, params
);
1288 res
= INVALID_PNAME
;
1296 /* state change - we do nothing special at this time */
1299 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIuiv(pname=%s)\n",
1300 _mesa_enum_to_string(pname
));
1303 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIuiv(param=%u)\n",
1307 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterIuiv(param=%u)\n",
1317 _mesa_GetSamplerParameteriv(GLuint sampler
, GLenum pname
, GLint
*params
)
1319 struct gl_sampler_object
*sampObj
;
1320 GET_CURRENT_CONTEXT(ctx
);
1322 sampObj
= sampler_parameter_error_check(ctx
, sampler
, true,
1323 "glGetSamplerParameteriv");
1328 case GL_TEXTURE_WRAP_S
:
1329 *params
= sampObj
->WrapS
;
1331 case GL_TEXTURE_WRAP_T
:
1332 *params
= sampObj
->WrapT
;
1334 case GL_TEXTURE_WRAP_R
:
1335 *params
= sampObj
->WrapR
;
1337 case GL_TEXTURE_MIN_FILTER
:
1338 *params
= sampObj
->MinFilter
;
1340 case GL_TEXTURE_MAG_FILTER
:
1341 *params
= sampObj
->MagFilter
;
1343 case GL_TEXTURE_MIN_LOD
:
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
->MinLod
);
1349 case GL_TEXTURE_MAX_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
->MaxLod
);
1355 case GL_TEXTURE_LOD_BIAS
:
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
->LodBias
);
1361 case GL_TEXTURE_COMPARE_MODE
:
1362 *params
= sampObj
->CompareMode
;
1364 case GL_TEXTURE_COMPARE_FUNC
:
1365 *params
= sampObj
->CompareFunc
;
1367 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1368 /* GL spec 'Data Conversions' section specifies that floating-point
1369 * value in integer Get function is rounded to nearest integer
1371 *params
= IROUND(sampObj
->MaxAnisotropy
);
1373 case GL_TEXTURE_BORDER_COLOR
:
1374 params
[0] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[0]);
1375 params
[1] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[1]);
1376 params
[2] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[2]);
1377 params
[3] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[3]);
1379 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1380 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1382 *params
= sampObj
->CubeMapSeamless
;
1384 case GL_TEXTURE_SRGB_DECODE_EXT
:
1385 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1387 *params
= (GLenum
) sampObj
->sRGBDecode
;
1395 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameteriv(pname=%s)",
1396 _mesa_enum_to_string(pname
));
1401 _mesa_GetSamplerParameterfv(GLuint sampler
, GLenum pname
, GLfloat
*params
)
1403 struct gl_sampler_object
*sampObj
;
1404 GET_CURRENT_CONTEXT(ctx
);
1406 sampObj
= sampler_parameter_error_check(ctx
, sampler
, true,
1407 "glGetSamplerParameterfv");
1412 case GL_TEXTURE_WRAP_S
:
1413 *params
= (GLfloat
) sampObj
->WrapS
;
1415 case GL_TEXTURE_WRAP_T
:
1416 *params
= (GLfloat
) sampObj
->WrapT
;
1418 case GL_TEXTURE_WRAP_R
:
1419 *params
= (GLfloat
) sampObj
->WrapR
;
1421 case GL_TEXTURE_MIN_FILTER
:
1422 *params
= (GLfloat
) sampObj
->MinFilter
;
1424 case GL_TEXTURE_MAG_FILTER
:
1425 *params
= (GLfloat
) sampObj
->MagFilter
;
1427 case GL_TEXTURE_MIN_LOD
:
1428 *params
= sampObj
->MinLod
;
1430 case GL_TEXTURE_MAX_LOD
:
1431 *params
= sampObj
->MaxLod
;
1433 case GL_TEXTURE_LOD_BIAS
:
1434 *params
= sampObj
->LodBias
;
1436 case GL_TEXTURE_COMPARE_MODE
:
1437 *params
= (GLfloat
) sampObj
->CompareMode
;
1439 case GL_TEXTURE_COMPARE_FUNC
:
1440 *params
= (GLfloat
) sampObj
->CompareFunc
;
1442 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1443 *params
= sampObj
->MaxAnisotropy
;
1445 case GL_TEXTURE_BORDER_COLOR
:
1446 params
[0] = sampObj
->BorderColor
.f
[0];
1447 params
[1] = sampObj
->BorderColor
.f
[1];
1448 params
[2] = sampObj
->BorderColor
.f
[2];
1449 params
[3] = sampObj
->BorderColor
.f
[3];
1451 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1452 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1454 *params
= (GLfloat
) sampObj
->CubeMapSeamless
;
1456 case GL_TEXTURE_SRGB_DECODE_EXT
:
1457 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1459 *params
= (GLfloat
) sampObj
->sRGBDecode
;
1467 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterfv(pname=%s)",
1468 _mesa_enum_to_string(pname
));
1473 _mesa_GetSamplerParameterIiv(GLuint sampler
, GLenum pname
, GLint
*params
)
1475 struct gl_sampler_object
*sampObj
;
1476 GET_CURRENT_CONTEXT(ctx
);
1478 sampObj
= sampler_parameter_error_check(ctx
, sampler
, true,
1479 "glGetSamplerParameterIiv");
1484 case GL_TEXTURE_WRAP_S
:
1485 *params
= sampObj
->WrapS
;
1487 case GL_TEXTURE_WRAP_T
:
1488 *params
= sampObj
->WrapT
;
1490 case GL_TEXTURE_WRAP_R
:
1491 *params
= sampObj
->WrapR
;
1493 case GL_TEXTURE_MIN_FILTER
:
1494 *params
= sampObj
->MinFilter
;
1496 case GL_TEXTURE_MAG_FILTER
:
1497 *params
= sampObj
->MagFilter
;
1499 case GL_TEXTURE_MIN_LOD
:
1500 *params
= (GLint
) sampObj
->MinLod
;
1502 case GL_TEXTURE_MAX_LOD
:
1503 *params
= (GLint
) sampObj
->MaxLod
;
1505 case GL_TEXTURE_LOD_BIAS
:
1506 *params
= (GLint
) sampObj
->LodBias
;
1508 case GL_TEXTURE_COMPARE_MODE
:
1509 *params
= sampObj
->CompareMode
;
1511 case GL_TEXTURE_COMPARE_FUNC
:
1512 *params
= sampObj
->CompareFunc
;
1514 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1515 *params
= (GLint
) sampObj
->MaxAnisotropy
;
1517 case GL_TEXTURE_BORDER_COLOR
:
1518 params
[0] = sampObj
->BorderColor
.i
[0];
1519 params
[1] = sampObj
->BorderColor
.i
[1];
1520 params
[2] = sampObj
->BorderColor
.i
[2];
1521 params
[3] = sampObj
->BorderColor
.i
[3];
1523 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1524 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1526 *params
= sampObj
->CubeMapSeamless
;
1528 case GL_TEXTURE_SRGB_DECODE_EXT
:
1529 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1531 *params
= (GLenum
) sampObj
->sRGBDecode
;
1539 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterIiv(pname=%s)",
1540 _mesa_enum_to_string(pname
));
1545 _mesa_GetSamplerParameterIuiv(GLuint sampler
, GLenum pname
, GLuint
*params
)
1547 struct gl_sampler_object
*sampObj
;
1548 GET_CURRENT_CONTEXT(ctx
);
1550 sampObj
= sampler_parameter_error_check(ctx
, sampler
, true,
1551 "glGetSamplerParameterIuiv");
1556 case GL_TEXTURE_WRAP_S
:
1557 *params
= sampObj
->WrapS
;
1559 case GL_TEXTURE_WRAP_T
:
1560 *params
= sampObj
->WrapT
;
1562 case GL_TEXTURE_WRAP_R
:
1563 *params
= sampObj
->WrapR
;
1565 case GL_TEXTURE_MIN_FILTER
:
1566 *params
= sampObj
->MinFilter
;
1568 case GL_TEXTURE_MAG_FILTER
:
1569 *params
= sampObj
->MagFilter
;
1571 case GL_TEXTURE_MIN_LOD
:
1572 *params
= (GLuint
) sampObj
->MinLod
;
1574 case GL_TEXTURE_MAX_LOD
:
1575 *params
= (GLuint
) sampObj
->MaxLod
;
1577 case GL_TEXTURE_LOD_BIAS
:
1578 *params
= (GLuint
) sampObj
->LodBias
;
1580 case GL_TEXTURE_COMPARE_MODE
:
1581 *params
= sampObj
->CompareMode
;
1583 case GL_TEXTURE_COMPARE_FUNC
:
1584 *params
= sampObj
->CompareFunc
;
1586 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1587 *params
= (GLuint
) sampObj
->MaxAnisotropy
;
1589 case GL_TEXTURE_BORDER_COLOR
:
1590 params
[0] = sampObj
->BorderColor
.ui
[0];
1591 params
[1] = sampObj
->BorderColor
.ui
[1];
1592 params
[2] = sampObj
->BorderColor
.ui
[2];
1593 params
[3] = sampObj
->BorderColor
.ui
[3];
1595 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1596 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1598 *params
= sampObj
->CubeMapSeamless
;
1600 case GL_TEXTURE_SRGB_DECODE_EXT
:
1601 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1603 *params
= (GLenum
) sampObj
->sRGBDecode
;
1611 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterIuiv(pname=%s)",
1612 _mesa_enum_to_string(pname
));
1617 _mesa_init_sampler_object_functions(struct dd_function_table
*driver
)
1619 driver
->NewSamplerObject
= _mesa_new_sampler_object
;