#include "frontend/sw_winsys.h"
#include "gallium/auxiliary/util/u_transfer.h"
#include "gallium/auxiliary/util/u_surface.h"
+#include "gallium/auxiliary/util/u_framebuffer.h"
#include "agx_public.h"
#include "agx_state.h"
#include "magic.h"
}
static void
-agx_destroy_context(struct pipe_context *ctx)
+agx_destroy_context(struct pipe_context *pctx)
{
- if (ctx->stream_uploader)
- u_upload_destroy(ctx->stream_uploader);
+ struct agx_context *ctx = agx_context(pctx);
+
+ if (pctx->stream_uploader)
+ u_upload_destroy(pctx->stream_uploader);
+
+ util_unreference_framebuffer_state(&ctx->framebuffer);
FREE(ctx);
}
#include "gallium/auxiliary/util/u_helpers.h"
#include "gallium/auxiliary/util/u_viewport.h"
#include "gallium/auxiliary/util/u_blend.h"
+#include "gallium/auxiliary/util/u_framebuffer.h"
#include "gallium/auxiliary/tgsi/tgsi_from_mesa.h"
#include "gallium/auxiliary/nir/tgsi_to_nir.h"
#include "compiler/nir/nir.h"
struct agx_zsa *so = CALLOC_STRUCT(agx_zsa);
assert(!state->depth_bounds_test && "todo");
+ so->base = *state;
so->disable_z_write = !state->depth_writemask;
/* Z func can be used as-is */
cfg.compare_func = agx_compare_funcs[state->compare_func];
}
- return bo;
+ struct agx_sampler_state *so = CALLOC_STRUCT(agx_sampler_state);
+ so->base = *state;
+ so->desc = bo;
+
+ return so;
}
static void
{
struct agx_context *ctx = agx_context(pctx);
+ ctx->stage[shader].sampler_count = states ? count : 0;
+
memcpy(&ctx->stage[shader].samplers[start], states,
- sizeof(struct agx_bo *) * count);
+ sizeof(struct agx_sampler_state *) * count);
}
/* Channels agree for RGBA but are weird for force 0/1 */
static void
agx_set_sample_mask(struct pipe_context *pipe, unsigned sample_mask)
{
+ struct agx_context *ctx = agx_context(pipe);
+ ctx->sample_mask = sample_mask;
}
static void
}
static void
-agx_set_stencil_ref(struct pipe_context *ctx,
+agx_set_stencil_ref(struct pipe_context *pctx,
const struct pipe_stencil_ref state)
{
+ struct agx_context *ctx = agx_context(pctx);
+ ctx->stencil_ref = state;
}
static void
/* XXX: eliminate this flush with batch tracking logic */
pctx->flush(pctx, NULL, 0);
+ util_copy_framebuffer_state(&ctx->framebuffer, state);
ctx->batch->width = state->width;
ctx->batch->height = state->height;
ctx->batch->nr_cbufs = state->nr_cbufs;
const struct pipe_shader_state *cso)
{
struct agx_uncompiled_shader *so = CALLOC_STRUCT(agx_uncompiled_shader);
+ so->base = *cso;
if (!so)
return NULL;
}
for (unsigned i = 0; i < PIPE_MAX_SAMPLERS; ++i) {
- struct agx_bo *bo = ctx->stage[stage].samplers[i];
+ struct agx_sampler_state *sampler = ctx->stage[stage].samplers[i];
- if (!bo)
+ if (!sampler)
continue;
+ struct agx_bo *bo = sampler->desc;
agx_batch_add_bo(ctx->batch, bo);
agx_pack(record, BIND_SAMPLER, cfg) {
};
struct agx_uncompiled_shader {
+ struct pipe_shader_state base;
struct nir_shader *nir;
struct hash_table *variants;
struct pipe_constant_buffer cb[PIPE_MAX_CONSTANT_BUFFERS];
uint32_t cb_mask;
- /* BOs for bound samplers. This is all the information we need at
- * draw time to assemble the pipeline */
- struct agx_bo *samplers[PIPE_MAX_SAMPLERS];
-
- /* Sampler views need the full CSO due to Gallium state management */
+ /* Need full CSOs for u_blitter */
+ struct agx_sampler_state *samplers[PIPE_MAX_SAMPLERS];
struct agx_sampler_view *textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
- unsigned texture_count;
+
+ unsigned sampler_count, texture_count;
};
/* Uploaded scissor descriptors */
};
struct agx_zsa {
+ struct pipe_depth_stencil_alpha_state base;
enum agx_zs_func z_func;
bool disable_z_write;
};
struct pipe_blend_color blend_color;
struct pipe_viewport_state viewport;
struct pipe_scissor_state scissor;
+ struct pipe_stencil_ref stencil_ref;
struct agx_streamout streamout;
+ uint16_t sample_mask;
+ struct pipe_framebuffer_state framebuffer;
+
+ struct pipe_query *cond_query;
+ bool cond_cond;
+ enum pipe_render_cond_flag cond_mode;
+
+ bool is_noop;
uint8_t render_target[8][AGX_RENDER_TARGET_LENGTH];
};
unsigned query;
};
+struct agx_sampler_state {
+ struct pipe_sampler_state base;
+
+ /* Prepared descriptor */
+ struct agx_bo *desc;
+};
+
struct agx_sampler_view {
struct pipe_sampler_view base;