mesa: fix wrong parameter type in set_sampler_max_lod()
[mesa.git] / src / mesa / main / samplerobj.c
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 2011 VMware, Inc. All Rights Reserved.
5 *
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:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
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 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24
25 /**
26 * \file samplerobj.c
27 * \brief Functions for the GL_ARB_sampler_objects extension.
28 * \author Brian Paul
29 */
30
31
32 #include "main/glheader.h"
33 #include "main/context.h"
34 #include "main/dispatch.h"
35 #include "main/enums.h"
36 #include "main/hash.h"
37 #include "main/macros.h"
38 #include "main/mfeatures.h"
39 #include "main/mtypes.h"
40 #include "main/samplerobj.h"
41
42
43 static struct gl_sampler_object *
44 _mesa_lookup_samplerobj(struct gl_context *ctx, GLuint name)
45 {
46 if (name == 0)
47 return NULL;
48 else
49 return (struct gl_sampler_object *)
50 _mesa_HashLookup(ctx->Shared->SamplerObjects, name);
51 }
52
53
54 /**
55 * Handle reference counting.
56 */
57 void
58 _mesa_reference_sampler_object(struct gl_context *ctx,
59 struct gl_sampler_object **ptr,
60 struct gl_sampler_object *samp)
61 {
62 if (*ptr == samp)
63 return;
64
65 if (*ptr) {
66 /* Unreference the old sampler */
67 GLboolean deleteFlag = GL_FALSE;
68 struct gl_sampler_object *oldSamp = *ptr;
69
70 /*_glthread_LOCK_MUTEX(oldSamp->Mutex);*/
71 ASSERT(oldSamp->RefCount > 0);
72 oldSamp->RefCount--;
73 #if 0
74 printf("SamplerObj %p %d DECR to %d\n",
75 (void *) oldSamp, oldSamp->Name, oldSamp->RefCount);
76 #endif
77 deleteFlag = (oldSamp->RefCount == 0);
78 /*_glthread_UNLOCK_MUTEX(oldSamp->Mutex);*/
79
80 if (deleteFlag) {
81 ASSERT(ctx->Driver.DeleteSamplerObject);
82 ctx->Driver.DeleteSamplerObject(ctx, oldSamp);
83 }
84
85 *ptr = NULL;
86 }
87 ASSERT(!*ptr);
88
89 if (samp) {
90 /* reference new sampler */
91 /*_glthread_LOCK_MUTEX(samp->Mutex);*/
92 if (samp->RefCount == 0) {
93 /* this sampler's being deleted (look just above) */
94 /* Not sure this can every really happen. Warn if it does. */
95 _mesa_problem(NULL, "referencing deleted sampler object");
96 *ptr = NULL;
97 }
98 else {
99 samp->RefCount++;
100 #if 0
101 printf("SamplerObj %p %d INCR to %d\n",
102 (void *) samp, samp->Name, samp->RefCount);
103 #endif
104 *ptr = samp;
105 }
106 /*_glthread_UNLOCK_MUTEX(samp->Mutex);*/
107 }
108 }
109
110
111 /**
112 * Initialize the fields of the given sampler object.
113 */
114 void
115 _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name)
116 {
117 sampObj->Name = name;
118 sampObj->RefCount = 1;
119 sampObj->WrapS = GL_REPEAT;
120 sampObj->WrapT = GL_REPEAT;
121 sampObj->WrapR = GL_REPEAT;
122 sampObj->MinFilter = GL_NEAREST_MIPMAP_LINEAR;
123 sampObj->MagFilter = GL_LINEAR;
124 sampObj->BorderColor.f[0] = 0.0;
125 sampObj->BorderColor.f[1] = 0.0;
126 sampObj->BorderColor.f[2] = 0.0;
127 sampObj->BorderColor.f[3] = 0.0;
128 sampObj->MinLod = -1000.0F;
129 sampObj->MaxLod = 1000.0F;
130 sampObj->LodBias = 0.0F;
131 sampObj->MaxAnisotropy = 1.0F;
132 sampObj->CompareMode = GL_NONE;
133 sampObj->CompareFunc = GL_LEQUAL;
134 sampObj->CompareFailValue = 0.0;
135 sampObj->sRGBDecode = GL_FALSE;
136 sampObj->DepthMode = 0;
137 }
138
139
140 /**
141 * Fallback for ctx->Driver.NewSamplerObject();
142 */
143 struct gl_sampler_object *
144 _mesa_new_sampler_object(struct gl_context *ctx, GLuint name)
145 {
146 struct gl_sampler_object *sampObj = CALLOC_STRUCT(gl_sampler_object);
147 if (sampObj) {
148 _mesa_init_sampler_object(sampObj, name);
149 }
150 return sampObj;
151 }
152
153
154 /**
155 * Fallback for ctx->Driver.DeleteSamplerObject();
156 */
157 void
158 _mesa_delete_sampler_object(struct gl_context *ctx,
159 struct gl_sampler_object *sampObj)
160 {
161 FREE(sampObj);
162 }
163
164
165 static void GLAPIENTRY
166 _mesa_GenSamplers(GLsizei count, GLuint *samplers)
167 {
168 GET_CURRENT_CONTEXT(ctx);
169 GLuint first;
170 GLint i;
171
172 ASSERT_OUTSIDE_BEGIN_END(ctx);
173
174 if (MESA_VERBOSE & VERBOSE_API)
175 _mesa_debug(ctx, "glGenSamplers(%d)\n", count);
176
177 if (count < 0) {
178 _mesa_error(ctx, GL_INVALID_VALUE, "glGenSamplers");
179 return;
180 }
181
182 if (!samplers)
183 return;
184
185 first = _mesa_HashFindFreeKeyBlock(ctx->Shared->SamplerObjects, count);
186
187 /* Insert the ID and pointer to new sampler object into hash table */
188 for (i = 0; i < count; i++) {
189 struct gl_sampler_object *sampObj =
190 ctx->Driver.NewSamplerObject(ctx, first + i);
191 _mesa_HashInsert(ctx->Shared->SamplerObjects, first + i, sampObj);
192 samplers[i] = first + i;
193 }
194 }
195
196
197 static void GLAPIENTRY
198 _mesa_DeleteSamplers(GLsizei count, const GLuint *samplers)
199 {
200 GET_CURRENT_CONTEXT(ctx);
201 GLsizei i;
202
203 ASSERT_OUTSIDE_BEGIN_END(ctx);
204 FLUSH_VERTICES(ctx, 0);
205
206 if (count < 0) {
207 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteSamplers(count)");
208 return;
209 }
210
211 _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
212
213 for (i = 0; i < count; i++) {
214 if (samplers[i]) {
215 struct gl_sampler_object *sampObj =
216 _mesa_lookup_samplerobj(ctx, samplers[i]);
217 if (sampObj) {
218 /* The ID is immediately freed for re-use */
219 _mesa_HashRemove(ctx->Shared->SamplerObjects, samplers[i]);
220 /* But the object exists until its reference count goes to zero */
221 _mesa_reference_sampler_object(ctx, &sampObj, NULL);
222 }
223 }
224 }
225
226 _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
227 }
228
229
230 static GLboolean GLAPIENTRY
231 _mesa_IsSampler(GLuint sampler)
232 {
233 struct gl_sampler_object *sampObj;
234 GET_CURRENT_CONTEXT(ctx);
235
236 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
237
238 if (sampler == 0)
239 return GL_FALSE;
240
241 sampObj = _mesa_lookup_samplerobj(ctx, sampler);
242
243 return sampObj != NULL;
244 }
245
246
247 static void GLAPIENTRY
248 _mesa_BindSampler(GLuint unit, GLuint sampler)
249 {
250 struct gl_sampler_object *sampObj;
251 GET_CURRENT_CONTEXT(ctx);
252
253 if (unit >= ctx->Const.MaxTextureImageUnits) {
254 _mesa_error(ctx, GL_INVALID_VALUE, "glBindSampler(unit %u)", unit);
255 return;
256 }
257
258 if (sampler == 0) {
259 /* Use the default sampler object, the one contained in the texture
260 * object.
261 */
262 sampObj = NULL;
263 }
264 else {
265 /* user-defined sampler object */
266 sampObj = _mesa_lookup_samplerobj(ctx, sampler);
267 if (!sampObj) {
268 _mesa_error(ctx, GL_INVALID_OPERATION, "glBindSampler(sampler)");
269 return;
270 }
271 }
272
273 if (ctx->Texture.Unit[unit].Sampler != sampObj) {
274 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
275 }
276
277 /* bind new sampler */
278 _mesa_reference_sampler_object(ctx, &ctx->Texture.Unit[unit].Sampler,
279 sampObj);
280 }
281
282
283 /**
284 * Check if a coordinate wrap mode is legal.
285 * \return GL_TRUE if legal, GL_FALSE otherwise
286 */
287 static GLboolean
288 validate_texture_wrap_mode(struct gl_context *ctx, GLenum wrap)
289 {
290 const struct gl_extensions * const e = &ctx->Extensions;
291
292 switch (wrap) {
293 case GL_CLAMP:
294 case GL_CLAMP_TO_EDGE:
295 case GL_REPEAT:
296 return GL_TRUE;
297 case GL_CLAMP_TO_BORDER:
298 return e->ARB_texture_border_clamp;
299 case GL_MIRRORED_REPEAT:
300 return e->ARB_texture_mirrored_repeat;
301 case GL_MIRROR_CLAMP_EXT:
302 return e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp;
303 case GL_MIRROR_CLAMP_TO_EDGE_EXT:
304 return e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp;
305 case GL_MIRROR_CLAMP_TO_BORDER_EXT:
306 return e->EXT_texture_mirror_clamp;
307 default:
308 return GL_FALSE;
309 }
310 }
311
312
313 /**
314 * This is called just prior to changing any sampler object state.
315 */
316 static INLINE void
317 flush(struct gl_context *ctx)
318 {
319 FLUSH_VERTICES(ctx, _NEW_TEXTURE);
320 }
321
322
323 #define INVALID_PARAM 0x100
324 #define INVALID_PNAME 0x101
325 #define INVALID_VALUE 0x102
326
327 static GLuint
328 set_sampler_wrap_s(struct gl_context *ctx, struct gl_sampler_object *samp,
329 GLint param)
330 {
331 if (samp->WrapS == param)
332 return GL_FALSE;
333 if (validate_texture_wrap_mode(ctx, param)) {
334 flush(ctx);
335 samp->WrapS = param;
336 return GL_TRUE;
337 }
338 return INVALID_PARAM;
339 }
340
341
342 static GLuint
343 set_sampler_wrap_t(struct gl_context *ctx, struct gl_sampler_object *samp,
344 GLint param)
345 {
346 if (samp->WrapT == param)
347 return GL_FALSE;
348 if (validate_texture_wrap_mode(ctx, param)) {
349 flush(ctx);
350 samp->WrapT = param;
351 return GL_TRUE;
352 }
353 return INVALID_PARAM;
354 }
355
356
357 static GLuint
358 set_sampler_wrap_r(struct gl_context *ctx, struct gl_sampler_object *samp,
359 GLint param)
360 {
361 if (samp->WrapR == param)
362 return GL_FALSE;
363 if (validate_texture_wrap_mode(ctx, param)) {
364 flush(ctx);
365 samp->WrapR = param;
366 return GL_TRUE;
367 }
368 return INVALID_PARAM;
369 }
370
371
372 static GLuint
373 set_sampler_min_filter(struct gl_context *ctx, struct gl_sampler_object *samp,
374 GLint param)
375 {
376 if (samp->MinFilter == param)
377 return GL_FALSE;
378
379 switch (param) {
380 case GL_NEAREST:
381 case GL_LINEAR:
382 case GL_NEAREST_MIPMAP_NEAREST:
383 case GL_LINEAR_MIPMAP_NEAREST:
384 case GL_NEAREST_MIPMAP_LINEAR:
385 case GL_LINEAR_MIPMAP_LINEAR:
386 flush(ctx);
387 samp->MinFilter = param;
388 return GL_TRUE;
389 default:
390 return INVALID_PARAM;
391 }
392 }
393
394
395 static GLuint
396 set_sampler_mag_filter(struct gl_context *ctx, struct gl_sampler_object *samp,
397 GLint param)
398 {
399 if (samp->MagFilter == param)
400 return GL_FALSE;
401
402 switch (param) {
403 case GL_NEAREST:
404 case GL_LINEAR:
405 flush(ctx);
406 samp->MagFilter = param;
407 return GL_TRUE;
408 default:
409 return INVALID_PARAM;
410 }
411 }
412
413
414 static GLuint
415 set_sampler_lod_bias(struct gl_context *ctx, struct gl_sampler_object *samp,
416 GLfloat param)
417 {
418 if (samp->LodBias == param)
419 return GL_FALSE;
420
421 flush(ctx);
422 samp->LodBias = param;
423 return GL_TRUE;
424 }
425
426
427 static GLuint
428 set_sampler_border_colorf(struct gl_context *ctx,
429 struct gl_sampler_object *samp,
430 const GLfloat params[4])
431 {
432 flush(ctx);
433 samp->BorderColor.f[RCOMP] = params[0];
434 samp->BorderColor.f[GCOMP] = params[1];
435 samp->BorderColor.f[BCOMP] = params[2];
436 samp->BorderColor.f[ACOMP] = params[3];
437 return GL_TRUE;
438 }
439
440
441 static GLuint
442 set_sampler_border_colori(struct gl_context *ctx,
443 struct gl_sampler_object *samp,
444 const GLint params[4])
445 {
446 flush(ctx);
447 samp->BorderColor.i[RCOMP] = params[0];
448 samp->BorderColor.i[GCOMP] = params[1];
449 samp->BorderColor.i[BCOMP] = params[2];
450 samp->BorderColor.i[ACOMP] = params[3];
451 return GL_TRUE;
452 }
453
454
455 static GLuint
456 set_sampler_border_colorui(struct gl_context *ctx,
457 struct gl_sampler_object *samp,
458 const GLuint params[4])
459 {
460 flush(ctx);
461 samp->BorderColor.ui[RCOMP] = params[0];
462 samp->BorderColor.ui[GCOMP] = params[1];
463 samp->BorderColor.ui[BCOMP] = params[2];
464 samp->BorderColor.ui[ACOMP] = params[3];
465 return GL_TRUE;
466 }
467
468
469 static GLuint
470 set_sampler_min_lod(struct gl_context *ctx, struct gl_sampler_object *samp,
471 GLfloat param)
472 {
473 if (samp->MinLod == param)
474 return GL_FALSE;
475
476 flush(ctx);
477 samp->MinLod = param;
478 return GL_TRUE;
479 }
480
481
482 static GLuint
483 set_sampler_max_lod(struct gl_context *ctx, struct gl_sampler_object *samp,
484 GLfloat param)
485 {
486 if (samp->MaxLod == param)
487 return GL_FALSE;
488
489 flush(ctx);
490 samp->MaxLod = param;
491 return GL_TRUE;
492 }
493
494
495 static GLuint
496 set_sampler_compare_mode(struct gl_context *ctx,
497 struct gl_sampler_object *samp, GLint param)
498 {
499 if (!ctx->Extensions.ARB_shadow)
500 return INVALID_PNAME;
501
502 if (samp->CompareMode == param)
503 return GL_FALSE;
504
505 if (param == GL_NONE ||
506 param == GL_COMPARE_R_TO_TEXTURE_ARB) {
507 flush(ctx);
508 samp->CompareMode = param;
509 return GL_TRUE;
510 }
511
512 return INVALID_PARAM;
513 }
514
515
516 static GLuint
517 set_sampler_compare_func(struct gl_context *ctx,
518 struct gl_sampler_object *samp, GLint param)
519 {
520 if (!ctx->Extensions.ARB_shadow)
521 return INVALID_PNAME;
522
523 if (samp->CompareFunc == param)
524 return GL_FALSE;
525
526 switch (param) {
527 case GL_LEQUAL:
528 case GL_GEQUAL:
529 flush(ctx);
530 samp->CompareFunc = param;
531 return GL_TRUE;
532 case GL_EQUAL:
533 case GL_NOTEQUAL:
534 case GL_LESS:
535 case GL_GREATER:
536 case GL_ALWAYS:
537 case GL_NEVER:
538 if (ctx->Extensions.EXT_shadow_funcs) {
539 flush(ctx);
540 samp->CompareFunc = param;
541 return GL_TRUE;
542 }
543 /* fall-through */
544 default:
545 return INVALID_PARAM;
546 }
547 }
548
549
550 static GLuint
551 set_sampler_max_anisotropy(struct gl_context *ctx,
552 struct gl_sampler_object *samp, GLfloat param)
553 {
554 if (!ctx->Extensions.EXT_texture_filter_anisotropic)
555 return INVALID_PNAME;
556
557 if (samp->MaxAnisotropy == param)
558 return GL_FALSE;
559
560 if (param < 1.0)
561 return INVALID_VALUE;
562
563 flush(ctx);
564 /* clamp to max, that's what NVIDIA does */
565 samp->MaxAnisotropy = MIN2(param, ctx->Const.MaxTextureMaxAnisotropy);
566 return GL_TRUE;
567 }
568
569
570 static void GLAPIENTRY
571 _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
572 {
573 struct gl_sampler_object *sampObj;
574 GLuint res;
575 GET_CURRENT_CONTEXT(ctx);
576
577 sampObj = _mesa_lookup_samplerobj(ctx, sampler);
578 if (!sampObj) {
579 _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteri(sampler %u)",
580 sampler);
581 return;
582 }
583
584 switch (pname) {
585 case GL_TEXTURE_WRAP_S:
586 res = set_sampler_wrap_s(ctx, sampObj, param);
587 break;
588 case GL_TEXTURE_WRAP_T:
589 res = set_sampler_wrap_t(ctx, sampObj, param);
590 break;
591 case GL_TEXTURE_WRAP_R:
592 res = set_sampler_wrap_r(ctx, sampObj, param);
593 break;
594 case GL_TEXTURE_MIN_FILTER:
595 res = set_sampler_min_filter(ctx, sampObj, param);
596 break;
597 case GL_TEXTURE_MAG_FILTER:
598 res = set_sampler_mag_filter(ctx, sampObj, param);
599 break;
600 case GL_TEXTURE_MIN_LOD:
601 res = set_sampler_min_lod(ctx, sampObj, (GLfloat) param);
602 break;
603 case GL_TEXTURE_MAX_LOD:
604 res = set_sampler_max_lod(ctx, sampObj, (GLfloat) param);
605 break;
606 case GL_TEXTURE_LOD_BIAS:
607 res = set_sampler_lod_bias(ctx, sampObj, (GLfloat) param);
608 break;
609 case GL_TEXTURE_COMPARE_MODE:
610 res = set_sampler_compare_mode(ctx, sampObj, param);
611 break;
612 case GL_TEXTURE_COMPARE_FUNC:
613 res = set_sampler_compare_func(ctx, sampObj, param);
614 break;
615 case GL_TEXTURE_MAX_ANISOTROPY_EXT:
616 res = set_sampler_max_anisotropy(ctx, sampObj, (GLfloat) param);
617 break;
618 case GL_TEXTURE_BORDER_COLOR:
619 /* fall-through */
620 default:
621 res = INVALID_PNAME;
622 }
623
624 switch (res) {
625 case GL_FALSE:
626 /* no change */
627 break;
628 case GL_TRUE:
629 /* state change - we do nothing special at this time */
630 break;
631 case INVALID_PNAME:
632 _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameteri(pname=%s)\n",
633 _mesa_lookup_enum_by_nr(pname));
634 break;
635 case INVALID_PARAM:
636 _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameteri(param=%d)\n",
637 param);
638 break;
639 case INVALID_VALUE:
640 _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteri(param=%d)\n",
641 param);
642 break;
643 default:
644 ;
645 }
646 }
647
648
649 static void GLAPIENTRY
650 _mesa_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
651 {
652 struct gl_sampler_object *sampObj;
653 GLuint res;
654 GET_CURRENT_CONTEXT(ctx);
655
656 ASSERT_OUTSIDE_BEGIN_END(ctx);
657
658 sampObj = _mesa_lookup_samplerobj(ctx, sampler);
659 if (!sampObj) {
660 _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterf(sampler %u)",
661 sampler);
662 return;
663 }
664
665 switch (pname) {
666 case GL_TEXTURE_WRAP_S:
667 res = set_sampler_wrap_s(ctx, sampObj, (GLint) param);
668 break;
669 case GL_TEXTURE_WRAP_T:
670 res = set_sampler_wrap_t(ctx, sampObj, (GLint) param);
671 break;
672 case GL_TEXTURE_WRAP_R:
673 res = set_sampler_wrap_r(ctx, sampObj, (GLint) param);
674 break;
675 case GL_TEXTURE_MIN_FILTER:
676 res = set_sampler_min_filter(ctx, sampObj, (GLint) param);
677 break;
678 case GL_TEXTURE_MAG_FILTER:
679 res = set_sampler_mag_filter(ctx, sampObj, (GLint) param);
680 break;
681 case GL_TEXTURE_MIN_LOD:
682 res = set_sampler_min_lod(ctx, sampObj, param);
683 break;
684 case GL_TEXTURE_MAX_LOD:
685 res = set_sampler_max_lod(ctx, sampObj, param);
686 break;
687 case GL_TEXTURE_LOD_BIAS:
688 res = set_sampler_lod_bias(ctx, sampObj, param);
689 break;
690 case GL_TEXTURE_COMPARE_MODE:
691 res = set_sampler_compare_mode(ctx, sampObj, (GLint) param);
692 break;
693 case GL_TEXTURE_COMPARE_FUNC:
694 res = set_sampler_compare_func(ctx, sampObj, (GLint) param);
695 break;
696 case GL_TEXTURE_MAX_ANISOTROPY_EXT:
697 res = set_sampler_max_anisotropy(ctx, sampObj, param);
698 break;
699 case GL_TEXTURE_BORDER_COLOR:
700 /* fall-through */
701 default:
702 res = INVALID_PNAME;
703 }
704
705 switch (res) {
706 case GL_FALSE:
707 /* no change */
708 break;
709 case GL_TRUE:
710 /* state change - we do nothing special at this time */
711 break;
712 case INVALID_PNAME:
713 _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameterf(pname=%s)\n",
714 _mesa_lookup_enum_by_nr(pname));
715 break;
716 case INVALID_PARAM:
717 _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameterf(param=%f)\n",
718 param);
719 break;
720 case INVALID_VALUE:
721 _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterf(param=%f)\n",
722 param);
723 break;
724 default:
725 ;
726 }
727 }
728
729 static void GLAPIENTRY
730 _mesa_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
731 {
732 struct gl_sampler_object *sampObj;
733 GLuint res;
734 GET_CURRENT_CONTEXT(ctx);
735
736 sampObj = _mesa_lookup_samplerobj(ctx, sampler);
737 if (!sampObj) {
738 _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteriv(sampler %u)",
739 sampler);
740 return;
741 }
742
743 switch (pname) {
744 case GL_TEXTURE_WRAP_S:
745 res = set_sampler_wrap_s(ctx, sampObj, params[0]);
746 break;
747 case GL_TEXTURE_WRAP_T:
748 res = set_sampler_wrap_t(ctx, sampObj, params[0]);
749 break;
750 case GL_TEXTURE_WRAP_R:
751 res = set_sampler_wrap_r(ctx, sampObj, params[0]);
752 break;
753 case GL_TEXTURE_MIN_FILTER:
754 res = set_sampler_min_filter(ctx, sampObj, params[0]);
755 break;
756 case GL_TEXTURE_MAG_FILTER:
757 res = set_sampler_mag_filter(ctx, sampObj, params[0]);
758 break;
759 case GL_TEXTURE_MIN_LOD:
760 res = set_sampler_min_lod(ctx, sampObj, (GLfloat) params[0]);
761 break;
762 case GL_TEXTURE_MAX_LOD:
763 res = set_sampler_max_lod(ctx, sampObj, (GLfloat) params[0]);
764 break;
765 case GL_TEXTURE_LOD_BIAS:
766 res = set_sampler_lod_bias(ctx, sampObj, (GLfloat) params[0]);
767 break;
768 case GL_TEXTURE_COMPARE_MODE:
769 res = set_sampler_compare_mode(ctx, sampObj, params[0]);
770 break;
771 case GL_TEXTURE_COMPARE_FUNC:
772 res = set_sampler_compare_func(ctx, sampObj, params[0]);
773 break;
774 case GL_TEXTURE_MAX_ANISOTROPY_EXT:
775 res = set_sampler_max_anisotropy(ctx, sampObj, (GLfloat) params[0]);
776 break;
777 case GL_TEXTURE_BORDER_COLOR:
778 {
779 GLfloat c[4];
780 c[0] = INT_TO_FLOAT(params[0]);
781 c[1] = INT_TO_FLOAT(params[1]);
782 c[2] = INT_TO_FLOAT(params[2]);
783 c[3] = INT_TO_FLOAT(params[3]);
784 res = set_sampler_border_colorf(ctx, sampObj, c);
785 }
786 break;
787 default:
788 res = INVALID_PNAME;
789 }
790
791 switch (res) {
792 case GL_FALSE:
793 /* no change */
794 break;
795 case GL_TRUE:
796 /* state change - we do nothing special at this time */
797 break;
798 case INVALID_PNAME:
799 _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameteriv(pname=%s)\n",
800 _mesa_lookup_enum_by_nr(pname));
801 break;
802 case INVALID_PARAM:
803 _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameteriv(param=%d)\n",
804 params[0]);
805 break;
806 case INVALID_VALUE:
807 _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteriv(param=%d)\n",
808 params[0]);
809 break;
810 default:
811 ;
812 }
813 }
814
815 static void GLAPIENTRY
816 _mesa_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
817 {
818 struct gl_sampler_object *sampObj;
819 GLuint res;
820 GET_CURRENT_CONTEXT(ctx);
821
822 ASSERT_OUTSIDE_BEGIN_END(ctx);
823
824 sampObj = _mesa_lookup_samplerobj(ctx, sampler);
825 if (!sampObj) {
826 _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterfv(sampler %u)",
827 sampler);
828 return;
829 }
830
831 switch (pname) {
832 case GL_TEXTURE_WRAP_S:
833 res = set_sampler_wrap_s(ctx, sampObj, (GLint) params[0]);
834 break;
835 case GL_TEXTURE_WRAP_T:
836 res = set_sampler_wrap_t(ctx, sampObj, (GLint) params[0]);
837 break;
838 case GL_TEXTURE_WRAP_R:
839 res = set_sampler_wrap_r(ctx, sampObj, (GLint) params[0]);
840 break;
841 case GL_TEXTURE_MIN_FILTER:
842 res = set_sampler_min_filter(ctx, sampObj, (GLint) params[0]);
843 break;
844 case GL_TEXTURE_MAG_FILTER:
845 res = set_sampler_mag_filter(ctx, sampObj, (GLint) params[0]);
846 break;
847 case GL_TEXTURE_MIN_LOD:
848 res = set_sampler_min_lod(ctx, sampObj, params[0]);
849 break;
850 case GL_TEXTURE_MAX_LOD:
851 res = set_sampler_max_lod(ctx, sampObj, params[0]);
852 break;
853 case GL_TEXTURE_LOD_BIAS:
854 res = set_sampler_lod_bias(ctx, sampObj, params[0]);
855 break;
856 case GL_TEXTURE_COMPARE_MODE:
857 res = set_sampler_compare_mode(ctx, sampObj, (GLint) params[0]);
858 break;
859 case GL_TEXTURE_COMPARE_FUNC:
860 res = set_sampler_compare_func(ctx, sampObj, (GLint) params[0]);
861 break;
862 case GL_TEXTURE_MAX_ANISOTROPY_EXT:
863 res = set_sampler_max_anisotropy(ctx, sampObj, params[0]);
864 break;
865 case GL_TEXTURE_BORDER_COLOR:
866 res = set_sampler_border_colorf(ctx, sampObj, params);
867 break;
868 default:
869 res = INVALID_PNAME;
870 }
871
872 switch (res) {
873 case GL_FALSE:
874 /* no change */
875 break;
876 case GL_TRUE:
877 /* state change - we do nothing special at this time */
878 break;
879 case INVALID_PNAME:
880 _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameterfv(pname=%s)\n",
881 _mesa_lookup_enum_by_nr(pname));
882 break;
883 case INVALID_PARAM:
884 _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameterfv(param=%f)\n",
885 params[0]);
886 break;
887 case INVALID_VALUE:
888 _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterfv(param=%f)\n",
889 params[0]);
890 break;
891 default:
892 ;
893 }
894 }
895
896 static void GLAPIENTRY
897 _mesa_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
898 {
899 struct gl_sampler_object *sampObj;
900 GLuint res;
901 GET_CURRENT_CONTEXT(ctx);
902
903 sampObj = _mesa_lookup_samplerobj(ctx, sampler);
904 if (!sampObj) {
905 _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterIiv(sampler %u)",
906 sampler);
907 return;
908 }
909
910 switch (pname) {
911 case GL_TEXTURE_WRAP_S:
912 res = set_sampler_wrap_s(ctx, sampObj, params[0]);
913 break;
914 case GL_TEXTURE_WRAP_T:
915 res = set_sampler_wrap_t(ctx, sampObj, params[0]);
916 break;
917 case GL_TEXTURE_WRAP_R:
918 res = set_sampler_wrap_r(ctx, sampObj, params[0]);
919 break;
920 case GL_TEXTURE_MIN_FILTER:
921 res = set_sampler_min_filter(ctx, sampObj, params[0]);
922 break;
923 case GL_TEXTURE_MAG_FILTER:
924 res = set_sampler_mag_filter(ctx, sampObj, params[0]);
925 break;
926 case GL_TEXTURE_MIN_LOD:
927 res = set_sampler_min_lod(ctx, sampObj, (GLfloat) params[0]);
928 break;
929 case GL_TEXTURE_MAX_LOD:
930 res = set_sampler_max_lod(ctx, sampObj, (GLfloat) params[0]);
931 break;
932 case GL_TEXTURE_LOD_BIAS:
933 res = set_sampler_lod_bias(ctx, sampObj, (GLfloat) params[0]);
934 break;
935 case GL_TEXTURE_COMPARE_MODE:
936 res = set_sampler_compare_mode(ctx, sampObj, params[0]);
937 break;
938 case GL_TEXTURE_COMPARE_FUNC:
939 res = set_sampler_compare_func(ctx, sampObj, params[0]);
940 break;
941 case GL_TEXTURE_MAX_ANISOTROPY_EXT:
942 res = set_sampler_max_anisotropy(ctx, sampObj, (GLfloat) params[0]);
943 break;
944 case GL_TEXTURE_BORDER_COLOR:
945 res = set_sampler_border_colori(ctx, sampObj, params);
946 break;
947 default:
948 res = INVALID_PNAME;
949 }
950
951 switch (res) {
952 case GL_FALSE:
953 /* no change */
954 break;
955 case GL_TRUE:
956 /* state change - we do nothing special at this time */
957 break;
958 case INVALID_PNAME:
959 _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameterIiv(pname=%s)\n",
960 _mesa_lookup_enum_by_nr(pname));
961 break;
962 case INVALID_PARAM:
963 _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameterIiv(param=%d)\n",
964 params[0]);
965 break;
966 case INVALID_VALUE:
967 _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterIiv(param=%d)\n",
968 params[0]);
969 break;
970 default:
971 ;
972 }
973 }
974
975
976 static void GLAPIENTRY
977 _mesa_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
978 {
979 struct gl_sampler_object *sampObj;
980 GLuint res;
981 GET_CURRENT_CONTEXT(ctx);
982
983 sampObj = _mesa_lookup_samplerobj(ctx, sampler);
984 if (!sampObj) {
985 _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterIuiv(sampler %u)",
986 sampler);
987 return;
988 }
989
990 switch (pname) {
991 case GL_TEXTURE_WRAP_S:
992 res = set_sampler_wrap_s(ctx, sampObj, params[0]);
993 break;
994 case GL_TEXTURE_WRAP_T:
995 res = set_sampler_wrap_t(ctx, sampObj, params[0]);
996 break;
997 case GL_TEXTURE_WRAP_R:
998 res = set_sampler_wrap_r(ctx, sampObj, params[0]);
999 break;
1000 case GL_TEXTURE_MIN_FILTER:
1001 res = set_sampler_min_filter(ctx, sampObj, params[0]);
1002 break;
1003 case GL_TEXTURE_MAG_FILTER:
1004 res = set_sampler_mag_filter(ctx, sampObj, params[0]);
1005 break;
1006 case GL_TEXTURE_MIN_LOD:
1007 res = set_sampler_min_lod(ctx, sampObj, (GLfloat) params[0]);
1008 break;
1009 case GL_TEXTURE_MAX_LOD:
1010 res = set_sampler_max_lod(ctx, sampObj, (GLfloat) params[0]);
1011 break;
1012 case GL_TEXTURE_LOD_BIAS:
1013 res = set_sampler_lod_bias(ctx, sampObj, (GLfloat) params[0]);
1014 break;
1015 case GL_TEXTURE_COMPARE_MODE:
1016 res = set_sampler_compare_mode(ctx, sampObj, params[0]);
1017 break;
1018 case GL_TEXTURE_COMPARE_FUNC:
1019 res = set_sampler_compare_func(ctx, sampObj, params[0]);
1020 break;
1021 case GL_TEXTURE_MAX_ANISOTROPY_EXT:
1022 res = set_sampler_max_anisotropy(ctx, sampObj, (GLfloat) params[0]);
1023 break;
1024 case GL_TEXTURE_BORDER_COLOR:
1025 res = set_sampler_border_colorui(ctx, sampObj, params);
1026 break;
1027 default:
1028 res = INVALID_PNAME;
1029 }
1030
1031 switch (res) {
1032 case GL_FALSE:
1033 /* no change */
1034 break;
1035 case GL_TRUE:
1036 /* state change - we do nothing special at this time */
1037 break;
1038 case INVALID_PNAME:
1039 _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameterIuiv(pname=%s)\n",
1040 _mesa_lookup_enum_by_nr(pname));
1041 break;
1042 case INVALID_PARAM:
1043 _mesa_error(ctx, GL_INVALID_ENUM, "glSamplerParameterIuiv(param=%u)\n",
1044 params[0]);
1045 break;
1046 case INVALID_VALUE:
1047 _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterIuiv(param=%u)\n",
1048 params[0]);
1049 break;
1050 default:
1051 ;
1052 }
1053 }
1054
1055
1056 static void GLAPIENTRY
1057 _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
1058 {
1059 struct gl_sampler_object *sampObj;
1060 GET_CURRENT_CONTEXT(ctx);
1061
1062 sampObj = _mesa_lookup_samplerobj(ctx, sampler);
1063 if (!sampObj) {
1064 _mesa_error(ctx, GL_INVALID_VALUE, "glGetSamplerParameteriv(sampler %u)",
1065 sampler);
1066 return;
1067 }
1068
1069 switch (pname) {
1070 case GL_TEXTURE_WRAP_S:
1071 *params = sampObj->WrapS;
1072 break;
1073 case GL_TEXTURE_WRAP_T:
1074 *params = sampObj->WrapT;
1075 break;
1076 case GL_TEXTURE_WRAP_R:
1077 *params = sampObj->WrapR;
1078 break;
1079 case GL_TEXTURE_MIN_FILTER:
1080 *params = sampObj->MinFilter;
1081 break;
1082 case GL_TEXTURE_MAG_FILTER:
1083 *params = sampObj->MagFilter;
1084 break;
1085 case GL_TEXTURE_MIN_LOD:
1086 *params = (GLint) sampObj->MinLod;
1087 break;
1088 case GL_TEXTURE_MAX_LOD:
1089 *params = (GLint) sampObj->MaxLod;
1090 break;
1091 case GL_TEXTURE_LOD_BIAS:
1092 *params = (GLint) sampObj->LodBias;
1093 break;
1094 case GL_TEXTURE_COMPARE_MODE:
1095 if (!ctx->Extensions.ARB_shadow)
1096 goto invalid_pname;
1097 *params = sampObj->CompareMode;
1098 break;
1099 case GL_TEXTURE_COMPARE_FUNC:
1100 if (!ctx->Extensions.ARB_shadow)
1101 goto invalid_pname;
1102 *params = sampObj->CompareFunc;
1103 break;
1104 case GL_TEXTURE_MAX_ANISOTROPY_EXT:
1105 *params = (GLint) sampObj->MaxAnisotropy;
1106 break;
1107 case GL_TEXTURE_BORDER_COLOR:
1108 params[0] = FLOAT_TO_INT(sampObj->BorderColor.f[0]);
1109 params[1] = FLOAT_TO_INT(sampObj->BorderColor.f[1]);
1110 params[2] = FLOAT_TO_INT(sampObj->BorderColor.f[2]);
1111 params[3] = FLOAT_TO_INT(sampObj->BorderColor.f[3]);
1112 break;
1113 default:
1114 goto invalid_pname;
1115 }
1116 return;
1117
1118 invalid_pname:
1119 _mesa_error(ctx, GL_INVALID_ENUM, "glGetSamplerParameteriv(pname=%s)",
1120 _mesa_lookup_enum_by_nr(pname));
1121 }
1122
1123
1124 static void GLAPIENTRY
1125 _mesa_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
1126 {
1127 struct gl_sampler_object *sampObj;
1128 GET_CURRENT_CONTEXT(ctx);
1129
1130 sampObj = _mesa_lookup_samplerobj(ctx, sampler);
1131 if (!sampObj) {
1132 _mesa_error(ctx, GL_INVALID_VALUE, "glGetSamplerParameterfv(sampler %u)",
1133 sampler);
1134 return;
1135 }
1136
1137 switch (pname) {
1138 case GL_TEXTURE_WRAP_S:
1139 *params = (GLfloat) sampObj->WrapS;
1140 break;
1141 case GL_TEXTURE_WRAP_T:
1142 *params = (GLfloat) sampObj->WrapT;
1143 break;
1144 case GL_TEXTURE_WRAP_R:
1145 *params = (GLfloat) sampObj->WrapR;
1146 break;
1147 case GL_TEXTURE_MIN_FILTER:
1148 *params = (GLfloat) sampObj->MinFilter;
1149 break;
1150 case GL_TEXTURE_MAG_FILTER:
1151 *params = (GLfloat) sampObj->MagFilter;
1152 break;
1153 case GL_TEXTURE_MIN_LOD:
1154 *params = sampObj->MinLod;
1155 break;
1156 case GL_TEXTURE_MAX_LOD:
1157 *params = sampObj->MaxLod;
1158 break;
1159 case GL_TEXTURE_LOD_BIAS:
1160 *params = sampObj->LodBias;
1161 break;
1162 case GL_TEXTURE_COMPARE_MODE:
1163 if (!ctx->Extensions.ARB_shadow)
1164 goto invalid_pname;
1165 *params = (GLfloat) sampObj->CompareMode;
1166 break;
1167 case GL_TEXTURE_COMPARE_FUNC:
1168 if (!ctx->Extensions.ARB_shadow)
1169 goto invalid_pname;
1170 *params = (GLfloat) sampObj->CompareFunc;
1171 break;
1172 case GL_TEXTURE_MAX_ANISOTROPY_EXT:
1173 *params = sampObj->MaxAnisotropy;
1174 break;
1175 case GL_TEXTURE_BORDER_COLOR:
1176 params[0] = sampObj->BorderColor.f[0];
1177 params[1] = sampObj->BorderColor.f[1];
1178 params[2] = sampObj->BorderColor.f[2];
1179 params[3] = sampObj->BorderColor.f[3];
1180 break;
1181 default:
1182 goto invalid_pname;
1183 }
1184 return;
1185
1186 invalid_pname:
1187 _mesa_error(ctx, GL_INVALID_ENUM, "glGetSamplerParameterfv(pname=%s)",
1188 _mesa_lookup_enum_by_nr(pname));
1189 }
1190
1191
1192 static void GLAPIENTRY
1193 _mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
1194 {
1195 struct gl_sampler_object *sampObj;
1196 GET_CURRENT_CONTEXT(ctx);
1197
1198 sampObj = _mesa_lookup_samplerobj(ctx, sampler);
1199 if (!sampObj) {
1200 _mesa_error(ctx, GL_INVALID_VALUE,
1201 "glGetSamplerParameterIiv(sampler %u)",
1202 sampler);
1203 return;
1204 }
1205
1206 switch (pname) {
1207 case GL_TEXTURE_WRAP_S:
1208 *params = sampObj->WrapS;
1209 break;
1210 case GL_TEXTURE_WRAP_T:
1211 *params = sampObj->WrapT;
1212 break;
1213 case GL_TEXTURE_WRAP_R:
1214 *params = sampObj->WrapR;
1215 break;
1216 case GL_TEXTURE_MIN_FILTER:
1217 *params = sampObj->MinFilter;
1218 break;
1219 case GL_TEXTURE_MAG_FILTER:
1220 *params = sampObj->MagFilter;
1221 break;
1222 case GL_TEXTURE_MIN_LOD:
1223 *params = (GLint) sampObj->MinLod;
1224 break;
1225 case GL_TEXTURE_MAX_LOD:
1226 *params = (GLint) sampObj->MaxLod;
1227 break;
1228 case GL_TEXTURE_LOD_BIAS:
1229 *params = (GLint) sampObj->LodBias;
1230 break;
1231 case GL_TEXTURE_COMPARE_MODE:
1232 if (!ctx->Extensions.ARB_shadow)
1233 goto invalid_pname;
1234 *params = sampObj->CompareMode;
1235 break;
1236 case GL_TEXTURE_COMPARE_FUNC:
1237 if (!ctx->Extensions.ARB_shadow)
1238 goto invalid_pname;
1239 *params = sampObj->CompareFunc;
1240 break;
1241 case GL_TEXTURE_MAX_ANISOTROPY_EXT:
1242 *params = (GLint) sampObj->MaxAnisotropy;
1243 break;
1244 case GL_TEXTURE_BORDER_COLOR:
1245 params[0] = sampObj->BorderColor.i[0];
1246 params[1] = sampObj->BorderColor.i[1];
1247 params[2] = sampObj->BorderColor.i[2];
1248 params[3] = sampObj->BorderColor.i[3];
1249 break;
1250 default:
1251 goto invalid_pname;
1252 }
1253 return;
1254
1255 invalid_pname:
1256 _mesa_error(ctx, GL_INVALID_ENUM, "glGetSamplerParameterIiv(pname=%s)",
1257 _mesa_lookup_enum_by_nr(pname));
1258 }
1259
1260
1261 static void GLAPIENTRY
1262 _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
1263 {
1264 struct gl_sampler_object *sampObj;
1265 GET_CURRENT_CONTEXT(ctx);
1266
1267 sampObj = _mesa_lookup_samplerobj(ctx, sampler);
1268 if (!sampObj) {
1269 _mesa_error(ctx, GL_INVALID_VALUE,
1270 "glGetSamplerParameterIuiv(sampler %u)",
1271 sampler);
1272 return;
1273 }
1274
1275 switch (pname) {
1276 case GL_TEXTURE_WRAP_S:
1277 *params = sampObj->WrapS;
1278 break;
1279 case GL_TEXTURE_WRAP_T:
1280 *params = sampObj->WrapT;
1281 break;
1282 case GL_TEXTURE_WRAP_R:
1283 *params = sampObj->WrapR;
1284 break;
1285 case GL_TEXTURE_MIN_FILTER:
1286 *params = sampObj->MinFilter;
1287 break;
1288 case GL_TEXTURE_MAG_FILTER:
1289 *params = sampObj->MagFilter;
1290 break;
1291 case GL_TEXTURE_MIN_LOD:
1292 *params = (GLuint) sampObj->MinLod;
1293 break;
1294 case GL_TEXTURE_MAX_LOD:
1295 *params = (GLuint) sampObj->MaxLod;
1296 break;
1297 case GL_TEXTURE_LOD_BIAS:
1298 *params = (GLuint) sampObj->LodBias;
1299 break;
1300 case GL_TEXTURE_COMPARE_MODE:
1301 if (!ctx->Extensions.ARB_shadow)
1302 goto invalid_pname;
1303 *params = sampObj->CompareMode;
1304 break;
1305 case GL_TEXTURE_COMPARE_FUNC:
1306 if (!ctx->Extensions.ARB_shadow)
1307 goto invalid_pname;
1308 *params = sampObj->CompareFunc;
1309 break;
1310 case GL_TEXTURE_MAX_ANISOTROPY_EXT:
1311 *params = (GLuint) sampObj->MaxAnisotropy;
1312 break;
1313 case GL_TEXTURE_BORDER_COLOR:
1314 params[0] = sampObj->BorderColor.ui[0];
1315 params[1] = sampObj->BorderColor.ui[1];
1316 params[2] = sampObj->BorderColor.ui[2];
1317 params[3] = sampObj->BorderColor.ui[3];
1318 break;
1319 default:
1320 goto invalid_pname;
1321 }
1322 return;
1323
1324 invalid_pname:
1325 _mesa_error(ctx, GL_INVALID_ENUM, "glGetSamplerParameterIuiv(pname=%s)",
1326 _mesa_lookup_enum_by_nr(pname));
1327 }
1328
1329
1330 void
1331 _mesa_init_sampler_object_functions(struct dd_function_table *driver)
1332 {
1333 driver->NewSamplerObject = _mesa_new_sampler_object;
1334 driver->DeleteSamplerObject = _mesa_delete_sampler_object;
1335 }
1336
1337
1338 void
1339 _mesa_init_sampler_object_dispatch(struct _glapi_table *disp)
1340 {
1341 SET_GenSamplers(disp, _mesa_GenSamplers);
1342 SET_DeleteSamplers(disp, _mesa_DeleteSamplers);
1343 SET_IsSampler(disp, _mesa_IsSampler);
1344 SET_BindSampler(disp, _mesa_BindSampler);
1345 SET_SamplerParameteri(disp, _mesa_SamplerParameteri);
1346 SET_SamplerParameterf(disp, _mesa_SamplerParameterf);
1347 SET_SamplerParameteriv(disp, _mesa_SamplerParameteriv);
1348 SET_SamplerParameterfv(disp, _mesa_SamplerParameterfv);
1349 SET_SamplerParameterIiv(disp, _mesa_SamplerParameterIiv);
1350 SET_SamplerParameterIuiv(disp, _mesa_SamplerParameterIuiv);
1351 SET_GetSamplerParameteriv(disp, _mesa_GetSamplerParameteriv);
1352 SET_GetSamplerParameterfv(disp, _mesa_GetSamplerParameterfv);
1353 SET_GetSamplerParameterIiv(disp, _mesa_GetSamplerParameterIiv);
1354 SET_GetSamplerParameterIuiv(disp, _mesa_GetSamplerParameterIuiv);
1355 }