aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2020-03-10 10:15:21 +1000
committerMarge Bot <[email protected]>2020-05-06 06:20:37 +0000
commit026bf2659975817cb8fceb759eb80b2459df8c06 (patch)
tree7b99a282a42b000813d6d10592f92551648d8a4a
parent609a3bea16b14cd5bbc59c702b91367ed768d629 (diff)
draw: introduce sampler num samples + stride members
This adds the num samples + sampler stride into the texture mapping paths, currently drivers just pass 0 for now. Reviewed-by: Roland Scheidegger <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c12
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.h6
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm_sample.c5
-rw-r--r--src/gallium/drivers/i915/i915_state.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_sampler.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_state_sampler.c2
-rw-r--r--src/mesa/state_tracker/st_draw_feedback.c2
9 files changed, 31 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 3b2b2d0306f..5d5a91c0f2c 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -1168,6 +1168,8 @@ draw_set_mapped_texture(struct draw_context *draw,
unsigned sview_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t first_level, uint32_t last_level,
+ uint32_t num_samples,
+ uint32_t sample_stride,
const void *base_ptr,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
@@ -1179,7 +1181,7 @@ draw_set_mapped_texture(struct draw_context *draw,
shader_stage,
sview_idx,
width, height, depth, first_level,
- last_level, base_ptr,
+ last_level, num_samples, sample_stride, base_ptr,
row_stride, img_stride, mip_offsets);
#endif
}
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index 659b81fd0be..d0dc7688cf0 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -198,6 +198,8 @@ draw_set_mapped_texture(struct draw_context *draw,
unsigned sview_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t first_level, uint32_t last_level,
+ uint32_t num_samples,
+ uint32_t sample_stride,
const void *base,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index 765cd1d84e1..303e377ffae 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -152,6 +152,8 @@ create_jit_texture_type(struct gallivm_state *gallivm, const char *struct_name)
elem_types[DRAW_JIT_TEXTURE_WIDTH] =
elem_types[DRAW_JIT_TEXTURE_HEIGHT] =
elem_types[DRAW_JIT_TEXTURE_DEPTH] =
+ elem_types[DRAW_JIT_TEXTURE_NUM_SAMPLES] =
+ elem_types[DRAW_JIT_TEXTURE_SAMPLE_STRIDE] =
elem_types[DRAW_JIT_TEXTURE_FIRST_LEVEL] =
elem_types[DRAW_JIT_TEXTURE_LAST_LEVEL] = int32_type;
elem_types[DRAW_JIT_TEXTURE_BASE] =
@@ -192,6 +194,12 @@ create_jit_texture_type(struct gallivm_state *gallivm, const char *struct_name)
LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, mip_offsets,
target, texture_type,
DRAW_JIT_TEXTURE_MIP_OFFSETS);
+ LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, num_samples,
+ target, texture_type,
+ DRAW_JIT_TEXTURE_NUM_SAMPLES);
+ LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, sample_stride,
+ target, texture_type,
+ DRAW_JIT_TEXTURE_SAMPLE_STRIDE);
LP_CHECK_STRUCT_SIZE(struct draw_jit_texture, target, texture_type);
@@ -2404,6 +2412,8 @@ draw_llvm_set_mapped_texture(struct draw_context *draw,
unsigned sview_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t first_level, uint32_t last_level,
+ uint32_t num_samples,
+ uint32_t sample_stride,
const void *base_ptr,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
@@ -2440,6 +2450,8 @@ draw_llvm_set_mapped_texture(struct draw_context *draw,
jit_tex->first_level = first_level;
jit_tex->last_level = last_level;
jit_tex->base = base_ptr;
+ jit_tex->num_samples = num_samples;
+ jit_tex->sample_stride = sample_stride;
for (j = first_level; j <= last_level; j++) {
jit_tex->mip_offsets[j] = mip_offsets[j];
diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h
index b1c498631d2..51a2bd53d49 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.h
+++ b/src/gallium/auxiliary/draw/draw_llvm.h
@@ -58,6 +58,8 @@ struct draw_jit_texture
uint32_t first_level;
uint32_t last_level;
uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS];
+ uint32_t num_samples;
+ uint32_t sample_stride;
};
@@ -107,6 +109,8 @@ enum {
DRAW_JIT_TEXTURE_FIRST_LEVEL,
DRAW_JIT_TEXTURE_LAST_LEVEL,
DRAW_JIT_TEXTURE_MIP_OFFSETS,
+ DRAW_JIT_TEXTURE_NUM_SAMPLES,
+ DRAW_JIT_TEXTURE_SAMPLE_STRIDE,
DRAW_JIT_TEXTURE_NUM_FIELDS /* number of fields above */
};
@@ -897,6 +901,8 @@ draw_llvm_set_mapped_texture(struct draw_context *draw,
unsigned sview_idx,
uint32_t width, uint32_t height, uint32_t depth,
uint32_t first_level, uint32_t last_level,
+ uint32_t num_samples,
+ uint32_t sample_stride,
const void *base_ptr,
uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS],
uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c b/src/gallium/auxiliary/draw/draw_llvm_sample.c
index 9d7114a9a20..0a8f345280c 100644
--- a/src/gallium/auxiliary/draw/draw_llvm_sample.c
+++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c
@@ -252,7 +252,8 @@ DRAW_LLVM_TEXTURE_MEMBER(base_ptr, DRAW_JIT_TEXTURE_BASE, TRUE)
DRAW_LLVM_TEXTURE_MEMBER(row_stride, DRAW_JIT_TEXTURE_ROW_STRIDE, FALSE)
DRAW_LLVM_TEXTURE_MEMBER(img_stride, DRAW_JIT_TEXTURE_IMG_STRIDE, FALSE)
DRAW_LLVM_TEXTURE_MEMBER(mip_offsets, DRAW_JIT_TEXTURE_MIP_OFFSETS, FALSE)
-
+DRAW_LLVM_TEXTURE_MEMBER(num_samples, DRAW_JIT_TEXTURE_NUM_SAMPLES, TRUE)
+DRAW_LLVM_TEXTURE_MEMBER(sample_stride, DRAW_JIT_TEXTURE_SAMPLE_STRIDE, TRUE)
#define DRAW_LLVM_SAMPLER_MEMBER(_name, _index, _emit_load) \
static LLVMValueRef \
@@ -359,6 +360,8 @@ draw_llvm_sampler_soa_create(const struct draw_sampler_static_state *static_stat
sampler->dynamic_state.base.img_stride = draw_llvm_texture_img_stride;
sampler->dynamic_state.base.base_ptr = draw_llvm_texture_base_ptr;
sampler->dynamic_state.base.mip_offsets = draw_llvm_texture_mip_offsets;
+ sampler->dynamic_state.base.num_samples = draw_llvm_texture_num_samples;
+ sampler->dynamic_state.base.sample_stride = draw_llvm_texture_sample_stride;
sampler->dynamic_state.base.min_lod = draw_llvm_sampler_min_lod;
sampler->dynamic_state.base.max_lod = draw_llvm_sampler_max_lod;
sampler->dynamic_state.base.lod_bias = draw_llvm_sampler_lod_bias;
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index 03d218e984e..f3c38ae3237 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -432,7 +432,7 @@ i915_prepare_vertex_sampling(struct i915_context *i915)
i,
tex->width0, tex->height0, tex->depth0,
view->u.tex.first_level, tex->last_level,
- addr,
+ 0, 0, addr,
row_stride, img_stride, mip_offsets);
} else
i915->mapped_vs_tex[i] = NULL;
diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
index 485822df63b..73f6617dbc5 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c
@@ -335,7 +335,7 @@ prepare_shader_sampling(
shader_type,
i,
width0, tex->height0, num_layers,
- first_level, last_level,
+ first_level, last_level, 0, 0,
addr,
row_stride, img_stride, mip_offsets);
}
diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c
index ec1572646a2..14e44d1de9f 100644
--- a/src/gallium/drivers/softpipe/sp_state_sampler.c
+++ b/src/gallium/drivers/softpipe/sp_state_sampler.c
@@ -264,7 +264,7 @@ prepare_shader_sampling(
shader_type,
i,
width0, tex->height0, num_layers,
- first_level, last_level,
+ first_level, last_level, 0, 0,
addr,
row_stride, img_stride, mip_offsets);
}
diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c
index 956439122a3..4216b84b032 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -370,7 +370,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
draw_set_mapped_texture(draw, PIPE_SHADER_VERTEX, i, width0,
res->height0, num_layers, first_level,
- last_level, (void*)base_addr, row_stride,
+ last_level, 0, 0, (void*)base_addr, row_stride,
img_stride, mip_offset);
}