s.SurfaceFormat = info->view->format;
}
+ s.Width = info->surf->logical_level0_px.width - 1;
+ s.Height = info->surf->logical_level0_px.height - 1;
+
+ switch (s.SurfaceType) {
+ case SURFTYPE_1D:
+ case SURFTYPE_2D:
+ s.MinimumArrayElement = info->view->base_array_layer;
+
+ /* From the Broadwell PRM >> RENDER_SURFACE_STATE::Depth:
+ *
+ * For SURFTYPE_1D, 2D, and CUBE: The range of this field is reduced
+ * by one for each increase from zero of Minimum Array Element. For
+ * example, if Minimum Array Element is set to 1024 on a 2D surface,
+ * the range of this field is reduced to [0,1023].
+ *
+ * In other words, 'Depth' is the number of array layers.
+ */
+ s.Depth = info->view->array_len - 1;
+
+ /* From the Broadwell PRM >> RENDER_SURFACE_STATE::RenderTargetViewExtent:
+ *
+ * For Render Target and Typed Dataport 1D and 2D Surfaces:
+ * This field must be set to the same value as the Depth field.
+ */
+ s.RenderTargetViewExtent = s.Depth;
+ break;
+ case SURFTYPE_CUBE:
+ s.MinimumArrayElement = info->view->base_array_layer;
+ /* Same as SURFTYPE_2D, but divided by 6 */
+ s.Depth = info->view->array_len / 6 - 1;
+ s.RenderTargetViewExtent = s.Depth;
+ break;
+ case SURFTYPE_3D:
+ s.MinimumArrayElement = info->view->base_array_layer;
+
+ /* From the Broadwell PRM >> RENDER_SURFACE_STATE::Depth:
+ *
+ * If the volume texture is MIP-mapped, this field specifies the
+ * depth of the base MIP level.
+ */
+ s.Depth = info->surf->logical_level0_px.depth - 1;
+
+ /* From the Broadwell PRM >> RENDER_SURFACE_STATE::RenderTargetViewExtent:
+ *
+ * For Render Target and Typed Dataport 3D Surfaces: This field
+ * indicates the extent of the accessible 'R' coordinates minus 1 on
+ * the LOD currently being rendered to.
+ */
+ s.RenderTargetViewExtent = isl_minify(info->surf->logical_level0_px.depth,
+ info->view->base_level) - 1;
+ break;
+ default:
+ unreachable("bad SurfaceType");
+ }
+
s.SurfaceArray = info->surf->phys_level0_sa.array_len > 1;
+
+ if (info->view->usage & ISL_SURF_USAGE_RENDER_TARGET_BIT) {
+ /* For render target surfaces, the hardware interprets field
+ * MIPCount/LOD as LOD. The Broadwell PRM says:
+ *
+ * MIPCountLOD defines the LOD that will be rendered into.
+ * SurfaceMinLOD is ignored.
+ */
+ s.MIPCountLOD = info->view->base_level;
+ s.SurfaceMinLOD = 0;
+ } else {
+ /* For non render target surfaces, the hardware interprets field
+ * MIPCount/LOD as MIPCount. The range of levels accessible by the
+ * sampler engine is [SurfaceMinLOD, SurfaceMinLOD + MIPCountLOD].
+ */
+ s.SurfaceMinLOD = info->view->base_level;
+ s.MIPCountLOD = MAX(info->view->levels, 1) - 1;
+ }
+
s.SurfaceVerticalAlignment = valign;
s.SurfaceHorizontalAlignment = halign;
s.SurfaceQPitch = get_qpitch(info->surf) >> 2;
#endif
- s.Width = info->surf->logical_level0_px.width - 1;
- s.Height = info->surf->logical_level0_px.height - 1;
- s.Depth = 0; /* TEMPLATE */
-
- s.RenderTargetViewExtent = 0; /* TEMPLATE */
- s.MinimumArrayElement = 0; /* TEMPLATE */
-
s.MultisampledSurfaceStorageFormat =
isl_to_gen_multisample_layout[info->surf->msaa_layout];
s.NumberofMultisamples = ffs(info->surf->samples) - 1;
- s.MIPCountLOD = 0; /* TEMPLATE */
- s.SurfaceMinLOD = 0; /* TEMPLATE */
-
#if (GEN_GEN >= 8 || GEN_IS_HASWELL)
s.ShaderChannelSelectRed = info->view->channel_select[0];
s.ShaderChannelSelectGreen = info->view->channel_select[1];
s.SurfacePitch = info->surf->row_pitch - 1;
}
- switch (s.SurfaceType) {
- case SURFTYPE_1D:
- case SURFTYPE_2D:
- s.MinimumArrayElement = info->view->base_array_layer;
-
- /* From the Broadwell PRM >> RENDER_SURFACE_STATE::Depth:
- *
- * For SURFTYPE_1D, 2D, and CUBE: The range of this field is reduced
- * by one for each increase from zero of Minimum Array Element. For
- * example, if Minimum Array Element is set to 1024 on a 2D surface,
- * the range of this field is reduced to [0,1023].
- *
- * In other words, 'Depth' is the number of array layers.
- */
- s.Depth = info->view->array_len - 1;
-
- /* From the Broadwell PRM >> RENDER_SURFACE_STATE::RenderTargetViewExtent:
- *
- * For Render Target and Typed Dataport 1D and 2D Surfaces:
- * This field must be set to the same value as the Depth field.
- */
- s.RenderTargetViewExtent = s.Depth;
- break;
- case SURFTYPE_CUBE:
- s.MinimumArrayElement = info->view->base_array_layer;
- /* Same as SURFTYPE_2D, but divided by 6 */
- s.Depth = info->view->array_len / 6 - 1;
- s.RenderTargetViewExtent = s.Depth;
- break;
- case SURFTYPE_3D:
- s.MinimumArrayElement = info->view->base_array_layer;
-
- /* From the Broadwell PRM >> RENDER_SURFACE_STATE::Depth:
- *
- * If the volume texture is MIP-mapped, this field specifies the
- * depth of the base MIP level.
- */
- s.Depth = info->surf->logical_level0_px.depth - 1;
-
- /* From the Broadwell PRM >> RENDER_SURFACE_STATE::RenderTargetViewExtent:
- *
- * For Render Target and Typed Dataport 3D Surfaces: This field
- * indicates the extent of the accessible 'R' coordinates minus 1 on
- * the LOD currently being rendered to.
- */
- s.RenderTargetViewExtent = isl_minify(info->surf->logical_level0_px.depth,
- info->view->base_level) - 1;
- break;
- default:
- unreachable("bad SurfaceType");
- }
-
- if (info->view->usage & ISL_SURF_USAGE_RENDER_TARGET_BIT) {
- /* For render target surfaces, the hardware interprets field
- * MIPCount/LOD as LOD. The Broadwell PRM says:
- *
- * MIPCountLOD defines the LOD that will be rendered into.
- * SurfaceMinLOD is ignored.
- */
- s.MIPCountLOD = info->view->base_level;
- s.SurfaceMinLOD = 0;
- } else {
- /* For non render target surfaces, the hardware interprets field
- * MIPCount/LOD as MIPCount. The range of levels accessible by the
- * sampler engine is [SurfaceMinLOD, SurfaceMinLOD + MIPCountLOD].
- */
- s.SurfaceMinLOD = info->view->base_level;
- s.MIPCountLOD = MAX(info->view->levels, 1) - 1;
- }
-
#if GEN_GEN >= 8
/* From the CHV PRM, Volume 2d, page 321 (RENDER_SURFACE_STATE dword 0
* bit 9 "Sampler L2 Bypass Mode Disable" Programming Notes):