via_3d.h revision 7e6fb56f
1/* 2 * Copyright 2006 Thomas Hellstrom. All Rights Reserved. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the 12 * next paragraph) shall be included in all copies or substantial portions 13 * of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 * DEALINGS IN THE SOFTWARE. 22 */ 23 24#ifndef VIA_3D_H 25#define VIA_3D_H 26 27#include "xf86.h" 28#include "via_dmabuffer.h" 29 30#define VIA_NUM_TEXUNITS 2 31 32typedef enum 33{ 34 via_single, 35 via_clamp, 36 via_repeat, 37 via_mirror, 38 via_warp 39} ViaTextureModes; 40 41typedef enum 42{ 43 via_src, 44 via_src_onepix_mask, 45 via_src_onepix_comp_mask, 46 via_mask, 47 via_comp_mask 48} ViaTexBlendingModes; 49 50typedef struct _ViaTextureUnit 51{ 52 CARD32 textureLevel0Offset; 53 CARD32 textureLevel0Pitch; 54 CARD32 textureLevel0Exp; 55 CARD32 textureLevel0WExp; 56 CARD32 textureLevel0HExp; 57 CARD32 textureFormat; 58 CARD32 textureModesT; 59 CARD32 textureModesS; 60 CARD32 texCsat; 61 CARD32 texRCa; 62 CARD32 texAsat; 63 CARD32 texRAa; 64 Bool agpTexture; 65 Bool textureDirty; 66 Bool texBColDirty; 67 Bool npot; 68} ViaTextureUnit; 69 70typedef struct _Via3DState 71{ 72 Bool destDirty; 73 Bool blendDirty; 74 Bool enableDirty; 75 Bool drawingDirty; 76 CARD32 rop; 77 CARD32 planeMask; 78 CARD32 solidColor; 79 CARD32 solidAlpha; 80 CARD32 destOffset; 81 CARD32 destPitch; 82 CARD32 destFormat; 83 int destDepth; 84 int numTextures; 85 Bool blend; 86 CARD32 blendCol0; 87 CARD32 blendCol1; 88 CARD32 blendAl0; 89 CARD32 blendAl1; 90 Bool writeAlpha; 91 Bool writeColor; 92 Bool useDestAlpha; 93 ViaTextureUnit tex[VIA_NUM_TEXUNITS]; 94 void (*setDestination) (struct _Via3DState * v3d, CARD32 offset, 95 CARD32 pitch, int format); 96 void (*setDrawing) (struct _Via3DState * v3d, int rop, 97 CARD32 planeMask, CARD32 solidColor, CARD32 solidAlpha); 98 void (*setFlags) (struct _Via3DState * v3d, int numTextures, 99 Bool writeAlpha, Bool writeColor, Bool blend); 100 Bool(*setTexture) (struct _Via3DState * v3d, int tex, CARD32 offset, 101 CARD32 pitch, Bool nPot, CARD32 width, CARD32 height, int format, 102 ViaTextureModes sMode, ViaTextureModes tMode, 103 ViaTexBlendingModes blendingMode, Bool agpTexture); 104 void (*setTexBlendCol) (struct _Via3DState * v3d, int tex, Bool component, 105 CARD32 color); 106 void (*setCompositeOperator) (struct _Via3DState * v3d, CARD8 op); 107 Bool(*opSupported) (CARD8 op); 108 void (*emitQuad) (struct _Via3DState * v3d, ViaCommandBuffer * cb, 109 int dstX, int dstY, int src0X, int src0Y, int src1X, int src1Y, int w, 110 int h); 111 void (*emitState) (struct _Via3DState * v3d, ViaCommandBuffer * cb, 112 Bool forceUpload); 113 void (*emitClipRect) (struct _Via3DState * v3d, ViaCommandBuffer * cb, 114 int x, int y, int w, int h); 115 Bool(*dstSupported) (int format); 116 Bool(*texSupported) (int format); 117} Via3DState; 118 119void viaInit3DState(Via3DState * v3d); 120 121#endif 122