summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorTopi Pohjolainen <[email protected]>2016-05-17 16:41:23 +0300
committerTopi Pohjolainen <[email protected]>2016-07-04 20:43:11 +0300
commit741a245ae41546f9e2660575e90beb17fccc333f (patch)
tree0651fd4e31d5a983a2fb1bf6e534c26301b85587 /src/mesa/drivers
parent01f2f364d4c12c951d81137454917fe7728ecad7 (diff)
i965/blorp: Load tranformation coordinates as vec4
In preparation for loading as flat vertex input. v2: Use LOAD_INPUT() macro Signed-off-by: Topi Pohjolainen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp.h3
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_blit.cpp24
2 files changed, 11 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h
index f5dba5823db..3f77ca4a37f 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -212,8 +212,7 @@ struct brw_blorp_wm_inputs
{
struct brw_blorp_discard_rect discard_rect;
struct brw_blorp_rect_grid rect_grid;
- struct brw_blorp_coord_transform x_transform;
- struct brw_blorp_coord_transform y_transform;
+ struct brw_blorp_coord_transform coord_transform[2];
/* Minimum layer setting works for all the textures types but texture_3d
* for which the setting has no effect. Use the z-coordinate instead.
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index dbf33e1a98d..0d9fb92a59a 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -333,10 +333,7 @@ struct brw_blorp_blit_vars {
/* Input values from brw_blorp_wm_inputs */
nir_variable *u_discard_rect;
nir_variable *u_rect_grid;
- struct {
- nir_variable *multiplier;
- nir_variable *offset;
- } u_x_transform, u_y_transform;
+ nir_variable *u_coord_transform;
nir_variable *u_src_z;
/* gl_FragCoord */
@@ -360,10 +357,7 @@ brw_blorp_blit_vars_init(nir_builder *b, struct brw_blorp_blit_vars *v,
LOAD_INPUT(discard_rect, glsl_vec4_type())
LOAD_INPUT(rect_grid, glsl_vec4_type())
- LOAD_INPUT(x_transform.multiplier, glsl_float_type())
- LOAD_INPUT(x_transform.offset, glsl_float_type())
- LOAD_INPUT(y_transform.multiplier, glsl_float_type())
- LOAD_INPUT(y_transform.offset, glsl_float_type())
+ LOAD_INPUT(coord_transform, glsl_vec4_type())
LOAD_INPUT(src_z, glsl_uint_type())
#undef LOAD_INPUT
@@ -401,10 +395,12 @@ nir_ssa_def *
blorp_blit_apply_transform(nir_builder *b, nir_ssa_def *src_pos,
struct brw_blorp_blit_vars *v)
{
- nir_ssa_def *offset = nir_vec2(b, nir_load_var(b, v->u_x_transform.offset),
- nir_load_var(b, v->u_y_transform.offset));
- nir_ssa_def *mul = nir_vec2(b, nir_load_var(b, v->u_x_transform.multiplier),
- nir_load_var(b, v->u_y_transform.multiplier));
+ nir_ssa_def *coord_transform = nir_load_var(b, v->u_coord_transform);
+
+ nir_ssa_def *offset = nir_vec2(b, nir_channel(b, coord_transform, 1),
+ nir_channel(b, coord_transform, 3));
+ nir_ssa_def *mul = nir_vec2(b, nir_channel(b, coord_transform, 0),
+ nir_channel(b, coord_transform, 2));
return nir_ffma(b, src_pos, mul, offset);
}
@@ -1847,9 +1843,9 @@ brw_blorp_blit_miptrees(struct brw_context *brw,
params.wm_inputs.rect_grid.y1 =
minify(src_mt->logical_height0, src_level) * wm_prog_key.y_scale - 1.0f;
- brw_blorp_setup_coord_transform(&params.wm_inputs.x_transform,
+ brw_blorp_setup_coord_transform(&params.wm_inputs.coord_transform[0],
src_x0, src_x1, dst_x0, dst_x1, mirror_x);
- brw_blorp_setup_coord_transform(&params.wm_inputs.y_transform,
+ brw_blorp_setup_coord_transform(&params.wm_inputs.coord_transform[1],
src_y0, src_y1, dst_y0, dst_y1, mirror_y);
if (brw->gen >= 8 && params.src.mt->target == GL_TEXTURE_3D) {