17e6fb56fSmrg/* 27e6fb56fSmrg * Copyright 2006 Thomas Hellstrom. All Rights Reserved. 37e6fb56fSmrg * 47e6fb56fSmrg * Permission is hereby granted, free of charge, to any person obtaining a 57e6fb56fSmrg * copy of this software and associated documentation files (the "Software"), 67e6fb56fSmrg * to deal in the Software without restriction, including without limitation 77e6fb56fSmrg * the rights to use, copy, modify, merge, publish, distribute, sub license, 87e6fb56fSmrg * and/or sell copies of the Software, and to permit persons to whom the 97e6fb56fSmrg * Software is furnished to do so, subject to the following conditions: 107e6fb56fSmrg * 117e6fb56fSmrg * The above copyright notice and this permission notice (including the 127e6fb56fSmrg * next paragraph) shall be included in all copies or substantial portions 137e6fb56fSmrg * of the Software. 147e6fb56fSmrg * 157e6fb56fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 167e6fb56fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 177e6fb56fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 187e6fb56fSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 197e6fb56fSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 207e6fb56fSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 217e6fb56fSmrg * DEALINGS IN THE SOFTWARE. 227e6fb56fSmrg */ 237e6fb56fSmrg 247e6fb56fSmrg#ifndef VIA_3D_H 257e6fb56fSmrg#define VIA_3D_H 267e6fb56fSmrg 27963d66acSmrg#include "xorg-server.h" 287e6fb56fSmrg#include "xf86.h" 297e6fb56fSmrg#include "via_dmabuffer.h" 307e6fb56fSmrg 317e6fb56fSmrg#define VIA_NUM_TEXUNITS 2 327e6fb56fSmrg 337e6fb56fSmrgtypedef enum 347e6fb56fSmrg{ 357e6fb56fSmrg via_single, 367e6fb56fSmrg via_clamp, 377e6fb56fSmrg via_repeat, 387e6fb56fSmrg via_mirror, 397e6fb56fSmrg via_warp 407e6fb56fSmrg} ViaTextureModes; 417e6fb56fSmrg 427e6fb56fSmrgtypedef enum 437e6fb56fSmrg{ 447e6fb56fSmrg via_src, 457e6fb56fSmrg via_src_onepix_mask, 467e6fb56fSmrg via_src_onepix_comp_mask, 477e6fb56fSmrg via_mask, 487e6fb56fSmrg via_comp_mask 497e6fb56fSmrg} ViaTexBlendingModes; 507e6fb56fSmrg 517e6fb56fSmrgtypedef struct _ViaTextureUnit 527e6fb56fSmrg{ 537e6fb56fSmrg CARD32 textureLevel0Offset; 547e6fb56fSmrg CARD32 textureLevel0Pitch; 557e6fb56fSmrg CARD32 textureLevel0Exp; 567e6fb56fSmrg CARD32 textureLevel0WExp; 577e6fb56fSmrg CARD32 textureLevel0HExp; 587e6fb56fSmrg CARD32 textureFormat; 597e6fb56fSmrg CARD32 textureModesT; 607e6fb56fSmrg CARD32 textureModesS; 617e6fb56fSmrg CARD32 texCsat; 627e6fb56fSmrg CARD32 texRCa; 637e6fb56fSmrg CARD32 texAsat; 647e6fb56fSmrg CARD32 texRAa; 657e6fb56fSmrg Bool agpTexture; 667e6fb56fSmrg Bool textureDirty; 677e6fb56fSmrg Bool texBColDirty; 687e6fb56fSmrg Bool npot; 697e6fb56fSmrg} ViaTextureUnit; 707e6fb56fSmrg 717e6fb56fSmrgtypedef struct _Via3DState 727e6fb56fSmrg{ 737e6fb56fSmrg Bool destDirty; 747e6fb56fSmrg Bool blendDirty; 757e6fb56fSmrg Bool enableDirty; 767e6fb56fSmrg Bool drawingDirty; 777e6fb56fSmrg CARD32 rop; 787e6fb56fSmrg CARD32 planeMask; 797e6fb56fSmrg CARD32 solidColor; 807e6fb56fSmrg CARD32 solidAlpha; 817e6fb56fSmrg CARD32 destOffset; 827e6fb56fSmrg CARD32 destPitch; 837e6fb56fSmrg CARD32 destFormat; 847e6fb56fSmrg int destDepth; 857e6fb56fSmrg int numTextures; 867e6fb56fSmrg Bool blend; 877e6fb56fSmrg CARD32 blendCol0; 887e6fb56fSmrg CARD32 blendCol1; 897e6fb56fSmrg CARD32 blendAl0; 907e6fb56fSmrg CARD32 blendAl1; 917e6fb56fSmrg Bool writeAlpha; 927e6fb56fSmrg Bool writeColor; 937e6fb56fSmrg Bool useDestAlpha; 947e6fb56fSmrg ViaTextureUnit tex[VIA_NUM_TEXUNITS]; 957e6fb56fSmrg void (*setDestination) (struct _Via3DState * v3d, CARD32 offset, 967e6fb56fSmrg CARD32 pitch, int format); 977e6fb56fSmrg void (*setDrawing) (struct _Via3DState * v3d, int rop, 987e6fb56fSmrg CARD32 planeMask, CARD32 solidColor, CARD32 solidAlpha); 997e6fb56fSmrg void (*setFlags) (struct _Via3DState * v3d, int numTextures, 1007e6fb56fSmrg Bool writeAlpha, Bool writeColor, Bool blend); 1017e6fb56fSmrg Bool(*setTexture) (struct _Via3DState * v3d, int tex, CARD32 offset, 1027e6fb56fSmrg CARD32 pitch, Bool nPot, CARD32 width, CARD32 height, int format, 1037e6fb56fSmrg ViaTextureModes sMode, ViaTextureModes tMode, 1047e6fb56fSmrg ViaTexBlendingModes blendingMode, Bool agpTexture); 1057e6fb56fSmrg void (*setTexBlendCol) (struct _Via3DState * v3d, int tex, Bool component, 1067e6fb56fSmrg CARD32 color); 1077e6fb56fSmrg void (*setCompositeOperator) (struct _Via3DState * v3d, CARD8 op); 1087e6fb56fSmrg Bool(*opSupported) (CARD8 op); 1097e6fb56fSmrg void (*emitQuad) (struct _Via3DState * v3d, ViaCommandBuffer * cb, 1107e6fb56fSmrg int dstX, int dstY, int src0X, int src0Y, int src1X, int src1Y, int w, 1117e6fb56fSmrg int h); 1127e6fb56fSmrg void (*emitState) (struct _Via3DState * v3d, ViaCommandBuffer * cb, 1137e6fb56fSmrg Bool forceUpload); 1147e6fb56fSmrg void (*emitClipRect) (struct _Via3DState * v3d, ViaCommandBuffer * cb, 1157e6fb56fSmrg int x, int y, int w, int h); 1167e6fb56fSmrg Bool(*dstSupported) (int format); 1177e6fb56fSmrg Bool(*texSupported) (int format); 1187e6fb56fSmrg} Via3DState; 1197e6fb56fSmrg 1207e6fb56fSmrgvoid viaInit3DState(Via3DState * v3d); 1217e6fb56fSmrg 1227e6fb56fSmrg#endif 123