From 1371d65a7fbd695d3516861fe733685569d890d0 Mon Sep 17 00:00:00 2001 From: Vadim Girlin Date: Fri, 2 Aug 2013 06:38:23 +0400 Subject: r600g: initial support for geometry shaders on evergreen (v2) This is Vadim's initial work with a few regression fixes squashed in. v2: (airlied) fix regression in glsl-max-varyings - need to use vs and ps_dirty fix regression in shader exports from rebasing. whitespace fixing. v2.1: squash fix assert Signed-off-by: Vadim Girlin Signed-off-by: Dave Airlie Reviewed-by: Alex Deucher --- src/gallium/drivers/r600/sb/sb_bc.h | 2 ++ src/gallium/drivers/r600/sb/sb_bc_dump.cpp | 2 +- src/gallium/drivers/r600/sb/sb_bc_finalize.cpp | 2 +- src/gallium/drivers/r600/sb/sb_bc_parser.cpp | 11 +++++++++-- src/gallium/drivers/r600/sb/sb_shader.cpp | 3 ++- 5 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src/gallium/drivers/r600/sb') diff --git a/src/gallium/drivers/r600/sb/sb_bc.h b/src/gallium/drivers/r600/sb/sb_bc.h index 73b8b08ba39..d03da98777d 100644 --- a/src/gallium/drivers/r600/sb/sb_bc.h +++ b/src/gallium/drivers/r600/sb/sb_bc.h @@ -169,8 +169,10 @@ enum shader_target { TARGET_UNKNOWN, TARGET_VS, + TARGET_ES, TARGET_PS, TARGET_GS, + TARGET_GS_COPY, TARGET_COMPUTE, TARGET_FETCH, diff --git a/src/gallium/drivers/r600/sb/sb_bc_dump.cpp b/src/gallium/drivers/r600/sb/sb_bc_dump.cpp index 9b1420d3895..f79dff16ee3 100644 --- a/src/gallium/drivers/r600/sb/sb_bc_dump.cpp +++ b/src/gallium/drivers/r600/sb/sb_bc_dump.cpp @@ -137,7 +137,7 @@ void bc_dump::dump(cf_node& n) { for (int k = 0; k < 4; ++k) s << chans[n.bc.sel[k]]; - } else if (n.bc.op_ptr->flags & (CF_STRM | CF_RAT)) { + } else if (n.bc.op_ptr->flags & CF_MEM) { static const char *exp_type[] = {"WRITE", "WRITE_IND", "WRITE_ACK", "WRITE_IND_ACK"}; fill_to(s, 18); diff --git a/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp b/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp index 355eb63810c..d9654832259 100644 --- a/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp +++ b/src/gallium/drivers/r600/sb/sb_bc_finalize.cpp @@ -63,7 +63,7 @@ int bc_finalizer::run() { // workaround for some problems on r6xx/7xx // add ALU NOP to each vertex shader - if (!ctx.is_egcm() && sh.target == TARGET_VS) { + if (!ctx.is_egcm() && (sh.target == TARGET_VS || sh.target == TARGET_ES)) { cf_node *c = sh.create_clause(NST_ALU_CLAUSE); alu_group_node *g = sh.create_alu_group(); diff --git a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp index 67e6c3a582d..24c4854225d 100644 --- a/src/gallium/drivers/r600/sb/sb_bc_parser.cpp +++ b/src/gallium/drivers/r600/sb/sb_bc_parser.cpp @@ -58,7 +58,10 @@ int bc_parser::decode() { if (pshader) { switch (bc->type) { case TGSI_PROCESSOR_FRAGMENT: t = TARGET_PS; break; - case TGSI_PROCESSOR_VERTEX: t = TARGET_VS; break; + case TGSI_PROCESSOR_VERTEX: + t = pshader->vs_as_es ? TARGET_ES : TARGET_VS; + break; + case TGSI_PROCESSOR_GEOMETRY: t = TARGET_GS; break; case TGSI_PROCESSOR_COMPUTE: t = TARGET_COMPUTE; break; default: assert(!"unknown shader target"); return -1; break; } @@ -134,8 +137,12 @@ int bc_parser::parse_decls() { } } - if (sh->target == TARGET_VS) + if (sh->target == TARGET_VS || sh->target == TARGET_ES) sh->add_input(0, 1, 0x0F); + else if (sh->target == TARGET_GS) { + sh->add_input(0, 1, 0x0F); + sh->add_input(1, 1, 0x0F); + } bool ps_interp = ctx.hw_class >= HW_CLASS_EVERGREEN && sh->target == TARGET_PS; diff --git a/src/gallium/drivers/r600/sb/sb_shader.cpp b/src/gallium/drivers/r600/sb/sb_shader.cpp index 38617a85330..f996c0786d1 100644 --- a/src/gallium/drivers/r600/sb/sb_shader.cpp +++ b/src/gallium/drivers/r600/sb/sb_shader.cpp @@ -215,7 +215,7 @@ void shader::init() { void shader::init_call_fs(cf_node* cf) { unsigned gpr = 0; - assert(target == TARGET_VS); + assert(target == TARGET_VS || target == TARGET_ES); for(inputs_vec::const_iterator I = inputs.begin(), E = inputs.end(); I != E; ++I, ++gpr) { @@ -433,6 +433,7 @@ std::string shader::get_full_target_name() { const char* shader::get_shader_target_name() { switch (target) { case TARGET_VS: return "VS"; + case TARGET_ES: return "ES"; case TARGET_PS: return "PS"; case TARGET_GS: return "GS"; case TARGET_COMPUTE: return "COMPUTE"; -- cgit v1.2.3