Mesa (main): lavapipe: Allow for texture types
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Oct 16 06:15:09 UTC 2021
Module: Mesa
Branch: main
Commit: 3c398139e1022d38c0343ea9e69ec511340986dd
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3c398139e1022d38c0343ea9e69ec511340986dd
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Fri Oct 15 16:55:37 2021 -0500
lavapipe: Allow for texture types
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13389>
---
src/gallium/auxiliary/nir/nir_to_tgsi.c | 6 ++++--
src/gallium/auxiliary/nir/nir_to_tgsi_info.c | 3 ++-
src/gallium/frontends/lavapipe/lvp_lower_vulkan_resource.c | 2 +-
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c
index 0bc6796aeda..3919485c474 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c
@@ -471,12 +471,14 @@ static void
ntt_setup_uniforms(struct ntt_compile *c)
{
nir_foreach_uniform_variable(var, c->s) {
- if (glsl_type_is_sampler(glsl_without_array(var->type))) {
+ if (glsl_type_is_sampler(glsl_without_array(var->type)) ||
+ glsl_type_is_texture(glsl_without_array(var->type))) {
/* Don't use this size for the check for samplers -- arrays of structs
* containing samplers should be ignored, and just the separate lowered
* sampler uniform decl used.
*/
- int size = glsl_type_get_sampler_count(var->type);
+ int size = glsl_type_get_sampler_count(var->type) +
+ glsl_type_get_texture_count(var->type);
const struct glsl_type *stype = glsl_without_array(var->type);
enum tgsi_texture_type target = tgsi_texture_type_from_sampler_dim(glsl_get_sampler_dim(stype),
diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi_info.c b/src/gallium/auxiliary/nir/nir_to_tgsi_info.c
index f54c3a9aee8..ce1e3412f42 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi_info.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi_info.c
@@ -786,7 +786,8 @@ void nir_tgsi_scan_shader(const struct nir_shader *nir,
uint32_t sampler_mask = 0;
nir_foreach_uniform_variable(var, nir) {
- uint32_t sampler_count = glsl_type_get_sampler_count(var->type);
+ uint32_t sampler_count = glsl_type_get_sampler_count(var->type) +
+ glsl_type_get_texture_count(var->type);
sampler_mask |= ((1ull << sampler_count) - 1) << var->data.binding;
}
uint32_t image_mask = 0;
diff --git a/src/gallium/frontends/lavapipe/lvp_lower_vulkan_resource.c b/src/gallium/frontends/lavapipe/lvp_lower_vulkan_resource.c
index 49285384f1a..42938693ca4 100644
--- a/src/gallium/frontends/lavapipe/lvp_lower_vulkan_resource.c
+++ b/src/gallium/frontends/lavapipe/lvp_lower_vulkan_resource.c
@@ -220,7 +220,7 @@ void lvp_lower_pipeline_layout(const struct lvp_device *device,
struct lvp_descriptor_set_binding_layout *binding = &layout->set[desc_set_idx].layout->binding[binding_idx];
int value = 0;
var->data.descriptor_set = 0;
- if (base_type == GLSL_TYPE_SAMPLER) {
+ if (base_type == GLSL_TYPE_SAMPLER || base_type == GLSL_TYPE_TEXTURE) {
if (binding->type == VK_DESCRIPTOR_TYPE_SAMPLER) {
for (unsigned s = 0; s < desc_set_idx; s++)
value += layout->set[s].layout->stage[shader->info.stage].sampler_count;
More information about the mesa-commit
mailing list