mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 05:50:11 +01:00
st/mesa: move some st_cb_drawpixels.c code, add comments
This commit is contained in:
parent
c624241ef4
commit
a5b8ede253
1 changed files with 22 additions and 17 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue