diff options
author | Brian Paul <[email protected]> | 2016-02-09 14:19:25 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2016-02-09 17:47:42 -0700 |
commit | a5b8ede25319217843f8ff7681a0af5ad4aab84a (patch) | |
tree | 0a3972bed247e604a3a3b72aab0fceb5aae2ff0b | |
parent | c624241ef47c3a6ea2d1177969328bd4547e45a2 (diff) |
st/mesa: move some st_cb_drawpixels.c code, add comments
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 04a9de06520..9c1eba49dcd 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -648,6 +648,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, sampler.normalized_coords = normalized; if (fpv) { + /* drawing a color image */ const struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS]; uint num = MAX2(MAX2(fpv->drawpix_sampler, fpv->pixelmap_sampler) + 1, st->state.num_samplers[PIPE_SHADER_FRAGMENT]); @@ -662,12 +663,33 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, num, samplers); } else { + /* drawing a depth/stencil image */ const struct pipe_sampler_state *samplers[2] = {&sampler, &sampler}; cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, num_sampler_view, samplers); } } + /* user textures, plus the drawpix textures */ + if (fpv) { + /* drawing a color image */ + struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS]; + uint num = MAX3(fpv->drawpix_sampler + 1, + fpv->pixelmap_sampler + 1, + st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]); + + memcpy(sampler_views, st->state.sampler_views[PIPE_SHADER_FRAGMENT], + sizeof(sampler_views)); + + sampler_views[fpv->drawpix_sampler] = sv[0]; + if (sv[1]) + sampler_views[fpv->pixelmap_sampler] = sv[1]; + cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num, sampler_views); + } else { + /* drawing a depth/stencil image */ + cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num_sampler_view, sv); + } + /* viewport state: viewport matching window dims */ { const float w = (float) ctx->DrawBuffer->Width; @@ -685,23 +707,6 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_set_vertex_elements(cso, 3, st->velems_util_draw); cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); - /* user textures, plus the drawpix textures */ - if (fpv) { - struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS]; - uint num = MAX3(fpv->drawpix_sampler + 1, - fpv->pixelmap_sampler + 1, - st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]); - - memcpy(sampler_views, st->state.sampler_views[PIPE_SHADER_FRAGMENT], - sizeof(sampler_views)); - - sampler_views[fpv->drawpix_sampler] = sv[0]; - if (sv[1]) - sampler_views[fpv->pixelmap_sampler] = sv[1]; - cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num, sampler_views); - } else - cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num_sampler_view, sv); - /* Compute Gallium window coords (y=0=top) with pixel zoom. * Recall that these coords are transformed by the current * vertex shader and viewport transformation. |