st_atom_rasterizer.c revision 47e3896dfd89a26abbe4ca2469c2480f3982b204
18e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell/************************************************************************** 28e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 38e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. 48e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * All Rights Reserved. 58e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 68e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a 78e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * copy of this software and associated documentation files (the 88e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * "Software"), to deal in the Software without restriction, including 98e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * without limitation the rights to use, copy, modify, merge, publish, 108e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * distribute, sub license, and/or sell copies of the Software, and to 118e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * permit persons to whom the Software is furnished to do so, subject to 128e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * the following conditions: 138e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 148e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * The above copyright notice and this permission notice (including the 158e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * next paragraph) shall be included in all copies or substantial portions 168e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * of the Software. 178e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 188e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 198e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 208e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 218e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 228e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 238e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 248e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 258e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 268e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell **************************************************************************/ 278e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 288e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell /* 298e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * Authors: 308e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * Keith Whitwell <keith@tungstengraphics.com> 318e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell */ 328e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 3309ba1dd4ccb0ed907510cb9403b1fb1fb0ab3658Brian#include "main/macros.h" 348e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#include "st_context.h" 35339e7ec6805e6de8794514c0a935081b5d36d38fBrian#include "st_atom.h" 36943964a1e5bad86bdceb0a06d60fb3b302ebce6aKeith Whitwell#include "pipe/p_context.h" 37f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian#include "pipe/p_defines.h" 38339e7ec6805e6de8794514c0a935081b5d36d38fBrian#include "cso_cache/cso_context.h" 39339e7ec6805e6de8794514c0a935081b5d36d38fBrian 408e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 418e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwellstatic GLuint translate_fill( GLenum mode ) 428e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell{ 438e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell switch (mode) { 44f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian case GL_POINT: 45f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian return PIPE_POLYGON_MODE_POINT; 46f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian case GL_LINE: 47f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian return PIPE_POLYGON_MODE_LINE; 48f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian case GL_FILL: 49f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian return PIPE_POLYGON_MODE_FILL; 50f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian default: 51f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian assert(0); 52f79c225d9e5adee6287a9bba35f014c3fe00d3f9Brian return 0; 538e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell } 548e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell} 558e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 568e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 578e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 58294401814d1d89cc731de1c22c25333aa5d59374Zack Rusinstatic void update_raster_state( struct st_context *st ) 598e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell{ 60f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg struct gl_context *ctx = st->ctx; 61339e7ec6805e6de8794514c0a935081b5d36d38fBrian struct pipe_rasterizer_state *raster = &st->state.rasterizer; 622444f6c6a4c2f54c3198882c2256419628ca49d1Brian const struct gl_vertex_program *vertProg = ctx->VertexProgram._Current; 63e22e3927b056806e9bbb089734132ad0bcb98df1Brian Paul const struct gl_fragment_program *fragProg = ctx->FragmentProgram._Current; 641b4852345954af9b582b03a91a3d8399b8fb0e92Brian uint i; 658e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 66339e7ec6805e6de8794514c0a935081b5d36d38fBrian memset(raster, 0, sizeof(*raster)); 67017f862de1f857bca29f09794539aaf411014f13Brian 688e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell /* _NEW_POLYGON, _NEW_BUFFERS 698e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell */ 708e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell { 719c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell raster->front_ccw = (ctx->Polygon.FrontFace == GL_CCW); 728e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 734c251b88613ae3650a7b9eb255b79a95d0c837a7Brian Paul /* 744c251b88613ae3650a7b9eb255b79a95d0c837a7Brian Paul * Gallium's surfaces are Y=0=TOP orientation. OpenGL is the 754c251b88613ae3650a7b9eb255b79a95d0c837a7Brian Paul * opposite. Window system surfaces are Y=0=TOP. Mesa's FBOs 764c251b88613ae3650a7b9eb255b79a95d0c837a7Brian Paul * must match OpenGL conventions so FBOs use Y=0=BOTTOM. In that 774c251b88613ae3650a7b9eb255b79a95d0c837a7Brian Paul * case, we must invert Y and flip the notion of front vs. back. 78dc313b578386dc07f4916fba98da061af3ab18e5Brian */ 794c251b88613ae3650a7b9eb255b79a95d0c837a7Brian Paul if (st_fb_orientation(ctx->DrawBuffer) == Y_0_BOTTOM) { 804c251b88613ae3650a7b9eb255b79a95d0c837a7Brian Paul /* Drawing to an FBO. The viewport will be inverted. */ 819c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell raster->front_ccw ^= 1; 824c251b88613ae3650a7b9eb255b79a95d0c837a7Brian Paul } 838e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell } 848e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 858e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell /* _NEW_LIGHT 868e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell */ 878e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell if (ctx->Light.ShadeModel == GL_FLAT) 88339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->flatshade = 1; 898e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 90b631d5fbf45f4df44d1c445a9defb8c8f05599e2Brian Paul if (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION_EXT) 91b631d5fbf45f4df44d1c445a9defb8c8f05599e2Brian Paul raster->flatshade_first = 1; 92b631d5fbf45f4df44d1c445a9defb8c8f05599e2Brian Paul 93f0636d9653d142bdf71475d2d2066f5c7c436978Brian /* _NEW_LIGHT | _NEW_PROGRAM 948e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * 95f0636d9653d142bdf71475d2d2066f5c7c436978Brian * Back-face colors can come from traditional lighting (when 9652406c80d67d3e101d1da0f5babaabac202d31d5Brian Paul * GL_LIGHT_MODEL_TWO_SIDE is set) or from vertex programs/shaders (when 97f0636d9653d142bdf71475d2d2066f5c7c436978Brian * GL_VERTEX_PROGRAM_TWO_SIDE is set). Note the logic here. 988e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell */ 9952da6b559a47eca2c1a8ec1b713e188f38e1d16aBrian if (ctx->VertexProgram._Current) { 10052406c80d67d3e101d1da0f5babaabac202d31d5Brian Paul if (ctx->VertexProgram._Enabled || 10184eba3ef71dfa822e5ff0463032cdd2e3515b888Ian Romanick (ctx->Shader.CurrentVertexProgram && 10284eba3ef71dfa822e5ff0463032cdd2e3515b888Ian Romanick ctx->Shader.CurrentVertexProgram->LinkStatus)) { 10352406c80d67d3e101d1da0f5babaabac202d31d5Brian Paul /* user-defined vertex program or shader */ 104339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->light_twoside = ctx->VertexProgram.TwoSideEnabled; 105dd235ff1db6a2839607931cc07f9ba6e602ac3d4Brian } 106dd235ff1db6a2839607931cc07f9ba6e602ac3d4Brian else { 107dd235ff1db6a2839607931cc07f9ba6e602ac3d4Brian /* TNL-generated program */ 108339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->light_twoside = ctx->Light.Enabled && ctx->Light.Model.TwoSide; 109dd235ff1db6a2839607931cc07f9ba6e602ac3d4Brian } 110f0636d9653d142bdf71475d2d2066f5c7c436978Brian } 111f0636d9653d142bdf71475d2d2066f5c7c436978Brian else if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) { 112339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->light_twoside = 1; 113f0636d9653d142bdf71475d2d2066f5c7c436978Brian } 1148e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 11547e3896dfd89a26abbe4ca2469c2480f3982b204Luca Barbieri raster->clamp_vertex_color = ctx->Light._ClampVertexColor; 11647e3896dfd89a26abbe4ca2469c2480f3982b204Luca Barbieri 1178e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell /* _NEW_POLYGON 1188e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell */ 1198e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell if (ctx->Polygon.CullFlag) { 1209c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell switch (ctx->Polygon.CullFaceMode) { 1219c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell case GL_FRONT: 1229c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell raster->cull_face = PIPE_FACE_FRONT; 1239c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell break; 1249c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell case GL_BACK: 1259c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell raster->cull_face = PIPE_FACE_BACK; 1269c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell break; 1279c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell case GL_FRONT_AND_BACK: 1289c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell raster->cull_face = PIPE_FACE_FRONT_AND_BACK; 1299c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell break; 1308e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell } 1318e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell } 1329c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell else { 1339c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell raster->cull_face = PIPE_FACE_NONE; 1349c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell } 1358e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1368e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell /* _NEW_POLYGON 1378e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell */ 1388e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell { 1399c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell raster->fill_front = translate_fill( ctx->Polygon.FrontMode ); 1409c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell raster->fill_back = translate_fill( ctx->Polygon.BackMode ); 1418e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1428e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell /* Simplify when culling is active: 1438e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell */ 1449c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell if (raster->cull_face & PIPE_FACE_FRONT) { 1459c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell raster->fill_front = raster->fill_back; 1468e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell } 1478e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1489c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell if (raster->cull_face & PIPE_FACE_BACK) { 1499c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell raster->fill_back = raster->fill_front; 1508e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell } 1518e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell } 1528e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 153f6dffd6ee70473dcbf65420a9c635049199f7a4eBrian /* _NEW_POLYGON 1548e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell */ 155f6dffd6ee70473dcbf65420a9c635049199f7a4eBrian if (ctx->Polygon.OffsetUnits != 0.0 || 156f6dffd6ee70473dcbf65420a9c635049199f7a4eBrian ctx->Polygon.OffsetFactor != 0.0) { 1579c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell raster->offset_point = ctx->Polygon.OffsetPoint; 1589c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell raster->offset_line = ctx->Polygon.OffsetLine; 1599c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell raster->offset_tri = ctx->Polygon.OffsetFill; 1609c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell } 1619c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell 1629c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell if (ctx->Polygon.OffsetPoint || 1639c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell ctx->Polygon.OffsetLine || 1649c264642c385557d64b9bc6bbe31d2d15e703affKeith Whitwell ctx->Polygon.OffsetFill) { 165339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->offset_units = ctx->Polygon.OffsetUnits; 166339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->offset_scale = ctx->Polygon.OffsetFactor; 167f6dffd6ee70473dcbf65420a9c635049199f7a4eBrian } 1688e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 1691be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian if (ctx->Polygon.SmoothFlag) 170339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->poly_smooth = 1; 1711be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian 1721be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian if (ctx->Polygon.StippleFlag) 173339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->poly_stipple_enable = 1; 17468f93ea3eb83cfad014b8ec93cec3564c1aa9833Roland Scheidegger 1751be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian /* _NEW_POINT 1761be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian */ 177339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->point_size = ctx->Point.Size; 178bc739440c29c551fcc44e9e12d0d9c170d8d24fbKeith Whitwell 1794a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger if (!ctx->Point.PointSprite && ctx->Point.SmoothFlag) 1804a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger raster->point_smooth = 1; 1814a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger 182e22e3927b056806e9bbb089734132ad0bcb98df1Brian Paul /* _NEW_POINT | _NEW_PROGRAM 183e22e3927b056806e9bbb089734132ad0bcb98df1Brian Paul */ 1844a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger if (ctx->Point.PointSprite) { 185e22e3927b056806e9bbb089734132ad0bcb98df1Brian Paul /* origin */ 1864a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger if ((ctx->Point.SpriteOrigin == GL_UPPER_LEFT) ^ 1874a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger (st_fb_orientation(ctx->DrawBuffer) == Y_0_BOTTOM)) 1884a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger raster->sprite_coord_mode = PIPE_SPRITE_COORD_UPPER_LEFT; 1894a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger else 1904a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger raster->sprite_coord_mode = PIPE_SPRITE_COORD_LOWER_LEFT; 191e22e3927b056806e9bbb089734132ad0bcb98df1Brian Paul 192e22e3927b056806e9bbb089734132ad0bcb98df1Brian Paul /* Coord replacement flags. If bit 'k' is set that means 193e22e3927b056806e9bbb089734132ad0bcb98df1Brian Paul * that we need to replace GENERIC[k] attrib with an automatically 194e22e3927b056806e9bbb089734132ad0bcb98df1Brian Paul * computed texture coord. 195e22e3927b056806e9bbb089734132ad0bcb98df1Brian Paul */ 1964a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { 1974a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger if (ctx->Point.CoordReplace[i]) { 1984a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger raster->sprite_coord_enable |= 1 << i; 1994a4daa75a85db22cd37ebd533ebbccb427e07077Roland Scheidegger } 2001b4852345954af9b582b03a91a3d8399b8fb0e92Brian } 201e22e3927b056806e9bbb089734132ad0bcb98df1Brian Paul if (fragProg->Base.InputsRead & FRAG_BIT_PNTC) { 202e22e3927b056806e9bbb089734132ad0bcb98df1Brian Paul raster->sprite_coord_enable |= 203e22e3927b056806e9bbb089734132ad0bcb98df1Brian Paul 1 << (FRAG_ATTRIB_PNTC - FRAG_ATTRIB_TEX0); 204e22e3927b056806e9bbb089734132ad0bcb98df1Brian Paul } 205e22e3927b056806e9bbb089734132ad0bcb98df1Brian Paul 20668f93ea3eb83cfad014b8ec93cec3564c1aa9833Roland Scheidegger raster->point_quad_rasterization = 1; 2071b4852345954af9b582b03a91a3d8399b8fb0e92Brian } 208f7556fdd40ed2719beaba271eee4a7551e212ad1Brian Paul 209f7556fdd40ed2719beaba271eee4a7551e212ad1Brian Paul /* ST_NEW_VERTEX_PROGRAM 210f7556fdd40ed2719beaba271eee4a7551e212ad1Brian Paul */ 2112444f6c6a4c2f54c3198882c2256419628ca49d1Brian if (vertProg) { 2122444f6c6a4c2f54c3198882c2256419628ca49d1Brian if (vertProg->Base.Id == 0) { 213b46750d601655c39ccb967ae525d4edcbb9fb9d2Ben Skeggs if (vertProg->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_PSIZ)) { 2142444f6c6a4c2f54c3198882c2256419628ca49d1Brian /* generated program which emits point size */ 215339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->point_size_per_vertex = TRUE; 2162444f6c6a4c2f54c3198882c2256419628ca49d1Brian } 2172444f6c6a4c2f54c3198882c2256419628ca49d1Brian } 2182444f6c6a4c2f54c3198882c2256419628ca49d1Brian else if (ctx->VertexProgram.PointSizeEnabled) { 2192444f6c6a4c2f54c3198882c2256419628ca49d1Brian /* user-defined program and GL_VERTEX_PROGRAM_POINT_SIZE set */ 220339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->point_size_per_vertex = ctx->VertexProgram.PointSizeEnabled; 2212444f6c6a4c2f54c3198882c2256419628ca49d1Brian } 2222444f6c6a4c2f54c3198882c2256419628ca49d1Brian } 223cbf42c45a15d6a132c7f7d4946c422ee3de35e6cBrian Paul if (!raster->point_size_per_vertex) { 224cbf42c45a15d6a132c7f7d4946c422ee3de35e6cBrian Paul /* clamp size now */ 225cbf42c45a15d6a132c7f7d4946c422ee3de35e6cBrian Paul raster->point_size = CLAMP(ctx->Point.Size, 226cbf42c45a15d6a132c7f7d4946c422ee3de35e6cBrian Paul ctx->Point.MinSize, 227cbf42c45a15d6a132c7f7d4946c422ee3de35e6cBrian Paul ctx->Point.MaxSize); 228cbf42c45a15d6a132c7f7d4946c422ee3de35e6cBrian Paul } 2291be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian 2301be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian /* _NEW_LINE 2311be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian */ 232339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->line_smooth = ctx->Line.SmoothFlag; 23309ba1dd4ccb0ed907510cb9403b1fb1fb0ab3658Brian if (ctx->Line.SmoothFlag) { 234339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->line_width = CLAMP(ctx->Line.Width, 23509ba1dd4ccb0ed907510cb9403b1fb1fb0ab3658Brian ctx->Const.MinLineWidthAA, 23609ba1dd4ccb0ed907510cb9403b1fb1fb0ab3658Brian ctx->Const.MaxLineWidthAA); 23709ba1dd4ccb0ed907510cb9403b1fb1fb0ab3658Brian } 23809ba1dd4ccb0ed907510cb9403b1fb1fb0ab3658Brian else { 239339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->line_width = CLAMP(ctx->Line.Width, 24009ba1dd4ccb0ed907510cb9403b1fb1fb0ab3658Brian ctx->Const.MinLineWidth, 24109ba1dd4ccb0ed907510cb9403b1fb1fb0ab3658Brian ctx->Const.MaxLineWidth); 24209ba1dd4ccb0ed907510cb9403b1fb1fb0ab3658Brian } 24309ba1dd4ccb0ed907510cb9403b1fb1fb0ab3658Brian 244339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->line_stipple_enable = ctx->Line.StippleFlag; 245339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->line_stipple_pattern = ctx->Line.StipplePattern; 246a813f654872380547faf67fba75fa30792f87ea6Brian /* GL stipple factor is in [1,256], remap to [0, 255] here */ 247339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->line_stipple_factor = ctx->Line.StippleFactor - 1; 2481be17dc446aa6b0770d76a3eccf79d0faf6608c0Brian 24986352ff70d8c9a31fe0ebb4d02ce4bb4644fe54aBrian /* _NEW_MULTISAMPLE */ 2501a820f52f6fa125786538c1adf2aa350e66b8c1eBrian Paul if (ctx->Multisample._Enabled || st->force_msaa) 251339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->multisample = 1; 2528e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 2536abdad28f6f6c69158b942fe420a55f12c71fb08Brian /* _NEW_SCISSOR */ 2546abdad28f6f6c69158b942fe420a55f12c71fb08Brian if (ctx->Scissor.Enabled) 255339e7ec6805e6de8794514c0a935081b5d36d38fBrian raster->scissor = 1; 2566abdad28f6f6c69158b942fe420a55f12c71fb08Brian 25747e3896dfd89a26abbe4ca2469c2480f3982b204Luca Barbieri /* _NEW_FRAG_CLAMP */ 25847e3896dfd89a26abbe4ca2469c2480f3982b204Luca Barbieri raster->clamp_fragment_color = ctx->Color._ClampFragmentColor; 25947e3896dfd89a26abbe4ca2469c2480f3982b204Luca Barbieri 2608e33194837dd206d920889851d9cf22190100c99Keith Whitwell raster->gl_rasterization_rules = 1; 2618e33194837dd206d920889851d9cf22190100c99Keith Whitwell 262339e7ec6805e6de8794514c0a935081b5d36d38fBrian cso_set_rasterizer(st->cso_context, raster); 2638e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell} 2648e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell 265294401814d1d89cc731de1c22c25333aa5d59374Zack Rusinconst struct st_tracked_state st_update_rasterizer = { 266e552140a9a55fcadfe7f28c74a7e0aa1c68cdc93Brian Paul "st_update_rasterizer", /* name */ 267e552140a9a55fcadfe7f28c74a7e0aa1c68cdc93Brian Paul { 268e552140a9a55fcadfe7f28c74a7e0aa1c68cdc93Brian Paul (_NEW_BUFFERS | 269e552140a9a55fcadfe7f28c74a7e0aa1c68cdc93Brian Paul _NEW_LIGHT | 270e552140a9a55fcadfe7f28c74a7e0aa1c68cdc93Brian Paul _NEW_LINE | 271e552140a9a55fcadfe7f28c74a7e0aa1c68cdc93Brian Paul _NEW_MULTISAMPLE | 272e552140a9a55fcadfe7f28c74a7e0aa1c68cdc93Brian Paul _NEW_POINT | 273e552140a9a55fcadfe7f28c74a7e0aa1c68cdc93Brian Paul _NEW_POLYGON | 274e552140a9a55fcadfe7f28c74a7e0aa1c68cdc93Brian Paul _NEW_PROGRAM | 27547e3896dfd89a26abbe4ca2469c2480f3982b204Luca Barbieri _NEW_SCISSOR | 27647e3896dfd89a26abbe4ca2469c2480f3982b204Luca Barbieri _NEW_FRAG_CLAMP), /* mesa state dependencies*/ 277f7556fdd40ed2719beaba271eee4a7551e212ad1Brian Paul ST_NEW_VERTEX_PROGRAM, /* state tracker dependencies */ 2788e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell }, 279e552140a9a55fcadfe7f28c74a7e0aa1c68cdc93Brian Paul update_raster_state /* update function */ 2808e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell}; 281