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_no_error(GLsizei count
, GLuint
*samplers
)
199 GET_CURRENT_CONTEXT(ctx
);
200 create_samplers(ctx
, count
, samplers
);
204 _mesa_GenSamplers(GLsizei count
, GLuint
*samplers
)
206 GET_CURRENT_CONTEXT(ctx
);
207 create_samplers_err(ctx
, count
, samplers
, "glGenSamplers");
211 _mesa_CreateSamplers_no_error(GLsizei count
, GLuint
*samplers
)
213 GET_CURRENT_CONTEXT(ctx
);
214 create_samplers(ctx
, count
, samplers
);
218 _mesa_CreateSamplers(GLsizei count
, GLuint
*samplers
)
220 GET_CURRENT_CONTEXT(ctx
);
221 create_samplers_err(ctx
, count
, samplers
, "glCreateSamplers");
226 _mesa_DeleteSamplers(GLsizei count
, const GLuint
*samplers
)
228 GET_CURRENT_CONTEXT(ctx
);
231 FLUSH_VERTICES(ctx
, 0);
234 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteSamplers(count)");
238 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
240 for (i
= 0; i
< count
; i
++) {
243 struct gl_sampler_object
*sampObj
=
244 lookup_samplerobj_locked(ctx
, samplers
[i
]);
247 /* If the sampler is currently bound, unbind it. */
248 for (j
= 0; j
< ctx
->Const
.MaxCombinedTextureImageUnits
; j
++) {
249 if (ctx
->Texture
.Unit
[j
].Sampler
== sampObj
) {
250 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
251 _mesa_reference_sampler_object(ctx
, &ctx
->Texture
.Unit
[j
].Sampler
, NULL
);
255 /* The ID is immediately freed for re-use */
256 _mesa_HashRemoveLocked(ctx
->Shared
->SamplerObjects
, samplers
[i
]);
257 /* But the object exists until its reference count goes to zero */
258 _mesa_reference_sampler_object(ctx
, &sampObj
, NULL
);
263 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
268 _mesa_IsSampler(GLuint sampler
)
270 GET_CURRENT_CONTEXT(ctx
);
272 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
274 return _mesa_lookup_samplerobj(ctx
, sampler
) != NULL
;
278 _mesa_bind_sampler(struct gl_context
*ctx
, GLuint unit
,
279 struct gl_sampler_object
*sampObj
)
281 if (ctx
->Texture
.Unit
[unit
].Sampler
!= sampObj
) {
282 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
285 _mesa_reference_sampler_object(ctx
, &ctx
->Texture
.Unit
[unit
].Sampler
,
290 _mesa_BindSampler(GLuint unit
, GLuint sampler
)
292 struct gl_sampler_object
*sampObj
;
293 GET_CURRENT_CONTEXT(ctx
);
295 if (unit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
296 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindSampler(unit %u)", unit
);
301 /* Use the default sampler object, the one contained in the texture
307 /* user-defined sampler object */
308 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
310 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glBindSampler(sampler)");
315 /* bind new sampler */
316 _mesa_bind_sampler(ctx
, unit
, sampObj
);
321 _mesa_BindSamplers(GLuint first
, GLsizei count
, const GLuint
*samplers
)
323 GET_CURRENT_CONTEXT(ctx
);
326 /* The ARB_multi_bind spec says:
328 * "An INVALID_OPERATION error is generated if <first> + <count> is
329 * greater than the number of texture image units supported by
330 * the implementation."
332 if (first
+ count
> ctx
->Const
.MaxCombinedTextureImageUnits
) {
333 _mesa_error(ctx
, GL_INVALID_OPERATION
,
334 "glBindSamplers(first=%u + count=%d > the value of "
335 "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS=%u)",
336 first
, count
, ctx
->Const
.MaxCombinedTextureImageUnits
);
340 FLUSH_VERTICES(ctx
, 0);
343 /* Note that the error semantics for multi-bind commands differ from
344 * those of other GL commands.
346 * The Issues section in the ARB_multi_bind spec says:
348 * "(11) Typically, OpenGL specifies that if an error is generated by
349 * a command, that command has no effect. This is somewhat
350 * unfortunate for multi-bind commands, because it would require
351 * a first pass to scan the entire list of bound objects for
352 * errors and then a second pass to actually perform the
353 * bindings. Should we have different error semantics?
355 * RESOLVED: Yes. In this specification, when the parameters for
356 * one of the <count> binding points are invalid, that binding
357 * point is not updated and an error will be generated. However,
358 * other binding points in the same command will be updated if
359 * their parameters are valid and no other error occurs."
362 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
364 for (i
= 0; i
< count
; i
++) {
365 const GLuint unit
= first
+ i
;
366 struct gl_sampler_object
* const currentSampler
=
367 ctx
->Texture
.Unit
[unit
].Sampler
;
368 struct gl_sampler_object
*sampObj
;
370 if (samplers
[i
] != 0) {
371 if (currentSampler
&& currentSampler
->Name
== samplers
[i
])
372 sampObj
= currentSampler
;
374 sampObj
= lookup_samplerobj_locked(ctx
, samplers
[i
]);
376 /* The ARB_multi_bind spec says:
378 * "An INVALID_OPERATION error is generated if any value
379 * in <samplers> is not zero or the name of an existing
380 * sampler object (per binding)."
383 _mesa_error(ctx
, GL_INVALID_OPERATION
,
384 "glBindSamplers(samplers[%d]=%u is not zero or "
385 "the name of an existing sampler object)",
393 /* Bind the new sampler */
394 if (sampObj
!= currentSampler
) {
395 _mesa_reference_sampler_object(ctx
,
396 &ctx
->Texture
.Unit
[unit
].Sampler
,
398 ctx
->NewState
|= _NEW_TEXTURE_OBJECT
;
402 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
404 /* Unbind all samplers in the range <first> through <first>+<count>-1 */
405 for (i
= 0; i
< count
; i
++) {
406 const GLuint unit
= first
+ i
;
408 if (ctx
->Texture
.Unit
[unit
].Sampler
) {
409 _mesa_reference_sampler_object(ctx
,
410 &ctx
->Texture
.Unit
[unit
].Sampler
,
412 ctx
->NewState
|= _NEW_TEXTURE_OBJECT
;
420 * Check if a coordinate wrap mode is legal.
421 * \return GL_TRUE if legal, GL_FALSE otherwise
424 validate_texture_wrap_mode(struct gl_context
*ctx
, GLenum wrap
)
426 const struct gl_extensions
* const e
= &ctx
->Extensions
;
430 case GL_CLAMP_TO_EDGE
:
432 case GL_MIRRORED_REPEAT
:
434 case GL_CLAMP_TO_BORDER
:
435 return e
->ARB_texture_border_clamp
;
436 case GL_MIRROR_CLAMP_EXT
:
437 return e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
;
438 case GL_MIRROR_CLAMP_TO_EDGE_EXT
:
439 return e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
|| e
->ARB_texture_mirror_clamp_to_edge
;
440 case GL_MIRROR_CLAMP_TO_BORDER_EXT
:
441 return e
->EXT_texture_mirror_clamp
;
449 * This is called just prior to changing any sampler object state.
452 flush(struct gl_context
*ctx
)
454 FLUSH_VERTICES(ctx
, _NEW_TEXTURE_OBJECT
);
458 _mesa_set_sampler_wrap(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
459 GLenum s
, GLenum t
, GLenum r
)
461 assert(validate_texture_wrap_mode(ctx
, s
));
462 assert(validate_texture_wrap_mode(ctx
, t
));
463 assert(validate_texture_wrap_mode(ctx
, r
));
465 if (samp
->WrapS
== s
&& samp
->WrapT
== t
&& samp
->WrapR
== r
)
474 #define INVALID_PARAM 0x100
475 #define INVALID_PNAME 0x101
476 #define INVALID_VALUE 0x102
479 set_sampler_wrap_s(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
482 if (samp
->WrapS
== param
)
484 if (validate_texture_wrap_mode(ctx
, param
)) {
489 return INVALID_PARAM
;
494 set_sampler_wrap_t(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
497 if (samp
->WrapT
== param
)
499 if (validate_texture_wrap_mode(ctx
, param
)) {
504 return INVALID_PARAM
;
509 set_sampler_wrap_r(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
512 if (samp
->WrapR
== param
)
514 if (validate_texture_wrap_mode(ctx
, param
)) {
519 return INVALID_PARAM
;
523 _mesa_set_sampler_filters(struct gl_context
*ctx
,
524 struct gl_sampler_object
*samp
,
525 GLenum min_filter
, GLenum mag_filter
)
527 assert(min_filter
== GL_NEAREST
||
528 min_filter
== GL_LINEAR
||
529 min_filter
== GL_NEAREST_MIPMAP_NEAREST
||
530 min_filter
== GL_LINEAR_MIPMAP_NEAREST
||
531 min_filter
== GL_NEAREST_MIPMAP_LINEAR
||
532 min_filter
== GL_LINEAR_MIPMAP_LINEAR
);
533 assert(mag_filter
== GL_NEAREST
||
534 mag_filter
== GL_LINEAR
);
536 if (samp
->MinFilter
== min_filter
&& samp
->MagFilter
== mag_filter
)
540 samp
->MinFilter
= min_filter
;
541 samp
->MagFilter
= mag_filter
;
545 set_sampler_min_filter(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
548 if (samp
->MinFilter
== param
)
554 case GL_NEAREST_MIPMAP_NEAREST
:
555 case GL_LINEAR_MIPMAP_NEAREST
:
556 case GL_NEAREST_MIPMAP_LINEAR
:
557 case GL_LINEAR_MIPMAP_LINEAR
:
559 samp
->MinFilter
= param
;
562 return INVALID_PARAM
;
568 set_sampler_mag_filter(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
571 if (samp
->MagFilter
== param
)
578 samp
->MagFilter
= param
;
581 return INVALID_PARAM
;
587 set_sampler_lod_bias(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
590 if (samp
->LodBias
== param
)
594 samp
->LodBias
= param
;
600 set_sampler_border_colorf(struct gl_context
*ctx
,
601 struct gl_sampler_object
*samp
,
602 const GLfloat params
[4])
605 samp
->BorderColor
.f
[RCOMP
] = params
[0];
606 samp
->BorderColor
.f
[GCOMP
] = params
[1];
607 samp
->BorderColor
.f
[BCOMP
] = params
[2];
608 samp
->BorderColor
.f
[ACOMP
] = params
[3];
614 set_sampler_border_colori(struct gl_context
*ctx
,
615 struct gl_sampler_object
*samp
,
616 const GLint params
[4])
619 samp
->BorderColor
.i
[RCOMP
] = params
[0];
620 samp
->BorderColor
.i
[GCOMP
] = params
[1];
621 samp
->BorderColor
.i
[BCOMP
] = params
[2];
622 samp
->BorderColor
.i
[ACOMP
] = params
[3];
628 set_sampler_border_colorui(struct gl_context
*ctx
,
629 struct gl_sampler_object
*samp
,
630 const GLuint params
[4])
633 samp
->BorderColor
.ui
[RCOMP
] = params
[0];
634 samp
->BorderColor
.ui
[GCOMP
] = params
[1];
635 samp
->BorderColor
.ui
[BCOMP
] = params
[2];
636 samp
->BorderColor
.ui
[ACOMP
] = params
[3];
642 set_sampler_min_lod(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
645 if (samp
->MinLod
== param
)
649 samp
->MinLod
= param
;
655 set_sampler_max_lod(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
658 if (samp
->MaxLod
== param
)
662 samp
->MaxLod
= param
;
668 set_sampler_compare_mode(struct gl_context
*ctx
,
669 struct gl_sampler_object
*samp
, GLint param
)
671 /* If GL_ARB_shadow is not supported, don't report an error. The
672 * sampler object extension spec isn't clear on this extension interaction.
673 * Silences errors with Wine on older GPUs such as R200.
675 if (!ctx
->Extensions
.ARB_shadow
)
678 if (samp
->CompareMode
== param
)
681 if (param
== GL_NONE
||
682 param
== GL_COMPARE_R_TO_TEXTURE_ARB
) {
684 samp
->CompareMode
= param
;
688 return INVALID_PARAM
;
693 set_sampler_compare_func(struct gl_context
*ctx
,
694 struct gl_sampler_object
*samp
, GLint param
)
696 /* If GL_ARB_shadow is not supported, don't report an error. The
697 * sampler object extension spec isn't clear on this extension interaction.
698 * Silences errors with Wine on older GPUs such as R200.
700 if (!ctx
->Extensions
.ARB_shadow
)
703 if (samp
->CompareFunc
== param
)
716 samp
->CompareFunc
= param
;
719 return INVALID_PARAM
;
725 set_sampler_max_anisotropy(struct gl_context
*ctx
,
726 struct gl_sampler_object
*samp
, GLfloat param
)
728 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
729 return INVALID_PNAME
;
731 if (samp
->MaxAnisotropy
== param
)
735 return INVALID_VALUE
;
738 /* clamp to max, that's what NVIDIA does */
739 samp
->MaxAnisotropy
= MIN2(param
, ctx
->Const
.MaxTextureMaxAnisotropy
);
745 set_sampler_cube_map_seamless(struct gl_context
*ctx
,
746 struct gl_sampler_object
*samp
, GLboolean param
)
748 if (!_mesa_is_desktop_gl(ctx
)
749 || !ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
750 return INVALID_PNAME
;
752 if (samp
->CubeMapSeamless
== param
)
755 if (param
!= GL_TRUE
&& param
!= GL_FALSE
)
756 return INVALID_VALUE
;
759 samp
->CubeMapSeamless
= param
;
764 _mesa_set_sampler_srgb_decode(struct gl_context
*ctx
,
765 struct gl_sampler_object
*samp
, GLenum param
)
767 assert(param
== GL_DECODE_EXT
|| param
== GL_SKIP_DECODE_EXT
);
770 samp
->sRGBDecode
= param
;
774 set_sampler_srgb_decode(struct gl_context
*ctx
,
775 struct gl_sampler_object
*samp
, GLenum param
)
777 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
778 return INVALID_PNAME
;
780 if (samp
->sRGBDecode
== param
)
783 /* The EXT_texture_sRGB_decode spec says:
785 * "INVALID_ENUM is generated if the <pname> parameter of
786 * TexParameter[i,f,Ii,Iui][v][EXT],
787 * MultiTexParameter[i,f,Ii,Iui][v]EXT,
788 * TextureParameter[i,f,Ii,Iui][v]EXT, SamplerParameter[i,f,Ii,Iui][v]
789 * is TEXTURE_SRGB_DECODE_EXT when the <param> parameter is not one of
790 * DECODE_EXT or SKIP_DECODE_EXT.
792 * Returning INVALID_PARAM makes that happen.
794 if (param
!= GL_DECODE_EXT
&& param
!= GL_SKIP_DECODE_EXT
)
795 return INVALID_PARAM
;
798 samp
->sRGBDecode
= param
;
802 static struct gl_sampler_object
*
803 sampler_parameter_error_check(struct gl_context
*ctx
, GLuint sampler
,
804 bool get
, const char *name
)
806 struct gl_sampler_object
*sampObj
;
808 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
810 /* OpenGL 4.5 spec, section "8.2 Sampler Objects", page 176 of the PDF
813 * "An INVALID_OPERATION error is generated if sampler is not the name
814 * of a sampler object previously returned from a call to
817 _mesa_error(ctx
, GL_INVALID_OPERATION
, "%s(invalid sampler)", name
);
821 if (!get
&& sampObj
->HandleAllocated
) {
822 /* The ARB_bindless_texture spec says:
824 * "The error INVALID_OPERATION is generated by SamplerParameter* if
825 * <sampler> identifies a sampler object referenced by one or more
828 _mesa_error(ctx
, GL_INVALID_OPERATION
, "%s(immutable sampler)", name
);
836 _mesa_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
838 struct gl_sampler_object
*sampObj
;
840 GET_CURRENT_CONTEXT(ctx
);
842 sampObj
= sampler_parameter_error_check(ctx
, sampler
, false,
843 "glSamplerParameteri");
848 case GL_TEXTURE_WRAP_S
:
849 res
= set_sampler_wrap_s(ctx
, sampObj
, param
);
851 case GL_TEXTURE_WRAP_T
:
852 res
= set_sampler_wrap_t(ctx
, sampObj
, param
);
854 case GL_TEXTURE_WRAP_R
:
855 res
= set_sampler_wrap_r(ctx
, sampObj
, param
);
857 case GL_TEXTURE_MIN_FILTER
:
858 res
= set_sampler_min_filter(ctx
, sampObj
, param
);
860 case GL_TEXTURE_MAG_FILTER
:
861 res
= set_sampler_mag_filter(ctx
, sampObj
, param
);
863 case GL_TEXTURE_MIN_LOD
:
864 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) param
);
866 case GL_TEXTURE_MAX_LOD
:
867 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) param
);
869 case GL_TEXTURE_LOD_BIAS
:
870 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) param
);
872 case GL_TEXTURE_COMPARE_MODE
:
873 res
= set_sampler_compare_mode(ctx
, sampObj
, param
);
875 case GL_TEXTURE_COMPARE_FUNC
:
876 res
= set_sampler_compare_func(ctx
, sampObj
, param
);
878 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
879 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) param
);
881 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
882 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, param
);
884 case GL_TEXTURE_SRGB_DECODE_EXT
:
885 res
= set_sampler_srgb_decode(ctx
, sampObj
, param
);
887 case GL_TEXTURE_BORDER_COLOR
:
898 /* state change - we do nothing special at this time */
901 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteri(pname=%s)\n",
902 _mesa_enum_to_string(pname
));
905 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteri(param=%d)\n",
909 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameteri(param=%d)\n",
919 _mesa_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
921 struct gl_sampler_object
*sampObj
;
923 GET_CURRENT_CONTEXT(ctx
);
925 sampObj
= sampler_parameter_error_check(ctx
, sampler
, false,
926 "glSamplerParameterf");
931 case GL_TEXTURE_WRAP_S
:
932 res
= set_sampler_wrap_s(ctx
, sampObj
, (GLint
) param
);
934 case GL_TEXTURE_WRAP_T
:
935 res
= set_sampler_wrap_t(ctx
, sampObj
, (GLint
) param
);
937 case GL_TEXTURE_WRAP_R
:
938 res
= set_sampler_wrap_r(ctx
, sampObj
, (GLint
) param
);
940 case GL_TEXTURE_MIN_FILTER
:
941 res
= set_sampler_min_filter(ctx
, sampObj
, (GLint
) param
);
943 case GL_TEXTURE_MAG_FILTER
:
944 res
= set_sampler_mag_filter(ctx
, sampObj
, (GLint
) param
);
946 case GL_TEXTURE_MIN_LOD
:
947 res
= set_sampler_min_lod(ctx
, sampObj
, param
);
949 case GL_TEXTURE_MAX_LOD
:
950 res
= set_sampler_max_lod(ctx
, sampObj
, param
);
952 case GL_TEXTURE_LOD_BIAS
:
953 res
= set_sampler_lod_bias(ctx
, sampObj
, param
);
955 case GL_TEXTURE_COMPARE_MODE
:
956 res
= set_sampler_compare_mode(ctx
, sampObj
, (GLint
) param
);
958 case GL_TEXTURE_COMPARE_FUNC
:
959 res
= set_sampler_compare_func(ctx
, sampObj
, (GLint
) param
);
961 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
962 res
= set_sampler_max_anisotropy(ctx
, sampObj
, param
);
964 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
965 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, (GLboolean
) param
);
967 case GL_TEXTURE_SRGB_DECODE_EXT
:
968 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) param
);
970 case GL_TEXTURE_BORDER_COLOR
:
981 /* state change - we do nothing special at this time */
984 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterf(pname=%s)\n",
985 _mesa_enum_to_string(pname
));
988 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterf(param=%f)\n",
992 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterf(param=%f)\n",
1001 _mesa_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
1003 struct gl_sampler_object
*sampObj
;
1005 GET_CURRENT_CONTEXT(ctx
);
1007 sampObj
= sampler_parameter_error_check(ctx
, sampler
, false,
1008 "glSamplerParameteriv");
1013 case GL_TEXTURE_WRAP_S
:
1014 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
1016 case GL_TEXTURE_WRAP_T
:
1017 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
1019 case GL_TEXTURE_WRAP_R
:
1020 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
1022 case GL_TEXTURE_MIN_FILTER
:
1023 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1025 case GL_TEXTURE_MAG_FILTER
:
1026 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1028 case GL_TEXTURE_MIN_LOD
:
1029 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1031 case GL_TEXTURE_MAX_LOD
:
1032 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1034 case GL_TEXTURE_LOD_BIAS
:
1035 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1037 case GL_TEXTURE_COMPARE_MODE
:
1038 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1040 case GL_TEXTURE_COMPARE_FUNC
:
1041 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1043 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1044 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1046 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1047 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1049 case GL_TEXTURE_SRGB_DECODE_EXT
:
1050 res
= set_sampler_srgb_decode(ctx
, sampObj
, params
[0]);
1052 case GL_TEXTURE_BORDER_COLOR
:
1055 c
[0] = INT_TO_FLOAT(params
[0]);
1056 c
[1] = INT_TO_FLOAT(params
[1]);
1057 c
[2] = INT_TO_FLOAT(params
[2]);
1058 c
[3] = INT_TO_FLOAT(params
[3]);
1059 res
= set_sampler_border_colorf(ctx
, sampObj
, c
);
1063 res
= INVALID_PNAME
;
1071 /* state change - we do nothing special at this time */
1074 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteriv(pname=%s)\n",
1075 _mesa_enum_to_string(pname
));
1078 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteriv(param=%d)\n",
1082 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameteriv(param=%d)\n",
1091 _mesa_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
1093 struct gl_sampler_object
*sampObj
;
1095 GET_CURRENT_CONTEXT(ctx
);
1097 sampObj
= sampler_parameter_error_check(ctx
, sampler
, false,
1098 "glSamplerParameterfv");
1103 case GL_TEXTURE_WRAP_S
:
1104 res
= set_sampler_wrap_s(ctx
, sampObj
, (GLint
) params
[0]);
1106 case GL_TEXTURE_WRAP_T
:
1107 res
= set_sampler_wrap_t(ctx
, sampObj
, (GLint
) params
[0]);
1109 case GL_TEXTURE_WRAP_R
:
1110 res
= set_sampler_wrap_r(ctx
, sampObj
, (GLint
) params
[0]);
1112 case GL_TEXTURE_MIN_FILTER
:
1113 res
= set_sampler_min_filter(ctx
, sampObj
, (GLint
) params
[0]);
1115 case GL_TEXTURE_MAG_FILTER
:
1116 res
= set_sampler_mag_filter(ctx
, sampObj
, (GLint
) params
[0]);
1118 case GL_TEXTURE_MIN_LOD
:
1119 res
= set_sampler_min_lod(ctx
, sampObj
, params
[0]);
1121 case GL_TEXTURE_MAX_LOD
:
1122 res
= set_sampler_max_lod(ctx
, sampObj
, params
[0]);
1124 case GL_TEXTURE_LOD_BIAS
:
1125 res
= set_sampler_lod_bias(ctx
, sampObj
, params
[0]);
1127 case GL_TEXTURE_COMPARE_MODE
:
1128 res
= set_sampler_compare_mode(ctx
, sampObj
, (GLint
) params
[0]);
1130 case GL_TEXTURE_COMPARE_FUNC
:
1131 res
= set_sampler_compare_func(ctx
, sampObj
, (GLint
) params
[0]);
1133 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1134 res
= set_sampler_max_anisotropy(ctx
, sampObj
, params
[0]);
1136 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1137 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, (GLboolean
) params
[0]);
1139 case GL_TEXTURE_SRGB_DECODE_EXT
:
1140 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1142 case GL_TEXTURE_BORDER_COLOR
:
1143 res
= set_sampler_border_colorf(ctx
, sampObj
, params
);
1146 res
= INVALID_PNAME
;
1154 /* state change - we do nothing special at this time */
1157 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterfv(pname=%s)\n",
1158 _mesa_enum_to_string(pname
));
1161 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterfv(param=%f)\n",
1165 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterfv(param=%f)\n",
1174 _mesa_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
1176 struct gl_sampler_object
*sampObj
;
1178 GET_CURRENT_CONTEXT(ctx
);
1180 sampObj
= sampler_parameter_error_check(ctx
, sampler
, false,
1181 "glSamplerParameterIiv");
1186 case GL_TEXTURE_WRAP_S
:
1187 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
1189 case GL_TEXTURE_WRAP_T
:
1190 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
1192 case GL_TEXTURE_WRAP_R
:
1193 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
1195 case GL_TEXTURE_MIN_FILTER
:
1196 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1198 case GL_TEXTURE_MAG_FILTER
:
1199 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1201 case GL_TEXTURE_MIN_LOD
:
1202 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1204 case GL_TEXTURE_MAX_LOD
:
1205 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1207 case GL_TEXTURE_LOD_BIAS
:
1208 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1210 case GL_TEXTURE_COMPARE_MODE
:
1211 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1213 case GL_TEXTURE_COMPARE_FUNC
:
1214 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1216 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1217 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1219 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1220 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1222 case GL_TEXTURE_SRGB_DECODE_EXT
:
1223 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1225 case GL_TEXTURE_BORDER_COLOR
:
1226 res
= set_sampler_border_colori(ctx
, sampObj
, params
);
1229 res
= INVALID_PNAME
;
1237 /* state change - we do nothing special at this time */
1240 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIiv(pname=%s)\n",
1241 _mesa_enum_to_string(pname
));
1244 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIiv(param=%d)\n",
1248 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterIiv(param=%d)\n",
1258 _mesa_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
1260 struct gl_sampler_object
*sampObj
;
1262 GET_CURRENT_CONTEXT(ctx
);
1264 sampObj
= sampler_parameter_error_check(ctx
, sampler
, false,
1265 "glSamplerParameterIuiv");
1270 case GL_TEXTURE_WRAP_S
:
1271 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
1273 case GL_TEXTURE_WRAP_T
:
1274 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
1276 case GL_TEXTURE_WRAP_R
:
1277 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
1279 case GL_TEXTURE_MIN_FILTER
:
1280 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1282 case GL_TEXTURE_MAG_FILTER
:
1283 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1285 case GL_TEXTURE_MIN_LOD
:
1286 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1288 case GL_TEXTURE_MAX_LOD
:
1289 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1291 case GL_TEXTURE_LOD_BIAS
:
1292 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1294 case GL_TEXTURE_COMPARE_MODE
:
1295 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1297 case GL_TEXTURE_COMPARE_FUNC
:
1298 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1300 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1301 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1303 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1304 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1306 case GL_TEXTURE_SRGB_DECODE_EXT
:
1307 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1309 case GL_TEXTURE_BORDER_COLOR
:
1310 res
= set_sampler_border_colorui(ctx
, sampObj
, params
);
1313 res
= INVALID_PNAME
;
1321 /* state change - we do nothing special at this time */
1324 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIuiv(pname=%s)\n",
1325 _mesa_enum_to_string(pname
));
1328 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIuiv(param=%u)\n",
1332 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterIuiv(param=%u)\n",
1342 _mesa_GetSamplerParameteriv(GLuint sampler
, GLenum pname
, GLint
*params
)
1344 struct gl_sampler_object
*sampObj
;
1345 GET_CURRENT_CONTEXT(ctx
);
1347 sampObj
= sampler_parameter_error_check(ctx
, sampler
, true,
1348 "glGetSamplerParameteriv");
1353 case GL_TEXTURE_WRAP_S
:
1354 *params
= sampObj
->WrapS
;
1356 case GL_TEXTURE_WRAP_T
:
1357 *params
= sampObj
->WrapT
;
1359 case GL_TEXTURE_WRAP_R
:
1360 *params
= sampObj
->WrapR
;
1362 case GL_TEXTURE_MIN_FILTER
:
1363 *params
= sampObj
->MinFilter
;
1365 case GL_TEXTURE_MAG_FILTER
:
1366 *params
= sampObj
->MagFilter
;
1368 case GL_TEXTURE_MIN_LOD
:
1369 /* GL spec 'Data Conversions' section specifies that floating-point
1370 * value in integer Get function is rounded to nearest integer
1372 *params
= IROUND(sampObj
->MinLod
);
1374 case GL_TEXTURE_MAX_LOD
:
1375 /* GL spec 'Data Conversions' section specifies that floating-point
1376 * value in integer Get function is rounded to nearest integer
1378 *params
= IROUND(sampObj
->MaxLod
);
1380 case GL_TEXTURE_LOD_BIAS
:
1381 /* GL spec 'Data Conversions' section specifies that floating-point
1382 * value in integer Get function is rounded to nearest integer
1384 *params
= IROUND(sampObj
->LodBias
);
1386 case GL_TEXTURE_COMPARE_MODE
:
1387 *params
= sampObj
->CompareMode
;
1389 case GL_TEXTURE_COMPARE_FUNC
:
1390 *params
= sampObj
->CompareFunc
;
1392 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1393 /* GL spec 'Data Conversions' section specifies that floating-point
1394 * value in integer Get function is rounded to nearest integer
1396 *params
= IROUND(sampObj
->MaxAnisotropy
);
1398 case GL_TEXTURE_BORDER_COLOR
:
1399 params
[0] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[0]);
1400 params
[1] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[1]);
1401 params
[2] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[2]);
1402 params
[3] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[3]);
1404 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1405 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1407 *params
= sampObj
->CubeMapSeamless
;
1409 case GL_TEXTURE_SRGB_DECODE_EXT
:
1410 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1412 *params
= (GLenum
) sampObj
->sRGBDecode
;
1420 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameteriv(pname=%s)",
1421 _mesa_enum_to_string(pname
));
1426 _mesa_GetSamplerParameterfv(GLuint sampler
, GLenum pname
, GLfloat
*params
)
1428 struct gl_sampler_object
*sampObj
;
1429 GET_CURRENT_CONTEXT(ctx
);
1431 sampObj
= sampler_parameter_error_check(ctx
, sampler
, true,
1432 "glGetSamplerParameterfv");
1437 case GL_TEXTURE_WRAP_S
:
1438 *params
= (GLfloat
) sampObj
->WrapS
;
1440 case GL_TEXTURE_WRAP_T
:
1441 *params
= (GLfloat
) sampObj
->WrapT
;
1443 case GL_TEXTURE_WRAP_R
:
1444 *params
= (GLfloat
) sampObj
->WrapR
;
1446 case GL_TEXTURE_MIN_FILTER
:
1447 *params
= (GLfloat
) sampObj
->MinFilter
;
1449 case GL_TEXTURE_MAG_FILTER
:
1450 *params
= (GLfloat
) sampObj
->MagFilter
;
1452 case GL_TEXTURE_MIN_LOD
:
1453 *params
= sampObj
->MinLod
;
1455 case GL_TEXTURE_MAX_LOD
:
1456 *params
= sampObj
->MaxLod
;
1458 case GL_TEXTURE_LOD_BIAS
:
1459 *params
= sampObj
->LodBias
;
1461 case GL_TEXTURE_COMPARE_MODE
:
1462 *params
= (GLfloat
) sampObj
->CompareMode
;
1464 case GL_TEXTURE_COMPARE_FUNC
:
1465 *params
= (GLfloat
) sampObj
->CompareFunc
;
1467 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1468 *params
= sampObj
->MaxAnisotropy
;
1470 case GL_TEXTURE_BORDER_COLOR
:
1471 params
[0] = sampObj
->BorderColor
.f
[0];
1472 params
[1] = sampObj
->BorderColor
.f
[1];
1473 params
[2] = sampObj
->BorderColor
.f
[2];
1474 params
[3] = sampObj
->BorderColor
.f
[3];
1476 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1477 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1479 *params
= (GLfloat
) sampObj
->CubeMapSeamless
;
1481 case GL_TEXTURE_SRGB_DECODE_EXT
:
1482 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1484 *params
= (GLfloat
) sampObj
->sRGBDecode
;
1492 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterfv(pname=%s)",
1493 _mesa_enum_to_string(pname
));
1498 _mesa_GetSamplerParameterIiv(GLuint sampler
, GLenum pname
, GLint
*params
)
1500 struct gl_sampler_object
*sampObj
;
1501 GET_CURRENT_CONTEXT(ctx
);
1503 sampObj
= sampler_parameter_error_check(ctx
, sampler
, true,
1504 "glGetSamplerParameterIiv");
1509 case GL_TEXTURE_WRAP_S
:
1510 *params
= sampObj
->WrapS
;
1512 case GL_TEXTURE_WRAP_T
:
1513 *params
= sampObj
->WrapT
;
1515 case GL_TEXTURE_WRAP_R
:
1516 *params
= sampObj
->WrapR
;
1518 case GL_TEXTURE_MIN_FILTER
:
1519 *params
= sampObj
->MinFilter
;
1521 case GL_TEXTURE_MAG_FILTER
:
1522 *params
= sampObj
->MagFilter
;
1524 case GL_TEXTURE_MIN_LOD
:
1525 *params
= (GLint
) sampObj
->MinLod
;
1527 case GL_TEXTURE_MAX_LOD
:
1528 *params
= (GLint
) sampObj
->MaxLod
;
1530 case GL_TEXTURE_LOD_BIAS
:
1531 *params
= (GLint
) sampObj
->LodBias
;
1533 case GL_TEXTURE_COMPARE_MODE
:
1534 *params
= sampObj
->CompareMode
;
1536 case GL_TEXTURE_COMPARE_FUNC
:
1537 *params
= sampObj
->CompareFunc
;
1539 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1540 *params
= (GLint
) sampObj
->MaxAnisotropy
;
1542 case GL_TEXTURE_BORDER_COLOR
:
1543 params
[0] = sampObj
->BorderColor
.i
[0];
1544 params
[1] = sampObj
->BorderColor
.i
[1];
1545 params
[2] = sampObj
->BorderColor
.i
[2];
1546 params
[3] = sampObj
->BorderColor
.i
[3];
1548 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1549 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1551 *params
= sampObj
->CubeMapSeamless
;
1553 case GL_TEXTURE_SRGB_DECODE_EXT
:
1554 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1556 *params
= (GLenum
) sampObj
->sRGBDecode
;
1564 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterIiv(pname=%s)",
1565 _mesa_enum_to_string(pname
));
1570 _mesa_GetSamplerParameterIuiv(GLuint sampler
, GLenum pname
, GLuint
*params
)
1572 struct gl_sampler_object
*sampObj
;
1573 GET_CURRENT_CONTEXT(ctx
);
1575 sampObj
= sampler_parameter_error_check(ctx
, sampler
, true,
1576 "glGetSamplerParameterIuiv");
1581 case GL_TEXTURE_WRAP_S
:
1582 *params
= sampObj
->WrapS
;
1584 case GL_TEXTURE_WRAP_T
:
1585 *params
= sampObj
->WrapT
;
1587 case GL_TEXTURE_WRAP_R
:
1588 *params
= sampObj
->WrapR
;
1590 case GL_TEXTURE_MIN_FILTER
:
1591 *params
= sampObj
->MinFilter
;
1593 case GL_TEXTURE_MAG_FILTER
:
1594 *params
= sampObj
->MagFilter
;
1596 case GL_TEXTURE_MIN_LOD
:
1597 *params
= (GLuint
) sampObj
->MinLod
;
1599 case GL_TEXTURE_MAX_LOD
:
1600 *params
= (GLuint
) sampObj
->MaxLod
;
1602 case GL_TEXTURE_LOD_BIAS
:
1603 *params
= (GLuint
) sampObj
->LodBias
;
1605 case GL_TEXTURE_COMPARE_MODE
:
1606 *params
= sampObj
->CompareMode
;
1608 case GL_TEXTURE_COMPARE_FUNC
:
1609 *params
= sampObj
->CompareFunc
;
1611 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1612 *params
= (GLuint
) sampObj
->MaxAnisotropy
;
1614 case GL_TEXTURE_BORDER_COLOR
:
1615 params
[0] = sampObj
->BorderColor
.ui
[0];
1616 params
[1] = sampObj
->BorderColor
.ui
[1];
1617 params
[2] = sampObj
->BorderColor
.ui
[2];
1618 params
[3] = sampObj
->BorderColor
.ui
[3];
1620 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1621 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1623 *params
= sampObj
->CubeMapSeamless
;
1625 case GL_TEXTURE_SRGB_DECODE_EXT
:
1626 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1628 *params
= (GLenum
) sampObj
->sRGBDecode
;
1636 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterIuiv(pname=%s)",
1637 _mesa_enum_to_string(pname
));
1642 _mesa_init_sampler_object_functions(struct dd_function_table
*driver
)
1644 driver
->NewSamplerObject
= _mesa_new_sampler_object
;