static bool
draw_vbo(struct ilo_3d *hw3d, const struct ilo_context *ilo,
- const struct pipe_draw_info *info,
int *prim_generated, int *prim_emitted)
{
bool need_flush = false;
if (need_flush)
ilo_3d_pipeline_emit_flush(hw3d->pipeline);
- return ilo_3d_pipeline_emit_draw(hw3d->pipeline, ilo, info,
+ return ilo_3d_pipeline_emit_draw(hw3d->pipeline, ilo,
prim_generated, prim_emitted);
}
}
static inline bool
-ilo_check_restart_index(struct ilo_context *ilo,
- const struct pipe_draw_info *info)
+ilo_check_restart_index(const struct ilo_context *ilo, unsigned restart_index)
{
/*
* Haswell (GEN(7.5)) supports an arbitrary cut index, check everything
/* Note: indices must be unsigned byte, unsigned short or unsigned int */
switch (ilo->ib.state.index_size) {
case 1:
- return ((info->restart_index & 0xff) == 0xff);
+ return ((restart_index & 0xff) == 0xff);
break;
case 2:
- return ((info->restart_index & 0xffff) == 0xffff);
+ return ((restart_index & 0xffff) == 0xffff);
break;
case 4:
- return (info->restart_index == 0xffffffff);
+ return (restart_index == 0xffffffff);
break;
}
return false;
}
static inline bool
-ilo_check_restart_prim_type(struct ilo_context *ilo,
- const struct pipe_draw_info *info)
+ilo_check_restart_prim_type(const struct ilo_context *ilo, unsigned prim)
{
- switch (info->mode) {
+ switch (prim) {
case PIPE_PRIM_POINTS:
case PIPE_PRIM_LINES:
case PIPE_PRIM_LINE_STRIP:
* Want to draw an indexed primitive using primitive restart
* Check that HW can handle the request and fall to SW if not.
*/
- if (!ilo_check_restart_index(ilo, info) ||
- !ilo_check_restart_prim_type(ilo, info)) {
+ if (!ilo_check_restart_index(ilo, info->restart_index) ||
+ !ilo_check_restart_prim_type(ilo, info->mode)) {
ilo_draw_vbo_with_sw_restart(pipe, info);
return;
}
}
- ilo_finalize_states(ilo);
+ ilo_finalize_3d_states(ilo, info);
if (!upload_shaders(hw3d, ilo->shader_cache))
return;
/* If draw_vbo ever fails, return immediately. */
- if (!draw_vbo(hw3d, ilo, info, &prim_generated, &prim_emitted))
+ if (!draw_vbo(hw3d, ilo, &prim_generated, &prim_emitted))
return;
/* clear dirty status */
bool
ilo_3d_pipeline_emit_draw(struct ilo_3d_pipeline *p,
const struct ilo_context *ilo,
- const struct pipe_draw_info *info,
int *prim_generated, int *prim_emitted)
{
bool success;
/* draw! */
ilo_cp_assert_no_implicit_flush(p->cp, true);
- p->emit_draw(p, ilo, info);
+ p->emit_draw(p, ilo);
ilo_cp_assert_no_implicit_flush(p->cp, false);
err = intel_winsys_check_aperture_space(ilo->winsys, &p->cp->bo, 1);
}
if (success) {
- const int num_verts = u_vertices_per_prim(u_reduced_prim(info->mode));
+ const int num_verts =
+ u_vertices_per_prim(u_reduced_prim(ilo->draw->mode));
const int max_emit =
(p->state.so_max_vertices - p->state.so_num_vertices) / num_verts;
- const int generated = u_reduced_prims_for_vertices(info->mode, info->count);
+ const int generated =
+ u_reduced_prims_for_vertices(ilo->draw->mode, ilo->draw->count);
const int emitted = MIN2(generated, max_emit);
p->state.so_num_vertices += emitted * num_verts;
#include "ilo_gpe_gen6.h"
#include "ilo_gpe_gen7.h"
-struct pipe_draw_info;
struct intel_bo;
struct ilo_cp;
struct ilo_context;
const void *arg);
void (*emit_draw)(struct ilo_3d_pipeline *pipeline,
- const struct ilo_context *ilo,
- const struct pipe_draw_info *info);
+ const struct ilo_context *ilo);
void (*emit_flush)(struct ilo_3d_pipeline *pipeline);
bool
ilo_3d_pipeline_emit_draw(struct ilo_3d_pipeline *p,
const struct ilo_context *ilo,
- const struct pipe_draw_info *info,
int *prim_generated, int *prim_emitted);
void
/* 3DSTATE_INDEX_BUFFER */
if (DIRTY(INDEX_BUFFER) || session->batch_bo_changed) {
p->gen6_3DSTATE_INDEX_BUFFER(p->dev,
- &ilo->ib.state, session->info->primitive_restart, p->cp);
+ &ilo->ib.state, ilo->draw->primitive_restart, p->cp);
}
/* 3DSTATE_VERTEX_BUFFERS */
struct gen6_pipeline_session *session)
{
/* 3DPRIMITIVE */
- p->gen6_3DPRIMITIVE(p->dev, session->info, false, p->cp);
+ p->gen6_3DPRIMITIVE(p->dev, ilo->draw, false, p->cp);
p->state.has_gen6_wa_pipe_control = false;
}
void
gen6_pipeline_prepare(const struct ilo_3d_pipeline *p,
const struct ilo_context *ilo,
- const struct pipe_draw_info *info,
struct gen6_pipeline_session *session)
{
memset(session, 0, sizeof(*session));
- session->info = info;
session->pipe_dirty = ilo->dirty;
- session->reduced_prim = u_reduced_prim(info->mode);
+ session->reduced_prim = u_reduced_prim(ilo->draw->mode);
/* available space before the session */
session->init_cp_space = ilo_cp_space(p->cp);
static void
ilo_3d_pipeline_emit_draw_gen6(struct ilo_3d_pipeline *p,
- const struct ilo_context *ilo,
- const struct pipe_draw_info *info)
+ const struct ilo_context *ilo)
{
struct gen6_pipeline_session session;
- gen6_pipeline_prepare(p, ilo, info, &session);
+ gen6_pipeline_prepare(p, ilo, &session);
session.emit_draw_states = gen6_pipeline_states;
session.emit_draw_commands = gen6_pipeline_commands;
struct ilo_context;
struct gen6_pipeline_session {
- const struct pipe_draw_info *info;
-
uint32_t pipe_dirty;
int reduced_prim;
void
gen6_pipeline_prepare(const struct ilo_3d_pipeline *p,
const struct ilo_context *ilo,
- const struct pipe_draw_info *info,
struct gen6_pipeline_session *session);
void
static void
ilo_3d_pipeline_emit_draw_gen7(struct ilo_3d_pipeline *p,
- const struct ilo_context *ilo,
- const struct pipe_draw_info *info)
+ const struct ilo_context *ilo)
{
struct gen6_pipeline_session session;
- gen6_pipeline_prepare(p, ilo, info, &session);
+ gen6_pipeline_prepare(p, ilo, &session);
session.emit_draw_states = gen6_pipeline_states;
session.emit_draw_commands = gen7_pipeline_commands;
#include "ilo_gpe.h"
#include "ilo_common.h"
+struct pipe_draw_info;
struct u_upload_mgr;
struct intel_winsys;
struct intel_bo;
struct u_upload_mgr *uploader;
+ const struct pipe_draw_info *draw;
uint32_t dirty;
struct ilo_vb_state vb;
* incomplete/invalid until finalized.
*/
void
-ilo_finalize_states(struct ilo_context *ilo)
+ilo_finalize_3d_states(struct ilo_context *ilo,
+ const struct pipe_draw_info *draw)
{
+ ilo->draw = draw;
+
finalize_shader_states(ilo);
finalize_constant_buffers(ilo);
cbuf->user_buffer_size = 0;
}
- /* the correct value will be set in ilo_finalize_states() */
+ /* the correct value will be set in ilo_finalize_3d_states() */
ilo->cbuf[shader].count = 0;
ilo->dirty |= ILO_DIRTY_CONSTANT_BUFFER;
ilo_cleanup_states(struct ilo_context *ilo);
void
-ilo_finalize_states(struct ilo_context *ilo);
+ilo_finalize_3d_states(struct ilo_context *ilo,
+ const struct pipe_draw_info *draw);
void
ilo_mark_states_with_resource_dirty(struct ilo_context *ilo,