diff options
author | Dave Airlie <airlied@redhat.com> | 2014-03-03 16:21:09 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-03-03 16:21:09 +1000 |
commit | ddbed4545b60b6b8babee26b9ef300c6eefb7b39 (patch) | |
tree | 27d0f21a8470fad5b47132c06c25b94df7a13933 | |
parent | 3793b979c3a6e57db509fbb1996df3c03bfd066a (diff) |
handle new apis
-rw-r--r-- | src/gallium/drivers/virgl/graw_context.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/virgl/graw_encode.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/virgl/graw_encode.h | 2 | ||||
-rw-r--r-- | src/gallium/renderer/graw_decode.c | 16 | ||||
-rw-r--r-- | src/gallium/renderer/graw_renderer.c | 14 | ||||
-rw-r--r-- | src/gallium/renderer/graw_renderer.h | 2 |
6 files changed, 29 insertions, 17 deletions
diff --git a/src/gallium/drivers/virgl/graw_context.c b/src/gallium/drivers/virgl/graw_context.c index f6ff7ea28ae..2f26a96e25e 100644 --- a/src/gallium/drivers/virgl/graw_context.c +++ b/src/gallium/drivers/virgl/graw_context.c @@ -556,7 +556,7 @@ static void graw_set_sampler_views(struct pipe_context *ctx, tinfo->enabled_mask &= ~disable_mask; tinfo->enabled_mask |= new_mask; - graw_encode_set_sampler_views(grctx, shader_type, num_views, tinfo->views); + graw_encode_set_sampler_views(grctx, shader_type, start_slot, num_views, tinfo->views); } static void graw_destroy_sampler_view(struct pipe_context *ctx, @@ -602,7 +602,7 @@ static void graw_bind_sampler_states(struct pipe_context *ctx, for (i = 0; i < num_samplers; i++) { handles[i] = (unsigned long)(samplers[i]); } - graw_encode_bind_sampler_states(grctx, shader, num_samplers, handles); + graw_encode_bind_sampler_states(grctx, shader, start_slot, num_samplers, handles); } static void graw_set_polygon_stipple(struct pipe_context *ctx, diff --git a/src/gallium/drivers/virgl/graw_encode.c b/src/gallium/drivers/virgl/graw_encode.c index d6b3bacd4d0..1bcfe244f34 100644 --- a/src/gallium/drivers/virgl/graw_encode.c +++ b/src/gallium/drivers/virgl/graw_encode.c @@ -488,12 +488,14 @@ int graw_encode_sampler_view(struct graw_context *ctx, int graw_encode_set_sampler_views(struct graw_context *ctx, uint32_t shader_type, + uint32_t start_slot, uint32_t num_views, struct graw_sampler_view **views) { int i; - graw_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_SET_SAMPLER_VIEWS, 0, num_views + 1)); + graw_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_SET_SAMPLER_VIEWS, 0, num_views + 2)); graw_encoder_write_dword(ctx->cbuf, shader_type); + graw_encoder_write_dword(ctx->cbuf, start_slot); for (i = 0; i < num_views; i++) { uint32_t handle = views[i] ? views[i]->handle : 0; graw_encoder_write_dword(ctx->cbuf, handle); @@ -506,12 +508,14 @@ int graw_encode_set_sampler_views(struct graw_context *ctx, int graw_encode_bind_sampler_states(struct graw_context *ctx, uint32_t shader_type, + uint32_t start_slot, uint32_t num_handles, uint32_t *handles) { int i; - graw_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_BIND_SAMPLER_STATES, 0, num_handles + 1)); + graw_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_BIND_SAMPLER_STATES, 0, num_handles + 2)); graw_encoder_write_dword(ctx->cbuf, shader_type); + graw_encoder_write_dword(ctx->cbuf, start_slot); for (i = 0; i < num_handles; i++) graw_encoder_write_dword(ctx->cbuf, handles[i]); return 0; diff --git a/src/gallium/drivers/virgl/graw_encode.h b/src/gallium/drivers/virgl/graw_encode.h index 2bc2cabcc34..50cadf15042 100644 --- a/src/gallium/drivers/virgl/graw_encode.h +++ b/src/gallium/drivers/virgl/graw_encode.h @@ -119,11 +119,13 @@ int graw_encode_sampler_view(struct graw_context *ctx, int graw_encode_set_sampler_views(struct graw_context *ctx, uint32_t shader_type, + uint32_t start_slot, uint32_t num_views, struct graw_sampler_view **views); int graw_encode_bind_sampler_states(struct graw_context *ctx, uint32_t shader_type, + uint32_t start_slot, uint32_t num_handles, uint32_t *handles); diff --git a/src/gallium/renderer/graw_decode.c b/src/gallium/renderer/graw_decode.c index 96151aa9535..ad48c1c1839 100644 --- a/src/gallium/renderer/graw_decode.c +++ b/src/gallium/renderer/graw_decode.c @@ -182,14 +182,15 @@ static void graw_decode_set_sampler_views(struct grend_decode_ctx *ctx, uint16_t { int num_samps; int i; - uint32_t shader_type; - num_samps = length - 1; + uint32_t shader_type, start_slot; + num_samps = length - 2; shader_type = ctx->ds->buf[ctx->ds->buf_offset + 1]; + start_slot = ctx->ds->buf[ctx->ds->buf_offset + 2]; for (i = 0; i < num_samps; i++) { - uint32_t handle = ctx->ds->buf[ctx->ds->buf_offset + 2 + i]; - grend_set_single_sampler_view(ctx->grctx, shader_type, i, handle); + uint32_t handle = ctx->ds->buf[ctx->ds->buf_offset + 3 + i]; + grend_set_single_sampler_view(ctx->grctx, shader_type, i + start_slot, handle); } - grend_set_num_sampler_views(ctx->grctx, shader_type, num_samps); + grend_set_num_sampler_views(ctx->grctx, shader_type, start_slot, num_samps); } static void graw_decode_resource_inline_write(struct grend_decode_ctx *ctx, uint16_t length) @@ -658,10 +659,11 @@ static void graw_decode_blit(struct grend_decode_ctx *ctx) static void graw_decode_bind_sampler_states(struct grend_decode_ctx *ctx, int length) { uint32_t shader_type = ctx->ds->buf[ctx->ds->buf_offset + 1]; + uint32_t start_slot = ctx->ds->buf[ctx->ds->buf_offset + 2]; uint32_t num_states = length - 1; - grend_bind_sampler_states(ctx->grctx, shader_type, num_states, - &ctx->ds->buf[ctx->ds->buf_offset + 2]); + grend_bind_sampler_states(ctx->grctx, shader_type, start_slot, num_states, + &ctx->ds->buf[ctx->ds->buf_offset + 3]); } static void graw_decode_begin_query(struct grend_decode_ctx *ctx) diff --git a/src/gallium/renderer/graw_renderer.c b/src/gallium/renderer/graw_renderer.c index c36654d7bb7..dd04b3ed96a 100644 --- a/src/gallium/renderer/graw_renderer.c +++ b/src/gallium/renderer/graw_renderer.c @@ -1282,14 +1282,15 @@ void grend_set_single_sampler_view(struct grend_context *ctx, void grend_set_num_sampler_views(struct grend_context *ctx, uint32_t shader_type, + uint32_t start_slot, int num_sampler_views) { - if (num_sampler_views < ctx->views[shader_type].num_views) { + if (start_slot + num_sampler_views < ctx->views[shader_type].num_views) { int i; - for (i = num_sampler_views; i < ctx->views[shader_type].num_views; i++) + for (i = start_slot + num_sampler_views; i < ctx->views[shader_type].num_views; i++) grend_sampler_view_reference(&ctx->views[shader_type].views[i], NULL); } - ctx->views[shader_type].num_views = num_sampler_views; + ctx->views[shader_type].num_views = start_slot + num_sampler_views; } void grend_transfer_inline_write(struct grend_context *ctx, @@ -2437,6 +2438,7 @@ static GLuint convert_wrap(int wrap) void grend_bind_sampler_states(struct grend_context *ctx, uint32_t shader_type, + uint32_t start_slot, uint32_t num_states, uint32_t *handles) { @@ -2451,7 +2453,7 @@ void grend_bind_sampler_states(struct grend_context *ctx, else state = vrend_object_lookup(ctx->object_hash, handles[i], VIRGL_OBJECT_SAMPLER_STATE); - ctx->sampler_state[shader_type][i] = state; + ctx->sampler_state[shader_type][i + start_slot] = state; } ctx->sampler_state_dirty = TRUE; } @@ -2638,8 +2640,8 @@ bool grend_destroy_context(struct grend_context *ctx) /* reset references on framebuffers */ grend_set_framebuffer_state(ctx, 0, NULL, 0); - grend_set_num_sampler_views(ctx, PIPE_SHADER_VERTEX, 0); - grend_set_num_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0); + grend_set_num_sampler_views(ctx, PIPE_SHADER_VERTEX, 0, 0); + grend_set_num_sampler_views(ctx, PIPE_SHADER_FRAGMENT, 0, 0); grend_set_streamout_targets(ctx, 0, 0, NULL); grend_set_num_vbo(ctx, 0); diff --git a/src/gallium/renderer/graw_renderer.h b/src/gallium/renderer/graw_renderer.h index 3460259e694..5bc76e054f3 100644 --- a/src/gallium/renderer/graw_renderer.h +++ b/src/gallium/renderer/graw_renderer.h @@ -162,6 +162,7 @@ void grend_set_viewport_state(struct grend_context *ctx, const struct pipe_viewport_state *state); void grend_set_num_sampler_views(struct grend_context *ctx, uint32_t shader_type, + uint32_t start_slot, int num_sampler_views); void grend_set_single_sampler_view(struct grend_context *ctx, uint32_t shader_type, @@ -177,6 +178,7 @@ void grend_object_bind_rasterizer(struct grend_context *ctx, void grend_bind_sampler_states(struct grend_context *ctx, uint32_t shader_type, + uint32_t start_slot, uint32_t num_states, uint32_t *handles); void grend_set_index_buffer(struct grend_context *ctx, |