[Mesa-dev] [PATCH 09/22] i965/meta: Store destination bounding rectangle as a vec4
Ian Romanick
idr at freedesktop.org
Thu Feb 18 01:58:02 UTC 2016
From: Ian Romanick <ian.d.romanick at intel.com>
This has a few small benefits.
1. Reduces the size (and the tracking size) of the shaders. This should
basically undo the text expansion done previously.
2. Reduces the number of _mesa_Uniform* calls from 4 to 1. This means
half as much time spent doing redundant validation of parameters, etc.
3. Allows the use of _mesa_Uniform*v. On x64, the non-v path takes the
value in a register, stores it on the stack, and calls _mesa_uniform
with a pointer to that stack location. A future patch could call
_mesa_uniform directly.
text data bss dec hex filename
5126552 209888 28120 5364560 51db50 before-64/lib64/i965_dri.so
5126424 209888 28120 5364432 51dad0 after-64/lib64/i965_dri.so
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c | 27 +++++++++++------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
index 782dda0..ba41cb1 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
@@ -105,11 +105,8 @@ static const struct sampler_and_fetch {
#define src_off_loc 1
#define dst_off_loc 2
#define draw_rect_loc 3
-#define dst_x0_loc 8
-#define dst_x1_loc 9
-#define dst_y0_loc 10
-#define dst_y1_loc 11
-#define dst_num_samples_loc 12
+#define bounding_rect_loc 4
+#define dst_num_samples_loc 5
/**
* Translating Y-tiled to W-tiled:
@@ -139,11 +136,11 @@ static const char *fs_tmpl =
/* Bounding rectangle in the W-tiled space that will be used to skip pixels
* lying outside. In some cases the Y-tiled rectangle is larger.
+ *
+ * x = minimum x (inclusive), y = maximum x (exclusive),
+ * z = minimum y (inclusive), w = maximum y (exclusive).
*/
- DECLARE_UNIFORM(int, dst_x0)
- DECLARE_UNIFORM(int, dst_x1)
- DECLARE_UNIFORM(int, dst_y0)
- DECLARE_UNIFORM(int, dst_y1)
+ DECLARE_UNIFORM(ivec4, bounding_rect)
DECLARE_UNIFORM(int, dst_num_samples)
"in vec2 tex_coords;\n"
@@ -210,7 +207,8 @@ static const char *fs_tmpl =
"{\n"
" int X = txl_coords.x;\n"
" int Y = txl_coords.y;\n"
- " if (X >= dst_x1 || X < dst_x0 || Y >= dst_y1 || Y < dst_y0)\n"
+ " if (X >= bounding_rect.y || X < bounding_rect.x ||\n"
+ " Y >= bounding_rect.w || Y < bounding_rect.z)\n"
" discard;\n"
"}\n"
"\n"
@@ -234,10 +232,11 @@ static const char *fs_tmpl =
static void
setup_bounding_rect(const struct blit_dims *dims)
{
- _mesa_Uniform1i(dst_x0_loc, dims->dst_x0);
- _mesa_Uniform1i(dst_x1_loc, dims->dst_x1);
- _mesa_Uniform1i(dst_y0_loc, dims->dst_y0);
- _mesa_Uniform1i(dst_y1_loc, dims->dst_y1);
+ const int bounding_rect[4] = {
+ dims->dst_x0, dims->dst_x1, dims->dst_y0, dims->dst_y1
+ };
+
+ _mesa_Uniform4iv(bounding_rect_loc, 1, bounding_rect);
}
/**
--
2.5.0
More information about the mesa-dev
mailing list