Path: blob/21.2-virgl/src/gallium/drivers/llvmpipe/lp_setup_line.c
4570 views
/**************************************************************************1*2* Copyright 2007 VMware, Inc.3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sub license, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial portions15* of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS18* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.20* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR21* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,22* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE23* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.24*25**************************************************************************/2627/*28* Binning code for lines29*/3031#include "util/u_math.h"32#include "util/u_memory.h"33#include "lp_perf.h"34#include "lp_setup_context.h"35#include "lp_rast.h"36#include "lp_state_fs.h"37#include "lp_state_setup.h"38#include "lp_context.h"39#include "draw/draw_context.h"4041#define NUM_CHANNELS 44243struct lp_line_info {4445float dx;46float dy;47float oneoverarea;48boolean frontfacing;4950const float (*v1)[4];51const float (*v2)[4];5253float (*a0)[4];54float (*dadx)[4];55float (*dady)[4];56};575859/**60* Compute a0 for a constant-valued coefficient (GL_FLAT shading).61*/62static void constant_coef( struct lp_setup_context *setup,63struct lp_line_info *info,64unsigned slot,65const float value,66unsigned i )67{68info->a0[slot][i] = value;69info->dadx[slot][i] = 0.0f;70info->dady[slot][i] = 0.0f;71}727374/**75* Compute a0, dadx and dady for a linearly interpolated coefficient,76* for a triangle.77*/78static void linear_coef( struct lp_setup_context *setup,79struct lp_line_info *info,80unsigned slot,81unsigned vert_attr,82unsigned i)83{84float a1 = info->v1[vert_attr][i];85float a2 = info->v2[vert_attr][i];8687float da21 = a1 - a2;88float dadx = da21 * info->dx * info->oneoverarea;89float dady = da21 * info->dy * info->oneoverarea;9091info->dadx[slot][i] = dadx;92info->dady[slot][i] = dady;9394info->a0[slot][i] = (a1 -95(dadx * (info->v1[0][0] - setup->pixel_offset) +96dady * (info->v1[0][1] - setup->pixel_offset)));97}9899100/**101* Compute a0, dadx and dady for a perspective-corrected interpolant,102* for a triangle.103* We basically multiply the vertex value by 1/w before computing104* the plane coefficients (a0, dadx, dady).105* Later, when we compute the value at a particular fragment position we'll106* divide the interpolated value by the interpolated W at that fragment.107*/108static void perspective_coef( struct lp_setup_context *setup,109struct lp_line_info *info,110unsigned slot,111unsigned vert_attr,112unsigned i)113{114/* premultiply by 1/w (v[0][3] is always 1/w):115*/116float a1 = info->v1[vert_attr][i] * info->v1[0][3];117float a2 = info->v2[vert_attr][i] * info->v2[0][3];118119float da21 = a1 - a2;120float dadx = da21 * info->dx * info->oneoverarea;121float dady = da21 * info->dy * info->oneoverarea;122123info->dadx[slot][i] = dadx;124info->dady[slot][i] = dady;125126info->a0[slot][i] = (a1 -127(dadx * (info->v1[0][0] - setup->pixel_offset) +128dady * (info->v1[0][1] - setup->pixel_offset)));129}130131static void132setup_fragcoord_coef( struct lp_setup_context *setup,133struct lp_line_info *info,134unsigned slot,135unsigned usage_mask)136{137/*X*/138if (usage_mask & TGSI_WRITEMASK_X) {139info->a0[slot][0] = 0.0;140info->dadx[slot][0] = 1.0;141info->dady[slot][0] = 0.0;142}143144/*Y*/145if (usage_mask & TGSI_WRITEMASK_Y) {146info->a0[slot][1] = 0.0;147info->dadx[slot][1] = 0.0;148info->dady[slot][1] = 1.0;149}150151/*Z*/152if (usage_mask & TGSI_WRITEMASK_Z) {153linear_coef(setup, info, slot, 0, 2);154}155156/*W*/157if (usage_mask & TGSI_WRITEMASK_W) {158linear_coef(setup, info, slot, 0, 3);159}160}161162/**163* Compute the tri->coef[] array dadx, dady, a0 values.164*/165static void setup_line_coefficients( struct lp_setup_context *setup,166struct lp_line_info *info)167{168const struct lp_setup_variant_key *key = &setup->setup.variant->key;169unsigned fragcoord_usage_mask = TGSI_WRITEMASK_XYZ;170unsigned slot;171172/* setup interpolation for all the remaining attributes:173*/174for (slot = 0; slot < key->num_inputs; slot++) {175unsigned vert_attr = key->inputs[slot].src_index;176unsigned usage_mask = key->inputs[slot].usage_mask;177unsigned i;178179switch (key->inputs[slot].interp) {180case LP_INTERP_CONSTANT:181if (key->flatshade_first) {182for (i = 0; i < NUM_CHANNELS; i++)183if (usage_mask & (1 << i))184constant_coef(setup, info, slot+1, info->v1[vert_attr][i], i);185}186else {187for (i = 0; i < NUM_CHANNELS; i++)188if (usage_mask & (1 << i))189constant_coef(setup, info, slot+1, info->v2[vert_attr][i], i);190}191break;192193case LP_INTERP_LINEAR:194for (i = 0; i < NUM_CHANNELS; i++)195if (usage_mask & (1 << i))196linear_coef(setup, info, slot+1, vert_attr, i);197break;198199case LP_INTERP_PERSPECTIVE:200for (i = 0; i < NUM_CHANNELS; i++)201if (usage_mask & (1 << i))202perspective_coef(setup, info, slot+1, vert_attr, i);203fragcoord_usage_mask |= TGSI_WRITEMASK_W;204break;205206case LP_INTERP_POSITION:207/*208* The generated pixel interpolators will pick up the coeffs from209* slot 0, so all need to ensure that the usage mask is covers all210* usages.211*/212fragcoord_usage_mask |= usage_mask;213break;214215case LP_INTERP_FACING:216for (i = 0; i < NUM_CHANNELS; i++)217if (usage_mask & (1 << i))218constant_coef(setup, info, slot+1,219info->frontfacing ? 1.0f : -1.0f, i);220break;221222default:223assert(0);224}225}226227/* The internal position input is in slot zero:228*/229setup_fragcoord_coef(setup, info, 0,230fragcoord_usage_mask);231}232233234235static inline int subpixel_snap( float a )236{237return util_iround(FIXED_ONE * a);238}239240241/**242* Print line vertex attribs (for debug).243*/244static void245print_line(struct lp_setup_context *setup,246const float (*v1)[4],247const float (*v2)[4])248{249const struct lp_setup_variant_key *key = &setup->setup.variant->key;250uint i;251252debug_printf("llvmpipe line\n");253for (i = 0; i < 1 + key->num_inputs; i++) {254debug_printf(" v1[%d]: %f %f %f %f\n", i,255v1[i][0], v1[i][1], v1[i][2], v1[i][3]);256}257for (i = 0; i < 1 + key->num_inputs; i++) {258debug_printf(" v2[%d]: %f %f %f %f\n", i,259v2[i][0], v2[i][1], v2[i][2], v2[i][3]);260}261}262263264static inline boolean sign(float x){265return x >= 0;266}267268269/* Used on positive floats only:270*/271static inline float fracf(float f)272{273return f - floorf(f);274}275276277278static boolean279try_setup_line( struct lp_setup_context *setup,280const float (*v1)[4],281const float (*v2)[4])282{283struct llvmpipe_context *lp_context = (struct llvmpipe_context *)setup->pipe;284struct lp_scene *scene = setup->scene;285const struct lp_setup_variant_key *key = &setup->setup.variant->key;286struct lp_rast_triangle *line;287struct lp_rast_plane *plane;288struct lp_line_info info;289float width = MAX2(1.0, setup->line_width);290const struct u_rect *scissor;291struct u_rect bbox, bboxpos;292boolean s_planes[4];293unsigned tri_bytes;294int x[4];295int y[4];296int i;297int nr_planes = 4;298unsigned viewport_index = 0;299unsigned layer = 0;300float pixel_offset = setup->multisample ? 0.0 : setup->pixel_offset;301/* linewidth should be interpreted as integer */302int fixed_width = util_iround(width) * FIXED_ONE;303304float x_offset=0;305float y_offset=0;306float x_offset_end=0;307float y_offset_end=0;308309float x1diff;310float y1diff;311float x2diff;312float y2diff;313float dx, dy;314float area;315const float (*pv)[4];316317boolean draw_start;318boolean draw_end;319boolean will_draw_start;320boolean will_draw_end;321322if (lp_context->active_statistics_queries) {323lp_context->pipeline_statistics.c_primitives++;324}325326if (0)327print_line(setup, v1, v2);328329if (setup->flatshade_first) {330pv = v1;331}332else {333pv = v2;334}335if (setup->viewport_index_slot > 0) {336unsigned *udata = (unsigned*)pv[setup->viewport_index_slot];337viewport_index = lp_clamp_viewport_idx(*udata);338}339if (setup->layer_slot > 0) {340layer = *(unsigned*)pv[setup->layer_slot];341layer = MIN2(layer, scene->fb_max_layer);342}343344dx = v1[0][0] - v2[0][0];345dy = v1[0][1] - v2[0][1];346area = (dx * dx + dy * dy);347if (area == 0) {348LP_COUNT(nr_culled_tris);349return TRUE;350}351352info.oneoverarea = 1.0f / area;353info.dx = dx;354info.dy = dy;355info.v1 = v1;356info.v2 = v2;357358359if (setup->rectangular_lines) {360float scale = (setup->line_width * 0.5f) / sqrtf(area);361int tx = subpixel_snap(-dy * scale);362int ty = subpixel_snap(+dx * scale);363364x[0] = subpixel_snap(v1[0][0] - pixel_offset) - tx;365x[1] = subpixel_snap(v2[0][0] - pixel_offset) - tx;366x[2] = subpixel_snap(v2[0][0] - pixel_offset) + tx;367x[3] = subpixel_snap(v1[0][0] - pixel_offset) + tx;368369y[0] = subpixel_snap(v1[0][1] - pixel_offset) - ty;370y[1] = subpixel_snap(v2[0][1] - pixel_offset) - ty;371y[2] = subpixel_snap(v2[0][1] - pixel_offset) + ty;372y[3] = subpixel_snap(v1[0][1] - pixel_offset) + ty;373} else if (fabsf(dx) >= fabsf(dy)) {374float dydx = dy / dx;375376/* X-MAJOR LINE */377x1diff = v1[0][0] - floorf(v1[0][0]) - 0.5f;378y1diff = v1[0][1] - floorf(v1[0][1]) - 0.5f;379x2diff = v2[0][0] - floorf(v2[0][0]) - 0.5f;380y2diff = v2[0][1] - floorf(v2[0][1]) - 0.5f;381382if (y2diff==-0.5 && dy<0){383y2diff = 0.5;384}385386/*387* Diamond exit rule test for starting point388*/389if (fabsf(x1diff) + fabsf(y1diff) < 0.5) {390draw_start = TRUE;391}392else if (sign(x1diff) == sign(-dx)) {393draw_start = FALSE;394}395else if (sign(-y1diff) != sign(dy)) {396draw_start = TRUE;397}398else {399/* do intersection test */400float yintersect = fracf(v1[0][1]) + x1diff * dydx;401draw_start = (yintersect < 1.0 && yintersect > 0.0);402}403404405/*406* Diamond exit rule test for ending point407*/408if (fabsf(x2diff) + fabsf(y2diff) < 0.5) {409draw_end = FALSE;410}411else if (sign(x2diff) != sign(-dx)) {412draw_end = FALSE;413}414else if (sign(-y2diff) == sign(dy)) {415draw_end = TRUE;416}417else {418/* do intersection test */419float yintersect = fracf(v2[0][1]) + x2diff * dydx;420draw_end = (yintersect < 1.0 && yintersect > 0.0);421}422423/* Are we already drawing start/end?424*/425will_draw_start = sign(-x1diff) != sign(dx);426will_draw_end = (sign(x2diff) == sign(-dx)) || x2diff==0;427428if (dx < 0) {429/* if v2 is to the right of v1, swap pointers */430const float (*temp)[4] = v1;431v1 = v2;432v2 = temp;433dx = -dx;434dy = -dy;435/* Otherwise shift planes appropriately */436if (will_draw_start != draw_start) {437x_offset_end = - x1diff - 0.5;438y_offset_end = x_offset_end * dydx;439440}441if (will_draw_end != draw_end) {442x_offset = - x2diff - 0.5;443y_offset = x_offset * dydx;444}445446}447else{448/* Otherwise shift planes appropriately */449if (will_draw_start != draw_start) {450x_offset = - x1diff + 0.5;451y_offset = x_offset * dydx;452}453if (will_draw_end != draw_end) {454x_offset_end = - x2diff + 0.5;455y_offset_end = x_offset_end * dydx;456}457}458459/* x/y positions in fixed point */460x[0] = subpixel_snap(v1[0][0] + x_offset - pixel_offset);461x[1] = subpixel_snap(v2[0][0] + x_offset_end - pixel_offset);462x[2] = subpixel_snap(v2[0][0] + x_offset_end - pixel_offset);463x[3] = subpixel_snap(v1[0][0] + x_offset - pixel_offset);464465y[0] = subpixel_snap(v1[0][1] + y_offset - pixel_offset) - fixed_width/2;466y[1] = subpixel_snap(v2[0][1] + y_offset_end - pixel_offset) - fixed_width/2;467y[2] = subpixel_snap(v2[0][1] + y_offset_end - pixel_offset) + fixed_width/2;468y[3] = subpixel_snap(v1[0][1] + y_offset - pixel_offset) + fixed_width/2;469470}471else {472const float dxdy = dx / dy;473474/* Y-MAJOR LINE */475x1diff = v1[0][0] - floorf(v1[0][0]) - 0.5f;476y1diff = v1[0][1] - floorf(v1[0][1]) - 0.5f;477x2diff = v2[0][0] - floorf(v2[0][0]) - 0.5f;478y2diff = v2[0][1] - floorf(v2[0][1]) - 0.5f;479480if (x2diff==-0.5 && dx<0) {481x2diff = 0.5;482}483484/*485* Diamond exit rule test for starting point486*/487if (fabsf(x1diff) + fabsf(y1diff) < 0.5) {488draw_start = TRUE;489}490else if (sign(-y1diff) == sign(dy)) {491draw_start = FALSE;492}493else if (sign(x1diff) != sign(-dx)) {494draw_start = TRUE;495}496else {497/* do intersection test */498float xintersect = fracf(v1[0][0]) + y1diff * dxdy;499draw_start = (xintersect < 1.0 && xintersect > 0.0);500}501502/*503* Diamond exit rule test for ending point504*/505if (fabsf(x2diff) + fabsf(y2diff) < 0.5) {506draw_end = FALSE;507}508else if (sign(-y2diff) != sign(dy) ) {509draw_end = FALSE;510}511else if (sign(x2diff) == sign(-dx) ) {512draw_end = TRUE;513}514else {515/* do intersection test */516float xintersect = fracf(v2[0][0]) + y2diff * dxdy;517draw_end = (xintersect < 1.0 && xintersect >= 0.0);518}519520/* Are we already drawing start/end?521*/522will_draw_start = sign(y1diff) == sign(dy);523will_draw_end = (sign(-y2diff) == sign(dy)) || y2diff==0;524525if (dy > 0) {526/* if v2 is on top of v1, swap pointers */527const float (*temp)[4] = v1;528v1 = v2;529v2 = temp;530dx = -dx;531dy = -dy;532533/* Otherwise shift planes appropriately */534if (will_draw_start != draw_start) {535y_offset_end = - y1diff + 0.5;536x_offset_end = y_offset_end * dxdy;537}538if (will_draw_end != draw_end) {539y_offset = - y2diff + 0.5;540x_offset = y_offset * dxdy;541}542}543else {544/* Otherwise shift planes appropriately */545if (will_draw_start != draw_start) {546y_offset = - y1diff - 0.5;547x_offset = y_offset * dxdy;548549}550if (will_draw_end != draw_end) {551y_offset_end = - y2diff - 0.5;552x_offset_end = y_offset_end * dxdy;553}554}555556/* x/y positions in fixed point */557x[0] = subpixel_snap(v1[0][0] + x_offset - pixel_offset) - fixed_width/2;558x[1] = subpixel_snap(v2[0][0] + x_offset_end - pixel_offset) - fixed_width/2;559x[2] = subpixel_snap(v2[0][0] + x_offset_end - pixel_offset) + fixed_width/2;560x[3] = subpixel_snap(v1[0][0] + x_offset - pixel_offset) + fixed_width/2;561562y[0] = subpixel_snap(v1[0][1] + y_offset - pixel_offset);563y[1] = subpixel_snap(v2[0][1] + y_offset_end - pixel_offset);564y[2] = subpixel_snap(v2[0][1] + y_offset_end - pixel_offset);565y[3] = subpixel_snap(v1[0][1] + y_offset - pixel_offset);566}567568/* Bounding rectangle (in pixels) */569{570/* Yes this is necessary to accurately calculate bounding boxes571* with the two fill-conventions we support. GL (normally) ends572* up needing a bottom-left fill convention, which requires573* slightly different rounding.574*/575int adj = (setup->bottom_edge_rule != 0) ? 1 : 0;576577bbox.x0 = (MIN4(x[0], x[1], x[2], x[3]) + (FIXED_ONE-1)) >> FIXED_ORDER;578bbox.x1 = (MAX4(x[0], x[1], x[2], x[3]) + (FIXED_ONE-1)) >> FIXED_ORDER;579bbox.y0 = (MIN4(y[0], y[1], y[2], y[3]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER;580bbox.y1 = (MAX4(y[0], y[1], y[2], y[3]) + (FIXED_ONE-1) + adj) >> FIXED_ORDER;581582/* Inclusive coordinates:583*/584bbox.x1--;585bbox.y1--;586}587588if (bbox.x1 < bbox.x0 ||589bbox.y1 < bbox.y0) {590if (0) debug_printf("empty bounding box\n");591LP_COUNT(nr_culled_tris);592return TRUE;593}594595if (!u_rect_test_intersection(&setup->draw_regions[viewport_index], &bbox)) {596if (0) debug_printf("offscreen\n");597LP_COUNT(nr_culled_tris);598return TRUE;599}600601bboxpos = bbox;602603/* Can safely discard negative regions:604*/605bboxpos.x0 = MAX2(bboxpos.x0, 0);606bboxpos.y0 = MAX2(bboxpos.y0, 0);607608nr_planes = 4;609/*610* Determine how many scissor planes we need, that is drop scissor611* edges if the bounding box of the tri is fully inside that edge.612*/613scissor = &setup->draw_regions[viewport_index];614scissor_planes_needed(s_planes, &bboxpos, scissor);615nr_planes += s_planes[0] + s_planes[1] + s_planes[2] + s_planes[3];616617line = lp_setup_alloc_triangle(scene,618key->num_inputs,619nr_planes,620&tri_bytes);621if (!line)622return FALSE;623624#ifdef DEBUG625line->v[0][0] = v1[0][0];626line->v[1][0] = v2[0][0];627line->v[0][1] = v1[0][1];628line->v[1][1] = v2[0][1];629#endif630631LP_COUNT(nr_tris);632633/* calculate the deltas */634plane = GET_PLANES(line);635plane[0].dcdy = x[0] - x[1];636plane[1].dcdy = x[1] - x[2];637plane[2].dcdy = x[2] - x[3];638plane[3].dcdy = x[3] - x[0];639640plane[0].dcdx = y[0] - y[1];641plane[1].dcdx = y[1] - y[2];642plane[2].dcdx = y[2] - y[3];643plane[3].dcdx = y[3] - y[0];644645if (draw_will_inject_frontface(lp_context->draw) &&646setup->face_slot > 0) {647line->inputs.frontfacing = v1[setup->face_slot][0];648} else {649line->inputs.frontfacing = TRUE;650}651652/* Setup parameter interpolants:653*/654info.a0 = GET_A0(&line->inputs);655info.dadx = GET_DADX(&line->inputs);656info.dady = GET_DADY(&line->inputs);657info.frontfacing = line->inputs.frontfacing;658setup_line_coefficients(setup, &info);659660line->inputs.disable = FALSE;661line->inputs.opaque = FALSE;662line->inputs.layer = layer;663line->inputs.viewport_index = viewport_index;664line->inputs.view_index = setup->view_index;665666/*667* XXX: this code is mostly identical to the one in lp_setup_tri, except it668* uses 4 planes instead of 3. Could share the code (including the sse669* assembly, in fact we'd get the 4th plane for free).670* The only difference apart from storing the 4th plane would be some671* different shuffle for calculating dcdx/dcdy.672*/673for (i = 0; i < 4; i++) {674675/* half-edge constants, will be iterated over the whole render676* target.677*/678plane[i].c = IMUL64(plane[i].dcdx, x[i]) - IMUL64(plane[i].dcdy, y[i]);679680/* correct for top-left vs. bottom-left fill convention.681*/682if (plane[i].dcdx < 0) {683/* both fill conventions want this - adjust for left edges */684plane[i].c++;685}686else if (plane[i].dcdx == 0) {687if (setup->bottom_edge_rule == 0) {688/* correct for top-left fill convention:689*/690if (plane[i].dcdy > 0) plane[i].c++;691}692else {693/* correct for bottom-left fill convention:694*/695if (plane[i].dcdy < 0) plane[i].c++;696}697}698699plane[i].dcdx *= FIXED_ONE;700plane[i].dcdy *= FIXED_ONE;701702/* find trivial reject offsets for each edge for a single-pixel703* sized block. These will be scaled up at each recursive level to704* match the active blocksize. Scaling in this way works best if705* the blocks are square.706*/707plane[i].eo = 0;708if (plane[i].dcdx < 0) plane[i].eo -= plane[i].dcdx;709if (plane[i].dcdy > 0) plane[i].eo += plane[i].dcdy;710}711712713/*714* When rasterizing scissored tris, use the intersection of the715* triangle bounding box and the scissor rect to generate the716* scissor planes.717*718* This permits us to cut off the triangle "tails" that are present719* in the intermediate recursive levels caused when two of the720* triangles edges don't diverge quickly enough to trivially reject721* exterior blocks from the triangle.722*723* It's not really clear if it's worth worrying about these tails,724* but since we generate the planes for each scissored tri, it's725* free to trim them in this case.726*727* Note that otherwise, the scissor planes only vary in 'C' value,728* and even then only on state-changes. Could alternatively store729* these planes elsewhere.730* (Or only store the c value together with a bit indicating which731* scissor edge this is, so rasterization would treat them differently732* (easier to evaluate) to ordinary planes.)733*/734if (nr_planes > 4) {735struct lp_rast_plane *plane_s = &plane[4];736737if (s_planes[0]) {738plane_s->dcdx = ~0U << 8;739plane_s->dcdy = 0;740plane_s->c = (1-scissor->x0) << 8;741plane_s->eo = 1 << 8;742plane_s++;743}744if (s_planes[1]) {745plane_s->dcdx = 1 << 8;746plane_s->dcdy = 0;747plane_s->c = (scissor->x1+1) << 8;748plane_s->eo = 0 << 8;749plane_s++;750}751if (s_planes[2]) {752plane_s->dcdx = 0;753plane_s->dcdy = 1 << 8;754plane_s->c = (1-scissor->y0) << 8;755plane_s->eo = 1 << 8;756plane_s++;757}758if (s_planes[3]) {759plane_s->dcdx = 0;760plane_s->dcdy = ~0U << 8;761plane_s->c = (scissor->y1+1) << 8;762plane_s->eo = 0;763plane_s++;764}765assert(plane_s == &plane[nr_planes]);766}767768return lp_setup_bin_triangle(setup, line, &bbox, &bboxpos, nr_planes, viewport_index);769}770771772static void lp_setup_line_discard(struct lp_setup_context *setup,773const float (*v0)[4],774const float (*v1)[4])775{776}777778static void lp_setup_line(struct lp_setup_context *setup,779const float (*v0)[4],780const float (*v1)[4])781{782if (!try_setup_line(setup, v0, v1)) {783if (!lp_setup_flush_and_restart(setup))784return;785786if (!try_setup_line(setup, v0, v1))787return;788}789}790791792void lp_setup_choose_line(struct lp_setup_context *setup)793{794if (setup->rasterizer_discard) {795setup->line = lp_setup_line_discard;796} else {797setup->line = lp_setup_line;798}799}800801802803804