These cso_context capabilities will be removed.
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8180>
#endif
struct cso_context;
+struct st_context_iface;
struct pp_queue_t; /* Forward definition */
struct pp_program;
*/
struct pp_queue_t *pp_init(struct pipe_context *pipe,
const unsigned int *enabled,
- struct cso_context *);
+ struct cso_context *,
+ struct st_context_iface *st);
void pp_run(struct pp_queue_t *, struct pipe_resource *,
struct pipe_resource *, struct pipe_resource *);
{
struct pp_program *p = ppq->p;
+ struct pipe_context *pipe = p->pipe;
const struct pipe_sampler_state *samplers[] = {&p->sampler_point};
pp_filter_setup_in(p, in);
pp_filter_misc_state(p);
cso_set_samplers(p->cso, PIPE_SHADER_FRAGMENT, 1, samplers);
- cso_set_sampler_views(p->cso, PIPE_SHADER_FRAGMENT, 1, &p->view);
+ pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &p->view);
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][0]);
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][1]);
/** Initialize the post-processing queue. */
struct pp_queue_t *
pp_init(struct pipe_context *pipe, const unsigned int *enabled,
- struct cso_context *cso)
+ struct cso_context *cso, struct st_context_iface *st)
{
unsigned int num_filters = 0;
unsigned int curpos = 0, i, tmp_req = 0;
goto error;
}
- ppq->p = pp_init_prog(ppq, pipe, cso);
+ ppq->p = pp_init_prog(ppq, pipe, cso, st);
if (ppq->p == NULL) {
pp_debug("pp_init_prog returned NULL.\n");
goto error;
dimensions[1] = p->framebuffer.height;
}
- cso_set_constant_user_buffer(p->cso, PIPE_SHADER_VERTEX,
- 0, constants, sizeof(constants));
- cso_set_constant_user_buffer(p->cso, PIPE_SHADER_FRAGMENT,
- 0, constants, sizeof(constants));
+ struct pipe_constant_buffer cb;
+ cb.buffer = NULL;
+ cb.buffer_offset = 0;
+ cb.buffer_size = sizeof(constants);
+ cb.user_buffer = constants;
+
+ struct pipe_context *pipe = ppq->p->pipe;
+ pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, &cb);
+ pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, 0, &cb);
mstencil.stencil[0].enabled = 1;
mstencil.stencil[0].valuemask = mstencil.stencil[0].writemask = ~0;
const struct pipe_sampler_state *samplers[] = {&p->sampler_point};
cso_set_samplers(p->cso, PIPE_SHADER_FRAGMENT, 1, samplers);
}
- cso_set_sampler_views(p->cso, PIPE_SHADER_FRAGMENT, 1, &p->view);
+ pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, &p->view);
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][1]); /* offsetvs */
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][2]);
}
arr[0] = p->view;
- cso_set_sampler_views(p->cso, PIPE_SHADER_FRAGMENT, 3, arr);
+ pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 3, arr);
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][0]); /* passvs */
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][3]);
}
arr[1] = p->view;
- cso_set_sampler_views(p->cso, PIPE_SHADER_FRAGMENT, 2, arr);
+ pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 2, arr);
cso_set_vertex_shader_handle(p->cso, ppq->shaders[n][1]); /* offsetvs */
cso_set_fragment_shader_handle(p->cso, ppq->shaders[n][4]);
struct pipe_screen *screen;
struct pipe_context *pipe;
struct cso_context *cso;
+ struct st_context_iface *st;
struct pipe_blend_state blend;
struct pipe_depth_stencil_alpha_state depthstencil;
void pp_debug(const char *, ...);
struct pp_program *pp_init_prog(struct pp_queue_t *, struct pipe_context *pipe,
- struct cso_context *);
+ struct cso_context *, struct st_context_iface *st);
void pp_blit(struct pipe_context *pipe,
struct pipe_resource *src_tex,
/** Initialize the internal details */
struct pp_program *
pp_init_prog(struct pp_queue_t *ppq, struct pipe_context *pipe,
- struct cso_context *cso)
+ struct cso_context *cso, struct st_context_iface *st)
{
struct pp_program *p;
p->screen = pipe->screen;
p->pipe = pipe;
p->cso = cso;
+ p->st = st;
{
static const float verts[4][2][4] = {
#include "postprocess/pp_filters.h"
#include "postprocess/pp_private.h"
+#include "frontend/api.h"
#include "util/u_inlines.h"
#include "util/u_sampler.h"
CSO_BIT_SAMPLE_MASK |
CSO_BIT_MIN_SAMPLES |
CSO_BIT_FRAGMENT_SAMPLERS |
- CSO_BIT_FRAGMENT_SAMPLER_VIEWS |
CSO_BIT_STENCIL_REF |
CSO_BIT_STREAM_OUTPUTS |
CSO_BIT_VERTEX_ELEMENTS |
CSO_BIT_VERTEX_SHADER |
CSO_BIT_VIEWPORT |
- CSO_BIT_AUX_VERTEX_BUFFER_SLOT |
CSO_BIT_PAUSE_QUERIES |
CSO_BIT_RENDER_CONDITION));
- cso_save_constant_buffer_slot0(cso, PIPE_SHADER_VERTEX);
- cso_save_constant_buffer_slot0(cso, PIPE_SHADER_FRAGMENT);
/* set default state */
cso_set_sample_mask(cso, ~0);
/* restore state we changed */
cso_restore_state(cso);
- cso_restore_constant_buffer_slot0(cso, PIPE_SHADER_VERTEX);
- cso_restore_constant_buffer_slot0(cso, PIPE_SHADER_FRAGMENT);
+
+ /* Unbind resources that we have bound. */
+ struct pipe_context *pipe = ppq->p->pipe;
+ pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, NULL);
+ pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, 0, NULL);
+ pipe->set_vertex_buffers(pipe, 0, 1, NULL);
+ pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 3, NULL);
+
+ /* restore states not restored by cso */
+ if (ppq->p->st) {
+ ppq->p->st->invalidate_state(ppq->p->st,
+ ST_INVALIDATE_FS_SAMPLER_VIEWS |
+ ST_INVALIDATE_FS_CONSTBUF0 |
+ ST_INVALIDATE_VS_CONSTBUF0 |
+ ST_INVALIDATE_VERTEX_BUFFERS);
+ }
pipe_resource_reference(&ppq->depth, NULL);
pipe_resource_reference(&refin, NULL);
ctx->stapi = stapi;
if (ctx->st->cso_context) {
- ctx->pp = pp_init(ctx->st->pipe, screen->pp_enabled, ctx->st->cso_context);
+ ctx->pp = pp_init(ctx->st->pipe, screen->pp_enabled, ctx->st->cso_context,
+ ctx->st);
ctx->hud = hud_create(ctx->st->cso_context, ctx->st,
share_ctx ? share_ctx->hud : NULL);
}
if (any_pp_enabled) {
osmesa->pp = pp_init(osmesa->stctx->pipe,
osmesa->pp_enabled,
- osmesa->stctx->cso_context);
+ osmesa->stctx->cso_context,
+ osmesa->stctx);
pp_init_fbos(osmesa->pp, width, height);
}
// Init Gallium3D Post Processing
// TODO: no pp filters are enabled yet through postProcessEnable
context->postProcess = pp_init(stContext->pipe, context->postProcessEnable,
- stContext->cso_context);
+ stContext->cso_context, &stContext->iface);
context_id contextNext = -1;
Lock();