mesa/st: make sampler_type_for_target public

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11984>
This commit is contained in:
Mike Blumenkrantz 2021-11-16 10:14:37 -05:00
parent c9a47c85da
commit f7a51e9469
2 changed files with 17 additions and 14 deletions

View File

@ -44,17 +44,6 @@
#include "compiler/nir/nir_builder.h"
/* Conversion to apply in the fragment shader. */
enum st_pbo_conversion {
ST_PBO_CONVERT_FLOAT = 0,
ST_PBO_CONVERT_UINT,
ST_PBO_CONVERT_SINT,
ST_PBO_CONVERT_UINT_TO_SINT,
ST_PBO_CONVERT_SINT_TO_UINT,
ST_NUM_PBO_CONVERSIONS
};
/* Final setup of buffer addressing information.
*
* buf_offset is in pixels.
@ -385,8 +374,8 @@ st_pbo_create_gs(struct st_context *st)
return ureg_create_shader_and_destroy(ureg, st->pipe);
}
static const struct glsl_type *
sampler_type_for_target(enum pipe_texture_target target,
const struct glsl_type *
st_pbo_sampler_type_for_target(enum pipe_texture_target target,
enum st_pbo_conversion conv)
{
bool is_array = target >= PIPE_TEXTURE_1D_ARRAY;
@ -518,7 +507,7 @@ create_fs(struct st_context *st, bool download,
nir_variable *tex_var =
nir_variable_create(b.shader, nir_var_uniform,
sampler_type_for_target(target, conversion),
st_pbo_sampler_type_for_target(target, conversion),
"tex");
tex_var->data.explicit_binding = true;
tex_var->data.binding = 0;

View File

@ -58,6 +58,20 @@ struct st_pbo_addresses {
} constants;
};
/* Conversion to apply in the fragment shader. */
enum st_pbo_conversion {
ST_PBO_CONVERT_FLOAT = 0,
ST_PBO_CONVERT_UINT,
ST_PBO_CONVERT_SINT,
ST_PBO_CONVERT_UINT_TO_SINT,
ST_PBO_CONVERT_SINT_TO_UINT,
ST_NUM_PBO_CONVERSIONS
};
const struct glsl_type *
st_pbo_sampler_type_for_target(enum pipe_texture_target target,
enum st_pbo_conversion conv);
bool
st_pbo_addresses_setup(struct st_context *st,
struct pipe_resource *buf, intptr_t buf_offset,