{R_028244_PA_SC_GENERIC_SCISSOR_BR, 0},
{R_028250_PA_SC_VPORT_SCISSOR_0_TL, 0},
{R_028254_PA_SC_VPORT_SCISSOR_0_BR, 0},
- {R_0282D0_PA_SC_VPORT_ZMIN_0, 0},
- {R_0282D4_PA_SC_VPORT_ZMAX_0, 0},
- {R_028350_PA_SC_RASTER_CONFIG, 0},
{GROUP_FORCE_NEW_BLOCK, 0},
{R_028400_VGT_MAX_VTX_INDX, 0},
{R_028404_VGT_MIN_VTX_INDX, 0},
{GROUP_FORCE_NEW_BLOCK, 0},
{R_028430_DB_STENCILREFMASK, 0},
{R_028434_DB_STENCILREFMASK_BF, 0},
- {R_02843C_PA_CL_VPORT_XSCALE_0, 0},
- {R_028440_PA_CL_VPORT_XOFFSET_0, 0},
- {R_028444_PA_CL_VPORT_YSCALE_0, 0},
- {R_028448_PA_CL_VPORT_YOFFSET_0, 0},
- {R_02844C_PA_CL_VPORT_ZSCALE_0, 0},
- {R_028450_PA_CL_VPORT_ZOFFSET_0, 0},
{R_028644_SPI_PS_INPUT_CNTL_0, 0},
{R_028648_SPI_PS_INPUT_CNTL_1, 0},
{R_02864C_SPI_PS_INPUT_CNTL_2, 0},
{R_02880C_DB_SHADER_CONTROL, 0},
{R_028810_PA_CL_CLIP_CNTL, 0},
{R_028814_PA_SU_SC_MODE_CNTL, 0},
- {R_028818_PA_CL_VTE_CNTL, 0},
{R_02881C_PA_CL_VS_OUT_CNTL, 0},
{R_028820_PA_CL_NANINF_CNTL, 0},
{R_028824_PA_SU_LINE_STIPPLE_CNTL, 0},
{
}
-static void evergreen_set_viewport_state(struct pipe_context *ctx,
- const struct pipe_viewport_state *state)
-{
- struct r600_context *rctx = (struct r600_context *)ctx;
- struct r600_pipe_state *rstate = CALLOC_STRUCT(r600_pipe_state);
-
- if (rstate == NULL)
- return;
-
- rctx->viewport = *state;
- rstate->id = R600_PIPE_STATE_VIEWPORT;
- r600_pipe_state_add_reg(rstate, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000, NULL, 0);
- r600_pipe_state_add_reg(rstate, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000, NULL, 0);
- r600_pipe_state_add_reg(rstate, R_028350_PA_SC_RASTER_CONFIG, 0x00000000, NULL, 0);
- r600_pipe_state_add_reg(rstate, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]), NULL, 0);
- r600_pipe_state_add_reg(rstate, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]), NULL, 0);
- r600_pipe_state_add_reg(rstate, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]), NULL, 0);
- r600_pipe_state_add_reg(rstate, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]), NULL, 0);
- r600_pipe_state_add_reg(rstate, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]), NULL, 0);
- r600_pipe_state_add_reg(rstate, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]), NULL, 0);
- r600_pipe_state_add_reg(rstate, R_028818_PA_CL_VTE_CNTL, 0x0000043F, NULL, 0);
-
- free(rctx->states[R600_PIPE_STATE_VIEWPORT]);
- rctx->states[R600_PIPE_STATE_VIEWPORT] = rstate;
- r600_context_pipe_state_set(rctx, rstate);
-}
-
static void evergreen_cb(struct r600_context *rctx, struct r600_pipe_state *rstate,
const struct pipe_framebuffer_state *state, int cb)
{
rctx->context.set_vertex_buffers = r600_set_vertex_buffers;
rctx->context.set_index_buffer = r600_set_index_buffer;
rctx->context.set_vertex_sampler_views = evergreen_set_vs_sampler_view;
- rctx->context.set_viewport_state = evergreen_set_viewport_state;
rctx->context.sampler_view_destroy = r600_sampler_view_destroy;
rctx->context.texture_barrier = r600_texture_barrier;
rctx->context.create_stream_output_target = r600_create_so_target;
#include "util/u_blitter.h"
#include "util/u_format.h"
#include "radeonsi_pipe.h"
+#include "si_state.h"
enum r600_blitter_op /* bitmask */
{
util_blitter_save_fragment_shader(rctx->blitter, rctx->ps_shader);
util_blitter_save_vertex_shader(rctx->blitter, rctx->vs_shader);
util_blitter_save_vertex_elements(rctx->blitter, rctx->vertex_elements);
- if (rctx->states[R600_PIPE_STATE_VIEWPORT]) {
- util_blitter_save_viewport(rctx->blitter, &rctx->viewport);
+ if (rctx->queued.named.viewport) {
+ util_blitter_save_viewport(rctx->blitter, &rctx->queued.named.viewport->viewport);
}
util_blitter_save_vertex_buffers(rctx->blitter,
rctx->nr_vertex_buffers,
enum r600_pipe_state_id {
R600_PIPE_STATE_CONFIG,
R600_PIPE_STATE_SEAMLESS_CUBEMAP,
- R600_PIPE_STATE_VIEWPORT,
R600_PIPE_STATE_RASTERIZER,
R600_PIPE_STATE_VGT,
R600_PIPE_STATE_FRAMEBUFFER,
unsigned pa_cl_vs_out_cntl;
/* for saving when using blitter */
struct pipe_stencil_ref stencil_ref;
- struct pipe_viewport_state viewport;
struct r600_pipe_state config;
struct si_pipe_shader *ps_shader;
struct si_pipe_shader *vs_shader;
si_pm4_set_state(rctx, scissor, pm4);
}
+static void si_set_viewport_state(struct pipe_context *ctx,
+ const struct pipe_viewport_state *state)
+{
+ struct r600_context *rctx = (struct r600_context *)ctx;
+ struct si_state_viewport *viewport = CALLOC_STRUCT(si_state_viewport);
+ struct si_pm4_state *pm4 = &viewport->pm4;
+
+ if (viewport == NULL)
+ return;
+
+ viewport->viewport = *state;
+ si_pm4_set_reg(pm4, R_0282D0_PA_SC_VPORT_ZMIN_0, 0x00000000);
+ si_pm4_set_reg(pm4, R_0282D4_PA_SC_VPORT_ZMAX_0, 0x3F800000);
+ si_pm4_set_reg(pm4, R_028350_PA_SC_RASTER_CONFIG, 0x00000000);
+ si_pm4_set_reg(pm4, R_02843C_PA_CL_VPORT_XSCALE_0, fui(state->scale[0]));
+ si_pm4_set_reg(pm4, R_028440_PA_CL_VPORT_XOFFSET_0, fui(state->translate[0]));
+ si_pm4_set_reg(pm4, R_028444_PA_CL_VPORT_YSCALE_0, fui(state->scale[1]));
+ si_pm4_set_reg(pm4, R_028448_PA_CL_VPORT_YOFFSET_0, fui(state->translate[1]));
+ si_pm4_set_reg(pm4, R_02844C_PA_CL_VPORT_ZSCALE_0, fui(state->scale[2]));
+ si_pm4_set_reg(pm4, R_028450_PA_CL_VPORT_ZOFFSET_0, fui(state->translate[2]));
+ si_pm4_set_reg(pm4, R_028818_PA_CL_VTE_CNTL, 0x0000043F);
+
+ si_pm4_set_state(rctx, viewport, viewport);
+}
+
void si_init_state_functions(struct r600_context *rctx)
{
rctx->context.create_blend_state = si_create_blend_state;
rctx->context.set_clip_state = si_set_clip_state;
rctx->context.set_scissor_state = si_set_scissor_state;
+ rctx->context.set_viewport_state = si_set_viewport_state;
}
uint32_t cb_color_control;
};
+struct si_state_viewport {
+ struct si_pm4_state pm4;
+ struct pipe_viewport_state viewport;
+};
+
union si_state {
struct {
- struct si_state_blend *blend;
- struct si_pm4_state *blend_color;
- struct si_pm4_state *clip;
- struct si_pm4_state *scissor;
+ struct si_state_blend *blend;
+ struct si_pm4_state *blend_color;
+ struct si_pm4_state *clip;
+ struct si_pm4_state *scissor;
+ struct si_state_viewport *viewport;
} named;
struct si_pm4_state *array[0];
};