[Mesa-dev] [PATCH 2/5] meta/blit: Write depth only when asked for
Topi Pohjolainen
topi.pohjolainen at intel.com
Thu Jan 29 06:21:01 PST 2015
Implementing an idea from Ken, on i965 the shader program for 2D
blits becomes significantly simpler.
Before:
pln(8) g6<1>F g4<0,1,0>F g2<8,8,1>F { align1 1Q compacted };
pln(8) g7<1>F g4.4<0,1,0>F g2<8,8,1>F { align1 1Q compacted };
send(8) g2<1>UW g6<8,8,1>F
sampler (1, 0, 0, 1) mlen 2 rlen 4 { align1 1Q };
mov(8) g123<1>F g2<8,8,1>F { align1 1Q compacted };
mov(8) g124<1>F g3<8,8,1>F { align1 1Q compacted };
mov(8) g125<1>F g4<8,8,1>F { align1 1Q compacted };
mov(8) g126<1>F g5<8,8,1>F { align1 1Q compacted };
mov(8) g127<1>F g2<8,8,1>F { align1 1Q compacted };
nop ;
sendc(8) null g123<8,8,1>F
render RT write SIMD8 LastRT Surface = 0 mlen 5 rlen 0 { align1 1Q EOT };
After:
pln(8) g6<1>F g4<0,1,0>F g2<8,8,1>F { align1 1Q compacted };
pln(8) g7<1>F g4.4<0,1,0>F g2<8,8,1>F { align1 1Q compacted };
send(8) g124<1>UW g6<8,8,1>F
sampler (1, 0, 0, 1) mlen 2 rlen 4 { align1 1Q };
sendc(8) null g124<8,8,1>F
render RT write SIMD8 LastRT Surface = 0 mlen 4 rlen 0 { align1 1Q EOT };
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
CC: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/common/meta.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index ec7564a..45035b1 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -293,13 +293,14 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
"void main()\n"
"{\n"
" gl_FragColor = %s(texSampler, %s);\n"
- " gl_FragDepth = gl_FragColor.x;\n"
+ "%s"
"}\n",
fs_preprocess, shader->type, fs_input,
- shader->func, shader->texcoords);
+ shader->func, shader->texcoords,
+ do_depth ? " gl_FragDepth = gl_FragColor.x;\n" : "");
_mesa_meta_compile_and_link_program(ctx, vs_source, fs_source,
- ralloc_asprintf(mem_ctx, "%s blit",
+ ralloc_asprintf(mem_ctx,"%s blit",
shader->type),
&shader->shader_prog);
ralloc_free(mem_ctx);
--
1.9.3
More information about the mesa-dev
mailing list