1 /* $Id: histogram.c,v 1.3 2000/12/10 19:23:19 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 #include "histogram.h"
41 * XXX need to handle packed datatypes!
44 pack_histogram( GLcontext
*ctx
,
45 GLuint n
, CONST GLuint rgba
[][4],
46 GLenum format
, GLenum type
, GLvoid
*destination
,
47 const struct gl_pixelstore_attrib
*packing
)
49 const GLint comps
= _mesa_components_in_format(format
);
50 GLuint luminance
[MAX_WIDTH
];
52 if (format
== GL_LUMINANCE
|| format
== GL_LUMINANCE_ALPHA
) {
54 for (i
= 0; i
< n
; i
++) {
55 luminance
[i
] = rgba
[i
][RCOMP
] + rgba
[i
][GCOMP
] + rgba
[i
][BCOMP
];
59 #define PACK_MACRO(TYPE) \
65 dst[i] = (TYPE) rgba[i][RCOMP]; \
69 dst[i] = (TYPE) rgba[i][GCOMP]; \
73 dst[i] = (TYPE) rgba[i][BCOMP]; \
77 dst[i] = (TYPE) rgba[i][ACOMP]; \
81 dst[i] = (TYPE) luminance[i]; \
83 case GL_LUMINANCE_ALPHA: \
85 dst[i*2+0] = (TYPE) luminance[i]; \
86 dst[i*2+1] = (TYPE) rgba[i][ACOMP]; \
91 dst[i*3+0] = (TYPE) rgba[i][RCOMP]; \
92 dst[i*3+1] = (TYPE) rgba[i][GCOMP]; \
93 dst[i*3+2] = (TYPE) rgba[i][BCOMP]; \
98 dst[i*4+0] = (TYPE) rgba[i][RCOMP]; \
99 dst[i*4+1] = (TYPE) rgba[i][GCOMP]; \
100 dst[i*4+2] = (TYPE) rgba[i][BCOMP]; \
101 dst[i*4+3] = (TYPE) rgba[i][ACOMP]; \
105 for (i=0;i<n;i++) { \
106 dst[i*3+0] = (TYPE) rgba[i][BCOMP]; \
107 dst[i*3+1] = (TYPE) rgba[i][GCOMP]; \
108 dst[i*3+2] = (TYPE) rgba[i][RCOMP]; \
112 for (i=0;i<n;i++) { \
113 dst[i*4+0] = (TYPE) rgba[i][BCOMP]; \
114 dst[i*4+1] = (TYPE) rgba[i][GCOMP]; \
115 dst[i*4+2] = (TYPE) rgba[i][RCOMP]; \
116 dst[i*4+3] = (TYPE) rgba[i][ACOMP]; \
120 for (i=0;i<n;i++) { \
121 dst[i*4+0] = (TYPE) rgba[i][ACOMP]; \
122 dst[i*4+1] = (TYPE) rgba[i][BCOMP]; \
123 dst[i*4+2] = (TYPE) rgba[i][GCOMP]; \
124 dst[i*4+3] = (TYPE) rgba[i][RCOMP]; \
128 gl_problem(ctx, "bad format in pack_histogram"); \
133 case GL_UNSIGNED_BYTE
:
135 GLubyte
*dst
= (GLubyte
*) destination
;
141 GLbyte
*dst
= (GLbyte
*) destination
;
145 case GL_UNSIGNED_SHORT
:
147 GLushort
*dst
= (GLushort
*) destination
;
148 PACK_MACRO(GLushort
);
149 if (packing
->SwapBytes
) {
150 _mesa_swap2(dst
, n
* comps
);
156 GLshort
*dst
= (GLshort
*) destination
;
158 if (packing
->SwapBytes
) {
159 _mesa_swap2((GLushort
*) dst
, n
* comps
);
163 case GL_UNSIGNED_INT
:
165 GLuint
*dst
= (GLuint
*) destination
;
167 if (packing
->SwapBytes
) {
168 _mesa_swap4(dst
, n
* comps
);
174 GLint
*dst
= (GLint
*) destination
;
176 if (packing
->SwapBytes
) {
177 _mesa_swap4((GLuint
*) dst
, n
* comps
);
183 GLfloat
*dst
= (GLfloat
*) destination
;
185 if (packing
->SwapBytes
) {
186 _mesa_swap4((GLuint
*) dst
, n
* comps
);
191 gl_problem(ctx
, "Bad type in pack_histogram");
200 * XXX need to handle packed datatypes!
203 pack_minmax( GLcontext
*ctx
, CONST GLfloat minmax
[2][4],
204 GLenum format
, GLenum type
, GLvoid
*destination
,
205 const struct gl_pixelstore_attrib
*packing
)
207 const GLint comps
= _mesa_components_in_format(format
);
210 if (format
== GL_LUMINANCE
|| format
== GL_LUMINANCE_ALPHA
) {
211 luminance
[0] = minmax
[0][RCOMP
] + minmax
[0][GCOMP
] + minmax
[0][BCOMP
];
212 luminance
[1] = minmax
[1][RCOMP
] + minmax
[1][GCOMP
] + minmax
[1][BCOMP
];
215 #define PACK_MACRO(TYPE, CONVERSION) \
221 dst[i] = CONVERSION (minmax[i][RCOMP]); \
225 dst[i] = CONVERSION (minmax[i][GCOMP]); \
229 dst[i] = CONVERSION (minmax[i][BCOMP]); \
233 dst[i] = CONVERSION (minmax[i][ACOMP]); \
237 dst[i] = CONVERSION (luminance[i]); \
239 case GL_LUMINANCE_ALPHA: \
240 for (i=0;i<2;i++) { \
241 dst[i*2+0] = CONVERSION (luminance[i]); \
242 dst[i*2+1] = CONVERSION (minmax[i][ACOMP]); \
246 for (i=0;i<2;i++) { \
247 dst[i*3+0] = CONVERSION (minmax[i][RCOMP]); \
248 dst[i*3+1] = CONVERSION (minmax[i][GCOMP]); \
249 dst[i*3+2] = CONVERSION (minmax[i][BCOMP]); \
253 for (i=0;i<2;i++) { \
254 dst[i*4+0] = CONVERSION (minmax[i][RCOMP]); \
255 dst[i*4+1] = CONVERSION (minmax[i][GCOMP]); \
256 dst[i*4+2] = CONVERSION (minmax[i][BCOMP]); \
257 dst[i*4+3] = CONVERSION (minmax[i][ACOMP]); \
261 for (i=0;i<2;i++) { \
262 dst[i*3+0] = CONVERSION (minmax[i][BCOMP]); \
263 dst[i*3+1] = CONVERSION (minmax[i][GCOMP]); \
264 dst[i*3+2] = CONVERSION (minmax[i][RCOMP]); \
268 for (i=0;i<2;i++) { \
269 dst[i*4+0] = CONVERSION (minmax[i][BCOMP]); \
270 dst[i*4+1] = CONVERSION (minmax[i][GCOMP]); \
271 dst[i*4+2] = CONVERSION (minmax[i][RCOMP]); \
272 dst[i*4+3] = CONVERSION (minmax[i][ACOMP]); \
276 for (i=0;i<2;i++) { \
277 dst[i*4+0] = CONVERSION (minmax[i][ACOMP]); \
278 dst[i*4+1] = CONVERSION (minmax[i][BCOMP]); \
279 dst[i*4+2] = CONVERSION (minmax[i][GCOMP]); \
280 dst[i*4+3] = CONVERSION (minmax[i][RCOMP]); \
284 gl_problem(ctx, "bad format in pack_minmax"); \
289 case GL_UNSIGNED_BYTE
:
291 GLubyte
*dst
= (GLubyte
*) destination
;
292 PACK_MACRO(GLubyte
, FLOAT_TO_UBYTE
);
297 GLbyte
*dst
= (GLbyte
*) destination
;
298 PACK_MACRO(GLbyte
, FLOAT_TO_BYTE
);
301 case GL_UNSIGNED_SHORT
:
303 GLushort
*dst
= (GLushort
*) destination
;
304 PACK_MACRO(GLushort
, FLOAT_TO_USHORT
);
305 if (packing
->SwapBytes
) {
306 _mesa_swap2(dst
, 2 * comps
);
312 GLshort
*dst
= (GLshort
*) destination
;
313 PACK_MACRO(GLshort
, FLOAT_TO_SHORT
);
314 if (packing
->SwapBytes
) {
315 _mesa_swap2((GLushort
*) dst
, 2 * comps
);
319 case GL_UNSIGNED_INT
:
321 GLuint
*dst
= (GLuint
*) destination
;
322 PACK_MACRO(GLuint
, FLOAT_TO_UINT
);
323 if (packing
->SwapBytes
) {
324 _mesa_swap4(dst
, 2 * comps
);
330 GLint
*dst
= (GLint
*) destination
;
331 PACK_MACRO(GLint
, FLOAT_TO_INT
);
332 if (packing
->SwapBytes
) {
333 _mesa_swap4((GLuint
*) dst
, 2 * comps
);
339 GLfloat
*dst
= (GLfloat
*) destination
;
340 PACK_MACRO(GLfloat
, (GLfloat
));
341 if (packing
->SwapBytes
) {
342 _mesa_swap4((GLuint
*) dst
, 2 * comps
);
347 gl_problem(ctx
, "Bad type in pack_minmax");
355 * Given an internalFormat token passed to glHistogram or glMinMax,
356 * return the corresponding base format.
357 * Return -1 if invalid token.
360 base_histogram_format( GLenum format
)
375 case GL_LUMINANCE_ALPHA
:
376 case GL_LUMINANCE4_ALPHA4
:
377 case GL_LUMINANCE6_ALPHA2
:
378 case GL_LUMINANCE8_ALPHA8
:
379 case GL_LUMINANCE12_ALPHA4
:
380 case GL_LUMINANCE12_ALPHA12
:
381 case GL_LUMINANCE16_ALPHA16
:
382 return GL_LUMINANCE_ALPHA
;
402 return -1; /* error */
408 _mesa_GetMinmax(GLenum target
, GLboolean reset
, GLenum format
, GLenum type
, GLvoid
*values
)
410 GET_CURRENT_CONTEXT(ctx
);
411 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glGetMinmax");
413 if (!ctx
->Extensions
.EXT_histogram
) {
414 gl_error(ctx
, GL_INVALID_OPERATION
, "glGetMinmax");
418 if (target
!= GL_MINMAX
) {
419 gl_error(ctx
, GL_INVALID_ENUM
, "glGetMinmax(target)");
423 if (!_mesa_is_legal_format_and_type(format
, type
)) {
424 gl_error(ctx
, GL_INVALID_OPERATION
, "glGetMinmax(format or type)");
432 GLfloat minmax
[2][4];
433 minmax
[0][RCOMP
] = CLAMP(ctx
->MinMax
.Min
[RCOMP
], 0.0F
, 1.0F
);
434 minmax
[0][GCOMP
] = CLAMP(ctx
->MinMax
.Min
[GCOMP
], 0.0F
, 1.0F
);
435 minmax
[0][BCOMP
] = CLAMP(ctx
->MinMax
.Min
[BCOMP
], 0.0F
, 1.0F
);
436 minmax
[0][ACOMP
] = CLAMP(ctx
->MinMax
.Min
[ACOMP
], 0.0F
, 1.0F
);
437 minmax
[1][RCOMP
] = CLAMP(ctx
->MinMax
.Max
[RCOMP
], 0.0F
, 1.0F
);
438 minmax
[1][GCOMP
] = CLAMP(ctx
->MinMax
.Max
[GCOMP
], 0.0F
, 1.0F
);
439 minmax
[1][BCOMP
] = CLAMP(ctx
->MinMax
.Max
[BCOMP
], 0.0F
, 1.0F
);
440 minmax
[1][ACOMP
] = CLAMP(ctx
->MinMax
.Max
[ACOMP
], 0.0F
, 1.0F
);
441 pack_minmax(ctx
, (CONST
GLfloat (*)[4]) minmax
,
442 format
, type
, values
, &ctx
->Pack
);
446 _mesa_ResetMinmax(GL_MINMAX
);
452 _mesa_GetHistogram(GLenum target
, GLboolean reset
, GLenum format
, GLenum type
, GLvoid
*values
)
454 GET_CURRENT_CONTEXT(ctx
);
455 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glGetHistogram");
457 if (!ctx
->Extensions
.EXT_histogram
) {
458 gl_error(ctx
, GL_INVALID_OPERATION
, "glGetHistogram");
462 if (target
!= GL_HISTOGRAM
) {
463 gl_error(ctx
, GL_INVALID_ENUM
, "glGetHistogram(target)");
467 if (!_mesa_is_legal_format_and_type(format
, type
)) {
468 gl_error(ctx
, GL_INVALID_OPERATION
, "glGetHistogram(format or type)");
475 pack_histogram(ctx
, ctx
->Histogram
.Width
,
476 (CONST
GLuint (*)[4]) ctx
->Histogram
.Count
,
477 format
, type
, values
, &ctx
->Pack
);
481 for (i
= 0; i
< HISTOGRAM_TABLE_SIZE
; i
++) {
482 ctx
->Histogram
.Count
[i
][0] = 0;
483 ctx
->Histogram
.Count
[i
][1] = 0;
484 ctx
->Histogram
.Count
[i
][2] = 0;
485 ctx
->Histogram
.Count
[i
][3] = 0;
492 _mesa_GetHistogramParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
494 GET_CURRENT_CONTEXT(ctx
);
495 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glGetHistogramParameterfv");
497 if (!ctx
->Extensions
.EXT_histogram
) {
498 gl_error(ctx
, GL_INVALID_OPERATION
, "glGetHistogramParameterfv");
502 if (target
!= GL_HISTOGRAM
&& target
!= GL_PROXY_HISTOGRAM
) {
503 gl_error(ctx
, GL_INVALID_ENUM
, "glGetHistogramParameterfv(target)");
508 case GL_HISTOGRAM_WIDTH
:
509 *params
= (GLfloat
) ctx
->Histogram
.Width
;
511 case GL_HISTOGRAM_FORMAT
:
512 *params
= (GLfloat
) ctx
->Histogram
.Format
;
514 case GL_HISTOGRAM_RED_SIZE
:
515 *params
= (GLfloat
) ctx
->Histogram
.RedSize
;
517 case GL_HISTOGRAM_GREEN_SIZE
:
518 *params
= (GLfloat
) ctx
->Histogram
.GreenSize
;
520 case GL_HISTOGRAM_BLUE_SIZE
:
521 *params
= (GLfloat
) ctx
->Histogram
.BlueSize
;
523 case GL_HISTOGRAM_ALPHA_SIZE
:
524 *params
= (GLfloat
) ctx
->Histogram
.AlphaSize
;
526 case GL_HISTOGRAM_LUMINANCE_SIZE
:
527 *params
= (GLfloat
) ctx
->Histogram
.LuminanceSize
;
529 case GL_HISTOGRAM_SINK
:
530 *params
= (GLfloat
) ctx
->Histogram
.Sink
;
533 gl_error(ctx
, GL_INVALID_ENUM
, "glGetHistogramParameterfv(pname)");
539 _mesa_GetHistogramParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
541 GET_CURRENT_CONTEXT(ctx
);
542 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glGetHistogramParameteriv");
544 if (!ctx
->Extensions
.EXT_histogram
) {
545 gl_error(ctx
, GL_INVALID_OPERATION
, "glGetHistogramParameteriv");
549 if (target
!= GL_HISTOGRAM
&& target
!= GL_PROXY_HISTOGRAM
) {
550 gl_error(ctx
, GL_INVALID_ENUM
, "glGetHistogramParameteriv(target)");
555 case GL_HISTOGRAM_WIDTH
:
556 *params
= (GLint
) ctx
->Histogram
.Width
;
558 case GL_HISTOGRAM_FORMAT
:
559 *params
= (GLint
) ctx
->Histogram
.Format
;
561 case GL_HISTOGRAM_RED_SIZE
:
562 *params
= (GLint
) ctx
->Histogram
.RedSize
;
564 case GL_HISTOGRAM_GREEN_SIZE
:
565 *params
= (GLint
) ctx
->Histogram
.GreenSize
;
567 case GL_HISTOGRAM_BLUE_SIZE
:
568 *params
= (GLint
) ctx
->Histogram
.BlueSize
;
570 case GL_HISTOGRAM_ALPHA_SIZE
:
571 *params
= (GLint
) ctx
->Histogram
.AlphaSize
;
573 case GL_HISTOGRAM_LUMINANCE_SIZE
:
574 *params
= (GLint
) ctx
->Histogram
.LuminanceSize
;
576 case GL_HISTOGRAM_SINK
:
577 *params
= (GLint
) ctx
->Histogram
.Sink
;
580 gl_error(ctx
, GL_INVALID_ENUM
, "glGetHistogramParameteriv(pname)");
586 _mesa_GetMinmaxParameterfv(GLenum target
, GLenum pname
, GLfloat
*params
)
588 GET_CURRENT_CONTEXT(ctx
);
589 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glGetMinmaxParameterfv");
591 if (!ctx
->Extensions
.EXT_histogram
) {
592 gl_error(ctx
, GL_INVALID_OPERATION
, "glGetMinmaxParameterfv");
595 if (target
!= GL_MINMAX
) {
596 gl_error(ctx
, GL_INVALID_ENUM
, "glGetMinmaxParameterfv(target)");
599 if (pname
== GL_MINMAX_FORMAT
) {
600 *params
= (GLfloat
) ctx
->MinMax
.Format
;
602 else if (pname
== GL_MINMAX_SINK
) {
603 *params
= (GLfloat
) ctx
->MinMax
.Sink
;
606 gl_error(ctx
, GL_INVALID_ENUM
, "glGetMinMaxParameterfv(pname)");
612 _mesa_GetMinmaxParameteriv(GLenum target
, GLenum pname
, GLint
*params
)
614 GET_CURRENT_CONTEXT(ctx
);
615 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glGetMinmaxParameteriv");
617 if (!ctx
->Extensions
.EXT_histogram
) {
618 gl_error(ctx
, GL_INVALID_OPERATION
, "glGetMinmaxParameteriv");
621 if (target
!= GL_MINMAX
) {
622 gl_error(ctx
, GL_INVALID_ENUM
, "glGetMinmaxParameteriv(target)");
625 if (pname
== GL_MINMAX_FORMAT
) {
626 *params
= (GLint
) ctx
->MinMax
.Format
;
628 else if (pname
== GL_MINMAX_SINK
) {
629 *params
= (GLint
) ctx
->MinMax
.Sink
;
632 gl_error(ctx
, GL_INVALID_ENUM
, "glGetMinMaxParameteriv(pname)");
638 _mesa_Histogram(GLenum target
, GLsizei width
, GLenum internalFormat
, GLboolean sink
)
641 GLboolean error
= GL_FALSE
;
642 GET_CURRENT_CONTEXT(ctx
);
643 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glHistogram");
645 if (!ctx
->Extensions
.EXT_histogram
) {
646 gl_error(ctx
, GL_INVALID_OPERATION
, "glHistogram");
650 if (target
!= GL_HISTOGRAM
&& target
!= GL_PROXY_HISTOGRAM
) {
651 gl_error(ctx
, GL_INVALID_ENUM
, "glHistogram(target)");
655 if (width
< 0 || width
> HISTOGRAM_TABLE_SIZE
) {
656 if (target
== GL_PROXY_HISTOGRAM
) {
661 gl_error(ctx
, GL_INVALID_VALUE
, "glHistogram(width)");
663 gl_error(ctx
, GL_TABLE_TOO_LARGE
, "glHistogram(width)");
668 if (width
!= 0 && _mesa_bitcount(width
) != 1) {
669 if (target
== GL_PROXY_HISTOGRAM
) {
673 gl_error(ctx
, GL_INVALID_VALUE
, "glHistogram(width)");
678 if (base_histogram_format(internalFormat
) < 0) {
679 if (target
== GL_PROXY_HISTOGRAM
) {
683 gl_error(ctx
, GL_INVALID_ENUM
, "glHistogram(internalFormat)");
688 /* reset histograms */
689 for (i
= 0; i
< HISTOGRAM_TABLE_SIZE
; i
++) {
690 ctx
->Histogram
.Count
[i
][0] = 0;
691 ctx
->Histogram
.Count
[i
][1] = 0;
692 ctx
->Histogram
.Count
[i
][2] = 0;
693 ctx
->Histogram
.Count
[i
][3] = 0;
697 ctx
->Histogram
.Width
= 0;
698 ctx
->Histogram
.Format
= 0;
699 ctx
->Histogram
.RedSize
= 0;
700 ctx
->Histogram
.GreenSize
= 0;
701 ctx
->Histogram
.BlueSize
= 0;
702 ctx
->Histogram
.AlphaSize
= 0;
703 ctx
->Histogram
.LuminanceSize
= 0;
706 ctx
->Histogram
.Width
= width
;
707 ctx
->Histogram
.Format
= internalFormat
;
708 ctx
->Histogram
.Sink
= sink
;
709 ctx
->Histogram
.RedSize
= 0xffffffff;
710 ctx
->Histogram
.GreenSize
= 0xffffffff;
711 ctx
->Histogram
.BlueSize
= 0xffffffff;
712 ctx
->Histogram
.AlphaSize
= 0xffffffff;
713 ctx
->Histogram
.LuminanceSize
= 0xffffffff;
716 ctx
->NewState
|= _NEW_PIXEL
;
721 _mesa_Minmax(GLenum target
, GLenum internalFormat
, GLboolean sink
)
723 GET_CURRENT_CONTEXT(ctx
);
724 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glMinmax");
726 if (!ctx
->Extensions
.EXT_histogram
) {
727 gl_error(ctx
, GL_INVALID_OPERATION
, "glMinmax");
731 if (target
!= GL_MINMAX
) {
732 gl_error(ctx
, GL_INVALID_ENUM
, "glMinMax(target)");
736 if (base_histogram_format(internalFormat
) < 0) {
737 gl_error(ctx
, GL_INVALID_ENUM
, "glMinMax(internalFormat)");
741 ctx
->MinMax
.Sink
= sink
;
742 ctx
->NewState
|= _NEW_PIXEL
;
747 _mesa_ResetHistogram(GLenum target
)
750 GET_CURRENT_CONTEXT(ctx
);
751 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glResetHistogram");
753 if (!ctx
->Extensions
.EXT_histogram
) {
754 gl_error(ctx
, GL_INVALID_OPERATION
, "glResetHistogram");
758 if (target
!= GL_HISTOGRAM
) {
759 gl_error(ctx
, GL_INVALID_ENUM
, "glResetHistogram(target)");
763 for (i
= 0; i
< HISTOGRAM_TABLE_SIZE
; i
++) {
764 ctx
->Histogram
.Count
[i
][0] = 0;
765 ctx
->Histogram
.Count
[i
][1] = 0;
766 ctx
->Histogram
.Count
[i
][2] = 0;
767 ctx
->Histogram
.Count
[i
][3] = 0;
770 ctx
->NewState
|= _NEW_PIXEL
;
775 _mesa_ResetMinmax(GLenum target
)
777 GET_CURRENT_CONTEXT(ctx
);
778 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
, "glResetMinmax");
780 if (!ctx
->Extensions
.EXT_histogram
) {
781 gl_error(ctx
, GL_INVALID_OPERATION
, "glResetMinmax");
785 if (target
!= GL_MINMAX
) {
786 gl_error(ctx
, GL_INVALID_ENUM
, "glResetMinMax(target)");
790 ctx
->MinMax
.Min
[RCOMP
] = 1000; ctx
->MinMax
.Max
[RCOMP
] = -1000;
791 ctx
->MinMax
.Min
[GCOMP
] = 1000; ctx
->MinMax
.Max
[GCOMP
] = -1000;
792 ctx
->MinMax
.Min
[BCOMP
] = 1000; ctx
->MinMax
.Max
[BCOMP
] = -1000;
793 ctx
->MinMax
.Min
[ACOMP
] = 1000; ctx
->MinMax
.Max
[ACOMP
] = -1000;
794 ctx
->NewState
|= _NEW_PIXEL
;