diff options
author | Sagar Ghuge <[email protected]> | 2019-07-16 10:38:00 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2019-08-20 00:50:41 -0700 |
commit | 7e816991cc3c8baebbbff2f64e91202728c696e0 (patch) | |
tree | d20b03a0c0ae2a549ace682356eb6c7eb8828b24 /src/gallium/drivers/iris/iris_resource.c | |
parent | 58471e20d21dfd50f372a19675d8698cf61e3b7f (diff) |
iris: Add helper function to get isl dim layout
v2: Add missing space (Caio)
Signed-off-by: Sagar Ghuge <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/gallium/drivers/iris/iris_resource.c')
-rw-r--r-- | src/gallium/drivers/iris/iris_resource.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index d4360523294..ec59436df79 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -253,6 +253,35 @@ iris_get_depth_stencil_resources(struct pipe_resource *res, } } +enum isl_dim_layout +iris_get_isl_dim_layout(const struct gen_device_info *devinfo, + enum isl_tiling tiling, + enum pipe_texture_target target) +{ + switch (target) { + case PIPE_TEXTURE_1D: + case PIPE_TEXTURE_1D_ARRAY: + return (devinfo->gen >= 9 && tiling == ISL_TILING_LINEAR ? + ISL_DIM_LAYOUT_GEN9_1D : ISL_DIM_LAYOUT_GEN4_2D); + + case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_2D_ARRAY: + case PIPE_TEXTURE_RECT: + case PIPE_TEXTURE_CUBE: + case PIPE_TEXTURE_CUBE_ARRAY: + return ISL_DIM_LAYOUT_GEN4_2D; + + case PIPE_TEXTURE_3D: + return (devinfo->gen >= 9 ? + ISL_DIM_LAYOUT_GEN4_2D : ISL_DIM_LAYOUT_GEN4_3D); + + case PIPE_MAX_TEXTURE_TYPES: + case PIPE_BUFFER: + break; + } + unreachable("invalid texture type"); +} + void iris_resource_disable_aux(struct iris_resource *res) { |