[Mesa-dev] [PATCH 10/11] radeonsi: implement streamout shader support

Michel Dänzer michel at daenzer.net
Thu Sep 5 02:57:16 PDT 2013


On Die, 2013-09-03 at 15:23 +0200, Marek Olšák wrote:
> The shader is responsible for writing to streamout buffers using
> the TBUFFER_STORE_FORMAT_* instructions.
> 
> The locations of some input SGPRs and VGPRs are assigned dynamically, because
> the input SGPRs controlling streamout are not declared if they are not needed,
> decreasing the indices of all following inputs.
> ---
>  src/gallium/drivers/radeonsi/radeonsi_shader.c | 279 ++++++++++++++++++++++++-
>  src/gallium/drivers/radeonsi/radeonsi_shader.h |   5 +-
>  src/gallium/drivers/radeonsi/si_state_draw.c   |   7 +-
>  3 files changed, 276 insertions(+), 15 deletions(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> index 335cd79..92f7cf5 100644
> --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
> +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c

[...]

> +			/* Pack the output. */
> +			LLVMValueRef vdata;
> +
> +			switch (num_comps) {
> +			case 1: /* as i32 */
> +				vdata = out[0];
> +				break;
> +			case 2: /* as v2i32 */
> +			case 3: /* as v4i32 (aligned to 4) */
> +			case 4: /* as v4i32 */
> +				vdata = LLVMGetUndef(LLVMVectorType(i32, util_next_power_of_two(num_comps)));
> +				for (j = 0; j < num_comps; j++) {
> +					vdata = LLVMBuildInsertElement(builder, vdata, out[j],
> +								       LLVMConstInt(i32, j, 0), "");
> +				}
> +				break;
> +			}

This introduces a warning:

.../radeonsi_shader.c: In function 'si_llvm_emit_epilogue':
.../radeonsi_shader.c:708:15: warning: 'vdata' may be used uninitialized in this function [-Wmaybe-uninitialized]
  LLVMValueRef args[] = {
               ^
.../radeonsi_shader.c:840:17: note: 'vdata' was declared here
    LLVMValueRef vdata;
                 ^

Other than that, the series looks good to me.


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer



More information about the mesa-dev mailing list