16b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/************************************************************************** 26b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * 36b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 46b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * All Rights Reserved. 56b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * 66b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a 76b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * copy of this software and associated documentation files (the 86b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * "Software"), to deal in the Software without restriction, including 96b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * without limitation the rights to use, copy, modify, merge, publish, 106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * distribute, sub license, and/or sell copies of the Software, and to 116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * permit persons to whom the Software is furnished to do so, subject to 126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * the following conditions: 136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * 146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * The above copyright notice and this permission notice (including the 156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * next paragraph) shall be included in all copies or substantial portions 166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * of the Software. 176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * 186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * 266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell **************************************************************************/ 276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 29ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/glheader.h" 30ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/context.h" 31ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/macros.h" 32ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/enums.h" 334433b0302d0aa9dc61002e8bb4fd1b752b0be338Brian Paul#include "main/fbobject.h" 34ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/dd.h" 35decc6e2a32ef49e673c081f30e19b8970155d887Brian Paul#include "main/state.h" 366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 37a194bc3a8527ed41eead88632cc79ecabe4c81acBrian#include "drivers/common/driverfuncs.h" 38a194bc3a8527ed41eead88632cc79ecabe4c81acBrian 396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#include "intel_screen.h" 406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#include "intel_batchbuffer.h" 4187f12bb2d95236c7b025d1a8be56b5ab1683d702Eric Anholt#include "intel_mipmap_tree.h" 426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#include "intel_fbo.h" 430e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt#include "intel_buffers.h" 446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#include "i830_context.h" 466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#include "i830_reg.h" 476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define FILE_DEBUG_FLAG DEBUG_STATE 496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 51f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830StencilFuncSeparate(struct gl_context * ctx, GLenum face, GLenum func, GLint ref, 526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint mask) 536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int test = intel_translate_compare_func(func); 566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell mask = mask & 0xff; 586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s : func: %s, ref : 0x%x, mask: 0x%x\n", __FUNCTION__, 606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell _mesa_lookup_enum_by_nr(func), ref, mask); 616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 626b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_TEST_MASK; 656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE4] |= (ENABLE_STENCIL_TEST_MASK | 666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell STENCIL_TEST_MASK(mask)); 676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STENCILTST] &= ~(STENCIL_REF_VALUE_MASK | 686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_STENCIL_TEST_FUNC_MASK); 696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STENCILTST] |= (ENABLE_STENCIL_REF_VALUE | 706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_STENCIL_TEST_FUNC | 716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell STENCIL_REF_VALUE(ref) | 726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell STENCIL_TEST_FUNC(test)); 736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 76f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830StencilMaskSeparate(struct gl_context * ctx, GLenum face, GLuint mask) 776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s : mask 0x%x\n", __FUNCTION__, mask); 816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell mask = mask & 0xff; 836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_WRITE_MASK; 866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE4] |= (ENABLE_STENCIL_WRITE_MASK | 876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell STENCIL_WRITE_MASK(mask)); 886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 91f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830StencilOpSeparate(struct gl_context * ctx, GLenum face, GLenum fail, GLenum zfail, 926b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLenum zpass) 936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int fop, dfop, dpop; 966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s: fail : %s, zfail: %s, zpass : %s\n", __FUNCTION__, 986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell _mesa_lookup_enum_by_nr(fail), 996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell _mesa_lookup_enum_by_nr(zfail), 1006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell _mesa_lookup_enum_by_nr(zpass)); 1016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fop = 0; 1036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dfop = 0; 1046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dpop = 0; 1056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell switch (fail) { 1076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_KEEP: 1086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fop = STENCILOP_KEEP; 1096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_ZERO: 1116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fop = STENCILOP_ZERO; 1126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_REPLACE: 1146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fop = STENCILOP_REPLACE; 1156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_INCR: 1176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fop = STENCILOP_INCRSAT; 1186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_DECR: 1206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fop = STENCILOP_DECRSAT; 1216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_INCR_WRAP: 1236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fop = STENCILOP_INCR; 1246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_DECR_WRAP: 1266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fop = STENCILOP_DECR; 1276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_INVERT: 1296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fop = STENCILOP_INVERT; 1306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell default: 1326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 1346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell switch (zfail) { 1356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_KEEP: 1366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dfop = STENCILOP_KEEP; 1376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_ZERO: 1396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dfop = STENCILOP_ZERO; 1406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_REPLACE: 1426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dfop = STENCILOP_REPLACE; 1436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_INCR: 1456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dfop = STENCILOP_INCRSAT; 1466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_DECR: 1486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dfop = STENCILOP_DECRSAT; 1496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_INCR_WRAP: 1516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dfop = STENCILOP_INCR; 1526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_DECR_WRAP: 1546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dfop = STENCILOP_DECR; 1556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_INVERT: 1576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dfop = STENCILOP_INVERT; 1586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell default: 1606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 1626b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell switch (zpass) { 1636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_KEEP: 1646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dpop = STENCILOP_KEEP; 1656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_ZERO: 1676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dpop = STENCILOP_ZERO; 1686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_REPLACE: 1706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dpop = STENCILOP_REPLACE; 1716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_INCR: 1736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dpop = STENCILOP_INCRSAT; 1746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_DECR: 1766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dpop = STENCILOP_DECRSAT; 1776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_INCR_WRAP: 1796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dpop = STENCILOP_INCR; 1806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_DECR_WRAP: 1826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dpop = STENCILOP_DECR; 1836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_INVERT: 1856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell dpop = STENCILOP_INVERT; 1866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell default: 1886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 1896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 1906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1916b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1926b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 1936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STENCILTST] &= ~(STENCIL_OPS_MASK); 1946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STENCILTST] |= (ENABLE_STENCIL_PARMS | 1956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell STENCIL_FAIL_OP(fop) | 1966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell STENCIL_PASS_DEPTH_FAIL_OP 1976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (dfop) | 1986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell STENCIL_PASS_DEPTH_PASS_OP 1996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (dpop)); 2006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 2016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 203f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830AlphaFunc(struct gl_context * ctx, GLenum func, GLfloat ref) 2046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 2056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 2066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int test = intel_translate_compare_func(func); 2076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLubyte refByte; 2086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint refInt; 2096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell UNCLAMPED_FLOAT_TO_UBYTE(refByte, ref); 2116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell refInt = (GLuint) refByte; 2126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 2146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE2] &= ~ALPHA_TEST_REF_MASK; 2156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE2] |= (ENABLE_ALPHA_TEST_FUNC | 2166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_ALPHA_REF_VALUE | 2176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ALPHA_TEST_FUNC(test) | 2186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ALPHA_REF_VALUE(refInt)); 2196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 2206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/** 2226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * Makes sure that the proper enables are set for LogicOp, Independant Alpha 2236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * Blend, and Blending. It needs to be called from numerous places where we 2246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * could change the LogicOp or Independant Alpha Blend without subsequent 2256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * calls to glEnable. 2266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * 2276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * \todo 2286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * This function is substantially different from the old i830-specific driver. 2296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * I'm not sure which is correct. 2306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 2316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 232f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830EvalLogicOpBlendState(struct gl_context * ctx) 2336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 2346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 2356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 2376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2382e1cc883b380c3e038b7f2890bf80ed1736a9f18Ian Romanick if (ctx->Color.ColorLogicOpEnabled) { 2396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND | 2406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_LOGIC_OP_MASK); 2416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] |= (DISABLE_COLOR_BLEND | 2426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_LOGIC_OP); 2436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 2446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else if (ctx->Color.BlendEnabled) { 2456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND | 2466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_LOGIC_OP_MASK); 2476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] |= (ENABLE_COLOR_BLEND | 2486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_LOGIC_OP); 2496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 2506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else { 2516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND | 2526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_LOGIC_OP_MASK); 2536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] |= (DISABLE_COLOR_BLEND | 2546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_LOGIC_OP); 2556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 2566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 2576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 259f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830BlendColor(struct gl_context * ctx, const GLfloat color[4]) 2606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 2616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 2626b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLubyte r, g, b, a; 2636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s\n", __FUNCTION__); 2656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell UNCLAMPED_FLOAT_TO_UBYTE(r, color[RCOMP]); 2676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell UNCLAMPED_FLOAT_TO_UBYTE(g, color[GCOMP]); 2686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell UNCLAMPED_FLOAT_TO_UBYTE(b, color[BCOMP]); 2696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell UNCLAMPED_FLOAT_TO_UBYTE(a, color[ACOMP]); 2706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 2726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_BLENDCOLOR1] = 2736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (a << 24) | (r << 16) | (g << 8) | b; 2746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 2756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/** 2776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * Sets both the blend equation (called "function" in i830 docs) and the 2786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * blend function (called "factor" in i830 docs). This is done in a single 2796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * function because some blend equations (i.e., \c GL_MIN and \c GL_MAX) 2806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * change the interpretation of the blend function. 2816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 2826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 283f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830_set_blend_state(struct gl_context * ctx) 2846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 2856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 2866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int funcA; 2876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int funcRGB; 2886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int eqnA; 2896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int eqnRGB; 2906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int iab; 2916b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int s1; 2926b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 2946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell funcRGB = 29574713e2d293f9e796a4053a5a99ee5cb7df5c740Brian Paul SRC_BLND_FACT(intel_translate_blend_factor(ctx->Color.Blend[0].SrcRGB)) 29674713e2d293f9e796a4053a5a99ee5cb7df5c740Brian Paul | DST_BLND_FACT(intel_translate_blend_factor(ctx->Color.Blend[0].DstRGB)); 2976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 29874713e2d293f9e796a4053a5a99ee5cb7df5c740Brian Paul switch (ctx->Color.Blend[0].EquationRGB) { 2996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_FUNC_ADD: 3006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell eqnRGB = BLENDFUNC_ADD; 3016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 3026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_MIN: 3036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell eqnRGB = BLENDFUNC_MIN; 3046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE); 3056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 3066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_MAX: 3076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell eqnRGB = BLENDFUNC_MAX; 3086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell funcRGB = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE); 3096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 3106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_FUNC_SUBTRACT: 3116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell eqnRGB = BLENDFUNC_SUB; 3126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 3136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_FUNC_REVERSE_SUBTRACT: 3146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell eqnRGB = BLENDFUNC_RVRSE_SUB; 3156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 3166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell default: 3176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fprintf(stderr, "[%s:%u] Invalid RGB blend equation (0x%04x).\n", 31874713e2d293f9e796a4053a5a99ee5cb7df5c740Brian Paul __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationRGB); 3196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return; 3206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 3216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 32374713e2d293f9e796a4053a5a99ee5cb7df5c740Brian Paul funcA = SRC_ABLEND_FACT(intel_translate_blend_factor(ctx->Color.Blend[0].SrcA)) 32474713e2d293f9e796a4053a5a99ee5cb7df5c740Brian Paul | DST_ABLEND_FACT(intel_translate_blend_factor(ctx->Color.Blend[0].DstA)); 3256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 32674713e2d293f9e796a4053a5a99ee5cb7df5c740Brian Paul switch (ctx->Color.Blend[0].EquationA) { 3276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_FUNC_ADD: 3286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell eqnA = BLENDFUNC_ADD; 3296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 3306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_MIN: 3316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell eqnA = BLENDFUNC_MIN; 3326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE); 3336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 3346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_MAX: 3356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell eqnA = BLENDFUNC_MAX; 3366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell funcA = SRC_BLND_FACT(BLENDFACT_ONE) | DST_BLND_FACT(BLENDFACT_ONE); 3376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 3386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_FUNC_SUBTRACT: 3396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell eqnA = BLENDFUNC_SUB; 3406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 3416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_FUNC_REVERSE_SUBTRACT: 3426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell eqnA = BLENDFUNC_RVRSE_SUB; 3436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 3446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell default: 3456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fprintf(stderr, "[%s:%u] Invalid alpha blend equation (0x%04x).\n", 34674713e2d293f9e796a4053a5a99ee5cb7df5c740Brian Paul __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationA); 3476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return; 3486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 3496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell iab = eqnA | funcA 3516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell | _3DSTATE_INDPT_ALPHA_BLEND_CMD 3526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell | ENABLE_SRC_ABLEND_FACTOR | ENABLE_DST_ABLEND_FACTOR 3536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell | ENABLE_ALPHA_BLENDFUNC; 3546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell s1 = eqnRGB | funcRGB 3556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell | _3DSTATE_MODES_1_CMD 3566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell | ENABLE_SRC_BLND_FACTOR | ENABLE_DST_BLND_FACTOR 3576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell | ENABLE_COLR_BLND_FUNC; 3586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if ((eqnA | funcA) != (eqnRGB | funcRGB)) 3606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell iab |= ENABLE_INDPT_ALPHA_BLEND; 3616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else 3626b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell iab |= DISABLE_INDPT_ALPHA_BLEND; 3636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (iab != i830->state.Ctx[I830_CTXREG_IALPHAB] || 3656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell s1 != i830->state.Ctx[I830_CTXREG_STATE1]) { 3666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 3676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_IALPHAB] = iab; 3686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE1] = s1; 3696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 3706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* This will catch a logicop blend equation. It will also ensure 3726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * independant alpha blend is really in the correct state (either enabled 3736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * or disabled) if blending is already enabled. 3746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 3756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830EvalLogicOpBlendState(ctx); 3776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (0) { 3796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell fprintf(stderr, 3806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell "[%s:%u] STATE1: 0x%08x IALPHAB: 0x%08x blend is %sabled\n", 3816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell __FUNCTION__, __LINE__, i830->state.Ctx[I830_CTXREG_STATE1], 3826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_IALPHAB], 3836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (ctx->Color.BlendEnabled) ? "en" : "dis"); 3846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 3856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 3866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 389f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830BlendEquationSeparate(struct gl_context * ctx, GLenum modeRGB, GLenum modeA) 3906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 3916b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s -> %s, %s\n", __FUNCTION__, 3926b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell _mesa_lookup_enum_by_nr(modeRGB), 3936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell _mesa_lookup_enum_by_nr(modeA)); 3946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 3956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (void) modeRGB; 3966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (void) modeA; 3976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830_set_blend_state(ctx); 3986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 3996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 402f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830BlendFuncSeparate(struct gl_context * ctx, GLenum sfactorRGB, 4036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA) 4046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 4056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s -> RGB(%s, %s) A(%s, %s)\n", __FUNCTION__, 4066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell _mesa_lookup_enum_by_nr(sfactorRGB), 4076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell _mesa_lookup_enum_by_nr(dfactorRGB), 4086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell _mesa_lookup_enum_by_nr(sfactorA), 4096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell _mesa_lookup_enum_by_nr(dfactorA)); 4106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (void) sfactorRGB; 4126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (void) dfactorRGB; 4136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (void) sfactorA; 4146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (void) dfactorA; 4156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830_set_blend_state(ctx); 4166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 4176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 421f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830DepthFunc(struct gl_context * ctx, GLenum func) 4226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 4236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 4246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int test = intel_translate_compare_func(func); 4256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s\n", __FUNCTION__); 4276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 4296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE3] &= ~DEPTH_TEST_FUNC_MASK; 4306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE3] |= (ENABLE_DEPTH_TEST_FUNC | 4316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DEPTH_TEST_FUNC(test)); 4326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 4336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 435f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830DepthMask(struct gl_context * ctx, GLboolean flag) 4366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 4376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 4386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s flag (%d)\n", __FUNCTION__, flag); 4404d4f2daefabdc4ca1dd778a9265475c65ef52936Eric Anholt 4414d4f2daefabdc4ca1dd778a9265475c65ef52936Eric Anholt if (!ctx->DrawBuffer || !ctx->DrawBuffer->Visual.depthBits) 4424d4f2daefabdc4ca1dd778a9265475c65ef52936Eric Anholt flag = false; 4434d4f2daefabdc4ca1dd778a9265475c65ef52936Eric Anholt 4446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 4456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_DIS_DEPTH_WRITE_MASK; 4476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (flag && ctx->Depth.Test) 4496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_2] |= ENABLE_DEPTH_WRITE; 4506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else 4516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_DEPTH_WRITE; 4526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 4536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4540e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt/** Called from ctx->Driver.Viewport() */ 4550e83e8f51af07a3066519f169f07d9afbf23252eEric Anholtstatic void 456f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830Viewport(struct gl_context * ctx, 4570e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt GLint x, GLint y, GLsizei width, GLsizei height) 4580e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt{ 4590e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt intelCalcViewport(ctx); 4600e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt} 4610e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt 4620e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt 4630e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt/** Called from ctx->Driver.DepthRange() */ 4640e83e8f51af07a3066519f169f07d9afbf23252eEric Anholtstatic void 465f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830DepthRange(struct gl_context * ctx, GLclampd nearval, GLclampd farval) 4660e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt{ 4670e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt intelCalcViewport(ctx); 4680e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt} 4690e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt 4706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/* ============================================================= 4716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * Polygon stipple 4726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * 4736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * The i830 supports a 4x4 stipple natively, GL wants 32x32. 4746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * Fortunately stipple is usually a repeating pattern. 4756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 4766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 477f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830PolygonStipple(struct gl_context * ctx, const GLubyte * mask) 4786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 4796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 480489ac8e73a2432d29597a62cd83f09b9d1848533Kurt Roeckx const GLubyte *m; 4816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLubyte p[4]; 4826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int i, j, k; 4836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int active = (ctx->Polygon.StippleFlag && 4846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->intel.reduced_primitive == GL_TRIANGLES); 4856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint newMask; 4866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 4876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (active) { 4886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_STIPPLE); 4896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Stipple[I830_STPREG_ST1] &= ~ST1_ENABLE; 4906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 4916b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 492489ac8e73a2432d29597a62cd83f09b9d1848533Kurt Roeckx /* Use the already unpacked stipple data from the context rather than the 493489ac8e73a2432d29597a62cd83f09b9d1848533Kurt Roeckx * uninterpreted mask passed in. 494489ac8e73a2432d29597a62cd83f09b9d1848533Kurt Roeckx */ 495489ac8e73a2432d29597a62cd83f09b9d1848533Kurt Roeckx mask = (const GLubyte *)ctx->PolygonStipple; 496489ac8e73a2432d29597a62cd83f09b9d1848533Kurt Roeckx m = mask; 497489ac8e73a2432d29597a62cd83f09b9d1848533Kurt Roeckx 4986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p[0] = mask[12] & 0xf; 4996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p[0] |= p[0] << 4; 5006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p[1] = mask[8] & 0xf; 5016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p[1] |= p[1] << 4; 5026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p[2] = mask[4] & 0xf; 5036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p[2] |= p[2] << 4; 5046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p[3] = mask[0] & 0xf; 5056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell p[3] |= p[3] << 4; 5066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell for (k = 0; k < 8; k++) 5086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell for (j = 3; j >= 0; j--) 5096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell for (i = 0; i < 4; i++, m++) 5106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (*m != p[j]) { 5116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->intel.hw_stipple = 0; 5126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return; 5136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 5146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell newMask = (((p[0] & 0xf) << 0) | 5166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ((p[1] & 0xf) << 4) | 5176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ((p[2] & 0xf) << 8) | ((p[3] & 0xf) << 12)); 5186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (newMask == 0xffff || newMask == 0x0) { 5216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* this is needed to make conform pass */ 5226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->intel.hw_stipple = 0; 5236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return; 5246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 5256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Stipple[I830_STPREG_ST1] &= ~0xffff; 5276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Stipple[I830_STPREG_ST1] |= newMask; 5286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->intel.hw_stipple = 1; 5296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (active) 5316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Stipple[I830_STPREG_ST1] |= ST1_ENABLE; 5326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 5336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/* ============================================================= 5366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * Hardware clipping 5376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 5386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 539f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830Scissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h) 5406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 5416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 5426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int x1, y1, x2, y2; 5436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (!ctx->DrawBuffer) 5456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell return; 5466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h); 5486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5494433b0302d0aa9dc61002e8bb4fd1b752b0be338Brian Paul if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { 5506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell x1 = x; 5516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell y1 = ctx->DrawBuffer->Height - (y + h); 5526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell x2 = x + w - 1; 5536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell y2 = y1 + h - 1; 5546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s %d..%d,%d..%d (inverted)\n", __FUNCTION__, x1, x2, y1, y2); 5556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 5566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else { 5576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* FBO - not inverted 5586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 5596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell x1 = x; 5606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell y1 = y; 5616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell x2 = x + w - 1; 5626b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell y2 = y + h - 1; 5636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s %d..%d,%d..%d (not inverted)\n", __FUNCTION__, x1, x2, y1, y2); 5646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 5656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell x1 = CLAMP(x1, 0, ctx->DrawBuffer->Width - 1); 5676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell y1 = CLAMP(y1, 0, ctx->DrawBuffer->Height - 1); 5686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell x2 = CLAMP(x2, 0, ctx->DrawBuffer->Width - 1); 5696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell y2 = CLAMP(y2, 0, ctx->DrawBuffer->Height - 1); 5706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s %d..%d,%d..%d (clamped)\n", __FUNCTION__, x1, x2, y1, y2); 5726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_BUFFERS); 5746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Buffer[I830_DESTREG_SR1] = (y1 << 16) | (x1 & 0xffff); 5756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Buffer[I830_DESTREG_SR2] = (y2 << 16) | (x2 & 0xffff); 5766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 5776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 579f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830LogicOp(struct gl_context * ctx, GLenum opcode) 5806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 5816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 5826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int tmp = intel_translate_logic_op(opcode); 5836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s\n", __FUNCTION__); 5856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 5876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE4] &= ~LOGICOP_MASK; 5886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE4] |= LOGIC_OP_FUNC(tmp); 5896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 5906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5916b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5926b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 594f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830CullFaceFrontFace(struct gl_context * ctx, GLenum unused) 5956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 5966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 5976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint mode; 5986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 5996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s\n", __FUNCTION__); 6006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (!ctx->Polygon.CullFlag) { 6026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell mode = CULLMODE_NONE; 6036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 6046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) { 6056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell mode = CULLMODE_CW; 6066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (ctx->Polygon.CullFaceMode == GL_FRONT) 6086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell mode ^= (CULLMODE_CW ^ CULLMODE_CCW); 6096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (ctx->Polygon.FrontFace != GL_CCW) 6106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell mode ^= (CULLMODE_CW ^ CULLMODE_CCW); 6116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 6126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else { 6136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell mode = CULLMODE_BOTH; 6146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 6156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 6176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE3] &= ~CULLMODE_MASK; 6186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE3] |= ENABLE_CULL_MODE | mode; 6196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 6206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 622f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830LineWidth(struct gl_context * ctx, GLfloat widthf) 6236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 6246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 6256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int width; 6266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell int state5; 6276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s\n", __FUNCTION__); 6296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell width = (int) (widthf * 2); 631d203dbc73d3b036937e0404b580fb04d23e10652Eric Anholt width = CLAMP(width, 1, 15); 6326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell state5 = i830->state.Ctx[I830_CTXREG_STATE5] & ~FIXED_LINE_WIDTH_MASK; 6346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell state5 |= (ENABLE_FIXED_LINE_WIDTH | FIXED_LINE_WIDTH(width)); 6356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (state5 != i830->state.Ctx[I830_CTXREG_STATE5]) { 6376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 6386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE5] = state5; 6396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 6406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 6416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 643f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830PointSize(struct gl_context * ctx, GLfloat size) 6446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 6456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 6466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLint point_size = (int) size; 6476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s\n", __FUNCTION__); 6496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 650d203dbc73d3b036937e0404b580fb04d23e10652Eric Anholt point_size = CLAMP(point_size, 1, 256); 6516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 6526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE5] &= ~FIXED_POINT_WIDTH_MASK; 6536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE5] |= (ENABLE_FIXED_POINT_WIDTH | 6546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell FIXED_POINT_WIDTH(point_size)); 6556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 6566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/* ============================================================= 6596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * Color masks 6606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 6616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6626b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 663f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830ColorMask(struct gl_context * ctx, 6646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLboolean r, GLboolean g, GLboolean b, GLboolean a) 6656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 6666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 6676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint tmp = 0; 6686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s r(%d) g(%d) b(%d) a(%d)\n", __FUNCTION__, r, g, b, a); 6706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell tmp = ((i830->state.Ctx[I830_CTXREG_ENABLES_2] & ~WRITEMASK_MASK) | 6726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_COLOR_MASK | 6736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_COLOR_WRITE | 6746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ((!r) << WRITEMASK_RED_SHIFT) | 6756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ((!g) << WRITEMASK_GREEN_SHIFT) | 6766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ((!b) << WRITEMASK_BLUE_SHIFT) | ((!a) << WRITEMASK_ALPHA_SHIFT)); 6776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (tmp != i830->state.Ctx[I830_CTXREG_ENABLES_2]) { 6796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 6806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_2] = tmp; 6816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 6826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 6836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 685f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergupdate_specular(struct gl_context * ctx) 6866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 6876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 6886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 6906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_SPEC_ADD_MASK; 6916b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 692decc6e2a32ef49e673c081f30e19b8970155d887Brian Paul if (_mesa_need_secondary_color(ctx)) 6936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_SPEC_ADD; 6946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else 6956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_SPEC_ADD; 6966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 6976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 6986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 699f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830LightModelfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) 7006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 7016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s\n", __FUNCTION__); 7026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) { 7046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell update_specular(ctx); 7056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 7066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 7076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/* In Mesa 3.5 we can reliably do native flatshading. 7096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 7106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 711f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830ShadeModel(struct gl_context * ctx, GLenum mode) 7126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 7136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 7146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 7156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#define SHADE_MODE_MASK ((1<<10)|(1<<8)|(1<<6)|(1<<4)) 7186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE3] &= ~SHADE_MODE_MASK; 7206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (mode == GL_FLAT) { 7226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE3] |= 7236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (ALPHA_SHADE_MODE(SHADE_MODE_FLAT) | FOG_SHADE_MODE(SHADE_MODE_FLAT) 7246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell | SPEC_SHADE_MODE(SHADE_MODE_FLAT) | 7256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell COLOR_SHADE_MODE(SHADE_MODE_FLAT)); 7266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 7276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else { 7286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE3] |= 7296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (ALPHA_SHADE_MODE(SHADE_MODE_LINEAR) | 7306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell FOG_SHADE_MODE(SHADE_MODE_LINEAR) | 7316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell SPEC_SHADE_MODE(SHADE_MODE_LINEAR) | 7326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell COLOR_SHADE_MODE(SHADE_MODE_LINEAR)); 7336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 7346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 7356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/* ============================================================= 7376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * Fog 7386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 7396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 740f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830Fogfv(struct gl_context * ctx, GLenum pname, const GLfloat * param) 7416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 7426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 7436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DBG("%s\n", __FUNCTION__); 7456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (pname == GL_FOG_COLOR) { 7476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLuint color = (((GLubyte) (ctx->Fog.Color[0] * 255.0F) << 16) | 7486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ((GLubyte) (ctx->Fog.Color[1] * 255.0F) << 8) | 7496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ((GLubyte) (ctx->Fog.Color[2] * 255.0F) << 0)); 7506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 7526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_FOGCOLOR] = 7536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (_3DSTATE_FOG_COLOR_CMD | color); 7546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 7556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 7566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell/* ============================================================= 7586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 7596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 761f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830Enable(struct gl_context * ctx, GLenum cap, GLboolean state) 7626b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 7636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct i830_context *i830 = i830_context(ctx); 7646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell switch (cap) { 7666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_LIGHTING: 7676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_COLOR_SUM: 7686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell update_specular(ctx); 7696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 7706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_ALPHA_TEST: 7726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 7736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_ALPHA_TEST_MASK; 7746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (state) 7756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_ALPHA_TEST; 7766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else 7776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_ALPHA_TEST; 7786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 7806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_BLEND: 7826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830EvalLogicOpBlendState(ctx); 7836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 7846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_COLOR_LOGIC_OP: 7866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830EvalLogicOpBlendState(ctx); 7876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* Logicop doesn't seem to work at 16bpp: 7896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 79046eb02b60920a920b782bacb15f01b44e18f888dKristian Høgsberg if (i830->intel.ctx.Visual.rgbBits == 16) 7916b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell FALLBACK(&i830->intel, I830_FALLBACK_LOGICOP, state); 7926b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 7936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_DITHER: 7956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 7966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_DITHER; 7976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 7986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (state) 7996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_2] |= ENABLE_DITHER; 8006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else 8016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_2] |= DISABLE_DITHER; 8026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 8036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 8046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_DEPTH_TEST: 8056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 8066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_DEPTH_TEST_MASK; 8076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 8084d4f2daefabdc4ca1dd778a9265475c65ef52936Eric Anholt if (!ctx->DrawBuffer || !ctx->DrawBuffer->Visual.depthBits) 8094d4f2daefabdc4ca1dd778a9265475c65ef52936Eric Anholt state = false; 8104d4f2daefabdc4ca1dd778a9265475c65ef52936Eric Anholt 8116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (state) 8126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_DEPTH_TEST; 8136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else 8146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_DEPTH_TEST; 8156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 8166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* Also turn off depth writes when GL_DEPTH_TEST is disabled: 8176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 8186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830DepthMask(ctx, ctx->Depth.Mask); 8196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 8206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 8216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_SCISSOR_TEST: 8226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_BUFFERS); 8236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 8246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (state) 8256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Buffer[I830_DESTREG_SENABLE] = 8266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (_3DSTATE_SCISSOR_ENABLE_CMD | ENABLE_SCISSOR_RECT); 8276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else 8286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Buffer[I830_DESTREG_SENABLE] = 8296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (_3DSTATE_SCISSOR_ENABLE_CMD | DISABLE_SCISSOR_RECT); 8306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 8316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 8326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 8336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_LINE_SMOOTH: 8346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 8356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 8366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_AA] &= ~AA_LINE_ENABLE; 8376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (state) 8386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_AA] |= AA_LINE_ENABLE; 8396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else 8406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_AA] |= AA_LINE_DISABLE; 8416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 8426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 8436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_FOG: 8446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 8456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_FOG_MASK; 8466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (state) 8476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_FOG; 8486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else 8496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_FOG; 8506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 8516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 8526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_CULL_FACE: 8536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830CullFaceFrontFace(ctx, 0); 8546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 8556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 8566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_TEXTURE_2D: 8576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 8586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 8596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_STENCIL_TEST: 8606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell { 8612e5a1a254ed81b1d3efa6064f48183eefac784d0Kenneth Graunke bool hw_stencil = false; 8626b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (ctx->DrawBuffer) { 8636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell struct intel_renderbuffer *irbStencil 8646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); 865f92b2e5e90f456491fc15b3b9612381a83726606Kurt Roeckx hw_stencil = (irbStencil && irbStencil->mt); 8666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 8676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (hw_stencil) { 8686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_CTX); 8696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 8706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (state) { 8716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_STENCIL_TEST; 8726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_2] |= ENABLE_STENCIL_WRITE; 8736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 8746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else { 8756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_STENCIL_TEST; 8766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_2] &= 8776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ~ENABLE_STENCIL_WRITE; 8786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_STENCIL_TEST; 8796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_2] |= 8806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_STENCIL_WRITE; 8816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 8826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 8836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else { 8846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell FALLBACK(&i830->intel, I830_FALLBACK_STENCIL, state); 8856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 8866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 8876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 8886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 8896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell case GL_POLYGON_STIPPLE: 8906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* The stipple command worked on my 855GM box, but not my 845G. 8916b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * I'll do more testing later to find out exactly which hardware 8926b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell * supports it. Disabled for now. 8936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell */ 8946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (i830->intel.hw_stipple && 8956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->intel.reduced_primitive == GL_TRIANGLES) { 8966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_STATECHANGE(i830, I830_UPLOAD_STIPPLE); 8976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Stipple[I830_STPREG_ST1] &= ~ST1_ENABLE; 8986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (state) 8996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Stipple[I830_STPREG_ST1] |= ST1_ENABLE; 9006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 9016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell break; 9026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 9036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell default: 9046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ; 9056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 9066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 9076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 9086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 9096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellstatic void 9106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli830_init_packets(struct i830_context *i830) 9116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 9126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* Zero all state */ 9136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell memset(&i830->state, 0, sizeof(i830->state)); 9146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 9156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* Set default blend state */ 9166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.TexBlend[0][0] = (_3DSTATE_MAP_BLEND_OP_CMD(0) | 9176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXPIPE_COLOR | 9186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_TEXOUTPUT_WRT_SEL | 9196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXOP_OUTPUT_CURRENT | 9206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_TEX_CNTRL_STAGE | 9216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXOP_SCALE_1X | 9226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXOP_MODIFY_PARMS | 9236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXOP_LAST_STAGE | TEXBLENDOP_ARG1); 9246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.TexBlend[0][1] = (_3DSTATE_MAP_BLEND_OP_CMD(0) | 9256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXPIPE_ALPHA | 9266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_TEXOUTPUT_WRT_SEL | 9276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXOP_OUTPUT_CURRENT | 9286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXOP_SCALE_1X | 9296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXOP_MODIFY_PARMS | TEXBLENDOP_ARG1); 9306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.TexBlend[0][2] = (_3DSTATE_MAP_BLEND_ARG_CMD(0) | 9316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXPIPE_COLOR | 9326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXBLEND_ARG1 | 9336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXBLENDARG_MODIFY_PARMS | 9346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXBLENDARG_DIFFUSE); 9356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.TexBlend[0][3] = (_3DSTATE_MAP_BLEND_ARG_CMD(0) | 9366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXPIPE_ALPHA | 9376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXBLEND_ARG1 | 9386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXBLENDARG_MODIFY_PARMS | 9396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXBLENDARG_DIFFUSE); 9406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 9416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.TexBlendWordsUsed[0] = 4; 9426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 9436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 9446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_VF] = 0; 9456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_VF2] = 0; 9466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 9476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_AA] = (_3DSTATE_AA_CMD | 9486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell AA_LINE_ECAAR_WIDTH_ENABLE | 9496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell AA_LINE_ECAAR_WIDTH_1_0 | 9506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell AA_LINE_REGION_WIDTH_ENABLE | 9516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell AA_LINE_REGION_WIDTH_1_0 | 9526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell AA_LINE_DISABLE); 9536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 9546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_1] = (_3DSTATE_ENABLES_1_CMD | 9556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_LOGIC_OP | 9566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_STENCIL_TEST | 9576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_DEPTH_BIAS | 9586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_SPEC_ADD | 9596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_FOG | 9606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_ALPHA_TEST | 9616b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_COLOR_BLEND | 9626b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_DEPTH_TEST); 9636b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 9646b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#if 000 /* XXX all the stencil enable state is set in i830Enable(), right? */ 9656b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell if (i830->intel.hw_stencil) { 9666b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_2] = (_3DSTATE_ENABLES_2_CMD | 9676b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_STENCIL_WRITE | 9686b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_TEX_CACHE | 9696b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_DITHER | 9706b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_COLOR_MASK | 9716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* set no color comps disabled */ 9726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_COLOR_WRITE | 9736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_DEPTH_WRITE); 9746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 9756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell else 9766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell#endif 9776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell { 9786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_ENABLES_2] = (_3DSTATE_ENABLES_2_CMD | 9796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_STENCIL_WRITE | 9806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_TEX_CACHE | 9816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_DITHER | 9826b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_COLOR_MASK | 9836b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell /* set no color comps disabled */ 9846b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_COLOR_WRITE | 9856b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_DEPTH_WRITE); 9866b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell } 9876b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 9886b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE1] = (_3DSTATE_MODES_1_CMD | 9896b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_COLR_BLND_FUNC | 9906b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell BLENDFUNC_ADD | 9916b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_SRC_BLND_FACTOR | 9926b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell SRC_BLND_FACT(BLENDFACT_ONE) | 9936b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_DST_BLND_FACTOR | 9946b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DST_BLND_FACT(BLENDFACT_ZERO)); 9956b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 9966b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE2] = (_3DSTATE_MODES_2_CMD | 9976b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_GLOBAL_DEPTH_BIAS | 9986b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell GLOBAL_DEPTH_BIAS(0) | 9996b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_ALPHA_TEST_FUNC | 10006b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ALPHA_TEST_FUNC(COMPAREFUNC_ALWAYS) 10016b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell | ALPHA_REF_VALUE(0)); 10026b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 10036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE3] = (_3DSTATE_MODES_3_CMD | 10046b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_DEPTH_TEST_FUNC | 10056b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DEPTH_TEST_FUNC(COMPAREFUNC_LESS) | 10066b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_ALPHA_SHADE_MODE | 10076b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ALPHA_SHADE_MODE(SHADE_MODE_LINEAR) 10086b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell | ENABLE_FOG_SHADE_MODE | 10096b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell FOG_SHADE_MODE(SHADE_MODE_LINEAR) | 10106b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_SPEC_SHADE_MODE | 10116b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell SPEC_SHADE_MODE(SHADE_MODE_LINEAR) | 10126b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_COLOR_SHADE_MODE | 10136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell COLOR_SHADE_MODE(SHADE_MODE_LINEAR) 10146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell | ENABLE_CULL_MODE | CULLMODE_NONE); 10156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 10166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE4] = (_3DSTATE_MODES_4_CMD | 10176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_LOGIC_OP_FUNC | 10186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell LOGIC_OP_FUNC(LOGICOP_COPY) | 10196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_STENCIL_TEST_MASK | 10206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell STENCIL_TEST_MASK(0xff) | 10216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_STENCIL_WRITE_MASK | 10226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell STENCIL_WRITE_MASK(0xff)); 10236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 10246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STENCILTST] = (_3DSTATE_STENCIL_TEST_CMD | 10256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_STENCIL_PARMS | 10266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell STENCIL_FAIL_OP(STENCILOP_KEEP) 10276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell | 10286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell STENCIL_PASS_DEPTH_FAIL_OP 10296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (STENCILOP_KEEP) | 10306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell STENCIL_PASS_DEPTH_PASS_OP 10316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (STENCILOP_KEEP) | 10326b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_STENCIL_TEST_FUNC | 10336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell STENCIL_TEST_FUNC 10346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell (COMPAREFUNC_ALWAYS) | 10356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_STENCIL_REF_VALUE | 10366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell STENCIL_REF_VALUE(0)); 10376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 10386b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_STATE5] = (_3DSTATE_MODES_5_CMD | FLUSH_TEXTURE_CACHE | ENABLE_SPRITE_POINT_TEX | SPRITE_POINT_TEX_OFF | ENABLE_FIXED_LINE_WIDTH | FIXED_LINE_WIDTH(0x2) | /* 1.0 */ 10396b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_FIXED_POINT_WIDTH | 10406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell FIXED_POINT_WIDTH(1)); 10416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 10426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_IALPHAB] = (_3DSTATE_INDPT_ALPHA_BLEND_CMD | 10436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_INDPT_ALPHA_BLEND | 10446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ENABLE_ALPHA_BLENDFUNC | 10456b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell ABLENDFUNC_ADD); 10466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 10476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_FOGCOLOR] = (_3DSTATE_FOG_COLOR_CMD | 10486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell FOG_COLOR_RED(0) | 10496b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell FOG_COLOR_GREEN(0) | 10506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell FOG_COLOR_BLUE(0)); 10516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 10526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_BLENDCOLOR0] = _3DSTATE_CONST_BLEND_COLOR_CMD; 10536b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_BLENDCOLOR1] = 0; 10546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 10556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_MCSB0] = _3DSTATE_MAP_COORD_SETBIND_CMD; 10566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Ctx[I830_CTXREG_MCSB1] = (TEXBIND_SET3(TEXCOORDSRC_VTXSET_3) | 10576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXBIND_SET2(TEXCOORDSRC_VTXSET_2) | 10586b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXBIND_SET1(TEXCOORDSRC_VTXSET_1) | 10596b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell TEXBIND_SET0(TEXCOORDSRC_VTXSET_0)); 10606b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1061de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt i830->state.RasterRules[I830_RASTER_RULES] = (_3DSTATE_RASTER_RULES_CMD | 1062de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt ENABLE_POINT_RASTER_RULE | 1063de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt OGL_POINT_RASTER_RULE | 1064de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt ENABLE_LINE_STRIP_PROVOKE_VRTX | 1065de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt ENABLE_TRI_FAN_PROVOKE_VRTX | 1066de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt ENABLE_TRI_STRIP_PROVOKE_VRTX | 1067de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt LINE_STRIP_PROVOKE_VRTX(1) | 1068de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt TRI_FAN_PROVOKE_VRTX(2) | 1069de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt TRI_STRIP_PROVOKE_VRTX(2)); 1070de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt 10716b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 10726b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Stipple[I830_STPREG_ST0] = _3DSTATE_STIPPLE; 10736b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 10746b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Buffer[I830_DESTREG_DV0] = _3DSTATE_DST_BUF_VARS_CMD; 10756b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Buffer[I830_DESTREG_SENABLE] = (_3DSTATE_SCISSOR_ENABLE_CMD | 10766b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell DISABLE_SCISSOR_RECT); 10776b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Buffer[I830_DESTREG_SR0] = _3DSTATE_SCISSOR_RECT_0_CMD; 10786b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Buffer[I830_DESTREG_SR1] = 0; 10796b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.Buffer[I830_DESTREG_SR2] = 0; 10806b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 10816b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1082de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholtvoid 1083f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi830_update_provoking_vertex(struct gl_context * ctx) 1084de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt{ 1085de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt struct i830_context *i830 = i830_context(ctx); 1086de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt 1087de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt I830_STATECHANGE(i830, I830_UPLOAD_RASTER_RULES); 1088de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt i830->state.RasterRules[I830_RASTER_RULES] &= ~(LINE_STRIP_PROVOKE_VRTX_MASK | 1089de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt TRI_FAN_PROVOKE_VRTX_MASK | 1090de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt TRI_STRIP_PROVOKE_VRTX_MASK); 1091de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt 1092de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt /* _NEW_LIGHT */ 1093de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION) { 1094de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt i830->state.RasterRules[I830_RASTER_RULES] |= (LINE_STRIP_PROVOKE_VRTX(1) | 1095de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt TRI_FAN_PROVOKE_VRTX(2) | 1096de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt TRI_STRIP_PROVOKE_VRTX(2)); 1097de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt } else { 1098de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt i830->state.RasterRules[I830_RASTER_RULES] |= (LINE_STRIP_PROVOKE_VRTX(0) | 1099de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt TRI_FAN_PROVOKE_VRTX(1) | 1100de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt TRI_STRIP_PROVOKE_VRTX(0)); 1101de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt } 1102de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt} 11036b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1104b0d23b66cf2514949650bdfa9c918ab2fb1d8986Eric Anholt/* Fallback to swrast for select and feedback. 1105b0d23b66cf2514949650bdfa9c918ab2fb1d8986Eric Anholt */ 1106b0d23b66cf2514949650bdfa9c918ab2fb1d8986Eric Anholtstatic void 1107b0d23b66cf2514949650bdfa9c918ab2fb1d8986Eric Anholti830RenderMode(struct gl_context *ctx, GLenum mode) 1108b0d23b66cf2514949650bdfa9c918ab2fb1d8986Eric Anholt{ 1109b0d23b66cf2514949650bdfa9c918ab2fb1d8986Eric Anholt struct intel_context *intel = intel_context(ctx); 1110b0d23b66cf2514949650bdfa9c918ab2fb1d8986Eric Anholt FALLBACK(intel, INTEL_FALLBACK_RENDERMODE, (mode != GL_RENDER)); 1111b0d23b66cf2514949650bdfa9c918ab2fb1d8986Eric Anholt} 1112b0d23b66cf2514949650bdfa9c918ab2fb1d8986Eric Anholt 11136b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellvoid 11146b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli830InitStateFuncs(struct dd_function_table *functions) 11156b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 11166b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->AlphaFunc = i830AlphaFunc; 11176b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->BlendColor = i830BlendColor; 11186b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->BlendEquationSeparate = i830BlendEquationSeparate; 11196b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->BlendFuncSeparate = i830BlendFuncSeparate; 11206b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->ColorMask = i830ColorMask; 11216b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->CullFace = i830CullFaceFrontFace; 11226b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->DepthFunc = i830DepthFunc; 11236b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->DepthMask = i830DepthMask; 11246b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->Enable = i830Enable; 11256b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->Fogfv = i830Fogfv; 11266b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->FrontFace = i830CullFaceFrontFace; 11276b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->LightModelfv = i830LightModelfv; 11286b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->LineWidth = i830LineWidth; 11296b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->LogicOpcode = i830LogicOp; 11306b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->PointSize = i830PointSize; 11316b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->PolygonStipple = i830PolygonStipple; 1132b0d23b66cf2514949650bdfa9c918ab2fb1d8986Eric Anholt functions->RenderMode = i830RenderMode; 11336b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->Scissor = i830Scissor; 11346b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->ShadeModel = i830ShadeModel; 11356b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->StencilFuncSeparate = i830StencilFuncSeparate; 11366b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->StencilMaskSeparate = i830StencilMaskSeparate; 11376b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell functions->StencilOpSeparate = i830StencilOpSeparate; 11380e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt functions->DepthRange = i830DepthRange; 11390e83e8f51af07a3066519f169f07d9afbf23252eEric Anholt functions->Viewport = i830Viewport; 11406b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 11416b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 11426b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwellvoid 11436b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwelli830InitState(struct i830_context *i830) 11446b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell{ 1145f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg struct gl_context *ctx = &i830->intel.ctx; 11466b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 11476b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830_init_packets(i830); 11486b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 1149a194bc3a8527ed41eead88632cc79ecabe4c81acBrian _mesa_init_driver_state(ctx); 11506b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell 11516b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.emitted = 0; 11526b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell i830->state.active = (I830_UPLOAD_INVARIENT | 1153de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt I830_UPLOAD_RASTER_RULES | 11546b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_UPLOAD_TEXBLEND(0) | 11556b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_UPLOAD_STIPPLE | 11566b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell I830_UPLOAD_CTX | I830_UPLOAD_BUFFERS); 11576b9e31f3eb3dbe20cbc8493b963bbc6530e392c6Keith Whitwell} 1158