1 /*
2  * Mesa 3-D graphics library
3  * Version:  6.5.2
4  *
5  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a
8  * copy of this software and associated documentation files (the "Software"),
9  * to deal in the Software without restriction, including without limitation
10  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11  * and/or sell copies of the Software, and to permit persons to whom the
12  * Software is furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included
15  * in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 
26 /*
27  * Image convolution functions.
28  *
29  * Notes: filter kernel elements are indexed by <n> and <m> as in
30  * the GL spec.
31  */
32 
33 
34 #include "glheader.h"
35 #include "bufferobj.h"
36 #include "colormac.h"
37 #include "convolve.h"
38 #include "macros.h"
39 #include "mfeatures.h"
40 #include "mtypes.h"
41 #include "main/dispatch.h"
42 
43 
44 #if FEATURE_convolve
45 
46 static void GLAPIENTRY
_mesa_ConvolutionFilter1D(GLenum target,GLenum internalFormat,GLsizei width,GLenum format,GLenum type,const GLvoid * image)47 _mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)
48 {
49    GET_CURRENT_CONTEXT(ctx);
50 
51    _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D");
52 }
53 
54 static void GLAPIENTRY
_mesa_ConvolutionFilter2D(GLenum target,GLenum internalFormat,GLsizei width,GLsizei height,GLenum format,GLenum type,const GLvoid * image)55 _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)
56 {
57    GET_CURRENT_CONTEXT(ctx);
58 
59    _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D");
60 }
61 
62 
63 static void GLAPIENTRY
_mesa_ConvolutionParameterf(GLenum target,GLenum pname,GLfloat param)64 _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
65 {
66    GET_CURRENT_CONTEXT(ctx);
67 
68    _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf");
69 }
70 
71 
72 static void GLAPIENTRY
_mesa_ConvolutionParameterfv(GLenum target,GLenum pname,const GLfloat * params)73 _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
74 {
75    GET_CURRENT_CONTEXT(ctx);
76 
77    _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv");
78 }
79 
80 
81 static void GLAPIENTRY
_mesa_ConvolutionParameteri(GLenum target,GLenum pname,GLint param)82 _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
83 {
84    GET_CURRENT_CONTEXT(ctx);
85 
86    _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri");
87 }
88 
89 
90 static void GLAPIENTRY
_mesa_ConvolutionParameteriv(GLenum target,GLenum pname,const GLint * params)91 _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
92 {
93    GET_CURRENT_CONTEXT(ctx);
94 
95    _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv");
96 }
97 
98 
99 static void GLAPIENTRY
_mesa_CopyConvolutionFilter1D(GLenum target,GLenum internalFormat,GLint x,GLint y,GLsizei width)100 _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width)
101 {
102    GET_CURRENT_CONTEXT(ctx);
103 
104    _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D");
105 }
106 
107 
108 static void GLAPIENTRY
_mesa_CopyConvolutionFilter2D(GLenum target,GLenum internalFormat,GLint x,GLint y,GLsizei width,GLsizei height)109 _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height)
110 {
111    GET_CURRENT_CONTEXT(ctx);
112 
113    _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D");
114 }
115 
116 
117 static void GLAPIENTRY
_mesa_GetnConvolutionFilterARB(GLenum target,GLenum format,GLenum type,GLsizei bufSize,GLvoid * image)118 _mesa_GetnConvolutionFilterARB(GLenum target, GLenum format, GLenum type,
119                                GLsizei bufSize, GLvoid *image)
120 {
121    GET_CURRENT_CONTEXT(ctx);
122 
123    _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter");
124 }
125 
126 
127 static void GLAPIENTRY
_mesa_GetConvolutionFilter(GLenum target,GLenum format,GLenum type,GLvoid * image)128 _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
129                            GLvoid *image)
130 {
131    _mesa_GetnConvolutionFilterARB(target, format, type, INT_MAX, image);
132 }
133 
134 
135 static void GLAPIENTRY
_mesa_GetConvolutionParameterfv(GLenum target,GLenum pname,GLfloat * params)136 _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params)
137 {
138    GET_CURRENT_CONTEXT(ctx);
139 
140    _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv");
141 }
142 
143 
144 static void GLAPIENTRY
_mesa_GetConvolutionParameteriv(GLenum target,GLenum pname,GLint * params)145 _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params)
146 {
147    GET_CURRENT_CONTEXT(ctx);
148 
149    _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv");
150 }
151 
152 
153 static void GLAPIENTRY
_mesa_GetnSeparableFilterARB(GLenum target,GLenum format,GLenum type,GLsizei rowBufSize,GLvoid * row,GLsizei columnBufSize,GLvoid * column,GLvoid * span)154 _mesa_GetnSeparableFilterARB(GLenum target, GLenum format, GLenum type,
155                              GLsizei rowBufSize, GLvoid *row,
156                              GLsizei columnBufSize,  GLvoid *column,
157                              GLvoid *span)
158 {
159    GET_CURRENT_CONTEXT(ctx);
160 
161    _mesa_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter");
162 }
163 
164 
165 static void GLAPIENTRY
_mesa_GetSeparableFilter(GLenum target,GLenum format,GLenum type,GLvoid * row,GLvoid * column,GLvoid * span)166 _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
167                          GLvoid *row, GLvoid *column, GLvoid *span)
168 {
169    _mesa_GetnSeparableFilterARB(target, format, type, INT_MAX, row,
170                                 INT_MAX, column, span);
171 }
172 
173 
174 static void GLAPIENTRY
_mesa_SeparableFilter2D(GLenum target,GLenum internalFormat,GLsizei width,GLsizei height,GLenum format,GLenum type,const GLvoid * row,const GLvoid * column)175 _mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)
176 {
177    GET_CURRENT_CONTEXT(ctx);
178 
179    _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D");
180 }
181 
182 void
_mesa_init_convolve_dispatch(struct _glapi_table * disp)183 _mesa_init_convolve_dispatch(struct _glapi_table *disp)
184 {
185    SET_ConvolutionFilter1D(disp, _mesa_ConvolutionFilter1D);
186    SET_ConvolutionFilter2D(disp, _mesa_ConvolutionFilter2D);
187    SET_ConvolutionParameterf(disp, _mesa_ConvolutionParameterf);
188    SET_ConvolutionParameterfv(disp, _mesa_ConvolutionParameterfv);
189    SET_ConvolutionParameteri(disp, _mesa_ConvolutionParameteri);
190    SET_ConvolutionParameteriv(disp, _mesa_ConvolutionParameteriv);
191    SET_CopyConvolutionFilter1D(disp, _mesa_CopyConvolutionFilter1D);
192    SET_CopyConvolutionFilter2D(disp, _mesa_CopyConvolutionFilter2D);
193    SET_GetConvolutionFilter(disp, _mesa_GetConvolutionFilter);
194    SET_GetConvolutionParameterfv(disp, _mesa_GetConvolutionParameterfv);
195    SET_GetConvolutionParameteriv(disp, _mesa_GetConvolutionParameteriv);
196    SET_SeparableFilter2D(disp, _mesa_SeparableFilter2D);
197    SET_GetSeparableFilter(disp, _mesa_GetSeparableFilter);
198 
199    /* GL_ARB_robustness */
200    SET_GetnConvolutionFilterARB(disp, _mesa_GetnConvolutionFilterARB);
201    SET_GetnSeparableFilterARB(disp, _mesa_GetnSeparableFilterARB);
202 }
203 
204 
205 #endif /* FEATURE_convolve */
206