void *vertex_shader, *vertex_shader_saved;
void *geometry_shader, *geometry_shader_saved;
void *velements, *velements_saved;
+ struct pipe_query *render_condition, *render_condition_saved;
+ uint render_condition_mode, render_condition_mode_saved;
struct pipe_clip_state clip;
struct pipe_clip_state clip_saved;
}
}
+void cso_set_render_condition(struct cso_context *ctx,
+ struct pipe_query *query, uint mode)
+{
+ struct pipe_context *pipe = ctx->pipe;
+
+ if (ctx->render_condition != query || ctx->render_condition_mode != mode) {
+ pipe->render_condition(pipe, query, mode);
+ ctx->render_condition = query;
+ ctx->render_condition_mode = mode;
+ }
+}
+
+void cso_save_render_condition(struct cso_context *ctx)
+{
+ ctx->render_condition_saved = ctx->render_condition;
+ ctx->render_condition_mode_saved = ctx->render_condition_mode;
+}
+
+void cso_restore_render_condition(struct cso_context *ctx)
+{
+ cso_set_render_condition(ctx, ctx->render_condition_saved,
+ ctx->render_condition_mode_saved);
+}
+
enum pipe_error cso_set_geometry_shader_handle(struct cso_context *ctx,
void *handle)
{
void cso_save_stencil_ref(struct cso_context *cso);
void cso_restore_stencil_ref(struct cso_context *cso);
+void cso_set_render_condition(struct cso_context *cso,
+ struct pipe_query *query, uint mode);
+void cso_save_render_condition(struct cso_context *cso);
+void cso_restore_render_condition(struct cso_context *cso);
+
/* clip state */
cso_save_vertex_shader(cso);
cso_save_viewport(cso);
cso_save_aux_vertex_buffer_slot(cso);
+ cso_save_render_condition(cso);
/* set default state */
cso_set_sample_mask(cso, ~0);
cso_set_stream_outputs(cso, 0, NULL, 0);
cso_set_geometry_shader_handle(cso, NULL);
+ cso_set_render_condition(cso, NULL, 0);
// Kept only for this frame.
pipe_resource_reference(&ppq->depth, indepth);
cso_restore_vertex_shader(cso);
cso_restore_viewport(cso);
cso_restore_aux_vertex_buffer_slot(cso);
+ cso_restore_render_condition(cso);
pipe_resource_reference(&ppq->depth, NULL);
pipe_resource_reference(&refin, NULL);
cso_save_geometry_shader(ctx->cso);
cso_save_vertex_elements(ctx->cso);
cso_save_aux_vertex_buffer_slot(ctx->cso);
+ cso_save_render_condition(ctx->cso);
/* set misc state we care about */
if (writemask)
cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
cso_set_stream_outputs(ctx->cso, 0, NULL, 0);
+ cso_set_render_condition(ctx->cso, NULL, 0);
/* default sampler state */
ctx->sampler.normalized_coords = normalized;
cso_restore_vertex_elements(ctx->cso);
cso_restore_aux_vertex_buffer_slot(ctx->cso);
cso_restore_stream_outputs(ctx->cso);
+ cso_restore_render_condition(ctx->cso);
pipe_sampler_view_reference(&sampler_view, NULL);
if (dst_surface != dst)
cso_save_viewport(ctx->cso);
cso_save_vertex_elements(ctx->cso);
cso_save_aux_vertex_buffer_slot(ctx->cso);
+ cso_save_render_condition(ctx->cso);
/* bind our state */
cso_set_blend(ctx->cso, is_depth ? &ctx->blend_keep_color :
cso_set_sample_mask(ctx->cso, ~0);
cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
cso_set_stream_outputs(ctx->cso, 0, NULL, 0);
+ cso_set_render_condition(ctx->cso, NULL, 0);
set_fragment_shader(ctx, type, is_depth);
set_vertex_shader(ctx);
cso_restore_vertex_elements(ctx->cso);
cso_restore_stream_outputs(ctx->cso);
cso_restore_aux_vertex_buffer_slot(ctx->cso);
+ cso_restore_render_condition(ctx->cso);
}
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
+#include "cso_cache/cso_context.h"
#include "st_context.h"
#include "st_cb_queryobj.h"
#include "st_cb_condrender.h"
{
struct st_query_object *stq = st_query_object(q);
struct st_context *st = st_context(ctx);
- struct pipe_context *pipe = st->pipe;
uint m;
st_flush_bitmap_cache(st);
m = PIPE_RENDER_COND_WAIT;
}
- st->render_condition = stq->pq;
- st->condition_mode = m;
-
- pipe->render_condition(pipe, stq->pq, m);
+ cso_set_render_condition(st->cso_context, stq->pq, m);
}
st_EndConditionalRender(struct gl_context *ctx, struct gl_query_object *q)
{
struct st_context *st = st_context(ctx);
- struct pipe_context *pipe = st->pipe;
(void) q;
st_flush_bitmap_cache(st);
- pipe->render_condition(pipe, NULL, 0);
- st->render_condition = NULL;
+ cso_set_render_condition(st->cso_context, NULL, 0);
}
goto fallback;
}
- /* Disable conditional rendering. */
- if (st->render_condition) {
- pipe->render_condition(pipe, NULL, 0);
- }
-
memset(&surf_tmpl, 0, sizeof(surf_tmpl));
surf_tmpl.format = util_format_linear(stImage->pt->format);
surf_tmpl.usage = dst_usage;
0.0, PIPE_TEX_MIPFILTER_NEAREST,
color_writemask, 0);
pipe_surface_reference(&dest_surface, NULL);
-
- /* Restore conditional rendering state. */
- if (st->render_condition) {
- pipe->render_condition(pipe, st->render_condition,
- st->condition_mode);
- }
-
return;
fallback:
/* The number of vertex buffers from the last call of validate_arrays. */
unsigned last_num_vbuffers;
- /* Active render condition. */
- struct pipe_query *render_condition;
- unsigned condition_mode;
-
int32_t draw_stamp;
int32_t read_stamp;
psv = st_create_texture_sampler_view(pipe, stObj->pt);
- /* Disable conditional rendering. */
- if (st->render_condition) {
- pipe->render_condition(pipe, NULL, 0);
- }
-
util_gen_mipmap(st->gen_mipmap, psv, face, baseLevel, lastLevel,
PIPE_TEX_FILTER_LINEAR);
- if (st->render_condition) {
- pipe->render_condition(pipe, st->render_condition, st->condition_mode);
- }
-
pipe_sampler_view_reference(&psv, NULL);
return TRUE;