diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.c | 46 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.h | 29 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_shader.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 |
4 files changed, 61 insertions, 18 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 037d31a1643..ca2589ac996 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -104,8 +104,11 @@ struct ureg_program unsigned interp; unsigned char cylindrical_wrap; unsigned interp_location; + unsigned first; + unsigned last; + unsigned array_id; } fs_input[UREG_MAX_INPUT]; - unsigned nr_fs_inputs; + unsigned nr_fs_inputs, nr_fs_input_regs; unsigned vs_inputs[UREG_MAX_INPUT/32]; @@ -254,30 +257,42 @@ ureg_DECL_fs_input_cyl_centroid(struct ureg_program *ureg, unsigned semantic_index, unsigned interp_mode, unsigned cylindrical_wrap, - unsigned interp_location) + unsigned interp_location, + unsigned array_id, + unsigned array_size) { unsigned i; for (i = 0; i < ureg->nr_fs_inputs; i++) { if (ureg->fs_input[i].semantic_name == semantic_name && ureg->fs_input[i].semantic_index == semantic_index) { + assert(ureg->fs_input[i].interp == interp_mode); + assert(ureg->fs_input[i].cylindrical_wrap == cylindrical_wrap); + assert(ureg->fs_input[i].interp_location == interp_location); + assert(ureg->fs_input[i].array_id == array_id); goto out; } } if (ureg->nr_fs_inputs < UREG_MAX_INPUT) { + assert(array_size >= 1); ureg->fs_input[i].semantic_name = semantic_name; ureg->fs_input[i].semantic_index = semantic_index; ureg->fs_input[i].interp = interp_mode; ureg->fs_input[i].cylindrical_wrap = cylindrical_wrap; ureg->fs_input[i].interp_location = interp_location; + ureg->fs_input[i].first = ureg->nr_fs_input_regs; + ureg->fs_input[i].last = ureg->nr_fs_input_regs + array_size - 1; + ureg->fs_input[i].array_id = array_id; + ureg->nr_fs_input_regs += array_size; ureg->nr_fs_inputs++; } else { set_bad(ureg); } out: - return ureg_src_register(TGSI_FILE_INPUT, i); + return ureg_src_array_register(TGSI_FILE_INPUT, ureg->fs_input[i].first, + array_id); } @@ -1281,14 +1296,17 @@ emit_decl_semantic(struct ureg_program *ureg, static void emit_decl_fs(struct ureg_program *ureg, unsigned file, - unsigned index, + unsigned first, + unsigned last, unsigned semantic_name, unsigned semantic_index, unsigned interpolate, unsigned cylindrical_wrap, - unsigned interpolate_location) + unsigned interpolate_location, + unsigned array_id) { - union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 4); + union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, + array_id ? 5 : 4); out[0].value = 0; out[0].decl.Type = TGSI_TOKEN_TYPE_DECLARATION; @@ -1297,10 +1315,11 @@ emit_decl_fs(struct ureg_program *ureg, out[0].decl.UsageMask = TGSI_WRITEMASK_XYZW; /* FIXME! */ out[0].decl.Interpolate = 1; out[0].decl.Semantic = 1; + out[0].decl.Array = array_id != 0; out[1].value = 0; - out[1].decl_range.First = index; - out[1].decl_range.Last = index; + out[1].decl_range.First = first; + out[1].decl_range.Last = last; out[2].value = 0; out[2].decl_interp.Interpolate = interpolate; @@ -1310,6 +1329,11 @@ emit_decl_fs(struct ureg_program *ureg, out[3].value = 0; out[3].decl_semantic.Name = semantic_name; out[3].decl_semantic.Index = semantic_index; + + if (array_id) { + out[4].value = 0; + out[4].array.ArrayID = array_id; + } } static void @@ -1464,12 +1488,14 @@ static void emit_decls( struct ureg_program *ureg ) for (i = 0; i < ureg->nr_fs_inputs; i++) { emit_decl_fs(ureg, TGSI_FILE_INPUT, - i, + ureg->fs_input[i].first, + ureg->fs_input[i].last, ureg->fs_input[i].semantic_name, ureg->fs_input[i].semantic_index, ureg->fs_input[i].interp, ureg->fs_input[i].cylindrical_wrap, - ureg->fs_input[i].interp_location); + ureg->fs_input[i].interp_location, + ureg->fs_input[i].array_id); } } else { for (i = 0; i < ureg->nr_gs_inputs; i++) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index c3f4012f2b9..37846d5be8d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -172,7 +172,9 @@ ureg_DECL_fs_input_cyl_centroid(struct ureg_program *, unsigned semantic_index, unsigned interp_mode, unsigned cylindrical_wrap, - unsigned interp_location); + unsigned interp_location, + unsigned array_id, + unsigned array_size); static INLINE struct ureg_src ureg_DECL_fs_input_cyl(struct ureg_program *ureg, @@ -186,7 +188,7 @@ ureg_DECL_fs_input_cyl(struct ureg_program *ureg, semantic_index, interp_mode, cylindrical_wrap, - 0); + 0, 0, 1); } static INLINE struct ureg_src @@ -199,7 +201,7 @@ ureg_DECL_fs_input(struct ureg_program *ureg, semantic_name, semantic_index, interp_mode, - 0, 0); + 0, 0, 0, 1); } struct ureg_src @@ -1162,6 +1164,13 @@ ureg_src_dimension_indirect( struct ureg_src reg, struct ureg_src addr, return reg; } +static INLINE struct ureg_src +ureg_src_array_offset(struct ureg_src reg, int offset) +{ + reg.Index += offset; + return reg; +} + static INLINE struct ureg_dst ureg_dst_array_offset( struct ureg_dst reg, int offset ) { @@ -1236,8 +1245,9 @@ ureg_dst( struct ureg_src src ) } static INLINE struct ureg_src -ureg_src_register(unsigned file, - unsigned index) +ureg_src_array_register(unsigned file, + unsigned index, + unsigned array_id) { struct ureg_src src; @@ -1259,12 +1269,19 @@ ureg_src_register(unsigned file, src.DimIndFile = TGSI_FILE_NULL; src.DimIndIndex = 0; src.DimIndSwizzle = 0; - src.ArrayID = 0; + src.ArrayID = array_id; return src; } static INLINE struct ureg_src +ureg_src_register(unsigned file, + unsigned index) +{ + return ureg_src_array_register(file, index, 0); +} + +static INLINE struct ureg_src ureg_src( struct ureg_dst dst ) { struct ureg_src src; diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index fd0f76e1118..cdd4918530b 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -1979,7 +1979,7 @@ DECL_SPECIAL(DCL) ureg, tgsi.Name, tgsi.Index, nine_tgsi_to_interp_mode(&tgsi), 0, /* cylwrap */ - sem.reg.mod & NINED3DSPDM_CENTROID); + sem.reg.mod & NINED3DSPDM_CENTROID, 0, 1); } else if (!is_input && 0) { /* declare in COLOROUT/DEPTHOUT case */ /* FragColor or FragDepth */ diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index db190c943a4..72b47b7421b 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5149,7 +5149,7 @@ st_translate_program( inputSemanticName[i], inputSemanticIndex[i], interpMode[i], 0, - interpLocation[i]); + interpLocation[i], 0, 1); } if (proginfo->InputsRead & VARYING_BIT_POS) { |