Home | History | Annotate | Download | only in i965
      1 /*
      2  * Copyright  2009 Intel Corporation
      3  *
      4  * Permission is hereby granted, free of charge, to any person obtaining a
      5  * copy of this software and associated documentation files (the "Software"),
      6  * to deal in the Software without restriction, including without limitation
      7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      8  * and/or sell copies of the Software, and to permit persons to whom the
      9  * Software is furnished to do so, subject to the following conditions:
     10  *
     11  * The above copyright notice and this permission notice (including the next
     12  * paragraph) shall be included in all copies or substantial portions of the
     13  * Software.
     14  *
     15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
     21  * IN THE SOFTWARE.
     22  *
     23  * Authors:
     24  *    Eric Anholt <eric (at) anholt.net>
     25  *
     26  */
     27 
     28 #include "brw_context.h"
     29 #include "brw_state.h"
     30 #include "brw_defines.h"
     31 #include "compiler/brw_eu_defines.h"
     32 #include "brw_util.h"
     33 #include "intel_batchbuffer.h"
     34 #include "main/fbobject.h"
     35 #include "main/framebuffer.h"
     36 
     37 bool
     38 brw_is_drawing_points(const struct brw_context *brw)
     39 {
     40    /* Determine if the primitives *reaching the SF* are points */
     41    /* _NEW_POLYGON */
     42    if (brw->ctx.Polygon.FrontMode == GL_POINT ||
     43        brw->ctx.Polygon.BackMode == GL_POINT) {
     44       return true;
     45    }
     46 
     47    if (brw->gs.base.prog_data) {
     48       /* BRW_NEW_GS_PROG_DATA */
     49       return brw_gs_prog_data(brw->gs.base.prog_data)->output_topology ==
     50              _3DPRIM_POINTLIST;
     51    } else if (brw->tes.base.prog_data) {
     52       /* BRW_NEW_TES_PROG_DATA */
     53       return brw_tes_prog_data(brw->tes.base.prog_data)->output_topology ==
     54              BRW_TESS_OUTPUT_TOPOLOGY_POINT;
     55    } else {
     56       /* BRW_NEW_PRIMITIVE */
     57       return brw->primitive == _3DPRIM_POINTLIST;
     58    }
     59 }
     60 
     61 bool
     62 brw_is_drawing_lines(const struct brw_context *brw)
     63 {
     64    /* Determine if the primitives *reaching the SF* are points */
     65    /* _NEW_POLYGON */
     66    if (brw->ctx.Polygon.FrontMode == GL_LINE ||
     67        brw->ctx.Polygon.BackMode == GL_LINE) {
     68       return true;
     69    }
     70 
     71    if (brw->gs.base.prog_data) {
     72       /* BRW_NEW_GS_PROG_DATA */
     73       return brw_gs_prog_data(brw->gs.base.prog_data)->output_topology ==
     74              _3DPRIM_LINESTRIP;
     75    } else if (brw->tes.base.prog_data) {
     76       /* BRW_NEW_TES_PROG_DATA */
     77       return brw_tes_prog_data(brw->tes.base.prog_data)->output_topology ==
     78              BRW_TESS_OUTPUT_TOPOLOGY_LINE;
     79    } else {
     80       /* BRW_NEW_PRIMITIVE */
     81       switch (brw->primitive) {
     82       case _3DPRIM_LINELIST:
     83       case _3DPRIM_LINESTRIP:
     84       case _3DPRIM_LINELOOP:
     85          return true;
     86       }
     87    }
     88    return false;
     89 }
     90 
     91