/* 3DSTATE_VS */
if (emit_3dstate_vs) {
const struct ilo_shader *vs = (ilo->vs)? ilo->vs->shader : NULL;
- const int num_samplers = ilo->samplers[PIPE_SHADER_VERTEX].num_samplers;
+ const int num_samplers = ilo->sampler[PIPE_SHADER_VERTEX].count;
p->gen6_3DSTATE_VS(p->dev, vs, num_samplers, p->cp);
}
DIRTY(BLEND) || DIRTY(DEPTH_STENCIL_ALPHA) ||
DIRTY(RASTERIZER)) {
const struct ilo_shader *fs = (ilo->fs)? ilo->fs->shader : NULL;
- const int num_samplers =
- ilo->samplers[PIPE_SHADER_FRAGMENT].num_samplers;
+ const int num_samplers = ilo->sampler[PIPE_SHADER_FRAGMENT].count;
const bool dual_blend =
(!ilo->blend->state.logicop_enable &&
ilo->blend->state.rt[0].blend_enable &&
struct gen6_pipeline_session *session)
{
const struct pipe_sampler_view **views =
- (const struct pipe_sampler_view **)
- ilo->sampler_views[shader_type].views;
- const int num_views = ilo->sampler_views[shader_type].num_views;
+ (const struct pipe_sampler_view **) ilo->view[shader_type].states;
+ const int num_views = ilo->view[shader_type].count;
uint32_t *surface_state;
int offset, i;
bool skip = false;
struct gen6_pipeline_session *session)
{
const struct pipe_constant_buffer *buffers =
- ilo->constant_buffers[shader_type].buffers;
- const int num_buffers = ilo->constant_buffers[shader_type].num_buffers;
+ ilo->cbuf[shader_type].states;
+ const int num_buffers = ilo->cbuf[shader_type].count;
uint32_t *surface_state;
int offset, i;
bool skip = false;
struct gen6_pipeline_session *session)
{
const struct pipe_sampler_state **samplers =
- (const struct pipe_sampler_state **)
- ilo->samplers[shader_type].samplers;
+ (const struct pipe_sampler_state **) ilo->sampler[shader_type].states;
const struct pipe_sampler_view **views =
- (const struct pipe_sampler_view **)
- ilo->sampler_views[shader_type].views;
- const int num_samplers = ilo->samplers[shader_type].num_samplers;
- const int num_views = ilo->sampler_views[shader_type].num_views;
+ (const struct pipe_sampler_view **) ilo->view[shader_type].states;
+ const int num_samplers = ilo->sampler[shader_type].count;
+ const int num_views = ilo->view[shader_type].count;
uint32_t *sampler_state, *border_color_state;
bool emit_border_color = false;
bool skip = false;
count += ilo->vs->info.stream_output.num_outputs;
for (shader_type = 0; shader_type < PIPE_SHADER_TYPES; shader_type++) {
- count += ilo->sampler_views[shader_type].num_views;
- count += ilo->constant_buffers[shader_type].num_buffers;
+ count += ilo->view[shader_type].count;
+ count += ilo->cbuf[shader_type].count;
}
if (count) {
/* samplers (vs, fs) */
for (shader_type = 0; shader_type < PIPE_SHADER_TYPES; shader_type++) {
- count = ilo->samplers[shader_type].num_samplers;
+ count = ilo->sampler[shader_type].count;
if (count) {
size += gen6->estimate_state_size(p->dev,
ILO_GPE_GEN6_SAMPLER_BORDER_COLOR_STATE, count);
if (DIRTY(FS) || DIRTY(FRAGMENT_SAMPLERS) ||
DIRTY(BLEND)) {
const struct ilo_shader *fs = (ilo->fs)? ilo->fs->shader : NULL;
- const int num_samplers =
- ilo->samplers[PIPE_SHADER_FRAGMENT].num_samplers;
+ const int num_samplers = ilo->sampler[PIPE_SHADER_FRAGMENT].count;
const bool dual_blend =
(!ilo->blend->state.logicop_enable &&
ilo->blend->state.rt[0].blend_enable &&
*/
count = ilo->fb.state.nr_cbufs;
for (shader_type = 0; shader_type < PIPE_SHADER_TYPES; shader_type++) {
- count += ilo->sampler_views[shader_type].num_views;
- count += ilo->constant_buffers[shader_type].num_buffers;
+ count += ilo->view[shader_type].count;
+ count += ilo->cbuf[shader_type].count;
}
if (count) {
/* samplers (vs, fs) */
for (shader_type = 0; shader_type < PIPE_SHADER_TYPES; shader_type++) {
- count = ilo->samplers[shader_type].num_samplers;
+ count = ilo->sampler[shader_type].count;
if (count) {
size += gen7->estimate_state_size(p->dev,
ILO_GPE_GEN7_SAMPLER_BORDER_COLOR_STATE, count);
util_blitter_save_framebuffer(ilo->blitter, &ilo->fb.state);
util_blitter_save_fragment_sampler_states(ilo->blitter,
- ilo->samplers[PIPE_SHADER_FRAGMENT].num_samplers,
- (void **) ilo->samplers[PIPE_SHADER_FRAGMENT].samplers);
+ ilo->sampler[PIPE_SHADER_FRAGMENT].count,
+ (void **) ilo->sampler[PIPE_SHADER_FRAGMENT].states);
util_blitter_save_fragment_sampler_views(ilo->blitter,
- ilo->sampler_views[PIPE_SHADER_FRAGMENT].num_views,
- ilo->sampler_views[PIPE_SHADER_FRAGMENT].views);
+ ilo->view[PIPE_SHADER_FRAGMENT].count,
+ ilo->view[PIPE_SHADER_FRAGMENT].states);
/* disable render condition? */
break;
const struct ilo_ve_state *ve;
struct ilo_ib_state ib;
+ struct ilo_shader_state *vs;
+ struct ilo_shader_state *gs;
+
struct ilo_so_state so;
struct pipe_clip_state clip;
struct pipe_poly_stipple poly_stipple;
unsigned sample_mask;
+ struct ilo_shader_state *fs;
+
const struct ilo_dsa_state *dsa;
struct pipe_stencil_ref stencil_ref;
const struct ilo_blend_state *blend;
struct pipe_blend_color blend_color;
struct ilo_fb_state fb;
- struct ilo_shader_state *fs;
- struct ilo_shader_state *vs;
- struct ilo_shader_state *gs;
+ /* shader resources */
+ struct ilo_sampler_state sampler[PIPE_SHADER_TYPES];
+ struct ilo_view_state view[PIPE_SHADER_TYPES];
+ struct ilo_cbuf_state cbuf[PIPE_SHADER_TYPES];
+ struct ilo_resource_state resource;
- struct {
- struct pipe_sampler_state *samplers[ILO_MAX_SAMPLERS];
- unsigned num_samplers;
- } samplers[PIPE_SHADER_TYPES];
-
- struct {
- struct pipe_sampler_view *views[ILO_MAX_SAMPLER_VIEWS];
- unsigned num_views;
- } sampler_views[PIPE_SHADER_TYPES];
-
- struct {
- struct pipe_constant_buffer buffers[ILO_MAX_CONST_BUFFERS];
- unsigned num_buffers;
- } constant_buffers[PIPE_SHADER_TYPES];
-
- struct {
- struct pipe_surface *surfaces[PIPE_MAX_SHADER_RESOURCES];
- unsigned num_surfaces;
- } shader_resources;
-
- struct ilo_shader_state *compute;
-
- struct {
- struct pipe_surface *surfaces[PIPE_MAX_SHADER_RESOURCES];
- unsigned num_surfaces;
- } compute_resources;
-
- struct {
- /*
- * XXX These should not be treated as real resources (and there could be
- * thousands of them). They should be treated as regions in GLOBAL
- * resource, which is the only real resource.
- *
- * That is, a resource here should instead be
- *
- * struct ilo_global_region {
- * struct pipe_resource base;
- * int offset;
- * int size;
- * };
- *
- * and it describes the region [offset, offset + size) in GLOBAL
- * resource.
- */
- struct pipe_resource *resources[PIPE_MAX_SHADER_RESOURCES];
- uint32_t *handles[PIPE_MAX_SHADER_RESOURCES];
- unsigned num_resources;
- } global_binding;
+ /* GPGPU */
+ struct ilo_shader_state *cs;
+ struct ilo_resource_state cs_resource;
+ struct ilo_global_binding global_binding;
};
static inline struct ilo_context *
struct pipe_blend_state state;
};
+struct ilo_sampler_state {
+ struct pipe_sampler_state *states[ILO_MAX_SAMPLERS];
+ unsigned count;
+};
+
+struct ilo_view_state {
+ struct pipe_sampler_view *states[ILO_MAX_SAMPLER_VIEWS];
+ unsigned count;
+};
+
+struct ilo_cbuf_state {
+ struct pipe_constant_buffer states[ILO_MAX_CONST_BUFFERS];
+ unsigned count;
+};
+
+struct ilo_resource_state {
+ struct pipe_surface *states[PIPE_MAX_SHADER_RESOURCES];
+ unsigned count;
+};
+
struct ilo_fb_state {
struct pipe_framebuffer_state state;
unsigned num_samples;
};
+struct ilo_global_binding {
+ /*
+ * XXX These should not be treated as real resources (and there could be
+ * thousands of them). They should be treated as regions in GLOBAL
+ * resource, which is the only real resource.
+ *
+ * That is, a resource here should instead be
+ *
+ * struct ilo_global_region {
+ * struct pipe_resource base;
+ * int offset;
+ * int size;
+ * };
+ *
+ * and it describes the region [offset, offset + size) in GLOBAL
+ * resource.
+ */
+ struct pipe_resource *resources[PIPE_MAX_SHADER_RESOURCES];
+ uint32_t *handles[PIPE_MAX_SHADER_RESOURCES];
+ unsigned count;
+};
+
#endif /* ILO_GPE_H */
break;
}
- num_views = ilo->sampler_views[info->type].num_views;
+ num_views = ilo->view[info->type].count;
assert(info->num_samplers <= num_views);
variant->num_sampler_views = info->num_samplers;
for (i = 0; i < info->num_samplers; i++) {
const struct pipe_sampler_view *view =
- ilo->sampler_views[info->type].views[i];
+ ilo->view[info->type].states[i];
const struct pipe_sampler_state *sampler =
- ilo->samplers[info->type].samplers[i];
+ ilo->sampler[info->type].states[i];
if (view) {
variant->sampler_view_swizzles[i].r = view->swizzle_r;
return;
for (sh = 0; sh < PIPE_SHADER_TYPES; sh++) {
- int last_cbuf = Elements(ilo->constant_buffers[sh].buffers) - 1;
+ int last_cbuf = Elements(ilo->cbuf[sh].states) - 1;
/* find the last cbuf */
while (last_cbuf >= 0 &&
- !ilo->constant_buffers[sh].buffers[last_cbuf].buffer)
+ !ilo->cbuf[sh].states[last_cbuf].buffer)
last_cbuf--;
- ilo->constant_buffers[sh].num_buffers = last_cbuf + 1;
+ ilo->cbuf[sh].count = last_cbuf + 1;
}
}
unsigned shader, unsigned start, unsigned count,
void **samplers, bool unbind_old)
{
- struct pipe_sampler_state **dst = ilo->samplers[shader].samplers;
+ struct pipe_sampler_state **dst = ilo->sampler[shader].states;
unsigned i;
- assert(start + count <= Elements(ilo->samplers[shader].samplers));
+ assert(start + count <= Elements(ilo->sampler[shader].states));
if (unbind_old) {
if (!samplers) {
dst[i] = NULL;
for (; i < start + count; i++)
dst[i] = samplers[i - start];
- for (; i < ilo->samplers[shader].num_samplers; i++)
+ for (; i < ilo->sampler[shader].count; i++)
dst[i] = NULL;
- ilo->samplers[shader].num_samplers = start + count;
+ ilo->sampler[shader].count = start + count;
return;
}
dst[i] = NULL;
}
- if (ilo->samplers[shader].num_samplers <= start + count) {
+ if (ilo->sampler[shader].count <= start + count) {
count += start;
- while (count > 0 && !ilo->samplers[shader].samplers[count - 1])
+ while (count > 0 && !ilo->sampler[shader].states[count - 1])
count--;
- ilo->samplers[shader].num_samplers = count;
+ ilo->sampler[shader].count = count;
}
}
struct ilo_context *ilo = ilo_context(pipe);
struct pipe_constant_buffer *cbuf;
- assert(shader < Elements(ilo->constant_buffers));
- assert(index < Elements(ilo->constant_buffers[shader].buffers));
+ assert(shader < Elements(ilo->cbuf));
+ assert(index < Elements(ilo->cbuf[shader].states));
- cbuf = &ilo->constant_buffers[shader].buffers[index];
+ cbuf = &ilo->cbuf[shader].states[index];
pipe_resource_reference(&cbuf->buffer, NULL);
}
/* the correct value will be set in ilo_finalize_states() */
- ilo->constant_buffers[shader].num_buffers = 0;
+ ilo->cbuf[shader].count = 0;
ilo->dirty |= ILO_DIRTY_CONSTANT_BUFFER;
}
unsigned shader, unsigned start, unsigned count,
struct pipe_sampler_view **views, bool unset_old)
{
- struct pipe_sampler_view **dst = ilo->sampler_views[shader].views;
+ struct pipe_sampler_view **dst = ilo->view[shader].states;
unsigned i;
- assert(start + count <= Elements(ilo->sampler_views[shader].views));
+ assert(start + count <= Elements(ilo->view[shader].states));
if (unset_old) {
if (!views) {
pipe_sampler_view_reference(&dst[i], NULL);
for (; i < start + count; i++)
pipe_sampler_view_reference(&dst[i], views[i - start]);
- for (; i < ilo->sampler_views[shader].num_views; i++)
+ for (; i < ilo->view[shader].count; i++)
pipe_sampler_view_reference(&dst[i], NULL);
- ilo->sampler_views[shader].num_views = start + count;
+ ilo->view[shader].count = start + count;
return;
}
pipe_sampler_view_reference(&dst[i], NULL);
}
- if (ilo->sampler_views[shader].num_views <= start + count) {
+ if (ilo->view[shader].count <= start + count) {
count += start;
- while (count > 0 && !ilo->sampler_views[shader].views[count - 1])
+ while (count > 0 && !ilo->view[shader].states[count - 1])
count--;
- ilo->sampler_views[shader].num_views = count;
+ ilo->view[shader].count = count;
}
}
struct pipe_surface **surfaces)
{
struct ilo_context *ilo = ilo_context(pipe);
- struct pipe_surface **dst = ilo->shader_resources.surfaces;
+ struct pipe_surface **dst = ilo->resource.states;
unsigned i;
- assert(start + count <= Elements(ilo->shader_resources.surfaces));
+ assert(start + count <= Elements(ilo->resource.states));
dst += start;
if (surfaces) {
pipe_surface_reference(&dst[i], NULL);
}
- if (ilo->shader_resources.num_surfaces <= start + count) {
+ if (ilo->resource.count <= start + count) {
count += start;
- while (count > 0 && !ilo->shader_resources.surfaces[count - 1])
+ while (count > 0 && !ilo->resource.states[count - 1])
count--;
- ilo->shader_resources.num_surfaces = count;
+ ilo->resource.count = count;
}
ilo->dirty |= ILO_DIRTY_SHADER_RESOURCES;
{
struct ilo_context *ilo = ilo_context(pipe);
- ilo->compute = state;
+ ilo->cs = state;
ilo->dirty |= ILO_DIRTY_COMPUTE;
}
struct pipe_surface **surfaces)
{
struct ilo_context *ilo = ilo_context(pipe);
- struct pipe_surface **dst = ilo->compute_resources.surfaces;
+ struct pipe_surface **dst = ilo->cs_resource.states;
unsigned i;
- assert(start + count <= Elements(ilo->compute_resources.surfaces));
+ assert(start + count <= Elements(ilo->cs_resource.states));
dst += start;
if (surfaces) {
pipe_surface_reference(&dst[i], NULL);
}
- if (ilo->compute_resources.num_surfaces <= start + count) {
+ if (ilo->cs_resource.count <= start + count) {
count += start;
- while (count > 0 && !ilo->compute_resources.surfaces[count - 1])
+ while (count > 0 && !ilo->cs_resource.states[count - 1])
count--;
- ilo->compute_resources.num_surfaces = count;
+ ilo->cs_resource.count = count;
}
ilo->dirty |= ILO_DIRTY_COMPUTE_RESOURCES;
pipe_resource_reference(&dst[i], NULL);
}
- if (ilo->global_binding.num_resources <= start + count) {
+ if (ilo->global_binding.count <= start + count) {
count += start;
while (count > 0 && !ilo->global_binding.resources[count - 1])
count--;
- ilo->global_binding.num_resources = count;
+ ilo->global_binding.count = count;
}
ilo->dirty |= ILO_DIRTY_GLOBAL_BINDING;