[Mesa-dev] [PATCH 11/14] i965/blorp: Ignore color setup in fast clears and resolves
Topi Pohjolainen
topi.pohjolainen at intel.com
Wed May 25 16:08:46 UTC 2016
Before:
START B0
mov(4) g114<1>F g2.3<8,2,4>F { align1 WE_all };
sendc(16) null<1>UW g114<8,8,1>F
render RT write SIMD16/RepData LastRT Surface = 0 mlen 1 rlen 0
{ align1 1H EOT };
END B0
After:
START B0
sendc(16) null<1>UW g114<8,8,1>F
render RT write SIMD16/RepData LastRT Surface = 0 mlen 1 rlen 0
{ align1 1H EOT };
END B0
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 43 ++++++++++++++++++++-------
1 file changed, 33 insertions(+), 10 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
index 5aa420f..3848e3e 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
@@ -44,17 +44,35 @@
struct brw_blorp_const_color_prog_key
{
bool use_simd16_replicated_data;
- bool pad[3];
+
+ /* Fast color clears and resolves ignore the actual color values in
+ * the rep-clear message payload. Therefore the actual setup of the
+ * color values in the program can be omitted also.
+ *
+ * From the BSpec: 3D Pipeline Stages - Pixel - Pixel Backend [IVB+] -
+ * Render Target Resolve [IVB+] Issues Info
+ *
+ * The pixel shader kernel requires no attributes, but must deliver a
+ * render target write message covering all pixels and all render targets
+ * desired to be resolved The color data in these messages is ignored
+ * (the replicated color message is required).
+ */
+ bool ignores_color_value;
+ bool pad[2];
};
static void
brw_blorp_params_get_clear_kernel(struct brw_context *brw,
struct brw_blorp_params *params,
- bool use_replicated_data)
+ bool use_replicated_data,
+ bool ignores_color_value)
{
+ assert(!ignores_color_value || use_replicated_data);
+
struct brw_blorp_const_color_prog_key blorp_key;
memset(&blorp_key, 0, sizeof(blorp_key));
blorp_key.use_simd16_replicated_data = use_replicated_data;
+ blorp_key.ignores_color_value = ignores_color_value;
if (brw_search_cache(&brw->cache, BRW_CACHE_BLORP_PROG,
&blorp_key, sizeof(blorp_key),
@@ -67,16 +85,18 @@ brw_blorp_params_get_clear_kernel(struct brw_context *brw,
nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_FRAGMENT, NULL);
b.shader->info.name = ralloc_strdup(b.shader, "BLORP-clear");
- nir_variable *u_color = nir_variable_create(b.shader, nir_var_uniform,
- glsl_vec4_type(), "u_color");
- u_color->data.location = 0;
-
nir_variable *frag_color = nir_variable_create(b.shader, nir_var_shader_out,
glsl_vec4_type(),
"gl_FragColor");
frag_color->data.location = FRAG_RESULT_COLOR;
- nir_copy_var(&b, frag_color, u_color);
+ if (!ignores_color_value) {
+ nir_variable *u_color = nir_variable_create(b.shader, nir_var_uniform,
+ glsl_vec4_type(), "u_color");
+ u_color->data.location = 0;
+
+ nir_copy_var(&b, frag_color, u_color);
+ }
struct brw_wm_prog_key wm_key;
brw_blorp_init_wm_prog_key(&wm_key);
@@ -84,7 +104,8 @@ brw_blorp_params_get_clear_kernel(struct brw_context *brw,
struct brw_blorp_prog_data prog_data;
unsigned program_size;
const int flags =
- use_replicated_data ? BRW_FS_COMPILER_OPTION_REP_SEND : 0;
+ (use_replicated_data ? BRW_FS_COMPILER_OPTION_REP_SEND : 0) |
+ (ignores_color_value ? BRW_FS_COMPILER_OPTION_IGNORE_COLOR : 0);
const unsigned *program =
brw_blorp_compile_nir_shader(brw, b.shader, &wm_key, flags,
&prog_data, &program_size);
@@ -187,7 +208,9 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,
¶ms.x1, ¶ms.y1);
}
- brw_blorp_params_get_clear_kernel(brw, ¶ms, use_simd16_replicated_data);
+ brw_blorp_params_get_clear_kernel(brw, ¶ms,
+ use_simd16_replicated_data,
+ params.fast_clear_op);
const bool is_fast_clear =
params.fast_clear_op == GEN7_PS_RENDER_TARGET_FAST_CLEAR_ENABLE;
@@ -325,7 +348,7 @@ brw_blorp_resolve_color(struct brw_context *brw, struct intel_mipmap_tree *mt)
* color" message.
*/
- brw_blorp_params_get_clear_kernel(brw, ¶ms, true);
+ brw_blorp_params_get_clear_kernel(brw, ¶ms, true, true);
brw_blorp_exec(brw, ¶ms);
mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
--
2.5.5
More information about the mesa-dev
mailing list