diff options
author | Jason Ekstrand <[email protected]> | 2016-06-17 16:40:24 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-06-22 12:26:43 -0700 |
commit | 215282c9f41432a245e79cdf5f8328c6785e924a (patch) | |
tree | 700ef646fe3c5d84e70c46ca559c9df9302ce0be | |
parent | bb326f7b01daeb97e544873f20a23614ed54c548 (diff) |
isl/state: Don't set RenderTargetViewExtent for texture surfaces
The docs specify that this only matters for render targets and surfaces
used with typed dataport messages. On some platforms (gen4-6) the Depth
field has more bits than RenderTargetViewExtent so we can have textures
with more levels than we can render to.
Reviewed-by: Chad Versace <[email protected]>
Cc: "12.0" <[email protected]>
-rw-r--r-- | src/intel/isl/isl_surface_state.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c index 602726a436a..bf9a2b307c0 100644 --- a/src/intel/isl/isl_surface_state.c +++ b/src/intel/isl/isl_surface_state.c @@ -227,13 +227,17 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state, * 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; + if (info->view->usage & (ISL_SURF_USAGE_RENDER_TARGET_BIT | + ISL_SURF_USAGE_STORAGE_BIT)) + 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; + if (info->view->usage & (ISL_SURF_USAGE_RENDER_TARGET_BIT | + ISL_SURF_USAGE_STORAGE_BIT)) + s.RenderTargetViewExtent = s.Depth; break; case SURFTYPE_3D: s.MinimumArrayElement = info->view->base_array_layer; @@ -250,9 +254,19 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state, * 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. + * + * The docs specify that this only matters for render targets and + * surfaces used with typed dataport messages. Prior to Ivy Bridge, the + * Depth field has more bits than RenderTargetViewExtent so we can have + * textures with more levels than we can render to. In order to prevent + * assert-failures in the packing function below, we only set the field + * when it's actually going to be used by the hardware. */ - s.RenderTargetViewExtent = isl_minify(info->surf->logical_level0_px.depth, - info->view->base_level) - 1; + if (info->view->usage & (ISL_SURF_USAGE_RENDER_TARGET_BIT | + ISL_SURF_USAGE_STORAGE_BIT)) { + s.RenderTargetViewExtent = isl_minify(info->surf->logical_level0_px.depth, + info->view->base_level) - 1; + } break; default: unreachable("bad SurfaceType"); |