.SurfaceQPitch = get_qpitch(info->surf) >> 2,
#endif
- .Width = info->level0_extent_px.width - 1,
- .Height = info->level0_extent_px.height - 1,
+ .Width = info->surf->logical_level0_px.width - 1,
+ .Height = info->surf->logical_level0_px.height - 1,
.Depth = 0, /* TEMPLATE */
- .SurfacePitch = info->surf->row_pitch - 1,
.RenderTargetViewExtent = 0, /* TEMPLATE */
.MinimumArrayElement = 0, /* TEMPLATE */
#endif
};
+ if (info->surf->tiling == ISL_TILING_W) {
+ /* From the Broadwell PRM documentation for this field:
+ *
+ * "If the surface is a stencil buffer (and thus has Tile Mode set
+ * to TILEMODE_WMAJOR), the pitch must be set to 2x the value
+ * computed based on width, as the stencil buffer is stored with
+ * two rows interleaved."
+ */
+ s.SurfacePitch = info->surf->row_pitch * 2 - 1;
+ } else {
+ s.SurfacePitch = info->surf->row_pitch - 1;
+ }
+
if (info->view->usage & ISL_SURF_USAGE_STORAGE_BIT) {
s.SurfaceFormat = isl_lower_storage_image_format(dev, info->view->format);
} else {
* If the volume texture is MIP-mapped, this field specifies the
* depth of the base MIP level.
*/
- s.Depth = info->level0_extent_px.depth - 1;
+ s.Depth = info->surf->logical_level0_px.depth - 1;
/* From the Broadwell PRM >> RENDER_SURFACE_STATE::RenderTargetViewExtent:
*
* indicates the extent of the accessible 'R' coordinates minus 1 on
* the LOD currently being rendered to.
*/
- s.RenderTargetViewExtent = info->level0_extent_px.depth - 1;
+ s.RenderTargetViewExtent = isl_minify(info->surf->logical_level0_px.depth,
+ info->view->base_level) - 1;
break;
default:
unreachable(!"bad SurfaceType");
}
#endif
-#if 0
- if (GEN_GEN == 8) {
- if (isl_format_is_integer(info->view->format)) {
+ if (GEN_GEN <= 8) {
+ /* Prior to Sky Lake, we only have one bit for the clear color which
+ * gives us 0 or 1 in whatever the surface's format happens to be.
+ */
+ if (isl_format_has_int_channel(info->view->format)) {
for (unsigned i = 0; i < 4; i++) {
assert(info->clear_color.u32[i] == 0 ||
info->clear_color.u32[i] == 1);
info->clear_color.f32[i] == 1.0f);
}
}
- s.RedClearColor = info->clear_color.u32[0] != 0,
- s.GreenClearColor = info->clear_color.u32[1] != 0,
- s.BlueClearColor = info->clear_color.u32[2] != 0,
- s.AlphaClearColor = info->clear_color.u32[3] != 0,
+ s.RedClearColor = info->clear_color.u32[0] != 0;
+ s.GreenClearColor = info->clear_color.u32[1] != 0;
+ s.BlueClearColor = info->clear_color.u32[2] != 0;
+ s.AlphaClearColor = info->clear_color.u32[3] != 0;
} else {
- .RedClearColor = info->clear_color.u32[0],
- .GreenClearColor = info->clear_color.u32[1],
- .BlueClearColor = info->clear_color.u32[2],
- .AlphaClearColor = info->clear_color.u32[3],
+ s.RedClearColor = info->clear_color.u32[0];
+ s.GreenClearColor = info->clear_color.u32[1];
+ s.BlueClearColor = info->clear_color.u32[2];
+ s.AlphaClearColor = info->clear_color.u32[3];
}
-#endif
GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &s);
}