diff options
Diffstat (limited to 'src/gallium/drivers/freedreno/a2xx/fd2_program.c')
-rw-r--r-- | src/gallium/drivers/freedreno/a2xx/fd2_program.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_program.c b/src/gallium/drivers/freedreno/a2xx/fd2_program.c index c4c23ff0d5b..9efc473b4a7 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_program.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_program.c @@ -166,30 +166,15 @@ static void patch_vtx_fetch(struct fd_context *ctx, struct pipe_vertex_element *elem, instr_fetch_vtx_t *instr, uint16_t dst_swiz) { - struct pipe_vertex_buffer *vb = - &ctx->vtx.vertexbuf.vb[elem->vertex_buffer_index]; - enum pipe_format format = elem->src_format; - const struct util_format_description *desc = - util_format_description(format); - unsigned j; - - /* Find the first non-VOID channel. */ - for (j = 0; j < 4; j++) - if (desc->channel[j].type != UTIL_FORMAT_TYPE_VOID) - break; - - instr->format = fd2_pipe2surface(format); - instr->num_format_all = !desc->channel[j].normalized; - instr->format_comp_all = desc->channel[j].type == UTIL_FORMAT_TYPE_SIGNED; - instr->stride = vb->stride; + struct surface_format fmt = fd2_pipe2surface(elem->src_format); + + instr->dst_swiz = fd2_vtx_swiz(elem->src_format, dst_swiz); + instr->format_comp_all = fmt.sign == SQ_TEX_SIGN_SIGNED; + instr->num_format_all = fmt.num_format; + instr->format = fmt.format; + instr->exp_adjust_all = fmt.exp_adjust; + instr->stride = ctx->vtx.vertexbuf.vb[elem->vertex_buffer_index].stride; instr->offset = elem->src_offset; - - unsigned swiz = 0; - for (int i = 0; i < 4; i++) { - unsigned s = dst_swiz >> i*3 & 7; - swiz |= (s >= 4 ? s : desc->swizzle[s]) << i*3; - } - instr->dst_swiz = swiz; } static void |