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 if (samp
->RefCount
== 0) {
101 /* this sampler's being deleted (look just above) */
102 /* Not sure this can every really happen. Warn if it does. */
103 _mesa_problem(NULL
, "referencing deleted sampler object");
110 mtx_unlock(&samp
->Mutex
);
116 * Initialize the fields of the given sampler object.
119 _mesa_init_sampler_object(struct gl_sampler_object
*sampObj
, GLuint name
)
121 mtx_init(&sampObj
->Mutex
, mtx_plain
);
122 sampObj
->Name
= name
;
123 sampObj
->RefCount
= 1;
124 sampObj
->WrapS
= GL_REPEAT
;
125 sampObj
->WrapT
= GL_REPEAT
;
126 sampObj
->WrapR
= GL_REPEAT
;
127 sampObj
->MinFilter
= GL_NEAREST_MIPMAP_LINEAR
;
128 sampObj
->MagFilter
= GL_LINEAR
;
129 sampObj
->BorderColor
.f
[0] = 0.0;
130 sampObj
->BorderColor
.f
[1] = 0.0;
131 sampObj
->BorderColor
.f
[2] = 0.0;
132 sampObj
->BorderColor
.f
[3] = 0.0;
133 sampObj
->MinLod
= -1000.0F
;
134 sampObj
->MaxLod
= 1000.0F
;
135 sampObj
->LodBias
= 0.0F
;
136 sampObj
->MaxAnisotropy
= 1.0F
;
137 sampObj
->CompareMode
= GL_NONE
;
138 sampObj
->CompareFunc
= GL_LEQUAL
;
139 sampObj
->sRGBDecode
= GL_DECODE_EXT
;
140 sampObj
->CubeMapSeamless
= GL_FALSE
;
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
,
163 if (MESA_VERBOSE
& VERBOSE_API
)
164 _mesa_debug(ctx
, "%s(%d)\n", caller
, count
);
167 _mesa_error(ctx
, GL_INVALID_VALUE
, "%s(n<0)", caller
);
174 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
176 first
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->SamplerObjects
, count
);
178 /* Insert the ID and pointer to new sampler object into hash table */
179 for (i
= 0; i
< count
; i
++) {
180 struct gl_sampler_object
*sampObj
=
181 ctx
->Driver
.NewSamplerObject(ctx
, first
+ i
);
182 _mesa_HashInsertLocked(ctx
->Shared
->SamplerObjects
, first
+ i
, sampObj
);
183 samplers
[i
] = first
+ i
;
186 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
190 _mesa_GenSamplers(GLsizei count
, GLuint
*samplers
)
192 GET_CURRENT_CONTEXT(ctx
);
193 create_samplers(ctx
, count
, samplers
, "glGenSamplers");
197 _mesa_CreateSamplers(GLsizei count
, GLuint
*samplers
)
199 GET_CURRENT_CONTEXT(ctx
);
200 create_samplers(ctx
, count
, samplers
, "glCreateSamplers");
205 _mesa_DeleteSamplers(GLsizei count
, const GLuint
*samplers
)
207 GET_CURRENT_CONTEXT(ctx
);
210 FLUSH_VERTICES(ctx
, 0);
213 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteSamplers(count)");
217 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
219 for (i
= 0; i
< count
; i
++) {
222 struct gl_sampler_object
*sampObj
=
223 lookup_samplerobj_locked(ctx
, samplers
[i
]);
226 /* If the sampler is currently bound, unbind it. */
227 for (j
= 0; j
< ctx
->Const
.MaxCombinedTextureImageUnits
; j
++) {
228 if (ctx
->Texture
.Unit
[j
].Sampler
== sampObj
) {
229 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
230 _mesa_reference_sampler_object(ctx
, &ctx
->Texture
.Unit
[j
].Sampler
, NULL
);
234 /* The ID is immediately freed for re-use */
235 _mesa_HashRemoveLocked(ctx
->Shared
->SamplerObjects
, samplers
[i
]);
236 /* But the object exists until its reference count goes to zero */
237 _mesa_reference_sampler_object(ctx
, &sampObj
, NULL
);
242 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
247 _mesa_IsSampler(GLuint sampler
)
249 GET_CURRENT_CONTEXT(ctx
);
251 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
253 return _mesa_lookup_samplerobj(ctx
, sampler
) != NULL
;
257 _mesa_bind_sampler(struct gl_context
*ctx
, GLuint unit
,
258 struct gl_sampler_object
*sampObj
)
260 if (ctx
->Texture
.Unit
[unit
].Sampler
!= sampObj
) {
261 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
264 _mesa_reference_sampler_object(ctx
, &ctx
->Texture
.Unit
[unit
].Sampler
,
269 _mesa_BindSampler(GLuint unit
, GLuint sampler
)
271 struct gl_sampler_object
*sampObj
;
272 GET_CURRENT_CONTEXT(ctx
);
274 if (unit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
275 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindSampler(unit %u)", unit
);
280 /* Use the default sampler object, the one contained in the texture
286 /* user-defined sampler object */
287 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
289 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glBindSampler(sampler)");
294 /* bind new sampler */
295 _mesa_bind_sampler(ctx
, unit
, sampObj
);
300 _mesa_BindSamplers(GLuint first
, GLsizei count
, const GLuint
*samplers
)
302 GET_CURRENT_CONTEXT(ctx
);
305 /* The ARB_multi_bind spec says:
307 * "An INVALID_OPERATION error is generated if <first> + <count> is
308 * greater than the number of texture image units supported by
309 * the implementation."
311 if (first
+ count
> ctx
->Const
.MaxCombinedTextureImageUnits
) {
312 _mesa_error(ctx
, GL_INVALID_OPERATION
,
313 "glBindSamplers(first=%u + count=%d > the value of "
314 "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS=%u)",
315 first
, count
, ctx
->Const
.MaxCombinedTextureImageUnits
);
319 FLUSH_VERTICES(ctx
, 0);
322 /* Note that the error semantics for multi-bind commands differ from
323 * those of other GL commands.
325 * The Issues section in the ARB_multi_bind spec says:
327 * "(11) Typically, OpenGL specifies that if an error is generated by
328 * a command, that command has no effect. This is somewhat
329 * unfortunate for multi-bind commands, because it would require
330 * a first pass to scan the entire list of bound objects for
331 * errors and then a second pass to actually perform the
332 * bindings. Should we have different error semantics?
334 * RESOLVED: Yes. In this specification, when the parameters for
335 * one of the <count> binding points are invalid, that binding
336 * point is not updated and an error will be generated. However,
337 * other binding points in the same command will be updated if
338 * their parameters are valid and no other error occurs."
341 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
343 for (i
= 0; i
< count
; i
++) {
344 const GLuint unit
= first
+ i
;
345 struct gl_sampler_object
* const currentSampler
=
346 ctx
->Texture
.Unit
[unit
].Sampler
;
347 struct gl_sampler_object
*sampObj
;
349 if (samplers
[i
] != 0) {
350 if (currentSampler
&& currentSampler
->Name
== samplers
[i
])
351 sampObj
= currentSampler
;
353 sampObj
= lookup_samplerobj_locked(ctx
, samplers
[i
]);
355 /* The ARB_multi_bind spec says:
357 * "An INVALID_OPERATION error is generated if any value
358 * in <samplers> is not zero or the name of an existing
359 * sampler object (per binding)."
362 _mesa_error(ctx
, GL_INVALID_OPERATION
,
363 "glBindSamplers(samplers[%d]=%u is not zero or "
364 "the name of an existing sampler object)",
372 /* Bind the new sampler */
373 if (sampObj
!= currentSampler
) {
374 _mesa_reference_sampler_object(ctx
,
375 &ctx
->Texture
.Unit
[unit
].Sampler
,
377 ctx
->NewState
|= _NEW_TEXTURE
;
381 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
383 /* Unbind all samplers in the range <first> through <first>+<count>-1 */
384 for (i
= 0; i
< count
; i
++) {
385 const GLuint unit
= first
+ i
;
387 if (ctx
->Texture
.Unit
[unit
].Sampler
) {
388 _mesa_reference_sampler_object(ctx
,
389 &ctx
->Texture
.Unit
[unit
].Sampler
,
391 ctx
->NewState
|= _NEW_TEXTURE
;
399 * Check if a coordinate wrap mode is legal.
400 * \return GL_TRUE if legal, GL_FALSE otherwise
403 validate_texture_wrap_mode(struct gl_context
*ctx
, GLenum wrap
)
405 const struct gl_extensions
* const e
= &ctx
->Extensions
;
409 case GL_CLAMP_TO_EDGE
:
411 case GL_MIRRORED_REPEAT
:
413 case GL_CLAMP_TO_BORDER
:
414 return e
->ARB_texture_border_clamp
;
415 case GL_MIRROR_CLAMP_EXT
:
416 return e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
;
417 case GL_MIRROR_CLAMP_TO_EDGE_EXT
:
418 return e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
|| e
->ARB_texture_mirror_clamp_to_edge
;
419 case GL_MIRROR_CLAMP_TO_BORDER_EXT
:
420 return e
->EXT_texture_mirror_clamp
;
428 * This is called just prior to changing any sampler object state.
431 flush(struct gl_context
*ctx
)
433 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
437 _mesa_set_sampler_wrap(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
438 GLenum s
, GLenum t
, GLenum r
)
440 assert(validate_texture_wrap_mode(ctx
, s
));
441 assert(validate_texture_wrap_mode(ctx
, t
));
442 assert(validate_texture_wrap_mode(ctx
, r
));
444 if (samp
->WrapS
== s
&& samp
->WrapT
== t
&& samp
->WrapR
== r
)
453 #define INVALID_PARAM 0x100
454 #define INVALID_PNAME 0x101
455 #define INVALID_VALUE 0x102
458 set_sampler_wrap_s(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
461 if (samp
->WrapS
== param
)
463 if (validate_texture_wrap_mode(ctx
, param
)) {
468 return INVALID_PARAM
;
473 set_sampler_wrap_t(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
476 if (samp
->WrapT
== param
)
478 if (validate_texture_wrap_mode(ctx
, param
)) {
483 return INVALID_PARAM
;
488 set_sampler_wrap_r(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
491 if (samp
->WrapR
== param
)
493 if (validate_texture_wrap_mode(ctx
, param
)) {
498 return INVALID_PARAM
;
502 _mesa_set_sampler_filters(struct gl_context
*ctx
,
503 struct gl_sampler_object
*samp
,
504 GLenum min_filter
, GLenum mag_filter
)
506 assert(min_filter
== GL_NEAREST
||
507 min_filter
== GL_LINEAR
||
508 min_filter
== GL_NEAREST_MIPMAP_NEAREST
||
509 min_filter
== GL_LINEAR_MIPMAP_NEAREST
||
510 min_filter
== GL_NEAREST_MIPMAP_LINEAR
||
511 min_filter
== GL_LINEAR_MIPMAP_LINEAR
);
512 assert(mag_filter
== GL_NEAREST
||
513 mag_filter
== GL_LINEAR
);
515 if (samp
->MinFilter
== min_filter
&& samp
->MagFilter
== mag_filter
)
519 samp
->MinFilter
= min_filter
;
520 samp
->MagFilter
= mag_filter
;
524 set_sampler_min_filter(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
527 if (samp
->MinFilter
== param
)
533 case GL_NEAREST_MIPMAP_NEAREST
:
534 case GL_LINEAR_MIPMAP_NEAREST
:
535 case GL_NEAREST_MIPMAP_LINEAR
:
536 case GL_LINEAR_MIPMAP_LINEAR
:
538 samp
->MinFilter
= param
;
541 return INVALID_PARAM
;
547 set_sampler_mag_filter(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
550 if (samp
->MagFilter
== param
)
557 samp
->MagFilter
= param
;
560 return INVALID_PARAM
;
566 set_sampler_lod_bias(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
569 if (samp
->LodBias
== param
)
573 samp
->LodBias
= param
;
579 set_sampler_border_colorf(struct gl_context
*ctx
,
580 struct gl_sampler_object
*samp
,
581 const GLfloat params
[4])
584 samp
->BorderColor
.f
[RCOMP
] = params
[0];
585 samp
->BorderColor
.f
[GCOMP
] = params
[1];
586 samp
->BorderColor
.f
[BCOMP
] = params
[2];
587 samp
->BorderColor
.f
[ACOMP
] = params
[3];
593 set_sampler_border_colori(struct gl_context
*ctx
,
594 struct gl_sampler_object
*samp
,
595 const GLint params
[4])
598 samp
->BorderColor
.i
[RCOMP
] = params
[0];
599 samp
->BorderColor
.i
[GCOMP
] = params
[1];
600 samp
->BorderColor
.i
[BCOMP
] = params
[2];
601 samp
->BorderColor
.i
[ACOMP
] = params
[3];
607 set_sampler_border_colorui(struct gl_context
*ctx
,
608 struct gl_sampler_object
*samp
,
609 const GLuint params
[4])
612 samp
->BorderColor
.ui
[RCOMP
] = params
[0];
613 samp
->BorderColor
.ui
[GCOMP
] = params
[1];
614 samp
->BorderColor
.ui
[BCOMP
] = params
[2];
615 samp
->BorderColor
.ui
[ACOMP
] = params
[3];
621 set_sampler_min_lod(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
624 if (samp
->MinLod
== param
)
628 samp
->MinLod
= param
;
634 set_sampler_max_lod(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
637 if (samp
->MaxLod
== param
)
641 samp
->MaxLod
= param
;
647 set_sampler_compare_mode(struct gl_context
*ctx
,
648 struct gl_sampler_object
*samp
, GLint param
)
650 /* If GL_ARB_shadow is not supported, don't report an error. The
651 * sampler object extension spec isn't clear on this extension interaction.
652 * Silences errors with Wine on older GPUs such as R200.
654 if (!ctx
->Extensions
.ARB_shadow
)
657 if (samp
->CompareMode
== param
)
660 if (param
== GL_NONE
||
661 param
== GL_COMPARE_R_TO_TEXTURE_ARB
) {
663 samp
->CompareMode
= param
;
667 return INVALID_PARAM
;
672 set_sampler_compare_func(struct gl_context
*ctx
,
673 struct gl_sampler_object
*samp
, GLint param
)
675 /* If GL_ARB_shadow is not supported, don't report an error. The
676 * sampler object extension spec isn't clear on this extension interaction.
677 * Silences errors with Wine on older GPUs such as R200.
679 if (!ctx
->Extensions
.ARB_shadow
)
682 if (samp
->CompareFunc
== param
)
695 samp
->CompareFunc
= param
;
698 return INVALID_PARAM
;
704 set_sampler_max_anisotropy(struct gl_context
*ctx
,
705 struct gl_sampler_object
*samp
, GLfloat param
)
707 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
708 return INVALID_PNAME
;
710 if (samp
->MaxAnisotropy
== param
)
714 return INVALID_VALUE
;
717 /* clamp to max, that's what NVIDIA does */
718 samp
->MaxAnisotropy
= MIN2(param
, ctx
->Const
.MaxTextureMaxAnisotropy
);
724 set_sampler_cube_map_seamless(struct gl_context
*ctx
,
725 struct gl_sampler_object
*samp
, GLboolean param
)
727 if (!_mesa_is_desktop_gl(ctx
)
728 || !ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
729 return INVALID_PNAME
;
731 if (samp
->CubeMapSeamless
== param
)
734 if (param
!= GL_TRUE
&& param
!= GL_FALSE
)
735 return INVALID_VALUE
;
738 samp
->CubeMapSeamless
= param
;
743 _mesa_set_sampler_srgb_decode(struct gl_context
*ctx
,
744 struct gl_sampler_object
*samp
, GLenum param
)
746 assert(param
== GL_DECODE_EXT
|| param
== GL_SKIP_DECODE_EXT
);
749 samp
->sRGBDecode
= param
;
753 set_sampler_srgb_decode(struct gl_context
*ctx
,
754 struct gl_sampler_object
*samp
, GLenum param
)
756 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
757 return INVALID_PNAME
;
759 if (samp
->sRGBDecode
== param
)
762 if (param
!= GL_DECODE_EXT
&& param
!= GL_SKIP_DECODE_EXT
)
763 return INVALID_VALUE
;
766 samp
->sRGBDecode
= param
;
770 static struct gl_sampler_object
*
771 sampler_parameter_error_check(struct gl_context
*ctx
, GLuint sampler
,
774 struct gl_sampler_object
*sampObj
;
776 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
778 /* OpenGL 4.5 spec, section "8.2 Sampler Objects", page 176 of the PDF
781 * "An INVALID_OPERATION error is generated if sampler is not the name
782 * of a sampler object previously returned from a call to
785 _mesa_error(ctx
, GL_INVALID_OPERATION
, "%s(invalid sampler)", name
);
793 _mesa_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
795 struct gl_sampler_object
*sampObj
;
797 GET_CURRENT_CONTEXT(ctx
);
799 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
800 "glSamplerParameteri");
805 case GL_TEXTURE_WRAP_S
:
806 res
= set_sampler_wrap_s(ctx
, sampObj
, param
);
808 case GL_TEXTURE_WRAP_T
:
809 res
= set_sampler_wrap_t(ctx
, sampObj
, param
);
811 case GL_TEXTURE_WRAP_R
:
812 res
= set_sampler_wrap_r(ctx
, sampObj
, param
);
814 case GL_TEXTURE_MIN_FILTER
:
815 res
= set_sampler_min_filter(ctx
, sampObj
, param
);
817 case GL_TEXTURE_MAG_FILTER
:
818 res
= set_sampler_mag_filter(ctx
, sampObj
, param
);
820 case GL_TEXTURE_MIN_LOD
:
821 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) param
);
823 case GL_TEXTURE_MAX_LOD
:
824 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) param
);
826 case GL_TEXTURE_LOD_BIAS
:
827 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) param
);
829 case GL_TEXTURE_COMPARE_MODE
:
830 res
= set_sampler_compare_mode(ctx
, sampObj
, param
);
832 case GL_TEXTURE_COMPARE_FUNC
:
833 res
= set_sampler_compare_func(ctx
, sampObj
, param
);
835 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
836 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) param
);
838 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
839 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, param
);
841 case GL_TEXTURE_SRGB_DECODE_EXT
:
842 res
= set_sampler_srgb_decode(ctx
, sampObj
, param
);
844 case GL_TEXTURE_BORDER_COLOR
:
855 /* state change - we do nothing special at this time */
858 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteri(pname=%s)\n",
859 _mesa_enum_to_string(pname
));
862 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteri(param=%d)\n",
866 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameteri(param=%d)\n",
876 _mesa_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
878 struct gl_sampler_object
*sampObj
;
880 GET_CURRENT_CONTEXT(ctx
);
882 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
883 "glSamplerParameterf");
888 case GL_TEXTURE_WRAP_S
:
889 res
= set_sampler_wrap_s(ctx
, sampObj
, (GLint
) param
);
891 case GL_TEXTURE_WRAP_T
:
892 res
= set_sampler_wrap_t(ctx
, sampObj
, (GLint
) param
);
894 case GL_TEXTURE_WRAP_R
:
895 res
= set_sampler_wrap_r(ctx
, sampObj
, (GLint
) param
);
897 case GL_TEXTURE_MIN_FILTER
:
898 res
= set_sampler_min_filter(ctx
, sampObj
, (GLint
) param
);
900 case GL_TEXTURE_MAG_FILTER
:
901 res
= set_sampler_mag_filter(ctx
, sampObj
, (GLint
) param
);
903 case GL_TEXTURE_MIN_LOD
:
904 res
= set_sampler_min_lod(ctx
, sampObj
, param
);
906 case GL_TEXTURE_MAX_LOD
:
907 res
= set_sampler_max_lod(ctx
, sampObj
, param
);
909 case GL_TEXTURE_LOD_BIAS
:
910 res
= set_sampler_lod_bias(ctx
, sampObj
, param
);
912 case GL_TEXTURE_COMPARE_MODE
:
913 res
= set_sampler_compare_mode(ctx
, sampObj
, (GLint
) param
);
915 case GL_TEXTURE_COMPARE_FUNC
:
916 res
= set_sampler_compare_func(ctx
, sampObj
, (GLint
) param
);
918 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
919 res
= set_sampler_max_anisotropy(ctx
, sampObj
, param
);
921 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
922 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, (GLboolean
) param
);
924 case GL_TEXTURE_SRGB_DECODE_EXT
:
925 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) param
);
927 case GL_TEXTURE_BORDER_COLOR
:
938 /* state change - we do nothing special at this time */
941 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterf(pname=%s)\n",
942 _mesa_enum_to_string(pname
));
945 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterf(param=%f)\n",
949 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterf(param=%f)\n",
958 _mesa_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
960 struct gl_sampler_object
*sampObj
;
962 GET_CURRENT_CONTEXT(ctx
);
964 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
965 "glSamplerParameteriv");
970 case GL_TEXTURE_WRAP_S
:
971 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
973 case GL_TEXTURE_WRAP_T
:
974 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
976 case GL_TEXTURE_WRAP_R
:
977 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
979 case GL_TEXTURE_MIN_FILTER
:
980 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
982 case GL_TEXTURE_MAG_FILTER
:
983 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
985 case GL_TEXTURE_MIN_LOD
:
986 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
988 case GL_TEXTURE_MAX_LOD
:
989 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
991 case GL_TEXTURE_LOD_BIAS
:
992 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
994 case GL_TEXTURE_COMPARE_MODE
:
995 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
997 case GL_TEXTURE_COMPARE_FUNC
:
998 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1000 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1001 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1003 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1004 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1006 case GL_TEXTURE_SRGB_DECODE_EXT
:
1007 res
= set_sampler_srgb_decode(ctx
, sampObj
, params
[0]);
1009 case GL_TEXTURE_BORDER_COLOR
:
1012 c
[0] = INT_TO_FLOAT(params
[0]);
1013 c
[1] = INT_TO_FLOAT(params
[1]);
1014 c
[2] = INT_TO_FLOAT(params
[2]);
1015 c
[3] = INT_TO_FLOAT(params
[3]);
1016 res
= set_sampler_border_colorf(ctx
, sampObj
, c
);
1020 res
= INVALID_PNAME
;
1028 /* state change - we do nothing special at this time */
1031 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteriv(pname=%s)\n",
1032 _mesa_enum_to_string(pname
));
1035 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteriv(param=%d)\n",
1039 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameteriv(param=%d)\n",
1048 _mesa_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
1050 struct gl_sampler_object
*sampObj
;
1052 GET_CURRENT_CONTEXT(ctx
);
1054 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1055 "glSamplerParameterfv");
1060 case GL_TEXTURE_WRAP_S
:
1061 res
= set_sampler_wrap_s(ctx
, sampObj
, (GLint
) params
[0]);
1063 case GL_TEXTURE_WRAP_T
:
1064 res
= set_sampler_wrap_t(ctx
, sampObj
, (GLint
) params
[0]);
1066 case GL_TEXTURE_WRAP_R
:
1067 res
= set_sampler_wrap_r(ctx
, sampObj
, (GLint
) params
[0]);
1069 case GL_TEXTURE_MIN_FILTER
:
1070 res
= set_sampler_min_filter(ctx
, sampObj
, (GLint
) params
[0]);
1072 case GL_TEXTURE_MAG_FILTER
:
1073 res
= set_sampler_mag_filter(ctx
, sampObj
, (GLint
) params
[0]);
1075 case GL_TEXTURE_MIN_LOD
:
1076 res
= set_sampler_min_lod(ctx
, sampObj
, params
[0]);
1078 case GL_TEXTURE_MAX_LOD
:
1079 res
= set_sampler_max_lod(ctx
, sampObj
, params
[0]);
1081 case GL_TEXTURE_LOD_BIAS
:
1082 res
= set_sampler_lod_bias(ctx
, sampObj
, params
[0]);
1084 case GL_TEXTURE_COMPARE_MODE
:
1085 res
= set_sampler_compare_mode(ctx
, sampObj
, (GLint
) params
[0]);
1087 case GL_TEXTURE_COMPARE_FUNC
:
1088 res
= set_sampler_compare_func(ctx
, sampObj
, (GLint
) params
[0]);
1090 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1091 res
= set_sampler_max_anisotropy(ctx
, sampObj
, params
[0]);
1093 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1094 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, (GLboolean
) params
[0]);
1096 case GL_TEXTURE_SRGB_DECODE_EXT
:
1097 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1099 case GL_TEXTURE_BORDER_COLOR
:
1100 res
= set_sampler_border_colorf(ctx
, sampObj
, params
);
1103 res
= INVALID_PNAME
;
1111 /* state change - we do nothing special at this time */
1114 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterfv(pname=%s)\n",
1115 _mesa_enum_to_string(pname
));
1118 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterfv(param=%f)\n",
1122 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterfv(param=%f)\n",
1131 _mesa_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
1133 struct gl_sampler_object
*sampObj
;
1135 GET_CURRENT_CONTEXT(ctx
);
1137 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1138 "glSamplerParameterIiv");
1143 case GL_TEXTURE_WRAP_S
:
1144 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
1146 case GL_TEXTURE_WRAP_T
:
1147 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
1149 case GL_TEXTURE_WRAP_R
:
1150 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
1152 case GL_TEXTURE_MIN_FILTER
:
1153 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1155 case GL_TEXTURE_MAG_FILTER
:
1156 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1158 case GL_TEXTURE_MIN_LOD
:
1159 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1161 case GL_TEXTURE_MAX_LOD
:
1162 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1164 case GL_TEXTURE_LOD_BIAS
:
1165 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1167 case GL_TEXTURE_COMPARE_MODE
:
1168 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1170 case GL_TEXTURE_COMPARE_FUNC
:
1171 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1173 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1174 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1176 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1177 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1179 case GL_TEXTURE_SRGB_DECODE_EXT
:
1180 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1182 case GL_TEXTURE_BORDER_COLOR
:
1183 res
= set_sampler_border_colori(ctx
, sampObj
, params
);
1186 res
= INVALID_PNAME
;
1194 /* state change - we do nothing special at this time */
1197 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIiv(pname=%s)\n",
1198 _mesa_enum_to_string(pname
));
1201 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIiv(param=%d)\n",
1205 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterIiv(param=%d)\n",
1215 _mesa_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
1217 struct gl_sampler_object
*sampObj
;
1219 GET_CURRENT_CONTEXT(ctx
);
1221 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1222 "glSamplerParameterIuiv");
1227 case GL_TEXTURE_WRAP_S
:
1228 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
1230 case GL_TEXTURE_WRAP_T
:
1231 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
1233 case GL_TEXTURE_WRAP_R
:
1234 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
1236 case GL_TEXTURE_MIN_FILTER
:
1237 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1239 case GL_TEXTURE_MAG_FILTER
:
1240 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1242 case GL_TEXTURE_MIN_LOD
:
1243 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1245 case GL_TEXTURE_MAX_LOD
:
1246 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1248 case GL_TEXTURE_LOD_BIAS
:
1249 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1251 case GL_TEXTURE_COMPARE_MODE
:
1252 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1254 case GL_TEXTURE_COMPARE_FUNC
:
1255 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1257 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1258 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1260 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1261 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1263 case GL_TEXTURE_SRGB_DECODE_EXT
:
1264 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1266 case GL_TEXTURE_BORDER_COLOR
:
1267 res
= set_sampler_border_colorui(ctx
, sampObj
, params
);
1270 res
= INVALID_PNAME
;
1278 /* state change - we do nothing special at this time */
1281 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIuiv(pname=%s)\n",
1282 _mesa_enum_to_string(pname
));
1285 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIuiv(param=%u)\n",
1289 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterIuiv(param=%u)\n",
1299 _mesa_GetSamplerParameteriv(GLuint sampler
, GLenum pname
, GLint
*params
)
1301 struct gl_sampler_object
*sampObj
;
1302 GET_CURRENT_CONTEXT(ctx
);
1304 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1305 "glGetSamplerParameteriv");
1310 case GL_TEXTURE_WRAP_S
:
1311 *params
= sampObj
->WrapS
;
1313 case GL_TEXTURE_WRAP_T
:
1314 *params
= sampObj
->WrapT
;
1316 case GL_TEXTURE_WRAP_R
:
1317 *params
= sampObj
->WrapR
;
1319 case GL_TEXTURE_MIN_FILTER
:
1320 *params
= sampObj
->MinFilter
;
1322 case GL_TEXTURE_MAG_FILTER
:
1323 *params
= sampObj
->MagFilter
;
1325 case GL_TEXTURE_MIN_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
->MinLod
);
1331 case GL_TEXTURE_MAX_LOD
:
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
->MaxLod
);
1337 case GL_TEXTURE_LOD_BIAS
:
1338 /* GL spec 'Data Conversions' section specifies that floating-point
1339 * value in integer Get function is rounded to nearest integer
1341 *params
= IROUND(sampObj
->LodBias
);
1343 case GL_TEXTURE_COMPARE_MODE
:
1344 *params
= sampObj
->CompareMode
;
1346 case GL_TEXTURE_COMPARE_FUNC
:
1347 *params
= sampObj
->CompareFunc
;
1349 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
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
->MaxAnisotropy
);
1355 case GL_TEXTURE_BORDER_COLOR
:
1356 params
[0] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[0]);
1357 params
[1] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[1]);
1358 params
[2] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[2]);
1359 params
[3] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[3]);
1361 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1362 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1364 *params
= sampObj
->CubeMapSeamless
;
1366 case GL_TEXTURE_SRGB_DECODE_EXT
:
1367 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1369 *params
= (GLenum
) sampObj
->sRGBDecode
;
1377 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameteriv(pname=%s)",
1378 _mesa_enum_to_string(pname
));
1383 _mesa_GetSamplerParameterfv(GLuint sampler
, GLenum pname
, GLfloat
*params
)
1385 struct gl_sampler_object
*sampObj
;
1386 GET_CURRENT_CONTEXT(ctx
);
1388 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1389 "glGetSamplerParameterfv");
1394 case GL_TEXTURE_WRAP_S
:
1395 *params
= (GLfloat
) sampObj
->WrapS
;
1397 case GL_TEXTURE_WRAP_T
:
1398 *params
= (GLfloat
) sampObj
->WrapT
;
1400 case GL_TEXTURE_WRAP_R
:
1401 *params
= (GLfloat
) sampObj
->WrapR
;
1403 case GL_TEXTURE_MIN_FILTER
:
1404 *params
= (GLfloat
) sampObj
->MinFilter
;
1406 case GL_TEXTURE_MAG_FILTER
:
1407 *params
= (GLfloat
) sampObj
->MagFilter
;
1409 case GL_TEXTURE_MIN_LOD
:
1410 *params
= sampObj
->MinLod
;
1412 case GL_TEXTURE_MAX_LOD
:
1413 *params
= sampObj
->MaxLod
;
1415 case GL_TEXTURE_LOD_BIAS
:
1416 *params
= sampObj
->LodBias
;
1418 case GL_TEXTURE_COMPARE_MODE
:
1419 *params
= (GLfloat
) sampObj
->CompareMode
;
1421 case GL_TEXTURE_COMPARE_FUNC
:
1422 *params
= (GLfloat
) sampObj
->CompareFunc
;
1424 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1425 *params
= sampObj
->MaxAnisotropy
;
1427 case GL_TEXTURE_BORDER_COLOR
:
1428 params
[0] = sampObj
->BorderColor
.f
[0];
1429 params
[1] = sampObj
->BorderColor
.f
[1];
1430 params
[2] = sampObj
->BorderColor
.f
[2];
1431 params
[3] = sampObj
->BorderColor
.f
[3];
1433 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1434 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1436 *params
= (GLfloat
) sampObj
->CubeMapSeamless
;
1438 case GL_TEXTURE_SRGB_DECODE_EXT
:
1439 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1441 *params
= (GLfloat
) sampObj
->sRGBDecode
;
1449 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterfv(pname=%s)",
1450 _mesa_enum_to_string(pname
));
1455 _mesa_GetSamplerParameterIiv(GLuint sampler
, GLenum pname
, GLint
*params
)
1457 struct gl_sampler_object
*sampObj
;
1458 GET_CURRENT_CONTEXT(ctx
);
1460 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1461 "glGetSamplerParameterIiv");
1466 case GL_TEXTURE_WRAP_S
:
1467 *params
= sampObj
->WrapS
;
1469 case GL_TEXTURE_WRAP_T
:
1470 *params
= sampObj
->WrapT
;
1472 case GL_TEXTURE_WRAP_R
:
1473 *params
= sampObj
->WrapR
;
1475 case GL_TEXTURE_MIN_FILTER
:
1476 *params
= sampObj
->MinFilter
;
1478 case GL_TEXTURE_MAG_FILTER
:
1479 *params
= sampObj
->MagFilter
;
1481 case GL_TEXTURE_MIN_LOD
:
1482 *params
= (GLint
) sampObj
->MinLod
;
1484 case GL_TEXTURE_MAX_LOD
:
1485 *params
= (GLint
) sampObj
->MaxLod
;
1487 case GL_TEXTURE_LOD_BIAS
:
1488 *params
= (GLint
) sampObj
->LodBias
;
1490 case GL_TEXTURE_COMPARE_MODE
:
1491 *params
= sampObj
->CompareMode
;
1493 case GL_TEXTURE_COMPARE_FUNC
:
1494 *params
= sampObj
->CompareFunc
;
1496 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1497 *params
= (GLint
) sampObj
->MaxAnisotropy
;
1499 case GL_TEXTURE_BORDER_COLOR
:
1500 params
[0] = sampObj
->BorderColor
.i
[0];
1501 params
[1] = sampObj
->BorderColor
.i
[1];
1502 params
[2] = sampObj
->BorderColor
.i
[2];
1503 params
[3] = sampObj
->BorderColor
.i
[3];
1505 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1506 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1508 *params
= sampObj
->CubeMapSeamless
;
1510 case GL_TEXTURE_SRGB_DECODE_EXT
:
1511 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1513 *params
= (GLenum
) sampObj
->sRGBDecode
;
1521 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterIiv(pname=%s)",
1522 _mesa_enum_to_string(pname
));
1527 _mesa_GetSamplerParameterIuiv(GLuint sampler
, GLenum pname
, GLuint
*params
)
1529 struct gl_sampler_object
*sampObj
;
1530 GET_CURRENT_CONTEXT(ctx
);
1532 sampObj
= sampler_parameter_error_check(ctx
, sampler
,
1533 "glGetSamplerParameterIuiv");
1538 case GL_TEXTURE_WRAP_S
:
1539 *params
= sampObj
->WrapS
;
1541 case GL_TEXTURE_WRAP_T
:
1542 *params
= sampObj
->WrapT
;
1544 case GL_TEXTURE_WRAP_R
:
1545 *params
= sampObj
->WrapR
;
1547 case GL_TEXTURE_MIN_FILTER
:
1548 *params
= sampObj
->MinFilter
;
1550 case GL_TEXTURE_MAG_FILTER
:
1551 *params
= sampObj
->MagFilter
;
1553 case GL_TEXTURE_MIN_LOD
:
1554 *params
= (GLuint
) sampObj
->MinLod
;
1556 case GL_TEXTURE_MAX_LOD
:
1557 *params
= (GLuint
) sampObj
->MaxLod
;
1559 case GL_TEXTURE_LOD_BIAS
:
1560 *params
= (GLuint
) sampObj
->LodBias
;
1562 case GL_TEXTURE_COMPARE_MODE
:
1563 *params
= sampObj
->CompareMode
;
1565 case GL_TEXTURE_COMPARE_FUNC
:
1566 *params
= sampObj
->CompareFunc
;
1568 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1569 *params
= (GLuint
) sampObj
->MaxAnisotropy
;
1571 case GL_TEXTURE_BORDER_COLOR
:
1572 params
[0] = sampObj
->BorderColor
.ui
[0];
1573 params
[1] = sampObj
->BorderColor
.ui
[1];
1574 params
[2] = sampObj
->BorderColor
.ui
[2];
1575 params
[3] = sampObj
->BorderColor
.ui
[3];
1577 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1578 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1580 *params
= sampObj
->CubeMapSeamless
;
1582 case GL_TEXTURE_SRGB_DECODE_EXT
:
1583 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1585 *params
= (GLenum
) sampObj
->sRGBDecode
;
1593 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterIuiv(pname=%s)",
1594 _mesa_enum_to_string(pname
));
1599 _mesa_init_sampler_object_functions(struct dd_function_table
*driver
)
1601 driver
->NewSamplerObject
= _mesa_new_sampler_object
;