#define ILO_WM_CONST_SURFACE(i) (ILO_MAX_DRAW_BUFFERS + i)
#define ILO_WM_TEXTURE_SURFACE(i) (ILO_MAX_DRAW_BUFFERS + ILO_MAX_CONST_BUFFERS + i)
+#define ILO_GPE_VALID_GEN(dev, min_gen, max_gen) \
+ assert((dev)->gen >= ILO_GEN(min_gen) && (dev)->gen <= ILO_GEN(max_gen))
+
struct ilo_buffer;
struct ilo_texture;
struct ilo_shader_state;
}
}
+static inline void
+ilo_gpe_set_view_surface_bo(const struct ilo_dev_info *dev,
+ struct intel_bo *bo, unsigned offset,
+ struct ilo_view_surface *surf)
+{
+ ILO_GPE_VALID_GEN(dev, 6, 7);
+
+ /* do not increment reference count */
+ surf->bo = bo;
+ surf->payload[1] = offset;
+}
+
void
ilo_gpe_init_zs_surface(const struct ilo_dev_info *dev,
const struct ilo_texture *tex,
/* upload user buffer */
if (cbuf->user_buffer) {
- const enum pipe_format elem_format =
- PIPE_FORMAT_R32G32B32A32_FLOAT;
unsigned offset;
u_upload_data(ilo->uploader, 0, cbuf->user_buffer_size,
cbuf->user_buffer, &offset, &cbuf->resource);
- ilo_gpe_init_view_surface_for_buffer(ilo->dev,
- ilo_buffer(cbuf->resource),
- offset, cbuf->user_buffer_size,
- util_format_get_blocksize(elem_format), elem_format,
- false, false, &cbuf->surface);
+ ilo_gpe_set_view_surface_bo(ilo->dev,
+ ilo_buffer(cbuf->resource)->bo, offset, &cbuf->surface);
cbuf->user_buffer = NULL;
cbuf->user_buffer_size = 0;
if (buf) {
for (i = 0; i < count; i++) {
+ const enum pipe_format elem_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
struct ilo_cbuf_cso *cso = &cbuf->cso[index + i];
pipe_resource_reference(&cso->resource, buf[i].buffer);
- if (buf[i].buffer) {
- const enum pipe_format elem_format =
- PIPE_FORMAT_R32G32B32A32_FLOAT;
+ ilo_gpe_init_view_surface_for_buffer(ilo->dev,
+ ilo_buffer(buf[i].buffer),
+ buf[i].buffer_offset, buf[i].buffer_size,
+ util_format_get_blocksize(elem_format), elem_format,
+ false, false, &cso->surface);
- ilo_gpe_init_view_surface_for_buffer(ilo->dev,
- ilo_buffer(buf[i].buffer),
- buf[i].buffer_offset, buf[i].buffer_size,
- util_format_get_blocksize(elem_format), elem_format,
- false, false, &cso->surface);
-
- cso->user_buffer = NULL;
- cso->user_buffer_size = 0;
-
- cbuf->enabled_mask |= 1 << (index + i);
- }
- else if (buf[i].user_buffer) {
+ if (buf[i].user_buffer) {
cso->surface.bo = NULL;
/* buffer_offset does not apply for user buffer */
cbuf->enabled_mask |= 1 << (index + i);
}
+ else if (buf[i].buffer) {
+ cso->user_buffer = NULL;
+ cso->user_buffer_size = 0;
+
+ cbuf->enabled_mask |= 1 << (index + i);
+ }
else {
cso->surface.bo = NULL;
cso->user_buffer = NULL;