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
);
55 begin_samplerobj_lookups(struct gl_context
*ctx
)
57 _mesa_HashLockMutex(ctx
->Shared
->SamplerObjects
);
62 end_samplerobj_lookups(struct gl_context
*ctx
)
64 _mesa_HashUnlockMutex(ctx
->Shared
->SamplerObjects
);
68 static inline struct gl_sampler_object
*
69 lookup_samplerobj_locked(struct gl_context
*ctx
, GLuint name
)
71 return (struct gl_sampler_object
*)
72 _mesa_HashLookupLocked(ctx
->Shared
->SamplerObjects
, name
);
77 * Handle reference counting.
80 _mesa_reference_sampler_object_(struct gl_context
*ctx
,
81 struct gl_sampler_object
**ptr
,
82 struct gl_sampler_object
*samp
)
84 assert(*ptr
!= samp
); /* The inline wrapper should prevent no-op calls */
87 /* Unreference the old sampler */
88 GLboolean deleteFlag
= GL_FALSE
;
89 struct gl_sampler_object
*oldSamp
= *ptr
;
91 /*mtx_lock(&oldSamp->Mutex);*/
92 assert(oldSamp
->RefCount
> 0);
95 printf("SamplerObj %p %d DECR to %d\n",
96 (void *) oldSamp
, oldSamp
->Name
, oldSamp
->RefCount
);
98 deleteFlag
= (oldSamp
->RefCount
== 0);
99 /*mtx_unlock(&oldSamp->Mutex);*/
102 assert(ctx
->Driver
.DeleteSamplerObject
);
103 ctx
->Driver
.DeleteSamplerObject(ctx
, oldSamp
);
111 /* reference new sampler */
112 /*mtx_lock(&samp->Mutex);*/
113 if (samp
->RefCount
== 0) {
114 /* this sampler's being deleted (look just above) */
115 /* Not sure this can every really happen. Warn if it does. */
116 _mesa_problem(NULL
, "referencing deleted sampler object");
122 printf("SamplerObj %p %d INCR to %d\n",
123 (void *) samp
, samp
->Name
, samp
->RefCount
);
127 /*mtx_unlock(&samp->Mutex);*/
133 * Initialize the fields of the given sampler object.
136 _mesa_init_sampler_object(struct gl_sampler_object
*sampObj
, GLuint name
)
138 sampObj
->Name
= name
;
139 sampObj
->RefCount
= 1;
140 sampObj
->WrapS
= GL_REPEAT
;
141 sampObj
->WrapT
= GL_REPEAT
;
142 sampObj
->WrapR
= GL_REPEAT
;
143 sampObj
->MinFilter
= GL_NEAREST_MIPMAP_LINEAR
;
144 sampObj
->MagFilter
= GL_LINEAR
;
145 sampObj
->BorderColor
.f
[0] = 0.0;
146 sampObj
->BorderColor
.f
[1] = 0.0;
147 sampObj
->BorderColor
.f
[2] = 0.0;
148 sampObj
->BorderColor
.f
[3] = 0.0;
149 sampObj
->MinLod
= -1000.0F
;
150 sampObj
->MaxLod
= 1000.0F
;
151 sampObj
->LodBias
= 0.0F
;
152 sampObj
->MaxAnisotropy
= 1.0F
;
153 sampObj
->CompareMode
= GL_NONE
;
154 sampObj
->CompareFunc
= GL_LEQUAL
;
155 sampObj
->sRGBDecode
= GL_DECODE_EXT
;
156 sampObj
->CubeMapSeamless
= GL_FALSE
;
160 * Fallback for ctx->Driver.NewSamplerObject();
162 struct gl_sampler_object
*
163 _mesa_new_sampler_object(struct gl_context
*ctx
, GLuint name
)
165 struct gl_sampler_object
*sampObj
= CALLOC_STRUCT(gl_sampler_object
);
167 _mesa_init_sampler_object(sampObj
, name
);
174 * Fallback for ctx->Driver.DeleteSamplerObject();
177 _mesa_delete_sampler_object(struct gl_context
*ctx
,
178 struct gl_sampler_object
*sampObj
)
180 free(sampObj
->Label
);
186 _mesa_GenSamplers(GLsizei count
, GLuint
*samplers
)
188 GET_CURRENT_CONTEXT(ctx
);
192 if (MESA_VERBOSE
& VERBOSE_API
)
193 _mesa_debug(ctx
, "glGenSamplers(%d)\n", count
);
196 _mesa_error(ctx
, GL_INVALID_VALUE
, "glGenSamplers");
203 first
= _mesa_HashFindFreeKeyBlock(ctx
->Shared
->SamplerObjects
, count
);
205 /* Insert the ID and pointer to new sampler object into hash table */
206 for (i
= 0; i
< count
; i
++) {
207 struct gl_sampler_object
*sampObj
=
208 ctx
->Driver
.NewSamplerObject(ctx
, first
+ i
);
209 _mesa_HashInsert(ctx
->Shared
->SamplerObjects
, first
+ i
, sampObj
);
210 samplers
[i
] = first
+ i
;
216 _mesa_DeleteSamplers(GLsizei count
, const GLuint
*samplers
)
218 GET_CURRENT_CONTEXT(ctx
);
221 FLUSH_VERTICES(ctx
, 0);
224 _mesa_error(ctx
, GL_INVALID_VALUE
, "glDeleteSamplers(count)");
228 mtx_lock(&ctx
->Shared
->Mutex
);
230 for (i
= 0; i
< count
; i
++) {
233 struct gl_sampler_object
*sampObj
=
234 _mesa_lookup_samplerobj(ctx
, samplers
[i
]);
237 /* If the sampler is currently bound, unbind it. */
238 for (j
= 0; j
< ctx
->Const
.MaxCombinedTextureImageUnits
; j
++) {
239 if (ctx
->Texture
.Unit
[j
].Sampler
== sampObj
) {
240 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
241 _mesa_reference_sampler_object(ctx
, &ctx
->Texture
.Unit
[j
].Sampler
, NULL
);
245 /* The ID is immediately freed for re-use */
246 _mesa_HashRemove(ctx
->Shared
->SamplerObjects
, samplers
[i
]);
247 /* But the object exists until its reference count goes to zero */
248 _mesa_reference_sampler_object(ctx
, &sampObj
, NULL
);
253 mtx_unlock(&ctx
->Shared
->Mutex
);
258 _mesa_IsSampler(GLuint sampler
)
260 struct gl_sampler_object
*sampObj
;
261 GET_CURRENT_CONTEXT(ctx
);
263 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx
, GL_FALSE
);
268 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
270 return sampObj
!= NULL
;
275 _mesa_BindSampler(GLuint unit
, GLuint sampler
)
277 struct gl_sampler_object
*sampObj
;
278 GET_CURRENT_CONTEXT(ctx
);
280 if (unit
>= ctx
->Const
.MaxCombinedTextureImageUnits
) {
281 _mesa_error(ctx
, GL_INVALID_VALUE
, "glBindSampler(unit %u)", unit
);
286 /* Use the default sampler object, the one contained in the texture
292 /* user-defined sampler object */
293 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
295 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glBindSampler(sampler)");
300 if (ctx
->Texture
.Unit
[unit
].Sampler
!= sampObj
) {
301 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
304 /* bind new sampler */
305 _mesa_reference_sampler_object(ctx
, &ctx
->Texture
.Unit
[unit
].Sampler
,
311 _mesa_BindSamplers(GLuint first
, GLsizei count
, const GLuint
*samplers
)
313 GET_CURRENT_CONTEXT(ctx
);
316 /* The ARB_multi_bind spec says:
318 * "An INVALID_OPERATION error is generated if <first> + <count> is
319 * greater than the number of texture image units supported by
320 * the implementation."
322 if (first
+ count
> ctx
->Const
.MaxCombinedTextureImageUnits
) {
323 _mesa_error(ctx
, GL_INVALID_OPERATION
,
324 "glBindSamplers(first=%u + count=%d > the value of "
325 "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS=%u)",
326 first
, count
, ctx
->Const
.MaxCombinedTextureImageUnits
);
330 FLUSH_VERTICES(ctx
, 0);
333 /* Note that the error semantics for multi-bind commands differ from
334 * those of other GL commands.
336 * The Issues section in the ARB_multi_bind spec says:
338 * "(11) Typically, OpenGL specifies that if an error is generated by
339 * a command, that command has no effect. This is somewhat
340 * unfortunate for multi-bind commands, because it would require
341 * a first pass to scan the entire list of bound objects for
342 * errors and then a second pass to actually perform the
343 * bindings. Should we have different error semantics?
345 * RESOLVED: Yes. In this specification, when the parameters for
346 * one of the <count> binding points are invalid, that binding
347 * point is not updated and an error will be generated. However,
348 * other binding points in the same command will be updated if
349 * their parameters are valid and no other error occurs."
352 begin_samplerobj_lookups(ctx
);
354 for (i
= 0; i
< count
; i
++) {
355 const GLuint unit
= first
+ i
;
356 struct gl_sampler_object
* const currentSampler
=
357 ctx
->Texture
.Unit
[unit
].Sampler
;
358 struct gl_sampler_object
*sampObj
;
360 if (samplers
[i
] != 0) {
361 if (currentSampler
&& currentSampler
->Name
== samplers
[i
])
362 sampObj
= currentSampler
;
364 sampObj
= lookup_samplerobj_locked(ctx
, samplers
[i
]);
366 /* The ARB_multi_bind spec says:
368 * "An INVALID_OPERATION error is generated if any value
369 * in <samplers> is not zero or the name of an existing
370 * sampler object (per binding)."
373 _mesa_error(ctx
, GL_INVALID_OPERATION
,
374 "glBindSamplers(samplers[%d]=%u is not zero or "
375 "the name of an existing sampler object)",
383 /* Bind the new sampler */
384 if (sampObj
!= currentSampler
) {
385 _mesa_reference_sampler_object(ctx
,
386 &ctx
->Texture
.Unit
[unit
].Sampler
,
388 ctx
->NewState
|= _NEW_TEXTURE
;
392 end_samplerobj_lookups(ctx
);
394 /* Unbind all samplers in the range <first> through <first>+<count>-1 */
395 for (i
= 0; i
< count
; i
++) {
396 const GLuint unit
= first
+ i
;
398 if (ctx
->Texture
.Unit
[unit
].Sampler
) {
399 _mesa_reference_sampler_object(ctx
,
400 &ctx
->Texture
.Unit
[unit
].Sampler
,
402 ctx
->NewState
|= _NEW_TEXTURE
;
410 * Check if a coordinate wrap mode is legal.
411 * \return GL_TRUE if legal, GL_FALSE otherwise
414 validate_texture_wrap_mode(struct gl_context
*ctx
, GLenum wrap
)
416 const struct gl_extensions
* const e
= &ctx
->Extensions
;
420 case GL_CLAMP_TO_EDGE
:
422 case GL_MIRRORED_REPEAT
:
424 case GL_CLAMP_TO_BORDER
:
425 return e
->ARB_texture_border_clamp
;
426 case GL_MIRROR_CLAMP_EXT
:
427 return e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
;
428 case GL_MIRROR_CLAMP_TO_EDGE_EXT
:
429 return e
->ATI_texture_mirror_once
|| e
->EXT_texture_mirror_clamp
|| e
->ARB_texture_mirror_clamp_to_edge
;
430 case GL_MIRROR_CLAMP_TO_BORDER_EXT
:
431 return e
->EXT_texture_mirror_clamp
;
439 * This is called just prior to changing any sampler object state.
442 flush(struct gl_context
*ctx
)
444 FLUSH_VERTICES(ctx
, _NEW_TEXTURE
);
448 #define INVALID_PARAM 0x100
449 #define INVALID_PNAME 0x101
450 #define INVALID_VALUE 0x102
453 set_sampler_wrap_s(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
456 if (samp
->WrapS
== param
)
458 if (validate_texture_wrap_mode(ctx
, param
)) {
463 return INVALID_PARAM
;
468 set_sampler_wrap_t(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
471 if (samp
->WrapT
== param
)
473 if (validate_texture_wrap_mode(ctx
, param
)) {
478 return INVALID_PARAM
;
483 set_sampler_wrap_r(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
486 if (samp
->WrapR
== param
)
488 if (validate_texture_wrap_mode(ctx
, param
)) {
493 return INVALID_PARAM
;
498 set_sampler_min_filter(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
501 if (samp
->MinFilter
== param
)
507 case GL_NEAREST_MIPMAP_NEAREST
:
508 case GL_LINEAR_MIPMAP_NEAREST
:
509 case GL_NEAREST_MIPMAP_LINEAR
:
510 case GL_LINEAR_MIPMAP_LINEAR
:
512 samp
->MinFilter
= param
;
515 return INVALID_PARAM
;
521 set_sampler_mag_filter(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
524 if (samp
->MagFilter
== param
)
531 samp
->MagFilter
= param
;
534 return INVALID_PARAM
;
540 set_sampler_lod_bias(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
543 if (samp
->LodBias
== param
)
547 samp
->LodBias
= param
;
553 set_sampler_border_colorf(struct gl_context
*ctx
,
554 struct gl_sampler_object
*samp
,
555 const GLfloat params
[4])
558 samp
->BorderColor
.f
[RCOMP
] = params
[0];
559 samp
->BorderColor
.f
[GCOMP
] = params
[1];
560 samp
->BorderColor
.f
[BCOMP
] = params
[2];
561 samp
->BorderColor
.f
[ACOMP
] = params
[3];
567 set_sampler_border_colori(struct gl_context
*ctx
,
568 struct gl_sampler_object
*samp
,
569 const GLint params
[4])
572 samp
->BorderColor
.i
[RCOMP
] = params
[0];
573 samp
->BorderColor
.i
[GCOMP
] = params
[1];
574 samp
->BorderColor
.i
[BCOMP
] = params
[2];
575 samp
->BorderColor
.i
[ACOMP
] = params
[3];
581 set_sampler_border_colorui(struct gl_context
*ctx
,
582 struct gl_sampler_object
*samp
,
583 const GLuint params
[4])
586 samp
->BorderColor
.ui
[RCOMP
] = params
[0];
587 samp
->BorderColor
.ui
[GCOMP
] = params
[1];
588 samp
->BorderColor
.ui
[BCOMP
] = params
[2];
589 samp
->BorderColor
.ui
[ACOMP
] = params
[3];
595 set_sampler_min_lod(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
598 if (samp
->MinLod
== param
)
602 samp
->MinLod
= param
;
608 set_sampler_max_lod(struct gl_context
*ctx
, struct gl_sampler_object
*samp
,
611 if (samp
->MaxLod
== param
)
615 samp
->MaxLod
= param
;
621 set_sampler_compare_mode(struct gl_context
*ctx
,
622 struct gl_sampler_object
*samp
, GLint param
)
624 if (!ctx
->Extensions
.ARB_shadow
)
625 return INVALID_PNAME
;
627 if (samp
->CompareMode
== param
)
630 if (param
== GL_NONE
||
631 param
== GL_COMPARE_R_TO_TEXTURE_ARB
) {
633 samp
->CompareMode
= param
;
637 return INVALID_PARAM
;
642 set_sampler_compare_func(struct gl_context
*ctx
,
643 struct gl_sampler_object
*samp
, GLint param
)
645 if (!ctx
->Extensions
.ARB_shadow
)
646 return INVALID_PNAME
;
648 if (samp
->CompareFunc
== param
)
661 samp
->CompareFunc
= param
;
664 return INVALID_PARAM
;
670 set_sampler_max_anisotropy(struct gl_context
*ctx
,
671 struct gl_sampler_object
*samp
, GLfloat param
)
673 if (!ctx
->Extensions
.EXT_texture_filter_anisotropic
)
674 return INVALID_PNAME
;
676 if (samp
->MaxAnisotropy
== param
)
680 return INVALID_VALUE
;
683 /* clamp to max, that's what NVIDIA does */
684 samp
->MaxAnisotropy
= MIN2(param
, ctx
->Const
.MaxTextureMaxAnisotropy
);
690 set_sampler_cube_map_seamless(struct gl_context
*ctx
,
691 struct gl_sampler_object
*samp
, GLboolean param
)
693 if (!_mesa_is_desktop_gl(ctx
)
694 || !ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
695 return INVALID_PNAME
;
697 if (samp
->CubeMapSeamless
== param
)
700 if (param
!= GL_TRUE
&& param
!= GL_FALSE
)
701 return INVALID_VALUE
;
704 samp
->CubeMapSeamless
= param
;
709 set_sampler_srgb_decode(struct gl_context
*ctx
,
710 struct gl_sampler_object
*samp
, GLenum param
)
712 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
713 return INVALID_PNAME
;
715 if (samp
->sRGBDecode
== param
)
718 if (param
!= GL_DECODE_EXT
&& param
!= GL_SKIP_DECODE_EXT
)
719 return INVALID_VALUE
;
722 samp
->sRGBDecode
= param
;
727 _mesa_SamplerParameteri(GLuint sampler
, GLenum pname
, GLint param
)
729 struct gl_sampler_object
*sampObj
;
731 GET_CURRENT_CONTEXT(ctx
);
733 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
735 /* '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:
737 * "An INVALID_OPERATION error is generated if sampler is not the name
738 * of a sampler object previously returned from a call to GenSamplers."
740 * In desktop GL, an GL_INVALID_VALUE is returned instead.
742 _mesa_error(ctx
, (_mesa_is_gles(ctx
) ?
743 GL_INVALID_OPERATION
: GL_INVALID_VALUE
),
744 "glSamplerParameteri(sampler %u)", sampler
);
749 case GL_TEXTURE_WRAP_S
:
750 res
= set_sampler_wrap_s(ctx
, sampObj
, param
);
752 case GL_TEXTURE_WRAP_T
:
753 res
= set_sampler_wrap_t(ctx
, sampObj
, param
);
755 case GL_TEXTURE_WRAP_R
:
756 res
= set_sampler_wrap_r(ctx
, sampObj
, param
);
758 case GL_TEXTURE_MIN_FILTER
:
759 res
= set_sampler_min_filter(ctx
, sampObj
, param
);
761 case GL_TEXTURE_MAG_FILTER
:
762 res
= set_sampler_mag_filter(ctx
, sampObj
, param
);
764 case GL_TEXTURE_MIN_LOD
:
765 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) param
);
767 case GL_TEXTURE_MAX_LOD
:
768 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) param
);
770 case GL_TEXTURE_LOD_BIAS
:
771 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) param
);
773 case GL_TEXTURE_COMPARE_MODE
:
774 res
= set_sampler_compare_mode(ctx
, sampObj
, param
);
776 case GL_TEXTURE_COMPARE_FUNC
:
777 res
= set_sampler_compare_func(ctx
, sampObj
, param
);
779 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
780 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) param
);
782 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
783 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, param
);
785 case GL_TEXTURE_SRGB_DECODE_EXT
:
786 res
= set_sampler_srgb_decode(ctx
, sampObj
, param
);
788 case GL_TEXTURE_BORDER_COLOR
:
799 /* state change - we do nothing special at this time */
802 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteri(pname=%s)\n",
803 _mesa_lookup_enum_by_nr(pname
));
806 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteri(param=%d)\n",
810 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameteri(param=%d)\n",
820 _mesa_SamplerParameterf(GLuint sampler
, GLenum pname
, GLfloat param
)
822 struct gl_sampler_object
*sampObj
;
824 GET_CURRENT_CONTEXT(ctx
);
826 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
828 /* '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:
830 * "An INVALID_OPERATION error is generated if sampler is not the name
831 * of a sampler object previously returned from a call to GenSamplers."
833 * In desktop GL, an GL_INVALID_VALUE is returned instead.
835 _mesa_error(ctx
, (_mesa_is_gles(ctx
) ?
836 GL_INVALID_OPERATION
: GL_INVALID_VALUE
),
837 "glSamplerParameterf(sampler %u)", sampler
);
842 case GL_TEXTURE_WRAP_S
:
843 res
= set_sampler_wrap_s(ctx
, sampObj
, (GLint
) param
);
845 case GL_TEXTURE_WRAP_T
:
846 res
= set_sampler_wrap_t(ctx
, sampObj
, (GLint
) param
);
848 case GL_TEXTURE_WRAP_R
:
849 res
= set_sampler_wrap_r(ctx
, sampObj
, (GLint
) param
);
851 case GL_TEXTURE_MIN_FILTER
:
852 res
= set_sampler_min_filter(ctx
, sampObj
, (GLint
) param
);
854 case GL_TEXTURE_MAG_FILTER
:
855 res
= set_sampler_mag_filter(ctx
, sampObj
, (GLint
) param
);
857 case GL_TEXTURE_MIN_LOD
:
858 res
= set_sampler_min_lod(ctx
, sampObj
, param
);
860 case GL_TEXTURE_MAX_LOD
:
861 res
= set_sampler_max_lod(ctx
, sampObj
, param
);
863 case GL_TEXTURE_LOD_BIAS
:
864 res
= set_sampler_lod_bias(ctx
, sampObj
, param
);
866 case GL_TEXTURE_COMPARE_MODE
:
867 res
= set_sampler_compare_mode(ctx
, sampObj
, (GLint
) param
);
869 case GL_TEXTURE_COMPARE_FUNC
:
870 res
= set_sampler_compare_func(ctx
, sampObj
, (GLint
) param
);
872 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
873 res
= set_sampler_max_anisotropy(ctx
, sampObj
, param
);
875 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
876 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, (GLboolean
) param
);
878 case GL_TEXTURE_SRGB_DECODE_EXT
:
879 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) param
);
881 case GL_TEXTURE_BORDER_COLOR
:
892 /* state change - we do nothing special at this time */
895 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterf(pname=%s)\n",
896 _mesa_lookup_enum_by_nr(pname
));
899 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterf(param=%f)\n",
903 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterf(param=%f)\n",
912 _mesa_SamplerParameteriv(GLuint sampler
, GLenum pname
, const GLint
*params
)
914 struct gl_sampler_object
*sampObj
;
916 GET_CURRENT_CONTEXT(ctx
);
918 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
920 /* '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:
922 * "An INVALID_OPERATION error is generated if sampler is not the name
923 * of a sampler object previously returned from a call to GenSamplers."
925 * In desktop GL, an GL_INVALID_VALUE is returned instead.
927 _mesa_error(ctx
, (_mesa_is_gles(ctx
) ?
928 GL_INVALID_OPERATION
: GL_INVALID_VALUE
),
929 "glSamplerParameteriv(sampler %u)", sampler
);
934 case GL_TEXTURE_WRAP_S
:
935 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
937 case GL_TEXTURE_WRAP_T
:
938 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
940 case GL_TEXTURE_WRAP_R
:
941 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
943 case GL_TEXTURE_MIN_FILTER
:
944 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
946 case GL_TEXTURE_MAG_FILTER
:
947 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
949 case GL_TEXTURE_MIN_LOD
:
950 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
952 case GL_TEXTURE_MAX_LOD
:
953 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
955 case GL_TEXTURE_LOD_BIAS
:
956 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
958 case GL_TEXTURE_COMPARE_MODE
:
959 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
961 case GL_TEXTURE_COMPARE_FUNC
:
962 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
964 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
965 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
967 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
968 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
970 case GL_TEXTURE_SRGB_DECODE_EXT
:
971 res
= set_sampler_srgb_decode(ctx
, sampObj
, params
[0]);
973 case GL_TEXTURE_BORDER_COLOR
:
976 c
[0] = INT_TO_FLOAT(params
[0]);
977 c
[1] = INT_TO_FLOAT(params
[1]);
978 c
[2] = INT_TO_FLOAT(params
[2]);
979 c
[3] = INT_TO_FLOAT(params
[3]);
980 res
= set_sampler_border_colorf(ctx
, sampObj
, c
);
992 /* state change - we do nothing special at this time */
995 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteriv(pname=%s)\n",
996 _mesa_lookup_enum_by_nr(pname
));
999 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameteriv(param=%d)\n",
1003 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameteriv(param=%d)\n",
1012 _mesa_SamplerParameterfv(GLuint sampler
, GLenum pname
, const GLfloat
*params
)
1014 struct gl_sampler_object
*sampObj
;
1016 GET_CURRENT_CONTEXT(ctx
);
1018 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
1020 /* '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:
1022 * "An INVALID_OPERATION error is generated if sampler is not the name
1023 * of a sampler object previously returned from a call to GenSamplers."
1025 * In desktop GL, an GL_INVALID_VALUE is returned instead.
1027 _mesa_error(ctx
, (_mesa_is_gles(ctx
) ?
1028 GL_INVALID_OPERATION
: GL_INVALID_VALUE
),
1029 "glSamplerParameterfv(sampler %u)", sampler
);
1034 case GL_TEXTURE_WRAP_S
:
1035 res
= set_sampler_wrap_s(ctx
, sampObj
, (GLint
) params
[0]);
1037 case GL_TEXTURE_WRAP_T
:
1038 res
= set_sampler_wrap_t(ctx
, sampObj
, (GLint
) params
[0]);
1040 case GL_TEXTURE_WRAP_R
:
1041 res
= set_sampler_wrap_r(ctx
, sampObj
, (GLint
) params
[0]);
1043 case GL_TEXTURE_MIN_FILTER
:
1044 res
= set_sampler_min_filter(ctx
, sampObj
, (GLint
) params
[0]);
1046 case GL_TEXTURE_MAG_FILTER
:
1047 res
= set_sampler_mag_filter(ctx
, sampObj
, (GLint
) params
[0]);
1049 case GL_TEXTURE_MIN_LOD
:
1050 res
= set_sampler_min_lod(ctx
, sampObj
, params
[0]);
1052 case GL_TEXTURE_MAX_LOD
:
1053 res
= set_sampler_max_lod(ctx
, sampObj
, params
[0]);
1055 case GL_TEXTURE_LOD_BIAS
:
1056 res
= set_sampler_lod_bias(ctx
, sampObj
, params
[0]);
1058 case GL_TEXTURE_COMPARE_MODE
:
1059 res
= set_sampler_compare_mode(ctx
, sampObj
, (GLint
) params
[0]);
1061 case GL_TEXTURE_COMPARE_FUNC
:
1062 res
= set_sampler_compare_func(ctx
, sampObj
, (GLint
) params
[0]);
1064 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1065 res
= set_sampler_max_anisotropy(ctx
, sampObj
, params
[0]);
1067 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1068 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, (GLboolean
) params
[0]);
1070 case GL_TEXTURE_SRGB_DECODE_EXT
:
1071 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1073 case GL_TEXTURE_BORDER_COLOR
:
1074 res
= set_sampler_border_colorf(ctx
, sampObj
, params
);
1077 res
= INVALID_PNAME
;
1085 /* state change - we do nothing special at this time */
1088 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterfv(pname=%s)\n",
1089 _mesa_lookup_enum_by_nr(pname
));
1092 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterfv(param=%f)\n",
1096 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterfv(param=%f)\n",
1105 _mesa_SamplerParameterIiv(GLuint sampler
, GLenum pname
, const GLint
*params
)
1107 struct gl_sampler_object
*sampObj
;
1109 GET_CURRENT_CONTEXT(ctx
);
1111 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
1113 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterIiv(sampler %u)",
1119 case GL_TEXTURE_WRAP_S
:
1120 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
1122 case GL_TEXTURE_WRAP_T
:
1123 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
1125 case GL_TEXTURE_WRAP_R
:
1126 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
1128 case GL_TEXTURE_MIN_FILTER
:
1129 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1131 case GL_TEXTURE_MAG_FILTER
:
1132 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1134 case GL_TEXTURE_MIN_LOD
:
1135 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1137 case GL_TEXTURE_MAX_LOD
:
1138 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1140 case GL_TEXTURE_LOD_BIAS
:
1141 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1143 case GL_TEXTURE_COMPARE_MODE
:
1144 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1146 case GL_TEXTURE_COMPARE_FUNC
:
1147 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1149 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1150 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1152 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1153 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1155 case GL_TEXTURE_SRGB_DECODE_EXT
:
1156 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1158 case GL_TEXTURE_BORDER_COLOR
:
1159 res
= set_sampler_border_colori(ctx
, sampObj
, params
);
1162 res
= INVALID_PNAME
;
1170 /* state change - we do nothing special at this time */
1173 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIiv(pname=%s)\n",
1174 _mesa_lookup_enum_by_nr(pname
));
1177 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIiv(param=%d)\n",
1181 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterIiv(param=%d)\n",
1191 _mesa_SamplerParameterIuiv(GLuint sampler
, GLenum pname
, const GLuint
*params
)
1193 struct gl_sampler_object
*sampObj
;
1195 GET_CURRENT_CONTEXT(ctx
);
1197 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
1199 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterIuiv(sampler %u)",
1205 case GL_TEXTURE_WRAP_S
:
1206 res
= set_sampler_wrap_s(ctx
, sampObj
, params
[0]);
1208 case GL_TEXTURE_WRAP_T
:
1209 res
= set_sampler_wrap_t(ctx
, sampObj
, params
[0]);
1211 case GL_TEXTURE_WRAP_R
:
1212 res
= set_sampler_wrap_r(ctx
, sampObj
, params
[0]);
1214 case GL_TEXTURE_MIN_FILTER
:
1215 res
= set_sampler_min_filter(ctx
, sampObj
, params
[0]);
1217 case GL_TEXTURE_MAG_FILTER
:
1218 res
= set_sampler_mag_filter(ctx
, sampObj
, params
[0]);
1220 case GL_TEXTURE_MIN_LOD
:
1221 res
= set_sampler_min_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1223 case GL_TEXTURE_MAX_LOD
:
1224 res
= set_sampler_max_lod(ctx
, sampObj
, (GLfloat
) params
[0]);
1226 case GL_TEXTURE_LOD_BIAS
:
1227 res
= set_sampler_lod_bias(ctx
, sampObj
, (GLfloat
) params
[0]);
1229 case GL_TEXTURE_COMPARE_MODE
:
1230 res
= set_sampler_compare_mode(ctx
, sampObj
, params
[0]);
1232 case GL_TEXTURE_COMPARE_FUNC
:
1233 res
= set_sampler_compare_func(ctx
, sampObj
, params
[0]);
1235 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1236 res
= set_sampler_max_anisotropy(ctx
, sampObj
, (GLfloat
) params
[0]);
1238 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1239 res
= set_sampler_cube_map_seamless(ctx
, sampObj
, params
[0]);
1241 case GL_TEXTURE_SRGB_DECODE_EXT
:
1242 res
= set_sampler_srgb_decode(ctx
, sampObj
, (GLenum
) params
[0]);
1244 case GL_TEXTURE_BORDER_COLOR
:
1245 res
= set_sampler_border_colorui(ctx
, sampObj
, params
);
1248 res
= INVALID_PNAME
;
1256 /* state change - we do nothing special at this time */
1259 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIuiv(pname=%s)\n",
1260 _mesa_lookup_enum_by_nr(pname
));
1263 _mesa_error(ctx
, GL_INVALID_ENUM
, "glSamplerParameterIuiv(param=%u)\n",
1267 _mesa_error(ctx
, GL_INVALID_VALUE
, "glSamplerParameterIuiv(param=%u)\n",
1277 _mesa_GetSamplerParameteriv(GLuint sampler
, GLenum pname
, GLint
*params
)
1279 struct gl_sampler_object
*sampObj
;
1280 GET_CURRENT_CONTEXT(ctx
);
1282 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
1284 /* '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:
1286 * "An INVALID_OPERATION error is generated if sampler is not the name
1287 * of a sampler object previously returned from a call to GenSamplers."
1289 * In desktop GL, an GL_INVALID_VALUE is returned instead.
1291 _mesa_error(ctx
, (_mesa_is_gles(ctx
) ?
1292 GL_INVALID_OPERATION
: GL_INVALID_VALUE
),
1293 "glGetSamplerParameteriv(sampler %u)", sampler
);
1298 case GL_TEXTURE_WRAP_S
:
1299 *params
= sampObj
->WrapS
;
1301 case GL_TEXTURE_WRAP_T
:
1302 *params
= sampObj
->WrapT
;
1304 case GL_TEXTURE_WRAP_R
:
1305 *params
= sampObj
->WrapR
;
1307 case GL_TEXTURE_MIN_FILTER
:
1308 *params
= sampObj
->MinFilter
;
1310 case GL_TEXTURE_MAG_FILTER
:
1311 *params
= sampObj
->MagFilter
;
1313 case GL_TEXTURE_MIN_LOD
:
1314 /* GL spec 'Data Conversions' section specifies that floating-point
1315 * value in integer Get function is rounded to nearest integer
1317 *params
= IROUND(sampObj
->MinLod
);
1319 case GL_TEXTURE_MAX_LOD
:
1320 /* GL spec 'Data Conversions' section specifies that floating-point
1321 * value in integer Get function is rounded to nearest integer
1323 *params
= IROUND(sampObj
->MaxLod
);
1325 case GL_TEXTURE_LOD_BIAS
:
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
->LodBias
);
1331 case GL_TEXTURE_COMPARE_MODE
:
1332 if (!ctx
->Extensions
.ARB_shadow
)
1334 *params
= sampObj
->CompareMode
;
1336 case GL_TEXTURE_COMPARE_FUNC
:
1337 if (!ctx
->Extensions
.ARB_shadow
)
1339 *params
= sampObj
->CompareFunc
;
1341 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1342 /* GL spec 'Data Conversions' section specifies that floating-point
1343 * value in integer Get function is rounded to nearest integer
1345 *params
= IROUND(sampObj
->MaxAnisotropy
);
1347 case GL_TEXTURE_BORDER_COLOR
:
1348 params
[0] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[0]);
1349 params
[1] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[1]);
1350 params
[2] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[2]);
1351 params
[3] = FLOAT_TO_INT(sampObj
->BorderColor
.f
[3]);
1353 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1354 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1356 *params
= sampObj
->CubeMapSeamless
;
1358 case GL_TEXTURE_SRGB_DECODE_EXT
:
1359 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1361 *params
= (GLenum
) sampObj
->sRGBDecode
;
1369 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameteriv(pname=%s)",
1370 _mesa_lookup_enum_by_nr(pname
));
1375 _mesa_GetSamplerParameterfv(GLuint sampler
, GLenum pname
, GLfloat
*params
)
1377 struct gl_sampler_object
*sampObj
;
1378 GET_CURRENT_CONTEXT(ctx
);
1380 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
1382 /* '3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:
1384 * "An INVALID_OPERATION error is generated if sampler is not the name
1385 * of a sampler object previously returned from a call to GenSamplers."
1387 * In desktop GL, an GL_INVALID_VALUE is returned instead.
1389 _mesa_error(ctx
, (_mesa_is_gles(ctx
) ?
1390 GL_INVALID_OPERATION
: GL_INVALID_VALUE
),
1391 "glGetSamplerParameterfv(sampler %u)", sampler
);
1396 case GL_TEXTURE_WRAP_S
:
1397 *params
= (GLfloat
) sampObj
->WrapS
;
1399 case GL_TEXTURE_WRAP_T
:
1400 *params
= (GLfloat
) sampObj
->WrapT
;
1402 case GL_TEXTURE_WRAP_R
:
1403 *params
= (GLfloat
) sampObj
->WrapR
;
1405 case GL_TEXTURE_MIN_FILTER
:
1406 *params
= (GLfloat
) sampObj
->MinFilter
;
1408 case GL_TEXTURE_MAG_FILTER
:
1409 *params
= (GLfloat
) sampObj
->MagFilter
;
1411 case GL_TEXTURE_MIN_LOD
:
1412 *params
= sampObj
->MinLod
;
1414 case GL_TEXTURE_MAX_LOD
:
1415 *params
= sampObj
->MaxLod
;
1417 case GL_TEXTURE_LOD_BIAS
:
1418 *params
= sampObj
->LodBias
;
1420 case GL_TEXTURE_COMPARE_MODE
:
1421 if (!ctx
->Extensions
.ARB_shadow
)
1423 *params
= (GLfloat
) sampObj
->CompareMode
;
1425 case GL_TEXTURE_COMPARE_FUNC
:
1426 if (!ctx
->Extensions
.ARB_shadow
)
1428 *params
= (GLfloat
) sampObj
->CompareFunc
;
1430 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1431 *params
= sampObj
->MaxAnisotropy
;
1433 case GL_TEXTURE_BORDER_COLOR
:
1434 params
[0] = sampObj
->BorderColor
.f
[0];
1435 params
[1] = sampObj
->BorderColor
.f
[1];
1436 params
[2] = sampObj
->BorderColor
.f
[2];
1437 params
[3] = sampObj
->BorderColor
.f
[3];
1439 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1440 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1442 *params
= (GLfloat
) sampObj
->CubeMapSeamless
;
1444 case GL_TEXTURE_SRGB_DECODE_EXT
:
1445 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1447 *params
= (GLfloat
) sampObj
->sRGBDecode
;
1455 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterfv(pname=%s)",
1456 _mesa_lookup_enum_by_nr(pname
));
1461 _mesa_GetSamplerParameterIiv(GLuint sampler
, GLenum pname
, GLint
*params
)
1463 struct gl_sampler_object
*sampObj
;
1464 GET_CURRENT_CONTEXT(ctx
);
1466 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
1468 _mesa_error(ctx
, GL_INVALID_VALUE
,
1469 "glGetSamplerParameterIiv(sampler %u)",
1475 case GL_TEXTURE_WRAP_S
:
1476 *params
= sampObj
->WrapS
;
1478 case GL_TEXTURE_WRAP_T
:
1479 *params
= sampObj
->WrapT
;
1481 case GL_TEXTURE_WRAP_R
:
1482 *params
= sampObj
->WrapR
;
1484 case GL_TEXTURE_MIN_FILTER
:
1485 *params
= sampObj
->MinFilter
;
1487 case GL_TEXTURE_MAG_FILTER
:
1488 *params
= sampObj
->MagFilter
;
1490 case GL_TEXTURE_MIN_LOD
:
1491 *params
= (GLint
) sampObj
->MinLod
;
1493 case GL_TEXTURE_MAX_LOD
:
1494 *params
= (GLint
) sampObj
->MaxLod
;
1496 case GL_TEXTURE_LOD_BIAS
:
1497 *params
= (GLint
) sampObj
->LodBias
;
1499 case GL_TEXTURE_COMPARE_MODE
:
1500 if (!ctx
->Extensions
.ARB_shadow
)
1502 *params
= sampObj
->CompareMode
;
1504 case GL_TEXTURE_COMPARE_FUNC
:
1505 if (!ctx
->Extensions
.ARB_shadow
)
1507 *params
= sampObj
->CompareFunc
;
1509 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1510 *params
= (GLint
) sampObj
->MaxAnisotropy
;
1512 case GL_TEXTURE_BORDER_COLOR
:
1513 params
[0] = sampObj
->BorderColor
.i
[0];
1514 params
[1] = sampObj
->BorderColor
.i
[1];
1515 params
[2] = sampObj
->BorderColor
.i
[2];
1516 params
[3] = sampObj
->BorderColor
.i
[3];
1518 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1519 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1521 *params
= sampObj
->CubeMapSeamless
;
1523 case GL_TEXTURE_SRGB_DECODE_EXT
:
1524 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1526 *params
= (GLenum
) sampObj
->sRGBDecode
;
1534 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterIiv(pname=%s)",
1535 _mesa_lookup_enum_by_nr(pname
));
1540 _mesa_GetSamplerParameterIuiv(GLuint sampler
, GLenum pname
, GLuint
*params
)
1542 struct gl_sampler_object
*sampObj
;
1543 GET_CURRENT_CONTEXT(ctx
);
1545 sampObj
= _mesa_lookup_samplerobj(ctx
, sampler
);
1547 _mesa_error(ctx
, GL_INVALID_VALUE
,
1548 "glGetSamplerParameterIuiv(sampler %u)",
1554 case GL_TEXTURE_WRAP_S
:
1555 *params
= sampObj
->WrapS
;
1557 case GL_TEXTURE_WRAP_T
:
1558 *params
= sampObj
->WrapT
;
1560 case GL_TEXTURE_WRAP_R
:
1561 *params
= sampObj
->WrapR
;
1563 case GL_TEXTURE_MIN_FILTER
:
1564 *params
= sampObj
->MinFilter
;
1566 case GL_TEXTURE_MAG_FILTER
:
1567 *params
= sampObj
->MagFilter
;
1569 case GL_TEXTURE_MIN_LOD
:
1570 *params
= (GLuint
) sampObj
->MinLod
;
1572 case GL_TEXTURE_MAX_LOD
:
1573 *params
= (GLuint
) sampObj
->MaxLod
;
1575 case GL_TEXTURE_LOD_BIAS
:
1576 *params
= (GLuint
) sampObj
->LodBias
;
1578 case GL_TEXTURE_COMPARE_MODE
:
1579 if (!ctx
->Extensions
.ARB_shadow
)
1581 *params
= sampObj
->CompareMode
;
1583 case GL_TEXTURE_COMPARE_FUNC
:
1584 if (!ctx
->Extensions
.ARB_shadow
)
1586 *params
= sampObj
->CompareFunc
;
1588 case GL_TEXTURE_MAX_ANISOTROPY_EXT
:
1589 *params
= (GLuint
) sampObj
->MaxAnisotropy
;
1591 case GL_TEXTURE_BORDER_COLOR
:
1592 params
[0] = sampObj
->BorderColor
.ui
[0];
1593 params
[1] = sampObj
->BorderColor
.ui
[1];
1594 params
[2] = sampObj
->BorderColor
.ui
[2];
1595 params
[3] = sampObj
->BorderColor
.ui
[3];
1597 case GL_TEXTURE_CUBE_MAP_SEAMLESS
:
1598 if (!ctx
->Extensions
.AMD_seamless_cubemap_per_texture
)
1600 *params
= sampObj
->CubeMapSeamless
;
1602 case GL_TEXTURE_SRGB_DECODE_EXT
:
1603 if (!ctx
->Extensions
.EXT_texture_sRGB_decode
)
1605 *params
= (GLenum
) sampObj
->sRGBDecode
;
1613 _mesa_error(ctx
, GL_INVALID_ENUM
, "glGetSamplerParameterIuiv(pname=%s)",
1614 _mesa_lookup_enum_by_nr(pname
));
1619 _mesa_init_sampler_object_functions(struct dd_function_table
*driver
)
1621 driver
->NewSamplerObject
= _mesa_new_sampler_object
;
1622 driver
->DeleteSamplerObject
= _mesa_delete_sampler_object
;