1cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul/* 2cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * Mesa 3-D graphics library 3176501dfff14b5bec78af2b3487207d42c26d37aBrian Paul * Version: 6.5.2 4cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * 5176501dfff14b5bec78af2b3487207d42c26d37aBrian Paul * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. 6cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * 7cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * Permission is hereby granted, free of charge, to any person obtaining a 8cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * copy of this software and associated documentation files (the "Software"), 9cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * to deal in the Software without restriction, including without limitation 10cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * and/or sell copies of the Software, and to permit persons to whom the 12cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * Software is furnished to do so, subject to the following conditions: 13cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * 14cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * The above copyright notice and this permission notice shall be included 15cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * in all copies or substantial portions of the Software. 16cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * 17cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 21cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul */ 24cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul 25cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul 26cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul/* 27cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * Image convolution functions. 28cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * 29cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * Notes: filter kernel elements are indexed by <n> and <m> as in 30cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul * the GL spec. 31cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul */ 32cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul 33cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul 34cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul#include "glheader.h" 35bd3b40ad75d50483aaa99ad2d08a3dd8f20cdb42Brian Paul#include "bufferobj.h" 36c893a015d8a50a38cd3f727d99835e7e7e2ccea9Brian Paul#include "colormac.h" 37d4b799b60c693ecebbbdcdb3fd6931a78b7a0e30Brian Paul#include "convolve.h" 383fdd9fa556e9ba48244cb2b3966d3bfb0b84731bVinson Lee#include "macros.h" 39db61b9ce39bccc43140357652ceb78baaf2aea44Vinson Lee#include "mfeatures.h" 405e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen#include "mtypes.h" 412cf44390d1e819f23e1d7ceb3199276c9148c647Chia-I Wu#include "main/dispatch.h" 425a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu 435a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu 445a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu#if FEATURE_convolve 45cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul 46a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholtstatic void GLAPIENTRY 47147b08328a2ccb0c1150feaf7871037683236e33Brian Paul_mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) 48147b08328a2ccb0c1150feaf7871037683236e33Brian Paul{ 49147b08328a2ccb0c1150feaf7871037683236e33Brian Paul GET_CURRENT_CONTEXT(ctx); 50147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 51a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholt _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D"); 52147b08328a2ccb0c1150feaf7871037683236e33Brian Paul} 53147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 54a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholtstatic void GLAPIENTRY 55147b08328a2ccb0c1150feaf7871037683236e33Brian Paul_mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) 56147b08328a2ccb0c1150feaf7871037683236e33Brian Paul{ 57147b08328a2ccb0c1150feaf7871037683236e33Brian Paul GET_CURRENT_CONTEXT(ctx); 58bd3b40ad75d50483aaa99ad2d08a3dd8f20cdb42Brian Paul 59a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholt _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D"); 60147b08328a2ccb0c1150feaf7871037683236e33Brian Paul} 61147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 62147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 635a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wustatic void GLAPIENTRY 64147b08328a2ccb0c1150feaf7871037683236e33Brian Paul_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) 65147b08328a2ccb0c1150feaf7871037683236e33Brian Paul{ 66147b08328a2ccb0c1150feaf7871037683236e33Brian Paul GET_CURRENT_CONTEXT(ctx); 67a96308c37db0bc0086a017d318bc3504aa5f0b1aKeith Whitwell 68a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholt _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf"); 69147b08328a2ccb0c1150feaf7871037683236e33Brian Paul} 70147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 71147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 725a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wustatic void GLAPIENTRY 73147b08328a2ccb0c1150feaf7871037683236e33Brian Paul_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) 74147b08328a2ccb0c1150feaf7871037683236e33Brian Paul{ 75147b08328a2ccb0c1150feaf7871037683236e33Brian Paul GET_CURRENT_CONTEXT(ctx); 76a96308c37db0bc0086a017d318bc3504aa5f0b1aKeith Whitwell 77a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholt _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv"); 78147b08328a2ccb0c1150feaf7871037683236e33Brian Paul} 79147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 80147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 815a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wustatic void GLAPIENTRY 82147b08328a2ccb0c1150feaf7871037683236e33Brian Paul_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) 83147b08328a2ccb0c1150feaf7871037683236e33Brian Paul{ 84147b08328a2ccb0c1150feaf7871037683236e33Brian Paul GET_CURRENT_CONTEXT(ctx); 85147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 86a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholt _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri"); 87147b08328a2ccb0c1150feaf7871037683236e33Brian Paul} 88147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 89147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 905a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wustatic void GLAPIENTRY 91147b08328a2ccb0c1150feaf7871037683236e33Brian Paul_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) 92147b08328a2ccb0c1150feaf7871037683236e33Brian Paul{ 93147b08328a2ccb0c1150feaf7871037683236e33Brian Paul GET_CURRENT_CONTEXT(ctx); 94a96308c37db0bc0086a017d318bc3504aa5f0b1aKeith Whitwell 95a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholt _mesa_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv"); 96147b08328a2ccb0c1150feaf7871037683236e33Brian Paul} 97147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 98147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 995a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wustatic void GLAPIENTRY 100147b08328a2ccb0c1150feaf7871037683236e33Brian Paul_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) 101147b08328a2ccb0c1150feaf7871037683236e33Brian Paul{ 102147b08328a2ccb0c1150feaf7871037683236e33Brian Paul GET_CURRENT_CONTEXT(ctx); 103147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 104a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholt _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D"); 105147b08328a2ccb0c1150feaf7871037683236e33Brian Paul} 106147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 107147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 1085a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wustatic void GLAPIENTRY 109147b08328a2ccb0c1150feaf7871037683236e33Brian Paul_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height) 110147b08328a2ccb0c1150feaf7871037683236e33Brian Paul{ 111147b08328a2ccb0c1150feaf7871037683236e33Brian Paul GET_CURRENT_CONTEXT(ctx); 112147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 113a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholt _mesa_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D"); 114147b08328a2ccb0c1150feaf7871037683236e33Brian Paul} 115147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 116147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 1175a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wustatic void GLAPIENTRY 1186b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul_mesa_GetnConvolutionFilterARB(GLenum target, GLenum format, GLenum type, 1196b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul GLsizei bufSize, GLvoid *image) 120147b08328a2ccb0c1150feaf7871037683236e33Brian Paul{ 121147b08328a2ccb0c1150feaf7871037683236e33Brian Paul GET_CURRENT_CONTEXT(ctx); 12290f042ae8dbc00ecedab5cc68dbc6abae4228af5Brian Paul 123a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholt _mesa_error(ctx, GL_INVALID_OPERATION, "glGetConvolutionFilter"); 124147b08328a2ccb0c1150feaf7871037683236e33Brian Paul} 125147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 126147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 1275a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wustatic void GLAPIENTRY 1286b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, 1296b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul GLvoid *image) 1306b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul{ 1316b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul _mesa_GetnConvolutionFilterARB(target, format, type, INT_MAX, image); 1326b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul} 1336b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul 1346b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul 1356b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paulstatic void GLAPIENTRY 136147b08328a2ccb0c1150feaf7871037683236e33Brian Paul_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) 137147b08328a2ccb0c1150feaf7871037683236e33Brian Paul{ 138147b08328a2ccb0c1150feaf7871037683236e33Brian Paul GET_CURRENT_CONTEXT(ctx); 139147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 140a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholt _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv"); 141147b08328a2ccb0c1150feaf7871037683236e33Brian Paul} 142147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 143147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 1445a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wustatic void GLAPIENTRY 145147b08328a2ccb0c1150feaf7871037683236e33Brian Paul_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) 146147b08328a2ccb0c1150feaf7871037683236e33Brian Paul{ 147147b08328a2ccb0c1150feaf7871037683236e33Brian Paul GET_CURRENT_CONTEXT(ctx); 148147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 149a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholt _mesa_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv"); 150147b08328a2ccb0c1150feaf7871037683236e33Brian Paul} 151147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 152147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 1535a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wustatic void GLAPIENTRY 1546b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul_mesa_GetnSeparableFilterARB(GLenum target, GLenum format, GLenum type, 1556b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul GLsizei rowBufSize, GLvoid *row, 1566b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul GLsizei columnBufSize, GLvoid *column, 1576b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul GLvoid *span) 158147b08328a2ccb0c1150feaf7871037683236e33Brian Paul{ 159147b08328a2ccb0c1150feaf7871037683236e33Brian Paul GET_CURRENT_CONTEXT(ctx); 16090f042ae8dbc00ecedab5cc68dbc6abae4228af5Brian Paul 161a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholt _mesa_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter"); 162147b08328a2ccb0c1150feaf7871037683236e33Brian Paul} 163147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 164147b08328a2ccb0c1150feaf7871037683236e33Brian Paul 1655a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wustatic void GLAPIENTRY 1666b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, 1676b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul GLvoid *row, GLvoid *column, GLvoid *span) 1686b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul{ 1696b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul _mesa_GetnSeparableFilterARB(target, format, type, INT_MAX, row, 1706b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul INT_MAX, column, span); 1716b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul} 1726b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul 1736b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul 1746b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paulstatic void GLAPIENTRY 175147b08328a2ccb0c1150feaf7871037683236e33Brian Paul_mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) 176147b08328a2ccb0c1150feaf7871037683236e33Brian Paul{ 177147b08328a2ccb0c1150feaf7871037683236e33Brian Paul GET_CURRENT_CONTEXT(ctx); 1787e70874420266fb81bed13c8464ee4c0309d75b2Brian Paul 179a62efdf82c20747feb11dfd7756f0579aa914b57Eric Anholt _mesa_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D"); 180cc8e37ffb393c892bbbf8850fef0e208c71d00f4Brian Paul} 18116461f7c53f3bd88ec20458edfc247df14cde721Brian Paul 1825a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wuvoid 1835a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu_mesa_init_convolve_dispatch(struct _glapi_table *disp) 1845a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu{ 1855a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu SET_ConvolutionFilter1D(disp, _mesa_ConvolutionFilter1D); 1865a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu SET_ConvolutionFilter2D(disp, _mesa_ConvolutionFilter2D); 1875a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu SET_ConvolutionParameterf(disp, _mesa_ConvolutionParameterf); 1885a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu SET_ConvolutionParameterfv(disp, _mesa_ConvolutionParameterfv); 1895a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu SET_ConvolutionParameteri(disp, _mesa_ConvolutionParameteri); 1905a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu SET_ConvolutionParameteriv(disp, _mesa_ConvolutionParameteriv); 1915a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu SET_CopyConvolutionFilter1D(disp, _mesa_CopyConvolutionFilter1D); 1925a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu SET_CopyConvolutionFilter2D(disp, _mesa_CopyConvolutionFilter2D); 1935a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu SET_GetConvolutionFilter(disp, _mesa_GetConvolutionFilter); 1945a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu SET_GetConvolutionParameterfv(disp, _mesa_GetConvolutionParameterfv); 1955a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu SET_GetConvolutionParameteriv(disp, _mesa_GetConvolutionParameteriv); 1965a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu SET_SeparableFilter2D(disp, _mesa_SeparableFilter2D); 1975a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu SET_GetSeparableFilter(disp, _mesa_GetSeparableFilter); 1986b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul 1996b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul /* GL_ARB_robustness */ 2006b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul SET_GetnConvolutionFilterARB(disp, _mesa_GetnConvolutionFilterARB); 2016b329b9274b18c50f4177eef7ee087d50ebc1525Brian Paul SET_GetnSeparableFilterARB(disp, _mesa_GetnSeparableFilterARB); 2025a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu} 2035a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu 2045a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu 2055a1e25afac8eac5df1c0c9d3165b9812f54909a6Chia-I Wu#endif /* FEATURE_convolve */ 206