1706f2543Smrg/*
2706f2543Smrg * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3706f2543Smrg * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
4706f2543Smrg *
5706f2543Smrg * Permission is hereby granted, free of charge, to any person obtaining a
6706f2543Smrg * copy of this software and associated documentation files (the "Software"),
7706f2543Smrg * to deal in the Software without restriction, including without limitation
8706f2543Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9706f2543Smrg * and/or sell copies of the Software, and to permit persons to whom the
10706f2543Smrg * Software is furnished to do so, subject to the following conditions:
11706f2543Smrg *
12706f2543Smrg * The above copyright notice including the dates of first publication and
13706f2543Smrg * either this permission notice or a reference to
14706f2543Smrg * http://oss.sgi.com/projects/FreeB/
15706f2543Smrg * shall be included in all copies or substantial portions of the Software.
16706f2543Smrg *
17706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18706f2543Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19706f2543Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20706f2543Smrg * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21706f2543Smrg * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22706f2543Smrg * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23706f2543Smrg * SOFTWARE.
24706f2543Smrg *
25706f2543Smrg * Except as contained in this notice, the name of Silicon Graphics, Inc.
26706f2543Smrg * shall not be used in advertising or otherwise to promote the sale, use or
27706f2543Smrg * other dealings in this Software without prior written authorization from
28706f2543Smrg * Silicon Graphics, Inc.
29706f2543Smrg */
30706f2543Smrg
31706f2543Smrg#ifdef HAVE_DIX_CONFIG_H
32706f2543Smrg#include <dix-config.h>
33706f2543Smrg#endif
34706f2543Smrg
35706f2543Smrg#include "glxserver.h"
36706f2543Smrg#include "unpack.h"
37706f2543Smrg#include "indirect_dispatch.h"
38706f2543Smrg#include "glapitable.h"
39706f2543Smrg#include "glapi.h"
40706f2543Smrg#include "glthread.h"
41706f2543Smrg#include "dispatch.h"
42706f2543Smrg
43706f2543Smrgvoid __glXDisp_SeparableFilter2D(GLbyte *pc)
44706f2543Smrg{
45706f2543Smrg   __GLXdispatchConvolutionFilterHeader *hdr =
46706f2543Smrg				(__GLXdispatchConvolutionFilterHeader *) pc;
47706f2543Smrg    GLint hdrlen, image1len;
48706f2543Smrg
49706f2543Smrg    hdrlen = __GLX_PAD(__GLX_CONV_FILT_CMD_DISPATCH_HDR_SIZE);
50706f2543Smrg
51706f2543Smrg    CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );
52706f2543Smrg    CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );
53706f2543Smrg    CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, hdr->rowLength) );
54706f2543Smrg    CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, hdr->skipRows) );
55706f2543Smrg    CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, hdr->skipPixels) );
56706f2543Smrg    CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, hdr->alignment) );
57706f2543Smrg
58706f2543Smrg    /* XXX check this usage - internal code called
59706f2543Smrg    ** a version without the packing parameters
60706f2543Smrg    */
61706f2543Smrg    image1len = __glXImageSize(hdr->format, hdr->type, 0, hdr->width, 1, 1,
62706f2543Smrg			       0, hdr->rowLength, 0, hdr->skipRows,
63706f2543Smrg			       hdr->alignment);
64706f2543Smrg    image1len = __GLX_PAD(image1len);
65706f2543Smrg
66706f2543Smrg    CALL_SeparableFilter2D( GET_DISPATCH(), (hdr->target, hdr->internalformat,
67706f2543Smrg		 hdr->width, hdr->height, hdr->format, hdr->type,
68706f2543Smrg		 ((GLubyte *)hdr+hdrlen), ((GLubyte *)hdr+hdrlen+image1len)) );
69706f2543Smrg}
70