summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>2020-09-15 21:40:51 +0300
committerDylan Baker <dylan.c.baker@intel.com>2020-11-02 07:48:29 -0800
commitf17e6fcb7ac715806b004121c5e3f7e64546e858 (patch)
tree2c612b7ce6770fac96ac5dddffad7d6ad69a862e
parent35b93d6f8aae0b5601e1886ee87c6fdfa0b12980 (diff)
blorp: allow blits with floating point source layers
The current blorp API only allows source layers for 3D images to be integers. That is causing problems with the Vulkan API where we need to be able to use a 3D layer that could be in between 2 layers. This change allows a floating point value to be passed for blits and internally sets up the input parameters to pass floating point values to kernels. v2: Use tex op to determinate what types are the coordinates (Jason) Drop setting params->z (Lionel) v3: Fix nir_texop_txf_ms_mcs op not considered as having integer coords (Lionel) v4: Fix incorrect test on nir_texop_txf_ms_mcs (Ivan) Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3458 Cc: <mesa-stable@lists.freedesktop.org> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6909> (cherry picked from commit 87934f02f9da94f1a493096049c229b973e4785c)
-rw-r--r--src/intel/blorp/blorp.c2
-rw-r--r--src/intel/blorp/blorp.h2
-rw-r--r--src/intel/blorp/blorp_blit.c13
-rw-r--r--src/intel/blorp/blorp_priv.h6
4 files changed, 14 insertions, 9 deletions
diff --git a/src/intel/blorp/blorp.c b/src/intel/blorp/blorp.c
index 681c8f1cc0c..58c43cb5f2b 100644
--- a/src/intel/blorp/blorp.c
+++ b/src/intel/blorp/blorp.c
@@ -63,7 +63,7 @@ void
brw_blorp_surface_info_init(struct blorp_context *blorp,
struct brw_blorp_surface_info *info,
const struct blorp_surf *surf,
- unsigned int level, unsigned int layer,
+ unsigned int level, float layer,
enum isl_format format, bool is_render_target)
{
memset(info, 0, sizeof(*info));
diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h
index b88178266c3..f8d8b0b8420 100644
--- a/src/intel/blorp/blorp.h
+++ b/src/intel/blorp/blorp.h
@@ -133,7 +133,7 @@ enum blorp_filter {
void
blorp_blit(struct blorp_batch *batch,
const struct blorp_surf *src_surf,
- unsigned src_level, unsigned src_layer,
+ unsigned src_level, float src_layer,
enum isl_format src_format, struct isl_swizzle src_swizzle,
const struct blorp_surf *dst_surf,
unsigned dst_level, unsigned dst_layer,
diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
index 3aac0abf274..d413e169ac4 100644
--- a/src/intel/blorp/blorp_blit.c
+++ b/src/intel/blorp/blorp_blit.c
@@ -56,7 +56,7 @@ brw_blorp_blit_vars_init(nir_builder *b, struct brw_blorp_blit_vars *v,
LOAD_INPUT(discard_rect, glsl_vec4_type())
LOAD_INPUT(rect_grid, glsl_vec4_type())
LOAD_INPUT(coord_transform, glsl_vec4_type())
- LOAD_INPUT(src_z, glsl_uint_type())
+ LOAD_INPUT(src_z, glsl_float_type())
LOAD_INPUT(src_offset, glsl_vector_type(GLSL_TYPE_UINT, 2))
LOAD_INPUT(dst_offset, glsl_vector_type(GLSL_TYPE_UINT, 2))
LOAD_INPUT(src_inv_size, glsl_vector_type(GLSL_TYPE_FLOAT, 2))
@@ -154,8 +154,13 @@ blorp_create_nir_tex_instr(nir_builder *b, struct brw_blorp_blit_vars *v,
* more explicit in the future.
*/
assert(pos->num_components >= 2);
- pos = nir_vec3(b, nir_channel(b, pos, 0), nir_channel(b, pos, 1),
- nir_load_var(b, v->v_src_z));
+ if (op == nir_texop_txf || op == nir_texop_txf_ms || op == nir_texop_txf_ms_mcs) {
+ pos = nir_vec3(b, nir_channel(b, pos, 0), nir_channel(b, pos, 1),
+ nir_f2i32(b, nir_load_var(b, v->v_src_z)));
+ } else {
+ pos = nir_vec3(b, nir_channel(b, pos, 0), nir_channel(b, pos, 1),
+ nir_load_var(b, v->v_src_z));
+ }
tex->src[0].src_type = nir_tex_src_coord;
tex->src[0].src = nir_src_for_ssa(pos);
@@ -2319,7 +2324,7 @@ do_blorp_blit(struct blorp_batch *batch,
void
blorp_blit(struct blorp_batch *batch,
const struct blorp_surf *src_surf,
- unsigned src_level, unsigned src_layer,
+ unsigned src_level, float src_layer,
enum isl_format src_format, struct isl_swizzle src_swizzle,
const struct blorp_surf *dst_surf,
unsigned dst_level, unsigned dst_layer,
diff --git a/src/intel/blorp/blorp_priv.h b/src/intel/blorp/blorp_priv.h
index 63b0ce9a88d..f34168681c0 100644
--- a/src/intel/blorp/blorp_priv.h
+++ b/src/intel/blorp/blorp_priv.h
@@ -61,7 +61,7 @@ struct brw_blorp_surface_info
struct isl_view view;
/* Z offset into a 3-D texture or slice of a 2-D array texture. */
- uint32_t z_offset;
+ float z_offset;
uint32_t tile_x_sa, tile_y_sa;
};
@@ -70,7 +70,7 @@ void
brw_blorp_surface_info_init(struct blorp_context *blorp,
struct brw_blorp_surface_info *info,
const struct blorp_surf *surf,
- unsigned int level, unsigned int layer,
+ unsigned int level, float layer,
enum isl_format format, bool is_render_target);
void
blorp_surf_convert_to_single_slice(const struct isl_device *isl_dev,
@@ -148,7 +148,7 @@ struct brw_blorp_wm_inputs
/* Minimum layer setting works for all the textures types but texture_3d
* for which the setting has no effect. Use the z-coordinate instead.
*/
- uint32_t src_z;
+ float src_z;
/* Pad out to an integral number of registers */
uint32_t pad[1];