Make offset to layer optional in ilo_gpe_init_view_surface_for_texture.
render_cache_rw is always the same as is_rt and is replaced.
unsigned num_levels,
unsigned first_layer,
unsigned num_layers,
- bool is_rt, bool render_cache_rw,
+ bool is_rt, bool offset_to_layer,
struct ilo_view_surface *surf);
void
unsigned num_levels,
unsigned first_layer,
unsigned num_layers,
- bool is_rt, bool render_cache_rw,
+ bool is_rt, bool offset_to_layer,
struct ilo_view_surface *surf);
static inline void
unsigned num_levels,
unsigned first_layer,
unsigned num_layers,
- bool is_rt, bool render_cache_rw,
+ bool is_rt, bool offset_to_layer,
struct ilo_view_surface *surf)
{
if (dev->gen >= ILO_GEN(7)) {
ilo_gpe_init_view_surface_for_texture_gen7(dev, tex, format,
first_level, num_levels, first_layer, num_layers,
- is_rt, render_cache_rw, surf);
+ is_rt, offset_to_layer, surf);
}
else {
ilo_gpe_init_view_surface_for_texture_gen6(dev, tex, format,
first_level, num_levels, first_layer, num_layers,
- is_rt, render_cache_rw, surf);
+ is_rt, offset_to_layer, surf);
}
}
unsigned num_levels,
unsigned first_layer,
unsigned num_layers,
- bool is_rt, bool render_cache_rw,
+ bool is_rt, bool offset_to_layer,
struct ilo_view_surface *surf)
{
int surface_type, surface_format;
assert(tex->interleaved);
if (is_rt) {
- /*
- * Compute the offset to the layer manually.
- *
- * For rendering, the hardware requires LOD to be the same for all
- * render targets and the depth buffer. We need to compute the offset
- * to the layer manually and always set LOD to 0.
- */
- if (true) {
- /* we lose the capability for layered rendering */
- assert(num_layers == 1);
-
- layer_offset = ilo_texture_get_slice_offset(tex,
- first_level, first_layer, &x_offset, &y_offset);
-
- assert(x_offset % 4 == 0);
- assert(y_offset % 2 == 0);
- x_offset /= 4;
- y_offset /= 2;
-
- /* derive the size for the LOD */
- width = u_minify(width, first_level);
- height = u_minify(height, first_level);
- if (surface_type == BRW_SURFACE_3D)
- depth = u_minify(depth, first_level);
- else
- depth = 1;
-
- first_level = 0;
- first_layer = 0;
- lod = 0;
- }
- else {
- layer_offset = 0;
- x_offset = 0;
- y_offset = 0;
- }
-
assert(num_levels == 1);
lod = first_level;
}
+ else {
+ lod = num_levels - 1;
+ }
+
+ /*
+ * Offset to the layer. When rendering, the hardware requires LOD and
+ * Depth to be the same for all render targets and the depth buffer. We
+ * need to offset to the layer manually and always set LOD and Depth to 0.
+ */
+ if (offset_to_layer) {
+ /* we lose the capability for layered rendering */
+ assert(is_rt && num_layers == 1);
+
+ layer_offset = ilo_texture_get_slice_offset(tex,
+ first_level, first_layer, &x_offset, &y_offset);
+
+ assert(x_offset % 4 == 0);
+ assert(y_offset % 2 == 0);
+ x_offset /= 4;
+ y_offset /= 2;
+
+ /* derive the size for the LOD */
+ width = u_minify(width, first_level);
+ height = u_minify(height, first_level);
+
+ first_level = 0;
+ first_layer = 0;
+
+ lod = 0;
+ depth = 1;
+ }
else {
layer_offset = 0;
x_offset = 0;
y_offset = 0;
-
- lod = num_levels - 1;
}
/*
BRW_SURFACE_CUBEFACE_ENABLES;
}
- if (render_cache_rw)
+ if (is_rt)
dw[0] |= BRW_SURFACE_RC_READ_WRITE;
dw[1] = layer_offset;
unsigned num_levels,
unsigned first_layer,
unsigned num_layers,
- bool is_rt, bool render_cache_rw,
+ bool is_rt, bool offset_to_layer,
struct ilo_view_surface *surf)
{
int surface_type, surface_format;
}
if (is_rt) {
- /*
- * Compute the offset to the layer manually.
- *
- * For rendering, the hardware requires LOD to be the same for all
- * render targets and the depth buffer. We need to compute the offset
- * to the layer manually and always set LOD to 0.
- */
- if (true) {
- /* we lose the capability for layered rendering */
- assert(num_layers == 1);
-
- layer_offset = ilo_texture_get_slice_offset(tex,
- first_level, first_layer, &x_offset, &y_offset);
-
- assert(x_offset % 4 == 0);
- assert(y_offset % 2 == 0);
- x_offset /= 4;
- y_offset /= 2;
-
- /* derive the size for the LOD */
- width = u_minify(width, first_level);
- height = u_minify(height, first_level);
- if (surface_type == BRW_SURFACE_3D)
- depth = u_minify(depth, first_level);
- else
- depth = 1;
-
- first_level = 0;
- first_layer = 0;
- lod = 0;
- }
- else {
- layer_offset = 0;
- x_offset = 0;
- y_offset = 0;
- }
-
assert(num_levels == 1);
lod = first_level;
}
+ else {
+ lod = num_levels - 1;
+ }
+
+ /*
+ * Offset to the layer. When rendering, the hardware requires LOD and
+ * Depth to be the same for all render targets and the depth buffer. We
+ * need to offset to the layer manually and always set LOD and Depth to 0.
+ */
+ if (offset_to_layer) {
+ /* we lose the capability for layered rendering */
+ assert(is_rt && num_layers == 1);
+
+ layer_offset = ilo_texture_get_slice_offset(tex,
+ first_level, first_layer, &x_offset, &y_offset);
+
+ assert(x_offset % 4 == 0);
+ assert(y_offset % 2 == 0);
+ x_offset /= 4;
+ y_offset /= 2;
+
+ /* derive the size for the LOD */
+ width = u_minify(width, first_level);
+ height = u_minify(height, first_level);
+
+ first_level = 0;
+ first_layer = 0;
+
+ lod = 0;
+ depth = 1;
+ }
else {
layer_offset = 0;
x_offset = 0;
y_offset = 0;
-
- lod = num_levels - 1;
}
/*
else
dw[0] |= GEN7_SURFACE_ARYSPC_LOD0;
- if (render_cache_rw)
+ if (is_rt)
dw[0] |= BRW_SURFACE_RC_READ_WRITE;
if (surface_type == BRW_SURFACE_CUBE && !is_rt)
templ->u.tex.last_level - templ->u.tex.first_level + 1,
templ->u.tex.first_layer,
templ->u.tex.last_layer - templ->u.tex.first_layer + 1,
- false, false, &view->surface);
+ false, true, &view->surface);
}
return &view->base;