[glsl] Fold TextureBuiltinsFromUniforms into GLSL bindings
This CL moves the TextureBuiltinsFromUniforms data into the GLSL options
bindings.
Change-Id: I8a773dccc2fabfb97aaf78fccde1adc953fb4fea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/191961
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
diff --git a/include/tint/tint.h b/include/tint/tint.h
index b168265..6207ad2 100644
--- a/include/tint/tint.h
+++ b/include/tint/tint.h
@@ -35,7 +35,6 @@
// headers will need to be moved to include/tint/.
#include "src/tint/api/common/binding_point.h"
-#include "src/tint/api/options/texture_builtins_from_uniform.h"
#include "src/tint/api/tint.h"
#include "src/tint/lang/core/type/manager.h"
#include "src/tint/lang/wgsl/ast/transform/first_index_offset.h"
diff --git a/src/dawn/native/opengl/ShaderModuleGL.cpp b/src/dawn/native/opengl/ShaderModuleGL.cpp
index 1550322..fa031a2 100644
--- a/src/dawn/native/opengl/ShaderModuleGL.cpp
+++ b/src/dawn/native/opengl/ShaderModuleGL.cpp
@@ -363,12 +363,11 @@
// Some texture builtin functions are unsupported on GLSL ES. These are emulated with internal
// uniforms.
- tint::TextureBuiltinsFromUniformOptions textureBuiltinsFromUniform;
- textureBuiltinsFromUniform.ubo_binding = {kMaxBindGroups + 1, 0};
+ bindings.texture_builtins_from_uniform.ubo_binding = {kMaxBindGroups + 1, 0};
// Remap the internal ubo binding as well.
bindings.uniform.emplace(
- textureBuiltinsFromUniform.ubo_binding,
+ bindings.texture_builtins_from_uniform.ubo_binding,
tint::glsl::writer::binding::Uniform{layout->GetInternalUniformBinding()});
auto textureBuiltinsFromUniformData = inspector.GetTextureQueries(programmableStage.entryPoint);
@@ -380,7 +379,8 @@
// This is the unmodified binding point from the WGSL shader.
tint::BindingPoint srcBindingPoint{info.group, info.binding};
- textureBuiltinsFromUniform.ubo_bindingpoint_ordering.emplace_back(srcBindingPoint);
+ bindings.texture_builtins_from_uniform.ubo_bindingpoint_ordering.emplace_back(
+ srcBindingPoint);
// The remapped binding point is inserted into the Dawn data structure.
const BindGroupLayoutInternalBase* bgl =
@@ -449,7 +449,6 @@
}
req.tintOptions.bindings = std::move(bindings);
- req.tintOptions.texture_builtins_from_uniform = std::move(textureBuiltinsFromUniform);
req.tintOptions.disable_polyfill_integer_div_mod =
GetDevice()->IsToggleEnabled(Toggle::DisablePolyfillsOnIntegerDivisonAndModulo);
diff --git a/src/tint/api/BUILD.bazel b/src/tint/api/BUILD.bazel
index c830679..4a82e4b 100644
--- a/src/tint/api/BUILD.bazel
+++ b/src/tint/api/BUILD.bazel
@@ -46,7 +46,6 @@
],
deps = [
"//src/tint/api/common",
- "//src/tint/api/options",
"//src/tint/lang/core",
"//src/tint/lang/core/constant",
"//src/tint/lang/core/ir",
diff --git a/src/tint/api/BUILD.cmake b/src/tint/api/BUILD.cmake
index 8f269d5..f851c9b 100644
--- a/src/tint/api/BUILD.cmake
+++ b/src/tint/api/BUILD.cmake
@@ -35,7 +35,6 @@
################################################################################
include(api/common/BUILD.cmake)
-include(api/options/BUILD.cmake)
################################################################################
# Target: tint_api
@@ -48,7 +47,6 @@
tint_target_add_dependencies(tint_api lib
tint_api_common
- tint_api_options
tint_lang_core
tint_lang_core_constant
tint_lang_core_ir
diff --git a/src/tint/api/BUILD.gn b/src/tint/api/BUILD.gn
index 6cd4598..183e21a 100644
--- a/src/tint/api/BUILD.gn
+++ b/src/tint/api/BUILD.gn
@@ -45,7 +45,6 @@
]
deps = [
"${tint_src_dir}/api/common",
- "${tint_src_dir}/api/options",
"${tint_src_dir}/lang/core",
"${tint_src_dir}/lang/core/constant",
"${tint_src_dir}/lang/core/ir",
diff --git a/src/tint/api/options/BUILD.bazel b/src/tint/api/options/BUILD.bazel
deleted file mode 100644
index 47bebba..0000000
--- a/src/tint/api/options/BUILD.bazel
+++ /dev/null
@@ -1,89 +0,0 @@
-# Copyright 2023 The Dawn & Tint Authors
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1. Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following disclaimer in the documentation
-# and/or other materials provided with the distribution.
-#
-# 3. Neither the name of the copyright holder nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-################################################################################
-# File generated by 'tools/src/cmd/gen' using the template:
-# tools/src/cmd/gen/build/BUILD.bazel.tmpl
-#
-# To regenerate run: './tools/run gen'
-#
-# Do not modify this file directly
-################################################################################
-
-load("//src/tint:flags.bzl", "COPTS")
-load("@bazel_skylib//lib:selects.bzl", "selects")
-cc_library(
- name = "options",
- srcs = [
- "options.cc",
- ],
- hdrs = [
- "texture_builtins_from_uniform.h",
- ],
- deps = [
- "//src/tint/api/common",
- "//src/tint/utils/containers",
- "//src/tint/utils/diagnostic",
- "//src/tint/utils/ice",
- "//src/tint/utils/macros",
- "//src/tint/utils/math",
- "//src/tint/utils/memory",
- "//src/tint/utils/reflection",
- "//src/tint/utils/result",
- "//src/tint/utils/rtti",
- "//src/tint/utils/text",
- "//src/tint/utils/traits",
- ],
- copts = COPTS,
- visibility = ["//visibility:public"],
-)
-cc_library(
- name = "test",
- alwayslink = True,
- srcs = [
- "texture_builtins_from_uniform_test.cc",
- ],
- deps = [
- "//src/tint/api/common",
- "//src/tint/api/options",
- "//src/tint/utils/containers",
- "//src/tint/utils/diagnostic",
- "//src/tint/utils/ice",
- "//src/tint/utils/macros",
- "//src/tint/utils/math",
- "//src/tint/utils/memory",
- "//src/tint/utils/reflection",
- "//src/tint/utils/result",
- "//src/tint/utils/rtti",
- "//src/tint/utils/text",
- "//src/tint/utils/traits",
- "@gtest",
- ],
- copts = COPTS,
- visibility = ["//visibility:public"],
-)
-
diff --git a/src/tint/api/options/BUILD.cmake b/src/tint/api/options/BUILD.cmake
deleted file mode 100644
index e6ef899..0000000
--- a/src/tint/api/options/BUILD.cmake
+++ /dev/null
@@ -1,87 +0,0 @@
-# Copyright 2023 The Dawn & Tint Authors
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1. Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following disclaimer in the documentation
-# and/or other materials provided with the distribution.
-#
-# 3. Neither the name of the copyright holder nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-################################################################################
-# File generated by 'tools/src/cmd/gen' using the template:
-# tools/src/cmd/gen/build/BUILD.cmake.tmpl
-#
-# To regenerate run: './tools/run gen'
-#
-# Do not modify this file directly
-################################################################################
-
-################################################################################
-# Target: tint_api_options
-# Kind: lib
-################################################################################
-tint_add_target(tint_api_options lib
- api/options/options.cc
- api/options/texture_builtins_from_uniform.h
-)
-
-tint_target_add_dependencies(tint_api_options lib
- tint_api_common
- tint_utils_containers
- tint_utils_diagnostic
- tint_utils_ice
- tint_utils_macros
- tint_utils_math
- tint_utils_memory
- tint_utils_reflection
- tint_utils_result
- tint_utils_rtti
- tint_utils_text
- tint_utils_traits
-)
-
-################################################################################
-# Target: tint_api_options_test
-# Kind: test
-################################################################################
-tint_add_target(tint_api_options_test test
- api/options/texture_builtins_from_uniform_test.cc
-)
-
-tint_target_add_dependencies(tint_api_options_test test
- tint_api_common
- tint_api_options
- tint_utils_containers
- tint_utils_diagnostic
- tint_utils_ice
- tint_utils_macros
- tint_utils_math
- tint_utils_memory
- tint_utils_reflection
- tint_utils_result
- tint_utils_rtti
- tint_utils_text
- tint_utils_traits
-)
-
-tint_target_add_external_dependencies(tint_api_options_test test
- "gtest"
-)
diff --git a/src/tint/api/options/BUILD.gn b/src/tint/api/options/BUILD.gn
deleted file mode 100644
index abb0c19..0000000
--- a/src/tint/api/options/BUILD.gn
+++ /dev/null
@@ -1,85 +0,0 @@
-# Copyright 2023 The Dawn & Tint Authors
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1. Redistributions of source code must retain the above copyright notice, this
-# list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following disclaimer in the documentation
-# and/or other materials provided with the distribution.
-#
-# 3. Neither the name of the copyright holder nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-################################################################################
-# File generated by 'tools/src/cmd/gen' using the template:
-# tools/src/cmd/gen/build/BUILD.gn.tmpl
-#
-# To regenerate run: './tools/run gen'
-#
-# Do not modify this file directly
-################################################################################
-
-import("../../../../scripts/tint_overrides_with_defaults.gni")
-
-import("${tint_src_dir}/tint.gni")
-
-if (tint_build_unittests || tint_build_benchmarks) {
- import("//testing/test.gni")
-}
-
-libtint_source_set("options") {
- sources = [
- "options.cc",
- "texture_builtins_from_uniform.h",
- ]
- deps = [
- "${tint_src_dir}/api/common",
- "${tint_src_dir}/utils/containers",
- "${tint_src_dir}/utils/diagnostic",
- "${tint_src_dir}/utils/ice",
- "${tint_src_dir}/utils/macros",
- "${tint_src_dir}/utils/math",
- "${tint_src_dir}/utils/memory",
- "${tint_src_dir}/utils/reflection",
- "${tint_src_dir}/utils/result",
- "${tint_src_dir}/utils/rtti",
- "${tint_src_dir}/utils/text",
- "${tint_src_dir}/utils/traits",
- ]
-}
-if (tint_build_unittests) {
- tint_unittests_source_set("unittests") {
- sources = [ "texture_builtins_from_uniform_test.cc" ]
- deps = [
- "${tint_src_dir}:gmock_and_gtest",
- "${tint_src_dir}/api/common",
- "${tint_src_dir}/api/options",
- "${tint_src_dir}/utils/containers",
- "${tint_src_dir}/utils/diagnostic",
- "${tint_src_dir}/utils/ice",
- "${tint_src_dir}/utils/macros",
- "${tint_src_dir}/utils/math",
- "${tint_src_dir}/utils/memory",
- "${tint_src_dir}/utils/reflection",
- "${tint_src_dir}/utils/result",
- "${tint_src_dir}/utils/rtti",
- "${tint_src_dir}/utils/text",
- "${tint_src_dir}/utils/traits",
- ]
- }
-}
diff --git a/src/tint/api/options/options.cc b/src/tint/api/options/options.cc
deleted file mode 100644
index accc963..0000000
--- a/src/tint/api/options/options.cc
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2023 The Dawn & Tint Authors
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#if defined(__clang__)
-#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
-#endif
-
-// A placeholder symbol used to emit a symbol for this lib target.
-int tint_api_options_symbol = 1;
diff --git a/src/tint/api/options/texture_builtins_from_uniform.h b/src/tint/api/options/texture_builtins_from_uniform.h
deleted file mode 100644
index 43e9232..0000000
--- a/src/tint/api/options/texture_builtins_from_uniform.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2023 The Dawn & Tint Authors
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#ifndef SRC_TINT_API_OPTIONS_TEXTURE_BUILTINS_FROM_UNIFORM_H_
-#define SRC_TINT_API_OPTIONS_TEXTURE_BUILTINS_FROM_UNIFORM_H_
-
-#include <vector>
-
-#include "src/tint/api/common/binding_point.h"
-#include "src/tint/utils/reflection/reflection.h"
-
-namespace tint {
-
-/// Options used to specify a mapping of binding points to indices into a UBO
-/// from which to load buffer sizes.
-struct TextureBuiltinsFromUniformOptions {
- /// The binding point to use to generate a uniform buffer from which to read
- /// buffer sizes.
- BindingPoint ubo_binding = {};
-
- /// Ordered list of binding points in the uniform buffer for polyfilling `textureNumSamples` and
- /// `textureNumLevels`
- std::vector<BindingPoint> ubo_bindingpoint_ordering = {};
-
- /// Reflect the fields of this class so that it can be used by tint::ForeachField()
- TINT_REFLECT(TextureBuiltinsFromUniformOptions, ubo_binding, ubo_bindingpoint_ordering);
-};
-
-} // namespace tint
-
-#endif // SRC_TINT_API_OPTIONS_TEXTURE_BUILTINS_FROM_UNIFORM_H_
diff --git a/src/tint/api/options/texture_builtins_from_uniform_test.cc b/src/tint/api/options/texture_builtins_from_uniform_test.cc
deleted file mode 100644
index 1e304b4..0000000
--- a/src/tint/api/options/texture_builtins_from_uniform_test.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2024 The Dawn & Tint Authors
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "src/tint/api/options/texture_builtins_from_uniform.h"
-
-#include <gtest/gtest.h>
-
-namespace tint {
-namespace {
-
-TEST(TintCheckAllFieldsReflected, ApiOptionsTextureBuiltinsFromUniformTest) {
- TINT_ASSERT_ALL_FIELDS_REFLECTED(tint::TextureBuiltinsFromUniformOptions);
-}
-
-} // namespace
-} // namespace tint
diff --git a/src/tint/cmd/loopy/BUILD.bazel b/src/tint/cmd/loopy/BUILD.bazel
index a1bcba6..289497a 100644
--- a/src/tint/cmd/loopy/BUILD.bazel
+++ b/src/tint/cmd/loopy/BUILD.bazel
@@ -44,7 +44,6 @@
deps = [
"//src/tint/api",
"//src/tint/api/common",
- "//src/tint/api/options",
"//src/tint/cmd/common",
"//src/tint/lang/core",
"//src/tint/lang/core/constant",
diff --git a/src/tint/cmd/loopy/BUILD.cmake b/src/tint/cmd/loopy/BUILD.cmake
index 9c63575..e3d6094 100644
--- a/src/tint/cmd/loopy/BUILD.cmake
+++ b/src/tint/cmd/loopy/BUILD.cmake
@@ -45,7 +45,6 @@
tint_target_add_dependencies(tint_cmd_loopy_cmd cmd
tint_api
tint_api_common
- tint_api_options
tint_cmd_common
tint_lang_core
tint_lang_core_constant
diff --git a/src/tint/cmd/loopy/BUILD.gn b/src/tint/cmd/loopy/BUILD.gn
index e5f20eb..cdc27e0 100644
--- a/src/tint/cmd/loopy/BUILD.gn
+++ b/src/tint/cmd/loopy/BUILD.gn
@@ -44,7 +44,6 @@
deps = [
"${tint_src_dir}/api",
"${tint_src_dir}/api/common",
- "${tint_src_dir}/api/options",
"${tint_src_dir}/cmd/common",
"${tint_src_dir}/lang/core",
"${tint_src_dir}/lang/core/constant",
diff --git a/src/tint/cmd/test/BUILD.bazel b/src/tint/cmd/test/BUILD.bazel
index 2a5901b..d73d959 100644
--- a/src/tint/cmd/test/BUILD.bazel
+++ b/src/tint/cmd/test/BUILD.bazel
@@ -44,7 +44,6 @@
deps = [
"//src/tint/api",
"//src/tint/api/common:test",
- "//src/tint/api/options:test",
"//src/tint/lang/core/constant:test",
"//src/tint/lang/core/intrinsic:test",
"//src/tint/lang/core/ir/transform/common:test",
diff --git a/src/tint/cmd/test/BUILD.cmake b/src/tint/cmd/test/BUILD.cmake
index e500500..2614f43 100644
--- a/src/tint/cmd/test/BUILD.cmake
+++ b/src/tint/cmd/test/BUILD.cmake
@@ -45,7 +45,6 @@
tint_target_add_dependencies(tint_cmd_test_test_cmd test_cmd
tint_api
tint_api_common_test
- tint_api_options_test
tint_lang_core_constant_test
tint_lang_core_intrinsic_test
tint_lang_core_ir_transform_common_test
diff --git a/src/tint/cmd/test/BUILD.gn b/src/tint/cmd/test/BUILD.gn
index 2942176..8d7b1a3 100644
--- a/src/tint/cmd/test/BUILD.gn
+++ b/src/tint/cmd/test/BUILD.gn
@@ -50,7 +50,6 @@
"${tint_src_dir}:gmock_and_gtest",
"${tint_src_dir}/api",
"${tint_src_dir}/api/common:unittests",
- "${tint_src_dir}/api/options:unittests",
"${tint_src_dir}/lang/core:unittests",
"${tint_src_dir}/lang/core/constant:unittests",
"${tint_src_dir}/lang/core/intrinsic:unittests",
diff --git a/src/tint/cmd/tint/BUILD.bazel b/src/tint/cmd/tint/BUILD.bazel
index 965c2f9..a1ea789 100644
--- a/src/tint/cmd/tint/BUILD.bazel
+++ b/src/tint/cmd/tint/BUILD.bazel
@@ -44,7 +44,6 @@
deps = [
"//src/tint/api",
"//src/tint/api/common",
- "//src/tint/api/options",
"//src/tint/cmd/common",
"//src/tint/lang/core",
"//src/tint/lang/core/constant",
diff --git a/src/tint/cmd/tint/BUILD.cmake b/src/tint/cmd/tint/BUILD.cmake
index 3df027a..a9c5e6a 100644
--- a/src/tint/cmd/tint/BUILD.cmake
+++ b/src/tint/cmd/tint/BUILD.cmake
@@ -45,7 +45,6 @@
tint_target_add_dependencies(tint_cmd_tint_cmd cmd
tint_api
tint_api_common
- tint_api_options
tint_cmd_common
tint_lang_core
tint_lang_core_constant
diff --git a/src/tint/cmd/tint/BUILD.gn b/src/tint/cmd/tint/BUILD.gn
index 07c823a..8244381 100644
--- a/src/tint/cmd/tint/BUILD.gn
+++ b/src/tint/cmd/tint/BUILD.gn
@@ -44,7 +44,6 @@
deps = [
"${tint_src_dir}/api",
"${tint_src_dir}/api/common",
- "${tint_src_dir}/api/options",
"${tint_src_dir}/cmd/common",
"${tint_src_dir}/lang/core",
"${tint_src_dir}/lang/core/constant",
diff --git a/src/tint/cmd/tint/main.cc b/src/tint/cmd/tint/main.cc
index be8f4ce..91d6359 100644
--- a/src/tint/cmd/tint/main.cc
+++ b/src/tint/cmd/tint/main.cc
@@ -1146,10 +1146,8 @@
gen_options.disable_robustness = !options.enable_robustness;
gen_options.bindings = tint::glsl::writer::GenerateBindings(program);
- tint::TextureBuiltinsFromUniformOptions textureBuiltinsFromUniform;
constexpr uint32_t kMaxBindGroups = 4u;
-
- textureBuiltinsFromUniform.ubo_binding = {kMaxBindGroups, 0u};
+ gen_options.bindings.texture_builtins_from_uniform.ubo_binding = {kMaxBindGroups, 0u};
auto textureBuiltinsFromUniformData = inspector.GetTextureQueries(entry_point_name);
if (!textureBuiltinsFromUniformData.empty()) {
@@ -1158,12 +1156,11 @@
// This is the unmodified binding point from the WGSL shader.
tint::BindingPoint srcBindingPoint{info.group, info.binding};
- textureBuiltinsFromUniform.ubo_bindingpoint_ordering.emplace_back(srcBindingPoint);
+ gen_options.bindings.texture_builtins_from_uniform.ubo_bindingpoint_ordering
+ .emplace_back(srcBindingPoint);
}
}
- gen_options.texture_builtins_from_uniform = std::move(textureBuiltinsFromUniform);
-
auto entry_point = inspector.GetEntryPoint(entry_point_name);
uint32_t offset = entry_point.push_constant_size;
diff --git a/src/tint/lang/glsl/writer/BUILD.bazel b/src/tint/lang/glsl/writer/BUILD.bazel
index 8ecd6b7..78b509d 100644
--- a/src/tint/lang/glsl/writer/BUILD.bazel
+++ b/src/tint/lang/glsl/writer/BUILD.bazel
@@ -48,7 +48,6 @@
],
deps = [
"//src/tint/api/common",
- "//src/tint/api/options",
"//src/tint/lang/core",
"//src/tint/lang/core/constant",
"//src/tint/lang/core/type",
@@ -92,7 +91,6 @@
],
deps = [
"//src/tint/api/common",
- "//src/tint/api/options",
"//src/tint/cmd/bench:bench",
"//src/tint/lang/core",
"//src/tint/lang/core/constant",
diff --git a/src/tint/lang/glsl/writer/BUILD.cmake b/src/tint/lang/glsl/writer/BUILD.cmake
index d857785..e80c329 100644
--- a/src/tint/lang/glsl/writer/BUILD.cmake
+++ b/src/tint/lang/glsl/writer/BUILD.cmake
@@ -56,7 +56,6 @@
tint_target_add_dependencies(tint_lang_glsl_writer lib
tint_api_common
- tint_api_options
tint_lang_core
tint_lang_core_constant
tint_lang_core_type
@@ -104,7 +103,6 @@
tint_target_add_dependencies(tint_lang_glsl_writer_bench bench
tint_api_common
- tint_api_options
tint_cmd_bench_bench
tint_lang_core
tint_lang_core_constant
@@ -153,7 +151,6 @@
tint_target_add_dependencies(tint_lang_glsl_writer_fuzz fuzz
tint_api_common
- tint_api_options
tint_lang_core
tint_lang_core_constant
tint_lang_core_type
diff --git a/src/tint/lang/glsl/writer/BUILD.gn b/src/tint/lang/glsl/writer/BUILD.gn
index 4b6b514..84f331c 100644
--- a/src/tint/lang/glsl/writer/BUILD.gn
+++ b/src/tint/lang/glsl/writer/BUILD.gn
@@ -51,7 +51,6 @@
]
deps = [
"${tint_src_dir}/api/common",
- "${tint_src_dir}/api/options",
"${tint_src_dir}/lang/core",
"${tint_src_dir}/lang/core/constant",
"${tint_src_dir}/lang/core/type",
@@ -94,7 +93,6 @@
deps = [
"${tint_src_dir}:google_benchmark",
"${tint_src_dir}/api/common",
- "${tint_src_dir}/api/options",
"${tint_src_dir}/cmd/bench:bench",
"${tint_src_dir}/lang/core",
"${tint_src_dir}/lang/core/constant",
@@ -134,7 +132,6 @@
sources = []
deps = [
"${tint_src_dir}/api/common",
- "${tint_src_dir}/api/options",
"${tint_src_dir}/lang/core",
"${tint_src_dir}/lang/core/constant",
"${tint_src_dir}/lang/core/type",
diff --git a/src/tint/lang/glsl/writer/ast_printer/BUILD.bazel b/src/tint/lang/glsl/writer/ast_printer/BUILD.bazel
index 88bf0886..0049a05 100644
--- a/src/tint/lang/glsl/writer/ast_printer/BUILD.bazel
+++ b/src/tint/lang/glsl/writer/ast_printer/BUILD.bazel
@@ -46,7 +46,6 @@
],
deps = [
"//src/tint/api/common",
- "//src/tint/api/options",
"//src/tint/lang/core",
"//src/tint/lang/core/common",
"//src/tint/lang/core/constant",
@@ -121,7 +120,6 @@
],
deps = [
"//src/tint/api/common",
- "//src/tint/api/options",
"//src/tint/lang/core",
"//src/tint/lang/core/constant",
"//src/tint/lang/core/type",
diff --git a/src/tint/lang/glsl/writer/ast_printer/BUILD.cmake b/src/tint/lang/glsl/writer/ast_printer/BUILD.cmake
index a6cb805..ac79962 100644
--- a/src/tint/lang/glsl/writer/ast_printer/BUILD.cmake
+++ b/src/tint/lang/glsl/writer/ast_printer/BUILD.cmake
@@ -47,7 +47,6 @@
tint_target_add_dependencies(tint_lang_glsl_writer_ast_printer lib
tint_api_common
- tint_api_options
tint_lang_core
tint_lang_core_common
tint_lang_core_constant
@@ -126,7 +125,6 @@
tint_target_add_dependencies(tint_lang_glsl_writer_ast_printer_test test
tint_api_common
- tint_api_options
tint_lang_core
tint_lang_core_constant
tint_lang_core_type
diff --git a/src/tint/lang/glsl/writer/ast_printer/BUILD.gn b/src/tint/lang/glsl/writer/ast_printer/BUILD.gn
index ab703e1..3bbad04 100644
--- a/src/tint/lang/glsl/writer/ast_printer/BUILD.gn
+++ b/src/tint/lang/glsl/writer/ast_printer/BUILD.gn
@@ -49,7 +49,6 @@
]
deps = [
"${tint_src_dir}/api/common",
- "${tint_src_dir}/api/options",
"${tint_src_dir}/lang/core",
"${tint_src_dir}/lang/core/common",
"${tint_src_dir}/lang/core/constant",
@@ -125,7 +124,6 @@
deps = [
"${tint_src_dir}:gmock_and_gtest",
"${tint_src_dir}/api/common",
- "${tint_src_dir}/api/options",
"${tint_src_dir}/lang/core",
"${tint_src_dir}/lang/core/constant",
"${tint_src_dir}/lang/core/type",
diff --git a/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc b/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
index 57453a2..d2c924a 100644
--- a/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
+++ b/src/tint/lang/glsl/writer/ast_printer/ast_printer.cc
@@ -184,8 +184,8 @@
// comes before BindingRemapper so the binding point info it reflects is before remapping.
manager.Add<TextureBuiltinsFromUniform>();
data.Add<TextureBuiltinsFromUniform::Config>(
- options.texture_builtins_from_uniform.ubo_binding,
- options.texture_builtins_from_uniform.ubo_bindingpoint_ordering);
+ options.bindings.texture_builtins_from_uniform.ubo_binding,
+ options.bindings.texture_builtins_from_uniform.ubo_bindingpoint_ordering);
tint::transform::multiplanar::BindingsMap multiplanar_map{};
RemapperData remapper_data{};
diff --git a/src/tint/lang/glsl/writer/ast_printer/ast_printer.h b/src/tint/lang/glsl/writer/ast_printer/ast_printer.h
index a1c41ae..a433734 100644
--- a/src/tint/lang/glsl/writer/ast_printer/ast_printer.h
+++ b/src/tint/lang/glsl/writer/ast_printer/ast_printer.h
@@ -34,7 +34,6 @@
#include <unordered_set>
#include <utility>
-#include "src/tint/api/options/texture_builtins_from_uniform.h"
#include "src/tint/lang/core/builtin_value.h"
#include "src/tint/lang/glsl/writer/common/version.h"
#include "src/tint/lang/wgsl/program/program_builder.h"
diff --git a/src/tint/lang/glsl/writer/ast_raise/BUILD.bazel b/src/tint/lang/glsl/writer/ast_raise/BUILD.bazel
index 49e220f..7bea3d7 100644
--- a/src/tint/lang/glsl/writer/ast_raise/BUILD.bazel
+++ b/src/tint/lang/glsl/writer/ast_raise/BUILD.bazel
@@ -52,7 +52,6 @@
],
deps = [
"//src/tint/api/common",
- "//src/tint/api/options",
"//src/tint/lang/core",
"//src/tint/lang/core/constant",
"//src/tint/lang/core/type",
@@ -97,7 +96,6 @@
],
deps = [
"//src/tint/api/common",
- "//src/tint/api/options",
"//src/tint/lang/core",
"//src/tint/lang/core/constant",
"//src/tint/lang/core/ir",
diff --git a/src/tint/lang/glsl/writer/ast_raise/BUILD.cmake b/src/tint/lang/glsl/writer/ast_raise/BUILD.cmake
index ab41d85..1bee34d 100644
--- a/src/tint/lang/glsl/writer/ast_raise/BUILD.cmake
+++ b/src/tint/lang/glsl/writer/ast_raise/BUILD.cmake
@@ -53,7 +53,6 @@
tint_target_add_dependencies(tint_lang_glsl_writer_ast_raise lib
tint_api_common
- tint_api_options
tint_lang_core
tint_lang_core_constant
tint_lang_core_type
@@ -102,7 +101,6 @@
tint_target_add_dependencies(tint_lang_glsl_writer_ast_raise_test test
tint_api_common
- tint_api_options
tint_lang_core
tint_lang_core_constant
tint_lang_core_ir
diff --git a/src/tint/lang/glsl/writer/ast_raise/BUILD.gn b/src/tint/lang/glsl/writer/ast_raise/BUILD.gn
index 75216fd..f1a3a32 100644
--- a/src/tint/lang/glsl/writer/ast_raise/BUILD.gn
+++ b/src/tint/lang/glsl/writer/ast_raise/BUILD.gn
@@ -55,7 +55,6 @@
]
deps = [
"${tint_src_dir}/api/common",
- "${tint_src_dir}/api/options",
"${tint_src_dir}/lang/core",
"${tint_src_dir}/lang/core/constant",
"${tint_src_dir}/lang/core/type",
@@ -100,7 +99,6 @@
deps = [
"${tint_src_dir}:gmock_and_gtest",
"${tint_src_dir}/api/common",
- "${tint_src_dir}/api/options",
"${tint_src_dir}/lang/core",
"${tint_src_dir}/lang/core/constant",
"${tint_src_dir}/lang/core/ir",
diff --git a/src/tint/lang/glsl/writer/common/BUILD.bazel b/src/tint/lang/glsl/writer/common/BUILD.bazel
index 6082ce9..189e12d 100644
--- a/src/tint/lang/glsl/writer/common/BUILD.bazel
+++ b/src/tint/lang/glsl/writer/common/BUILD.bazel
@@ -51,7 +51,6 @@
],
deps = [
"//src/tint/api/common",
- "//src/tint/api/options",
"//src/tint/lang/core",
"//src/tint/lang/core/common",
"//src/tint/lang/core/constant",
@@ -88,7 +87,6 @@
],
deps = [
"//src/tint/api/common",
- "//src/tint/api/options",
"//src/tint/lang/core",
"//src/tint/lang/core/constant",
"//src/tint/lang/core/type",
diff --git a/src/tint/lang/glsl/writer/common/BUILD.cmake b/src/tint/lang/glsl/writer/common/BUILD.cmake
index bdc8833..d135bd9 100644
--- a/src/tint/lang/glsl/writer/common/BUILD.cmake
+++ b/src/tint/lang/glsl/writer/common/BUILD.cmake
@@ -52,7 +52,6 @@
tint_target_add_dependencies(tint_lang_glsl_writer_common lib
tint_api_common
- tint_api_options
tint_lang_core
tint_lang_core_common
tint_lang_core_constant
@@ -92,7 +91,6 @@
tint_target_add_dependencies(tint_lang_glsl_writer_common_test test
tint_api_common
- tint_api_options
tint_lang_core
tint_lang_core_constant
tint_lang_core_type
diff --git a/src/tint/lang/glsl/writer/common/BUILD.gn b/src/tint/lang/glsl/writer/common/BUILD.gn
index ba77251..d0d6acc 100644
--- a/src/tint/lang/glsl/writer/common/BUILD.gn
+++ b/src/tint/lang/glsl/writer/common/BUILD.gn
@@ -54,7 +54,6 @@
]
deps = [
"${tint_src_dir}/api/common",
- "${tint_src_dir}/api/options",
"${tint_src_dir}/lang/core",
"${tint_src_dir}/lang/core/common",
"${tint_src_dir}/lang/core/constant",
@@ -91,7 +90,6 @@
deps = [
"${tint_src_dir}:gmock_and_gtest",
"${tint_src_dir}/api/common",
- "${tint_src_dir}/api/options",
"${tint_src_dir}/lang/core",
"${tint_src_dir}/lang/core/constant",
"${tint_src_dir}/lang/core/type",
diff --git a/src/tint/lang/glsl/writer/common/options.h b/src/tint/lang/glsl/writer/common/options.h
index c2b4bc3..a9c9fdd 100644
--- a/src/tint/lang/glsl/writer/common/options.h
+++ b/src/tint/lang/glsl/writer/common/options.h
@@ -31,8 +31,9 @@
#include <optional>
#include <string>
#include <unordered_map>
+#include <vector>
-#include "src/tint/api/options/texture_builtins_from_uniform.h"
+#include "src/tint/api/common/binding_point.h"
#include "src/tint/lang/glsl/writer/common/version.h"
#include "src/tint/lang/wgsl/ast/transform/transform.h"
@@ -158,6 +159,21 @@
using CombinedTextureSamplerInfo =
std::unordered_map<binding::CombinedTextureSamplerPair, std::string>;
+/// Options used to specify a mapping of binding points to indices into a UBO
+/// from which to load buffer sizes.
+struct TextureBuiltinsFromUniformOptions {
+ /// The binding point to use to generate a uniform buffer from which to read
+ /// buffer sizes.
+ BindingPoint ubo_binding = {};
+
+ /// Ordered list of binding points in the uniform buffer for polyfilling `textureNumSamples` and
+ /// `textureNumLevels`
+ std::vector<BindingPoint> ubo_bindingpoint_ordering = {};
+
+ /// Reflect the fields of this class so that it can be used by tint::ForeachField()
+ TINT_REFLECT(TextureBuiltinsFromUniformOptions, ubo_binding, ubo_bindingpoint_ordering);
+};
+
/// Binding information
struct Bindings : public Castable<Bindings, tint::ast::transform::Data> {
/// Constructor
@@ -191,6 +207,11 @@
/// The binding point to use for placeholder samplers.
BindingPoint placeholder_sampler_bind_point;
+ /// Options used to map WGSL textureNumLevels/textureNumSamples builtins to internal uniform
+ /// buffer values. If not specified, emits corresponding GLSL builtins
+ /// textureQueryLevels/textureSamples directly.
+ TextureBuiltinsFromUniformOptions texture_builtins_from_uniform = {};
+
/// Reflect the fields of this class so that it can be used by tint::ForeachField()
TINT_REFLECT(Bindings,
uniform,
@@ -200,7 +221,8 @@
sampler,
external_texture,
sampler_texture_to_name,
- placeholder_sampler_bind_point);
+ placeholder_sampler_bind_point,
+ texture_builtins_from_uniform);
};
/// Configuration options used for generating GLSL.
@@ -245,11 +267,6 @@
/// Offsets of the minDepth and maxDepth push constants.
std::optional<RangeOffsets> depth_range_offsets;
- /// Options used to map WGSL textureNumLevels/textureNumSamples builtins to internal uniform
- /// buffer values. If not specified, emits corresponding GLSL builtins
- /// textureQueryLevels/textureSamples directly.
- TextureBuiltinsFromUniformOptions texture_builtins_from_uniform = {};
-
/// The bindings
Bindings bindings{};
@@ -262,7 +279,6 @@
first_vertex_offset,
first_instance_offset,
depth_range_offsets,
- texture_builtins_from_uniform,
bindings);
};
diff --git a/src/tint/lang/glsl/writer/helpers/BUILD.bazel b/src/tint/lang/glsl/writer/helpers/BUILD.bazel
index 95473ea..16bc50a 100644
--- a/src/tint/lang/glsl/writer/helpers/BUILD.bazel
+++ b/src/tint/lang/glsl/writer/helpers/BUILD.bazel
@@ -46,7 +46,6 @@
],
deps = [
"//src/tint/api/common",
- "//src/tint/api/options",
"//src/tint/lang/core",
"//src/tint/lang/core/constant",
"//src/tint/lang/core/type",
diff --git a/src/tint/lang/glsl/writer/helpers/BUILD.cmake b/src/tint/lang/glsl/writer/helpers/BUILD.cmake
index 53bd8e7..0222e0a 100644
--- a/src/tint/lang/glsl/writer/helpers/BUILD.cmake
+++ b/src/tint/lang/glsl/writer/helpers/BUILD.cmake
@@ -47,7 +47,6 @@
tint_target_add_dependencies(tint_lang_glsl_writer_helpers lib
tint_api_common
- tint_api_options
tint_lang_core
tint_lang_core_constant
tint_lang_core_type
diff --git a/src/tint/lang/glsl/writer/helpers/BUILD.gn b/src/tint/lang/glsl/writer/helpers/BUILD.gn
index e4f6a1f..c6d48b4 100644
--- a/src/tint/lang/glsl/writer/helpers/BUILD.gn
+++ b/src/tint/lang/glsl/writer/helpers/BUILD.gn
@@ -45,7 +45,6 @@
]
deps = [
"${tint_src_dir}/api/common",
- "${tint_src_dir}/api/options",
"${tint_src_dir}/lang/core",
"${tint_src_dir}/lang/core/constant",
"${tint_src_dir}/lang/core/type",