[Mesa-dev] [PATCH 10/10] r600g: add initial cube map array support

Dave Airlie airlied at gmail.com
Thu Nov 8 11:59:54 PST 2012


On Thu, Nov 8, 2012 at 11:01 PM, Marek Olšák <maraeo at gmail.com> wrote:
> On Tue, Nov 6, 2012 at 11:16 PM, Dave Airlie <airlied at gmail.com> wrote:
>> This contains the evergreen support.
>>
>> Support is possible on rv670 upwards and the code in here
>> should work, but it doesn't and I haven't debugged it to
>> figure out why.
>>
>> Beyond just adding support for the cube map array sampling,
>> r600 resinfo isn't conformant with the GL specification,
>> which states the number of layers should be returned for
>> the textureSize, so we have to track in an external
>> constant buffer the layers for each sampler if we need
>> them in the shader.
>>
>> Signed-off-by: Dave Airlie <airlied at redhat.com>
>> ---
>>  src/gallium/drivers/r600/evergreen_state.c   |   4 +-
>>  src/gallium/drivers/r600/r600_blit.c         |   1 +
>>  src/gallium/drivers/r600/r600_pipe.c         |   1 +
>>  src/gallium/drivers/r600/r600_pipe.h         |   6 +-
>>  src/gallium/drivers/r600/r600_shader.c       | 198 +++++++++++++++++++++++++--
>>  src/gallium/drivers/r600/r600_shader.h       |   1 +
>>  src/gallium/drivers/r600/r600_state.c        |   4 +-
>>  src/gallium/drivers/r600/r600_state_common.c |  33 +++++
>>  src/gallium/drivers/r600/r600_texture.c      |   1 +
>>  9 files changed, 235 insertions(+), 14 deletions(-)
>>
>> diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
>> index c105e55..5f87cdb 100644
>> --- a/src/gallium/drivers/r600/evergreen_state.c
>> +++ b/src/gallium/drivers/r600/evergreen_state.c
>> @@ -174,6 +174,7 @@ static unsigned r600_tex_dim(unsigned dim, unsigned nr_samples)
>>         case PIPE_TEXTURE_3D:
>>                 return V_030000_SQ_TEX_DIM_3D;
>>         case PIPE_TEXTURE_CUBE:
>> +       case PIPE_TEXTURE_CUBE_ARRAY:
>>                 return V_030000_SQ_TEX_DIM_CUBEMAP;
>>         }
>>  }
>> @@ -1073,7 +1074,8 @@ evergreen_create_sampler_view_custom(struct pipe_context *ctx,
>>                 depth = texture->array_size;
>>         } else if (texture->target == PIPE_TEXTURE_2D_ARRAY) {
>>                 depth = texture->array_size;
>> -       }
>> +       } else if (texture->target == PIPE_TEXTURE_CUBE_ARRAY)
>> +               depth = (texture->array_size + 1) / 6;
>
> Why "+ 1"?

pointless rounding, I think I fed a fair few values in figuring it
out! will drop it.

>>
>> +       if (rctx->ps_shader && rctx->ps_shader->current->shader.has_txq_cube_array_z_comp)
>> +               r600_setup_txq_cube_array_constants(rctx, PIPE_SHADER_FRAGMENT);
>> +       if (rctx->vs_shader && rctx->vs_shader->current->shader.has_txq_cube_array_z_comp)
>> +               r600_setup_txq_cube_array_constants(rctx, PIPE_SHADER_VERTEX);
>> +
>
> I would prefer if the constant buffers were updated only if the
> sampler views were updated as well, so that it's not updated in every
> draw command that has a shader querying the array size.

probably makes sense, I was mostly thinking that nobody would use this
that often, and having it work for the sake of compliance :-), but
yeah makes sense to only update in that case.
>
> So what does GET_TEXTURE_RESINFO return in this case? 6? 1?

seems to return 0, and the DX10 opcode doesn't define a value in this
case, it leaves it as undefined.

Dave.


More information about the mesa-dev mailing list