convolve.c revision 3464ebd5
17117f1b4Smrg/* 27117f1b4Smrg * Mesa 3-D graphics library 37117f1b4Smrg * Version: 6.5.2 47117f1b4Smrg * 57117f1b4Smrg * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. 67117f1b4Smrg * 77117f1b4Smrg * Permission is hereby granted, free of charge, to any person obtaining a 87117f1b4Smrg * copy of this software and associated documentation files (the "Software"), 97117f1b4Smrg * to deal in the Software without restriction, including without limitation 107117f1b4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 117117f1b4Smrg * and/or sell copies of the Software, and to permit persons to whom the 127117f1b4Smrg * Software is furnished to do so, subject to the following conditions: 137117f1b4Smrg * 147117f1b4Smrg * The above copyright notice and this permission notice shall be included 157117f1b4Smrg * in all copies or substantial portions of the Software. 167117f1b4Smrg * 177117f1b4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 187117f1b4Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 197117f1b4Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 207117f1b4Smrg * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 217117f1b4Smrg * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 227117f1b4Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 237117f1b4Smrg */ 247117f1b4Smrg 257117f1b4Smrg 267117f1b4Smrg/* 277117f1b4Smrg * Image convolution functions. 287117f1b4Smrg * 297117f1b4Smrg * Notes: filter kernel elements are indexed by <n> and <m> as in 307117f1b4Smrg * the GL spec. 317117f1b4Smrg */ 327117f1b4Smrg 337117f1b4Smrg 347117f1b4Smrg#include "glheader.h" 357117f1b4Smrg#include "bufferobj.h" 367117f1b4Smrg#include "colormac.h" 377117f1b4Smrg#include "convolve.h" 383464ebd5Sriastradh#include "macros.h" 393464ebd5Sriastradh#include "mfeatures.h" 407117f1b4Smrg#include "mtypes.h" 41cdc920a0Smrg#include "main/dispatch.h" 424a49301eSmrg 434a49301eSmrg 444a49301eSmrg#if FEATURE_convolve 457117f1b4Smrg 463464ebd5Sriastradhstatic void GLAPIENTRY 477117f1b4Smrg_mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) 487117f1b4Smrg{ 497117f1b4Smrg GET_CURRENT_CONTEXT(ctx); 507117f1b4Smrg 513464ebd5Sriastradh _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D"); 527117f1b4Smrg} 537117f1b4Smrg 543464ebd5Sriastradhstatic void GLAPIENTRY 557117f1b4Smrg_mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) 567117f1b4Smrg{ 577117f1b4Smrg GET_CURRENT_CONTEXT(ctx); 587117f1b4Smrg 593464ebd5Sriastradh _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D"); 607117f1b4Smrg} 617117f1b4Smrg 627117f1b4Smrg 634a49301eSmrgstatic void GLAPIENTRY 647117f1b4Smrg_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) 657117f1b4Smrg{ 667117f1b4Smrg GET_CURRENT_CONTEXT(ctx); 677117f1b4Smrg 683464ebd5Sriastradh _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf"); 697117f1b4Smrg} 707117f1b4Smrg 717117f1b4Smrg 724a49301eSmrgstatic void GLAPIENTRY 737117f1b4Smrg_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) 747117f1b4Smrg{ 757117f1b4Smrg GET_CURRENT_CONTEXT(ctx); 767117f1b4Smrg 773464ebd5Sriastradh _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv"); 787117f1b4Smrg} 797117f1b4Smrg 807117f1b4Smrg 814a49301eSmrgstatic void GLAPIENTRY 827117f1b4Smrg_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) 837117f1b4Smrg{ 847117f1b4Smrg GET_CURRENT_CONTEXT(ctx); 857117f1b4Smrg 863464ebd5Sriastradh _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri"); 877117f1b4Smrg} 887117f1b4Smrg 897117f1b4Smrg 904a49301eSmrgstatic void GLAPIENTRY 917117f1b4Smrg_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) 927117f1b4Smrg{ 937117f1b4Smrg GET_CURRENT_CONTEXT(ctx); 947117f1b4Smrg 953464ebd5Sriastradh _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv"); 967117f1b4Smrg} 977117f1b4Smrg 987117f1b4Smrg 994a49301eSmrgstatic void GLAPIENTRY 1007117f1b4Smrg_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) 1017117f1b4Smrg{ 1027117f1b4Smrg GET_CURRENT_CONTEXT(ctx); 1037117f1b4Smrg 1043464ebd5Sriastradh _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D"); 1057117f1b4Smrg} 1067117f1b4Smrg 1077117f1b4Smrg 1084a49301eSmrgstatic void GLAPIENTRY 1097117f1b4Smrg_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height) 1107117f1b4Smrg{ 1117117f1b4Smrg GET_CURRENT_CONTEXT(ctx); 1127117f1b4Smrg 1133464ebd5Sriastradh _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D"); 1143464ebd5Sriastradh} 1157117f1b4Smrg 1167117f1b4Smrg 1173464ebd5Sriastradhstatic void GLAPIENTRY 1183464ebd5Sriastradh_mesa_GetnConvolutionFilterARB(GLenum target, GLenum format, GLenum type, 1193464ebd5Sriastradh GLsizei bufSize, GLvoid *image) 1203464ebd5Sriastradh{ 1213464ebd5Sriastradh GET_CURRENT_CONTEXT(ctx); 1224a49301eSmrg 1233464ebd5Sriastradh _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter"); 1247117f1b4Smrg} 1257117f1b4Smrg 1267117f1b4Smrg 1274a49301eSmrgstatic void GLAPIENTRY 1287117f1b4Smrg_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, 1297117f1b4Smrg GLvoid *image) 1307117f1b4Smrg{ 1313464ebd5Sriastradh _mesa_GetnConvolutionFilterARB(target, format, type, INT_MAX, image); 1327117f1b4Smrg} 1337117f1b4Smrg 1347117f1b4Smrg 1354a49301eSmrgstatic void GLAPIENTRY 1367117f1b4Smrg_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) 1377117f1b4Smrg{ 1387117f1b4Smrg GET_CURRENT_CONTEXT(ctx); 1397117f1b4Smrg 1403464ebd5Sriastradh _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv"); 1417117f1b4Smrg} 1427117f1b4Smrg 1437117f1b4Smrg 1444a49301eSmrgstatic void GLAPIENTRY 1457117f1b4Smrg_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) 1467117f1b4Smrg{ 1477117f1b4Smrg GET_CURRENT_CONTEXT(ctx); 1487117f1b4Smrg 1493464ebd5Sriastradh _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv"); 1507117f1b4Smrg} 1517117f1b4Smrg 1527117f1b4Smrg 1534a49301eSmrgstatic void GLAPIENTRY 1543464ebd5Sriastradh_mesa_GetnSeparableFilterARB(GLenum target, GLenum format, GLenum type, 1553464ebd5Sriastradh GLsizei rowBufSize, GLvoid *row, 1563464ebd5Sriastradh GLsizei columnBufSize, GLvoid *column, 1573464ebd5Sriastradh GLvoid *span) 1587117f1b4Smrg{ 1597117f1b4Smrg GET_CURRENT_CONTEXT(ctx); 1607117f1b4Smrg 1613464ebd5Sriastradh _mesa_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter"); 1627117f1b4Smrg} 1637117f1b4Smrg 1647117f1b4Smrg 1654a49301eSmrgstatic void GLAPIENTRY 1663464ebd5Sriastradh_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, 1673464ebd5Sriastradh GLvoid *row, GLvoid *column, GLvoid *span) 1687117f1b4Smrg{ 1693464ebd5Sriastradh _mesa_GetnSeparableFilterARB(target, format, type, INT_MAX, row, 1703464ebd5Sriastradh INT_MAX, column, span); 1717117f1b4Smrg} 1727117f1b4Smrg 1737117f1b4Smrg 1743464ebd5Sriastradhstatic void GLAPIENTRY 1753464ebd5Sriastradh_mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) 1767117f1b4Smrg{ 1773464ebd5Sriastradh GET_CURRENT_CONTEXT(ctx); 1787117f1b4Smrg 1793464ebd5Sriastradh _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D"); 1807117f1b4Smrg} 1814a49301eSmrg 1824a49301eSmrgvoid 1834a49301eSmrg_mesa_init_convolve_dispatch(struct _glapi_table *disp) 1844a49301eSmrg{ 1854a49301eSmrg SET_ConvolutionFilter1D(disp, _mesa_ConvolutionFilter1D); 1864a49301eSmrg SET_ConvolutionFilter2D(disp, _mesa_ConvolutionFilter2D); 1874a49301eSmrg SET_ConvolutionParameterf(disp, _mesa_ConvolutionParameterf); 1884a49301eSmrg SET_ConvolutionParameterfv(disp, _mesa_ConvolutionParameterfv); 1894a49301eSmrg SET_ConvolutionParameteri(disp, _mesa_ConvolutionParameteri); 1904a49301eSmrg SET_ConvolutionParameteriv(disp, _mesa_ConvolutionParameteriv); 1914a49301eSmrg SET_CopyConvolutionFilter1D(disp, _mesa_CopyConvolutionFilter1D); 1924a49301eSmrg SET_CopyConvolutionFilter2D(disp, _mesa_CopyConvolutionFilter2D); 1934a49301eSmrg SET_GetConvolutionFilter(disp, _mesa_GetConvolutionFilter); 1944a49301eSmrg SET_GetConvolutionParameterfv(disp, _mesa_GetConvolutionParameterfv); 1954a49301eSmrg SET_GetConvolutionParameteriv(disp, _mesa_GetConvolutionParameteriv); 1964a49301eSmrg SET_SeparableFilter2D(disp, _mesa_SeparableFilter2D); 1974a49301eSmrg SET_GetSeparableFilter(disp, _mesa_GetSeparableFilter); 1983464ebd5Sriastradh 1993464ebd5Sriastradh /* GL_ARB_robustness */ 2003464ebd5Sriastradh SET_GetnConvolutionFilterARB(disp, _mesa_GetnConvolutionFilterARB); 2013464ebd5Sriastradh SET_GetnSeparableFilterARB(disp, _mesa_GetnSeparableFilterARB); 2024a49301eSmrg} 2034a49301eSmrg 2044a49301eSmrg 2054a49301eSmrg#endif /* FEATURE_convolve */ 206