summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGert Wollny <[email protected]>2019-04-19 08:43:05 +0200
committerGert Wollny <[email protected]>2019-05-01 08:22:47 +0200
commit724a73509e1bc1ce3abf9500e457bb2911b642db (patch)
tree7f06c7fe818cc0f564b85f7bd079c479e2e589bc
parent7c004d093abcc9b1e147966403daa7edcc13bd92 (diff)
softpipe: Prepare handling explicit gradients
This only adds corde that is not yet enabled. Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
-rw-r--r--src/gallium/drivers/softpipe/sp_state_sampler.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_sample.c33
-rw-r--r--src/gallium/drivers/softpipe/sp_tex_sample.h9
3 files changed, 42 insertions, 1 deletions
diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c
index 751eb76e84b..356196c1917 100644
--- a/src/gallium/drivers/softpipe/sp_state_sampler.c
+++ b/src/gallium/drivers/softpipe/sp_state_sampler.c
@@ -127,6 +127,7 @@ softpipe_set_sampler_views(struct pipe_context *pipe,
if (sp_sviewsrc) {
memcpy(sp_sviewdst, sp_sviewsrc, sizeof(*sp_sviewsrc));
sp_sviewdst->compute_lambda = softpipe_get_lambda_func(&sp_sviewdst->base, shader);
+ sp_sviewdst->compute_lambda_from_grad = softpipe_get_lambda_from_grad_func(&sp_sviewdst->base, shader);
sp_sviewdst->cache = softpipe->tex_cache[shader][start + i];
}
else {
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c
index ce702c9bb78..bfd10b0736d 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.c
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.c
@@ -659,6 +659,39 @@ compute_lambda_vert(const struct sp_sampler_view *sview,
}
+static float
+compute_lambda_vert_explicite_gradients(UNUSED const struct sp_sampler_view *sview,
+ UNUSED const float derivs[3][2][TGSI_QUAD_SIZE],
+ UNUSED int quad)
+{
+ return 0.0f;
+}
+
+
+compute_lambda_from_grad_func
+softpipe_get_lambda_from_grad_func(const struct pipe_sampler_view *view,
+ enum pipe_shader_type shader)
+{
+ switch (view->target) {
+ case PIPE_BUFFER:
+ case PIPE_TEXTURE_1D:
+ case PIPE_TEXTURE_1D_ARRAY:
+ return compute_lambda_1d_explicit_gradients;
+ case PIPE_TEXTURE_2D:
+ case PIPE_TEXTURE_2D_ARRAY:
+ case PIPE_TEXTURE_RECT:
+ return compute_lambda_2d_explicit_gradients;
+ case PIPE_TEXTURE_CUBE:
+ case PIPE_TEXTURE_CUBE_ARRAY:
+ return compute_lambda_cube_explicit_gradients;
+ case PIPE_TEXTURE_3D:
+ return compute_lambda_3d_explicit_gradients;
+ default:
+ assert(0);
+ return compute_lambda_1d_explicit_gradients;
+ }
+}
+
/**
* Get a texel from a texture, using the texture tile cache.
diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h
index f7774f5e883..44853b3b529 100644
--- a/src/gallium/drivers/softpipe/sp_tex_sample.h
+++ b/src/gallium/drivers/softpipe/sp_tex_sample.h
@@ -53,6 +53,10 @@ typedef float (*compute_lambda_func)(const struct sp_sampler_view *sp_sview,
const float t[TGSI_QUAD_SIZE],
const float p[TGSI_QUAD_SIZE]);
+typedef float (*compute_lambda_from_grad_func)(const struct sp_sampler_view *sp_sview,
+ const float derivs[3][2][TGSI_QUAD_SIZE],
+ uint quad);
+
struct img_filter_args {
float s;
float t;
@@ -116,7 +120,7 @@ struct sp_sampler_view
/* these are different per shader type */
struct softpipe_tex_tile_cache *cache;
compute_lambda_func compute_lambda;
-
+ compute_lambda_from_grad_func compute_lambda_from_grad;
};
struct sp_filter_funcs {
@@ -158,6 +162,9 @@ compute_lambda_func
softpipe_get_lambda_func(const struct pipe_sampler_view *view,
enum pipe_shader_type shader);
+compute_lambda_from_grad_func
+softpipe_get_lambda_from_grad_func(const struct pipe_sampler_view *view,
+ enum pipe_shader_type shader);
void *
softpipe_create_sampler_state(struct pipe_context *pipe,