mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
i965/Gen6-7: Do not replace texcoords with point coord if not drawing points
Fixes broken rendering in Windows-based QtQuick2 apps run through Wine.
This library sets all texture units' GL_COORD_REPLACE, leaves point
sprite mode enabled, and then draws a triangle fan.
Will need a slightly different fix for Gen4-5, but I don't have my old
machines in a usable state currently.
V2: - Simplify patch -- the real changes are no longer duplicated across
the Gen6 and Gen7 atoms.
- Also don't clobber attr overrides -- which matters on Haswell too,
and fixes the other half of the problem
- Fix newly-introduced warnings
V3: - Use BRW_NEW_GEOMETRY_PROGRAM and brw->geometry_program rather than
core flag and state; keep the state flags in order.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84651
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
60f011af1a
commit
0008d0e59e
2 changed files with 49 additions and 12 deletions
|
|
@ -129,6 +129,20 @@ get_attr_override(const struct brw_vue_map *vue_map, int urb_entry_read_offset,
|
|||
}
|
||||
|
||||
|
||||
static bool
|
||||
is_drawing_points(const struct brw_context *brw)
|
||||
{
|
||||
/* Determine if the primitives *reaching the SF* are points */
|
||||
if (brw->geometry_program) {
|
||||
/* BRW_NEW_GEOMETRY_PROGRAM */
|
||||
return brw->geometry_program->OutputType == GL_POINTS;
|
||||
} else {
|
||||
/* BRW_NEW_PRIMITIVE */
|
||||
return brw->primitive == _3DPRIM_POINTLIST;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the mapping from the FS inputs we produce to the previous pipeline
|
||||
* stage (GS or VS) outputs they source from.
|
||||
|
|
@ -149,6 +163,23 @@ calculate_attr_overrides(const struct brw_context *brw,
|
|||
/* _NEW_LIGHT */
|
||||
bool shade_model_flat = brw->ctx.Light.ShadeModel == GL_FLAT;
|
||||
|
||||
/* From the Ivybridge PRM, Vol 2 Part 1, 3DSTATE_SBE,
|
||||
* description of dw10 Point Sprite Texture Coordinate Enable:
|
||||
*
|
||||
* "This field must be programmed to zero when non-point primitives
|
||||
* are rendered."
|
||||
*
|
||||
* The SandyBridge PRM doesn't explicitly say that point sprite enables
|
||||
* must be programmed to zero when rendering non-point primitives, but
|
||||
* the IvyBridge PRM does, and if we don't, we get garbage.
|
||||
*
|
||||
* This is not required on Haswell, as the hardware ignores this state
|
||||
* when drawing non-points -- although we do still need to be careful to
|
||||
* correctly set the attr overrides.
|
||||
*/
|
||||
/* BRW_NEW_PRIMITIVE | BRW_NEW_GEOMETRY_PROGRAM */
|
||||
bool drawing_points = is_drawing_points(brw);
|
||||
|
||||
/* Initialize all the attr_overrides to 0. In the loop below we'll modify
|
||||
* just the ones that correspond to inputs used by the fs.
|
||||
*/
|
||||
|
|
@ -167,18 +198,20 @@ calculate_attr_overrides(const struct brw_context *brw,
|
|||
|
||||
/* _NEW_POINT */
|
||||
bool point_sprite = false;
|
||||
if (brw->ctx.Point.PointSprite &&
|
||||
(attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) &&
|
||||
brw->ctx.Point.CoordReplace[attr - VARYING_SLOT_TEX0]) {
|
||||
point_sprite = true;
|
||||
if (drawing_points) {
|
||||
if (brw->ctx.Point.PointSprite &&
|
||||
(attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) &&
|
||||
brw->ctx.Point.CoordReplace[attr - VARYING_SLOT_TEX0]) {
|
||||
point_sprite = true;
|
||||
}
|
||||
|
||||
if (attr == VARYING_SLOT_PNTC)
|
||||
point_sprite = true;
|
||||
|
||||
if (point_sprite)
|
||||
*point_sprite_enables |= (1 << input_index);
|
||||
}
|
||||
|
||||
if (attr == VARYING_SLOT_PNTC)
|
||||
point_sprite = true;
|
||||
|
||||
if (point_sprite)
|
||||
*point_sprite_enables |= (1 << input_index);
|
||||
|
||||
/* flat shading */
|
||||
if (interp_qualifier == INTERP_QUALIFIER_FLAT ||
|
||||
(shade_model_flat && is_gl_Color &&
|
||||
|
|
@ -410,7 +443,9 @@ const struct brw_tracked_state gen6_sf_state = {
|
|||
_NEW_POINT |
|
||||
_NEW_MULTISAMPLE),
|
||||
.brw = (BRW_NEW_CONTEXT |
|
||||
BRW_NEW_FRAGMENT_PROGRAM |
|
||||
BRW_NEW_FRAGMENT_PROGRAM |
|
||||
BRW_NEW_GEOMETRY_PROGRAM |
|
||||
BRW_NEW_PRIMITIVE |
|
||||
BRW_NEW_VUE_MAP_GEOM_OUT),
|
||||
.cache = CACHE_NEW_WM_PROG
|
||||
},
|
||||
|
|
|
|||
|
|
@ -92,7 +92,9 @@ const struct brw_tracked_state gen7_sbe_state = {
|
|||
_NEW_POINT |
|
||||
_NEW_PROGRAM),
|
||||
.brw = (BRW_NEW_CONTEXT |
|
||||
BRW_NEW_FRAGMENT_PROGRAM |
|
||||
BRW_NEW_FRAGMENT_PROGRAM |
|
||||
BRW_NEW_GEOMETRY_PROGRAM |
|
||||
BRW_NEW_PRIMITIVE |
|
||||
BRW_NEW_VUE_MAP_GEOM_OUT),
|
||||
.cache = CACHE_NEW_WM_PROG
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue