diff options
author | Chia-I Wu <[email protected]> | 2015-06-18 22:47:20 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2015-06-20 11:18:10 +0800 |
commit | dcb5bad3a3a8ff116c32ecb01827ea8461fa2baa (patch) | |
tree | ad46976e46aad83846ee8beb86c82976c828d54c /src/gallium/drivers/ilo | |
parent | e3372c4bfb8d5960714651ca7d3f1acc0018a8fa (diff) |
ilo: move gen6_so_SURFACE_STATE() out of core
It does not belong to core.
Diffstat (limited to 'src/gallium/drivers/ilo')
-rw-r--r-- | src/gallium/drivers/ilo/core/ilo_builder_3d_top.h | 52 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_render_surface.c | 53 |
2 files changed, 53 insertions, 52 deletions
diff --git a/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h b/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h index 398586bbad8..a8873ed5e2f 100644 --- a/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h +++ b/src/gallium/drivers/ilo/core/ilo_builder_3d_top.h @@ -1317,58 +1317,6 @@ gen6_SURFACE_STATE(struct ilo_builder *builder, } static inline uint32_t -gen6_so_SURFACE_STATE(struct ilo_builder *builder, - const struct pipe_stream_output_target *so, - const struct pipe_stream_output_info *so_info, - int so_index) -{ - struct ilo_buffer *buf = ilo_buffer(so->buffer); - struct ilo_state_surface_buffer_info info; - struct ilo_state_surface surf; - - ILO_DEV_ASSERT(builder->dev, 6, 6); - - memset(&info, 0, sizeof(info)); - info.buf = buf; - info.access = ILO_STATE_SURFACE_ACCESS_DP_SVB; - - switch (so_info->output[so_index].num_components) { - case 1: - info.format = GEN6_FORMAT_R32_FLOAT; - info.format_size = 4; - break; - case 2: - info.format = GEN6_FORMAT_R32G32_FLOAT; - info.format_size = 8; - break; - case 3: - info.format = GEN6_FORMAT_R32G32B32_FLOAT; - info.format_size = 12; - break; - case 4: - info.format = GEN6_FORMAT_R32G32B32A32_FLOAT; - info.format_size = 16; - break; - default: - assert(!"unexpected SO components length"); - info.format = GEN6_FORMAT_R32_FLOAT; - info.format_size = 4; - break; - } - - info.struct_size = - so_info->stride[so_info->output[so_index].output_buffer] * 4; - info.offset = so->buffer_offset + so_info->output[so_index].dst_offset * 4; - info.size = so->buffer_size - so_info->output[so_index].dst_offset * 4; - - memset(&surf, 0, sizeof(surf)); - ilo_state_surface_init_for_buffer(&surf, builder->dev, &info); - surf.bo = info.buf->bo; - - return gen6_SURFACE_STATE(builder, &surf); -} - -static inline uint32_t gen6_SAMPLER_STATE(struct ilo_builder *builder, const struct ilo_state_sampler *samplers, const uint32_t *sampler_border_colors, diff --git a/src/gallium/drivers/ilo/ilo_render_surface.c b/src/gallium/drivers/ilo/ilo_render_surface.c index bbdd5fe7a0a..ad053564294 100644 --- a/src/gallium/drivers/ilo/ilo_render_surface.c +++ b/src/gallium/drivers/ilo/ilo_render_surface.c @@ -29,12 +29,65 @@ #include "ilo_common.h" #include "ilo_blitter.h" +#include "ilo_resource.h" #include "ilo_shader.h" #include "ilo_state.h" #include "ilo_render_gen.h" #define DIRTY(state) (session->pipe_dirty & ILO_DIRTY_ ## state) +static inline uint32_t +gen6_so_SURFACE_STATE(struct ilo_builder *builder, + const struct pipe_stream_output_target *so, + const struct pipe_stream_output_info *so_info, + int so_index) +{ + struct ilo_buffer *buf = ilo_buffer(so->buffer); + struct ilo_state_surface_buffer_info info; + struct ilo_state_surface surf; + + ILO_DEV_ASSERT(builder->dev, 6, 6); + + memset(&info, 0, sizeof(info)); + info.buf = buf; + info.access = ILO_STATE_SURFACE_ACCESS_DP_SVB; + + switch (so_info->output[so_index].num_components) { + case 1: + info.format = GEN6_FORMAT_R32_FLOAT; + info.format_size = 4; + break; + case 2: + info.format = GEN6_FORMAT_R32G32_FLOAT; + info.format_size = 8; + break; + case 3: + info.format = GEN6_FORMAT_R32G32B32_FLOAT; + info.format_size = 12; + break; + case 4: + info.format = GEN6_FORMAT_R32G32B32A32_FLOAT; + info.format_size = 16; + break; + default: + assert(!"unexpected SO components length"); + info.format = GEN6_FORMAT_R32_FLOAT; + info.format_size = 4; + break; + } + + info.struct_size = + so_info->stride[so_info->output[so_index].output_buffer] * 4; + info.offset = so->buffer_offset + so_info->output[so_index].dst_offset * 4; + info.size = so->buffer_size - so_info->output[so_index].dst_offset * 4; + + memset(&surf, 0, sizeof(surf)); + ilo_state_surface_init_for_buffer(&surf, builder->dev, &info); + surf.bo = info.buf->bo; + + return gen6_SURFACE_STATE(builder, &surf); +} + static void gen6_emit_draw_surface_rt(struct ilo_render *r, const struct ilo_state_vector *vec, |