tint: Add bgra8unorm storage texture support

Polyfill this for the SPIR-V, HLSL and GLSL backends by replacing bgra8unorm with rgba8unorm, and swizzling.

Bug: tint:1804
Change-Id: I36638202840d7313001dff6c5b60dcb948988c34
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117204
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton 2023-01-18 19:42:03 +00:00 committed by Dawn LUCI CQ
parent e2be18a7fd
commit d03dceebf3
240 changed files with 9683 additions and 249 deletions

View File

@ -67,6 +67,7 @@ Type* StorageTexture::SubtypeFor(TexelFormat format, ProgramBuilder& builder) {
return builder.create<I32>();
}
case TexelFormat::kBgra8Unorm:
case TexelFormat::kRgba8Unorm:
case TexelFormat::kRgba8Snorm:
case TexelFormat::kR32Float:

View File

@ -28,6 +28,9 @@ namespace tint::ast {
/// @param str the string to parse
/// @returns the parsed enum, or TexelFormat::kUndefined if the string could not be parsed.
TexelFormat ParseTexelFormat(std::string_view str) {
if (str == "bgra8unorm") {
return TexelFormat::kBgra8Unorm;
}
if (str == "r32float") {
return TexelFormat::kR32Float;
}
@ -83,6 +86,8 @@ std::ostream& operator<<(std::ostream& out, TexelFormat value) {
switch (value) {
case TexelFormat::kUndefined:
return out << "undefined";
case TexelFormat::kBgra8Unorm:
return out << "bgra8unorm";
case TexelFormat::kR32Float:
return out << "r32float";
case TexelFormat::kR32Sint:

View File

@ -30,6 +30,7 @@ namespace tint::ast {
/// Enumerator of texel formats
enum class TexelFormat {
kUndefined,
kBgra8Unorm,
kR32Float,
kR32Sint,
kR32Uint,
@ -59,9 +60,9 @@ std::ostream& operator<<(std::ostream& out, TexelFormat value);
TexelFormat ParseTexelFormat(std::string_view str);
constexpr const char* kTexelFormatStrings[] = {
"r32float", "r32sint", "r32uint", "rg32float", "rg32sint", "rg32uint",
"rgba16float", "rgba16sint", "rgba16uint", "rgba32float", "rgba32sint", "rgba32uint",
"rgba8sint", "rgba8snorm", "rgba8uint", "rgba8unorm",
"bgra8unorm", "r32float", "r32sint", "r32uint", "rg32float", "rg32sint",
"rg32uint", "rgba16float", "rgba16sint", "rgba16uint", "rgba32float", "rgba32sint",
"rgba32uint", "rgba8sint", "rgba8snorm", "rgba8uint", "rgba8unorm",
};
} // namespace tint::ast

View File

@ -31,29 +31,30 @@ namespace {
void TexelFormatParser(::benchmark::State& state) {
std::array kStrings{
"rcc2flot", "3flo3", "r32flVat", "r32float", "132float",
"32Jlqqat", "ll3277loat", "ppqq2snHH", "r3cv", "b2siGt",
"r32sint", "r32siivt", "8WW2sint", "rxxsint", "rXuingg",
"3uiXt", "r32u3nt", "r32uint", "E32uint", "rPTTuint",
"r32uidxx", "44g32float", "VVg32SSloat", "r32flo2Rt", "rg32float",
"r93Float", "rg32foat", "rgVROOlHat", "rg3ysin", "77grr2sllnnt",
"04g32sint", "rg32sint", "g3oont", "rg32zzt", "rgiipps1n",
"XXg32uint", "rII39955nnnt", "aagHH2uinYSS", "rg32uint", "rkk3it",
"gj3uRRn", "r3bunt", "rgba16fljat", "rgba6float", "rbq6float",
"rgba16float", "rgba1NNloat", "rgbvv6flot", "rgbaQQ6foat", "rgb6srnff",
"rgba16sijt", "NNgba16ww2t", "rgba16sint", "rgba16snt", "rgba16rrint",
"rgba1Gsint", "rgba16uFFnt", "g16uEnt", "rgb16rrint", "rgba16uint",
"gba16uit", "rXa1DuiJJt", "rgauint", "rga32klot", "rgb32float",
"rgJa32flot", "rgba32float", "rgba32fcoat", "rgba32floOt", "__gttavv2fKKoat",
"rg5a32xxnt", "__ba3sqqFt", "rgbqq2sint", "rgba32sint", "33ba32s66nt",
"rtt6a3QQooint", "r66ba3sint", "xba32zzinO6", "ryyba32uint", "rbZ32HinZ",
"rgba32uint", "rgba3u4WWnq", "rgba32uOOt", "oogba2Yin", "gba8si",
"rgba8inF", "rgba8wnt", "rgba8sint", "Gb8Kinff", "KKgqa8sint",
"rgbammsi3t", "rgba8snom", "rqba8norm", "rgbabbsnor", "rgba8snorm",
"rba8siorm", "qgba8snoOm", "rgba8snoTTvv", "rgbaFFuint", "rgQa00uiP",
"rgPa8uint", "rgba8uint", "rgssa77unt", "Cgbbb8uiRRt", "rgba8uinXX",
"CqgbaOOunorm", "rgbu8usrL", "rgba8Xnorm", "rgba8unorm", "rgba8unrm",
"ba8uqqor", "rgba8unor22",
"bgraunccrm", "blranr3", "bVra8unorm", "bgra8unorm", "bgra1unorm",
"bgrJqqnorm", "bgr7ll8unorm", "qq32lppHat", "c2fov", "r32Goat",
"r32float", "r3viiloat", "r3WWflo8t", "rxxfMoat", "rXsingg",
"3siXt", "r32s3nt", "r32sint", "E32sint", "rPTTsint",
"r32sidxx", "r442uint", "r3SSuiVVt", "R32R22t", "r32uint",
"rFui9t", "r32int", "VOORRHnt", "rgy2foat", "l77nnrr2floGt",
"rg42fl00at", "rg32float", "rgoofat", "rgzzflot", "g11p2fliia",
"XXg32sint", "rII39955nnnt", "aagHH2sinYSS", "rg32sint", "rkk3it",
"gj3sRRn", "r3bsnt", "rg32jint", "rg32unt", "rgqint",
"rg32uint", "rg32inNN", "g3vvint", "rg2uQQnt", "rga16floft",
"rgja16float", "rgNNww16f2oa", "rgba16float", "rgba16flot", "rgba16rrloat",
"rgGa16float", "rgba16sFFnt", "g16sEnt", "rgb16rrint", "rgba16sint",
"gba16sit", "rXa1DsiJJt", "rgasint", "rg111kin", "rgb16uint",
"rgJa16uit", "rgba16uint", "rgca16uint", "rgba16Oint", "KKgba__v6uintt",
"rgb832fxx5t", "rgbaqq__lat", "rgba32qloat", "rgba32float", "33gbO2floa66",
"rgboott6QQloat", "66ba32float", "xba32zzinO6", "ryyba32sint", "rbZ32HinZ",
"rgba32sint", "rgba3s4WWnq", "rgba32sOOt", "oogba2Yin", "ga32unt",
"Fga32uint", "rgb32uinw", "rgba32uint", "rgGf32uit", "rgbaqKKuint",
"rFba32ummnt", "rgba8snt", "rgq8sint", "rbbba8bin", "rgba8sint",
"rgbisint", "rgq8sinOO", "rgbaTTvvint", "rgFFa8snorm", "rg00QsnPrm",
"rgbaPsnorm", "rgba8snorm", "rgb77ssnorm", "rgba8snbbRRC", "rgbXX8snorm",
"qgCCOO8iOOt", "rsauuinL", "rgXa8uint", "rgba8uint", "rgba8int",
"rgbunqq", "rg22a8uint", "rybXX0nzzrm", "rgVVa8iorP", "rbaCunnnrm",
"rgba8unorm", "ba8unoqqHHA", "rga8unorm", "rgfa8uKKo",
};
for (auto _ : state) {
for (auto& str : kStrings) {

View File

@ -42,41 +42,44 @@ inline std::ostream& operator<<(std::ostream& out, Case c) {
}
static constexpr Case kValidCases[] = {
{"r32float", TexelFormat::kR32Float}, {"r32sint", TexelFormat::kR32Sint},
{"r32uint", TexelFormat::kR32Uint}, {"rg32float", TexelFormat::kRg32Float},
{"rg32sint", TexelFormat::kRg32Sint}, {"rg32uint", TexelFormat::kRg32Uint},
{"rgba16float", TexelFormat::kRgba16Float}, {"rgba16sint", TexelFormat::kRgba16Sint},
{"rgba16uint", TexelFormat::kRgba16Uint}, {"rgba32float", TexelFormat::kRgba32Float},
{"rgba32sint", TexelFormat::kRgba32Sint}, {"rgba32uint", TexelFormat::kRgba32Uint},
{"rgba8sint", TexelFormat::kRgba8Sint}, {"rgba8snorm", TexelFormat::kRgba8Snorm},
{"rgba8uint", TexelFormat::kRgba8Uint}, {"rgba8unorm", TexelFormat::kRgba8Unorm},
{"bgra8unorm", TexelFormat::kBgra8Unorm}, {"r32float", TexelFormat::kR32Float},
{"r32sint", TexelFormat::kR32Sint}, {"r32uint", TexelFormat::kR32Uint},
{"rg32float", TexelFormat::kRg32Float}, {"rg32sint", TexelFormat::kRg32Sint},
{"rg32uint", TexelFormat::kRg32Uint}, {"rgba16float", TexelFormat::kRgba16Float},
{"rgba16sint", TexelFormat::kRgba16Sint}, {"rgba16uint", TexelFormat::kRgba16Uint},
{"rgba32float", TexelFormat::kRgba32Float}, {"rgba32sint", TexelFormat::kRgba32Sint},
{"rgba32uint", TexelFormat::kRgba32Uint}, {"rgba8sint", TexelFormat::kRgba8Sint},
{"rgba8snorm", TexelFormat::kRgba8Snorm}, {"rgba8uint", TexelFormat::kRgba8Uint},
{"rgba8unorm", TexelFormat::kRgba8Unorm},
};
static constexpr Case kInvalidCases[] = {
{"rcc2flot", TexelFormat::kUndefined}, {"3flo3", TexelFormat::kUndefined},
{"r32flVat", TexelFormat::kUndefined}, {"r32s1nt", TexelFormat::kUndefined},
{"rq2Jint", TexelFormat::kUndefined}, {"r32sin7ll", TexelFormat::kUndefined},
{"ppqq2unHH", TexelFormat::kUndefined}, {"r3cv", TexelFormat::kUndefined},
{"b2uiGt", TexelFormat::kUndefined}, {"rgvi2float", TexelFormat::kUndefined},
{"rg328WWoat", TexelFormat::kUndefined}, {"rg32lxxMt", TexelFormat::kUndefined},
{"rgXggsnt", TexelFormat::kUndefined}, {"rgXsnu", TexelFormat::kUndefined},
{"rg32s3nt", TexelFormat::kUndefined}, {"rg3Euint", TexelFormat::kUndefined},
{"PP32TTint", TexelFormat::kUndefined}, {"xxg32ddnt", TexelFormat::kUndefined},
{"rgba446float", TexelFormat::kUndefined}, {"SSVVba16float", TexelFormat::kUndefined},
{"rgbRR6float", TexelFormat::kUndefined}, {"rga16Fint", TexelFormat::kUndefined},
{"rgb16sint", TexelFormat::kUndefined}, {"ORVHa16sint", TexelFormat::kUndefined},
{"ryba1uint", TexelFormat::kUndefined}, {"r77ba1nnullrrt", TexelFormat::kUndefined},
{"rgb4006uint", TexelFormat::kUndefined}, {"rboofloat", TexelFormat::kUndefined},
{"rgbaz2loat", TexelFormat::kUndefined}, {"ppga3ii1floa", TexelFormat::kUndefined},
{"XXgba32sint", TexelFormat::kUndefined}, {"IIgb9932nni55t", TexelFormat::kUndefined},
{"rYbaSSrrsiHHat", TexelFormat::kUndefined}, {"rbkk2Hit", TexelFormat::kUndefined},
{"jgba3ugRR", TexelFormat::kUndefined}, {"rgbab2ui", TexelFormat::kUndefined},
{"rgba8sijt", TexelFormat::kUndefined}, {"rba8sint", TexelFormat::kUndefined},
{"rba8sqt", TexelFormat::kUndefined}, {"rgba8NNnom", TexelFormat::kUndefined},
{"rga8vvorm", TexelFormat::kUndefined}, {"rgba8snorQ", TexelFormat::kUndefined},
{"rgbauirf", TexelFormat::kUndefined}, {"rgbajuint", TexelFormat::kUndefined},
{"wNNgbauin2", TexelFormat::kUndefined}, {"rgba8unrm", TexelFormat::kUndefined},
{"rgba8urrorm", TexelFormat::kUndefined}, {"rgba8Gnorm", TexelFormat::kUndefined},
{"bgraunccrm", TexelFormat::kUndefined}, {"blranr3", TexelFormat::kUndefined},
{"bVra8unorm", TexelFormat::kUndefined}, {"132float", TexelFormat::kUndefined},
{"32Jlqqat", TexelFormat::kUndefined}, {"ll3277loat", TexelFormat::kUndefined},
{"ppqq2snHH", TexelFormat::kUndefined}, {"r3cv", TexelFormat::kUndefined},
{"b2siGt", TexelFormat::kUndefined}, {"r32uiivt", TexelFormat::kUndefined},
{"8WW2uint", TexelFormat::kUndefined}, {"rxxuint", TexelFormat::kUndefined},
{"rX2flggat", TexelFormat::kUndefined}, {"rg3XVut", TexelFormat::kUndefined},
{"3g32float", TexelFormat::kUndefined}, {"rg3Esint", TexelFormat::kUndefined},
{"PP32TTint", TexelFormat::kUndefined}, {"xxg32ddnt", TexelFormat::kUndefined},
{"44g32uint", TexelFormat::kUndefined}, {"rSS32uinVV", TexelFormat::kUndefined},
{"R322Rint", TexelFormat::kUndefined}, {"rgba16fF9a", TexelFormat::kUndefined},
{"rgba16floa", TexelFormat::kUndefined}, {"rOObVR16floH", TexelFormat::kUndefined},
{"ryba1sint", TexelFormat::kUndefined}, {"r77ba1nnsllrrt", TexelFormat::kUndefined},
{"rgb4006sint", TexelFormat::kUndefined}, {"rb1uioot", TexelFormat::kUndefined},
{"rga1uzznt", TexelFormat::kUndefined}, {"r11b1uppiit", TexelFormat::kUndefined},
{"rgba32fXXoat", TexelFormat::kUndefined}, {"rgbII99355float", TexelFormat::kUndefined},
{"rgbaa32fSSrHHYt", TexelFormat::kUndefined}, {"rbkk2Hit", TexelFormat::kUndefined},
{"jgba3sgRR", TexelFormat::kUndefined}, {"rgbab2si", TexelFormat::kUndefined},
{"rgba32jint", TexelFormat::kUndefined}, {"rba32uint", TexelFormat::kUndefined},
{"rgba2uqn", TexelFormat::kUndefined}, {"rbaNNsint", TexelFormat::kUndefined},
{"rga8invv", TexelFormat::kUndefined}, {"gba8sQQnt", TexelFormat::kUndefined},
{"rgbsnrrff", TexelFormat::kUndefined}, {"rgba8snojm", TexelFormat::kUndefined},
{"NNgba8sww2m", TexelFormat::kUndefined}, {"rgba8uit", TexelFormat::kUndefined},
{"rrgba8uint", TexelFormat::kUndefined}, {"rgba8uiGt", TexelFormat::kUndefined},
{"rgba8unFFrm", TexelFormat::kUndefined}, {"g8unErm", TexelFormat::kUndefined},
{"rgb8urrorm", TexelFormat::kUndefined},
};
using TexelFormatParseTest = testing::TestWithParam<Case>;

View File

@ -335,6 +335,8 @@ std::string TexelFormatToString(tint::inspector::ResourceBinding::TexelFormat fo
return "R32Sint";
case tint::inspector::ResourceBinding::TexelFormat::kR32Float:
return "R32Float";
case tint::inspector::ResourceBinding::TexelFormat::kBgra8Unorm:
return "Bgra8Unorm";
case tint::inspector::ResourceBinding::TexelFormat::kRgba8Unorm:
return "Rgba8Unorm";
case tint::inspector::ResourceBinding::TexelFormat::kRgba8Snorm:

View File

@ -72,6 +72,8 @@ ResourceBinding::SampledKind BaseTypeToSampledKind(const type::Type* base_type)
ResourceBinding::TexelFormat TypeTexelFormatToResourceBindingTexelFormat(
const ast::TexelFormat& image_format) {
switch (image_format) {
case ast::TexelFormat::kBgra8Unorm:
return ResourceBinding::TexelFormat::kBgra8Unorm;
case ast::TexelFormat::kR32Uint:
return ResourceBinding::TexelFormat::kR32Uint;
case ast::TexelFormat::kR32Sint:

View File

@ -51,6 +51,7 @@ struct ResourceBinding {
enum class TexelFormat {
kNone = -1,
kBgra8Unorm,
kRgba8Unorm,
kRgba8Snorm,
kRgba8Uint,

View File

@ -79,6 +79,7 @@ enum access {
// https://gpuweb.github.io/gpuweb/wgsl/#texel-formats
enum texel_format {
bgra8unorm
rgba8unorm
rgba8snorm
rgba8uint
@ -244,7 +245,8 @@ match iu32: i32 | u32
// https://gpuweb.github.io/gpuweb/wgsl/#texel-formats
match f32_texel_format
: texel_format.rgba8unorm
: texel_format.bgra8unorm
| texel_format.rgba8unorm
| texel_format.rgba8snorm
| texel_format.rgba16float
| texel_format.r32float

View File

@ -681,7 +681,7 @@ var x : texture_storage_2d<r32uint, read;
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingSubtype) {
EXPECT("var x : texture_storage_2d<>;",
R"(test.wgsl:1:28 error: expected texel format for storage texture type
Possible values: 'r32float', 'r32sint', 'r32uint', 'rg32float', 'rg32sint', 'rg32uint', 'rgba16float', 'rgba16sint', 'rgba16uint', 'rgba32float', 'rgba32sint', 'rgba32uint', 'rgba8sint', 'rgba8snorm', 'rgba8uint', 'rgba8unorm'
Possible values: 'bgra8unorm', 'r32float', 'r32sint', 'r32uint', 'rg32float', 'rg32sint', 'rg32uint', 'rgba16float', 'rgba16sint', 'rgba16uint', 'rgba32float', 'rgba32sint', 'rgba32uint', 'rgba8sint', 'rgba8snorm', 'rgba8uint', 'rgba8unorm'
var x : texture_storage_2d<>;
^
)");
@ -690,7 +690,7 @@ var x : texture_storage_2d<>;
TEST_F(ParserImplErrorTest, GlobalDeclStorageTextureMissingInvalidSubtype) {
EXPECT("var x : texture_storage_2d<1>;",
R"(test.wgsl:1:28 error: expected texel format for storage texture type
Possible values: 'r32float', 'r32sint', 'r32uint', 'rg32float', 'rg32sint', 'rg32uint', 'rgba16float', 'rgba16sint', 'rgba16uint', 'rgba32float', 'rgba32sint', 'rgba32uint', 'rgba8sint', 'rgba8snorm', 'rgba8uint', 'rgba8unorm'
Possible values: 'bgra8unorm', 'r32float', 'r32sint', 'r32uint', 'rg32float', 'rg32sint', 'rg32uint', 'rgba16float', 'rgba16sint', 'rgba16uint', 'rgba32float', 'rgba32sint', 'rgba32uint', 'rgba8sint', 'rgba8snorm', 'rgba8uint', 'rgba8unorm'
var x : texture_storage_2d<1>;
^
)");

View File

@ -23,7 +23,7 @@ TEST_F(ParserImplTest, TexelFormat_Invalid) {
EXPECT_TRUE(t.errored);
EXPECT_TRUE(p->has_error());
EXPECT_EQ(p->error(), R"(1:1: expected texel format for test
Possible values: 'r32float', 'r32sint', 'r32uint', 'rg32float', 'rg32sint', 'rg32uint', 'rgba16float', 'rgba16sint', 'rgba16uint', 'rgba32float', 'rgba32sint', 'rgba32uint', 'rgba8sint', 'rgba8snorm', 'rgba8uint', 'rgba8unorm')");
Possible values: 'bgra8unorm', 'r32float', 'r32sint', 'r32uint', 'rg32float', 'rg32sint', 'rg32uint', 'rgba16float', 'rgba16sint', 'rgba16uint', 'rgba32float', 'rgba32sint', 'rgba32uint', 'rgba8sint', 'rgba8snorm', 'rgba8uint', 'rgba8unorm')");
}
TEST_F(ParserImplTest, TexelFormat_R32Uint) {

View File

@ -219,7 +219,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidType) {
EXPECT_FALSE(t.matched);
EXPECT_TRUE(t.errored);
EXPECT_EQ(p->error(), R"(1:20: expected texel format for storage texture type
Possible values: 'r32float', 'r32sint', 'r32uint', 'rg32float', 'rg32sint', 'rg32uint', 'rgba16float', 'rgba16sint', 'rgba16uint', 'rgba32float', 'rgba32sint', 'rgba32uint', 'rgba8sint', 'rgba8snorm', 'rgba8uint', 'rgba8unorm')");
Possible values: 'bgra8unorm', 'r32float', 'r32sint', 'r32uint', 'rg32float', 'rg32sint', 'rg32uint', 'rgba16float', 'rgba16sint', 'rgba16uint', 'rgba32float', 'rgba32sint', 'rgba32uint', 'rgba8sint', 'rgba8snorm', 'rgba8uint', 'rgba8unorm')");
}
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidTypeSuggest) {
@ -230,7 +230,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidTypeSuggest) {
EXPECT_TRUE(t.errored);
EXPECT_EQ(p->error(),
R"(1:20: expected texel format for storage texture type. Did you mean 'rg32float'?
Possible values: 'r32float', 'r32sint', 'r32uint', 'rg32float', 'rg32sint', 'rg32uint', 'rgba16float', 'rgba16sint', 'rgba16uint', 'rgba32float', 'rgba32sint', 'rgba32uint', 'rgba8sint', 'rgba8snorm', 'rgba8uint', 'rgba8unorm')");
Possible values: 'bgra8unorm', 'r32float', 'r32sint', 'r32uint', 'rg32float', 'rg32sint', 'rg32uint', 'rgba16float', 'rgba16sint', 'rgba16uint', 'rgba32float', 'rgba32sint', 'rgba32uint', 'rgba8sint', 'rgba8snorm', 'rgba8uint', 'rgba8unorm')");
}
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_InvalidAccess) {
@ -251,7 +251,7 @@ TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingType) {
EXPECT_FALSE(t.matched);
EXPECT_TRUE(t.errored);
EXPECT_EQ(p->error(), R"(1:20: expected texel format for storage texture type
Possible values: 'r32float', 'r32sint', 'r32uint', 'rg32float', 'rg32sint', 'rg32uint', 'rgba16float', 'rgba16sint', 'rgba16uint', 'rgba32float', 'rgba32sint', 'rgba32uint', 'rgba8sint', 'rgba8snorm', 'rgba8uint', 'rgba8unorm')");
Possible values: 'bgra8unorm', 'r32float', 'r32sint', 'r32uint', 'rg32float', 'rg32sint', 'rg32uint', 'rgba16float', 'rgba16sint', 'rgba16uint', 'rgba32float', 'rgba32sint', 'rgba32uint', 'rgba8sint', 'rgba8snorm', 'rgba8uint', 'rgba8unorm')");
}
TEST_F(ParserImplTest, TextureSamplerTypes_StorageTexture_MissingLessThan) {

View File

@ -2378,6 +2378,7 @@ class F32TexelFormat : public NumberMatcher {
Number F32TexelFormat::Match(MatchState&, Number number) const {
switch (static_cast<TexelFormat>(number.Value())) {
case TexelFormat::kBgra8Unorm:
case TexelFormat::kRgba8Unorm:
case TexelFormat::kRgba8Snorm:
case TexelFormat::kRgba16Float:
@ -2391,7 +2392,7 @@ Number F32TexelFormat::Match(MatchState&, Number number) const {
}
std::string F32TexelFormat::String(MatchState*) const {
return "rgba8unorm, rgba8snorm, rgba16float, r32float, rg32float or rgba32float";
return "bgra8unorm, rgba8unorm, rgba8snorm, rgba16float, r32float, rg32float or rgba32float";
}
/// EnumMatcher for 'match i32_texel_format'

View File

@ -1126,7 +1126,8 @@ struct FormatParams {
bool is_valid;
};
static constexpr FormatParams format_cases[] = {FormatParams{ast::TexelFormat::kR32Float, true},
static constexpr FormatParams format_cases[] = {FormatParams{ast::TexelFormat::kBgra8Unorm, true},
FormatParams{ast::TexelFormat::kR32Float, true},
FormatParams{ast::TexelFormat::kR32Sint, true},
FormatParams{ast::TexelFormat::kR32Uint, true},
FormatParams{ast::TexelFormat::kRg32Float, true},

View File

@ -98,6 +98,7 @@ bool IsValidStorageTextureDimension(ast::TextureDimension dim) {
bool IsValidStorageTextureTexelFormat(ast::TexelFormat format) {
switch (format) {
case ast::TexelFormat::kBgra8Unorm:
case ast::TexelFormat::kR32Uint:
case ast::TexelFormat::kR32Sint:
case ast::TexelFormat::kR32Float:

View File

@ -833,160 +833,206 @@ Transform::ApplyResult BuiltinPolyfill::Apply(const Program* src,
bool made_changes = false;
for (auto* node : src->ASTNodes().Objects()) {
auto* expr = src->Sem().Get<sem::Expression>(node);
if (!expr || expr->Stage() == sem::EvaluationStage::kConstant ||
expr->Stage() == sem::EvaluationStage::kNotEvaluated) {
continue; // Don't polyfill @const expressions
}
if (auto* call = expr->As<sem::Call>()) {
auto* builtin = call->Target()->As<sem::Builtin>();
if (!builtin) {
continue;
}
Symbol fn;
switch (builtin->Type()) {
case sem::BuiltinType::kAcosh:
if (polyfill.acosh != Level::kNone) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.acosh(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kAsinh:
if (polyfill.asinh) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.asinh(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kAtanh:
if (polyfill.atanh != Level::kNone) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.atanh(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kClamp:
if (polyfill.clamp_int) {
auto& sig = builtin->Signature();
if (sig.parameters[0]->Type()->is_integer_scalar_or_vector()) {
Switch(
node,
[&](const ast::CallExpression* expr) {
auto* call = src->Sem().Get(expr)->UnwrapMaterialize()->As<sem::Call>();
if (!call || call->Stage() == sem::EvaluationStage::kConstant ||
call->Stage() == sem::EvaluationStage::kNotEvaluated) {
return; // Don't polyfill @const expressions
}
auto* builtin = call->Target()->As<sem::Builtin>();
if (!builtin) {
return;
}
Symbol fn;
switch (builtin->Type()) {
case sem::BuiltinType::kAcosh:
if (polyfill.acosh != Level::kNone) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.clampInteger(builtin->ReturnType()); });
builtin, [&] { return s.acosh(builtin->ReturnType()); });
}
}
break;
case sem::BuiltinType::kCountLeadingZeros:
if (polyfill.count_leading_zeros) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.countLeadingZeros(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kCountTrailingZeros:
if (polyfill.count_trailing_zeros) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.countTrailingZeros(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kExtractBits:
if (polyfill.extract_bits != Level::kNone) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.extractBits(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kFirstLeadingBit:
if (polyfill.first_leading_bit) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.firstLeadingBit(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kFirstTrailingBit:
if (polyfill.first_trailing_bit) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.firstTrailingBit(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kInsertBits:
if (polyfill.insert_bits != Level::kNone) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.insertBits(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kSaturate:
if (polyfill.saturate) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.saturate(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kSign:
if (polyfill.sign_int) {
auto* ty = builtin->ReturnType();
if (ty->is_signed_integer_scalar_or_vector()) {
fn = builtin_polyfills.GetOrCreate(builtin,
[&] { return s.sign_int(ty); });
break;
case sem::BuiltinType::kAsinh:
if (polyfill.asinh) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.asinh(builtin->ReturnType()); });
}
}
break;
case sem::BuiltinType::kTextureSampleBaseClampToEdge:
if (polyfill.texture_sample_base_clamp_to_edge_2d_f32) {
auto& sig = builtin->Signature();
auto* tex = sig.Parameter(sem::ParameterUsage::kTexture);
if (auto* stex = tex->Type()->As<type::SampledTexture>()) {
if (stex->type()->Is<type::F32>()) {
fn = builtin_polyfills.GetOrCreate(builtin, [&] {
return s.textureSampleBaseClampToEdge_2d_f32();
});
break;
case sem::BuiltinType::kAtanh:
if (polyfill.atanh != Level::kNone) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.atanh(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kClamp:
if (polyfill.clamp_int) {
auto& sig = builtin->Signature();
if (sig.parameters[0]->Type()->is_integer_scalar_or_vector()) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.clampInteger(builtin->ReturnType()); });
}
}
}
break;
case sem::BuiltinType::kQuantizeToF16:
if (polyfill.quantize_to_vec_f16) {
if (auto* vec = builtin->ReturnType()->As<type::Vector>()) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.quantizeToF16(vec); });
break;
case sem::BuiltinType::kCountLeadingZeros:
if (polyfill.count_leading_zeros) {
fn = builtin_polyfills.GetOrCreate(builtin, [&] {
return s.countLeadingZeros(builtin->ReturnType());
});
}
}
break;
break;
case sem::BuiltinType::kCountTrailingZeros:
if (polyfill.count_trailing_zeros) {
fn = builtin_polyfills.GetOrCreate(builtin, [&] {
return s.countTrailingZeros(builtin->ReturnType());
});
}
break;
case sem::BuiltinType::kExtractBits:
if (polyfill.extract_bits != Level::kNone) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.extractBits(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kFirstLeadingBit:
if (polyfill.first_leading_bit) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.firstLeadingBit(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kFirstTrailingBit:
if (polyfill.first_trailing_bit) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.firstTrailingBit(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kInsertBits:
if (polyfill.insert_bits != Level::kNone) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.insertBits(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kSaturate:
if (polyfill.saturate) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.saturate(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kSign:
if (polyfill.sign_int) {
auto* ty = builtin->ReturnType();
if (ty->is_signed_integer_scalar_or_vector()) {
fn = builtin_polyfills.GetOrCreate(builtin,
[&] { return s.sign_int(ty); });
}
}
break;
case sem::BuiltinType::kTextureSampleBaseClampToEdge:
if (polyfill.texture_sample_base_clamp_to_edge_2d_f32) {
auto& sig = builtin->Signature();
auto* tex = sig.Parameter(sem::ParameterUsage::kTexture);
if (auto* stex = tex->Type()->As<type::SampledTexture>()) {
if (stex->type()->Is<type::F32>()) {
fn = builtin_polyfills.GetOrCreate(builtin, [&] {
return s.textureSampleBaseClampToEdge_2d_f32();
});
}
}
}
break;
case sem::BuiltinType::kTextureStore:
if (polyfill.bgra8unorm) {
auto& sig = builtin->Signature();
auto* tex = sig.Parameter(sem::ParameterUsage::kTexture);
if (auto* stex = tex->Type()->As<type::StorageTexture>()) {
if (stex->texel_format() == ast::TexelFormat::kBgra8Unorm) {
size_t value_idx = static_cast<size_t>(
sig.IndexOf(sem::ParameterUsage::kValue));
ctx.Replace(expr, [&ctx, expr, value_idx] {
utils::Vector<const ast::Expression*, 3> args;
for (auto* arg : expr->args) {
arg = ctx.Clone(arg);
if (args.Length() == value_idx) { // value
arg = ctx.dst->MemberAccessor(arg, "bgra");
}
args.Push(arg);
}
return ctx.dst->Call(
utils::ToString(sem::BuiltinType::kTextureStore),
std::move(args));
});
made_changes = true;
}
}
}
break;
case sem::BuiltinType::kQuantizeToF16:
if (polyfill.quantize_to_vec_f16) {
if (auto* vec = builtin->ReturnType()->As<type::Vector>()) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.quantizeToF16(vec); });
}
}
break;
case sem::BuiltinType::kWorkgroupUniformLoad:
if (polyfill.workgroup_uniform_load) {
fn = builtin_polyfills.GetOrCreate(
builtin, [&] { return s.workgroupUniformLoad(builtin->ReturnType()); });
}
break;
case sem::BuiltinType::kWorkgroupUniformLoad:
if (polyfill.workgroup_uniform_load) {
fn = builtin_polyfills.GetOrCreate(builtin, [&] {
return s.workgroupUniformLoad(builtin->ReturnType());
});
}
break;
default:
break;
}
if (fn.IsValid()) {
auto* replacement = b.Call(fn, ctx.Clone(call->Declaration()->args));
ctx.Replace(call->Declaration(), replacement);
made_changes = true;
}
} else if (auto* bin_op = node->As<ast::BinaryExpression>()) {
switch (bin_op->op) {
case ast::BinaryOp::kShiftLeft:
case ast::BinaryOp::kShiftRight: {
if (polyfill.bitshift_modulo) {
ctx.Replace(bin_op, [bin_op, &s] { return s.BitshiftModulo(bin_op); });
made_changes = true;
}
break;
default:
break;
}
case ast::BinaryOp::kDivide:
case ast::BinaryOp::kModulo: {
if (polyfill.int_div_mod) {
auto* lhs_ty = src->TypeOf(bin_op->lhs)->UnwrapRef();
if (lhs_ty->is_integer_scalar_or_vector()) {
ctx.Replace(bin_op, [bin_op, &s] { return s.IntDivMod(bin_op); });
if (fn.IsValid()) {
ctx.Replace(call->Declaration(), [&ctx, fn, expr] {
return ctx.dst->Call(fn, ctx.Clone(expr->args));
});
made_changes = true;
}
},
[&](const ast::BinaryExpression* bin_op) {
if (auto* sem = src->Sem().Get(bin_op);
!sem || sem->Stage() == sem::EvaluationStage::kConstant ||
sem->Stage() == sem::EvaluationStage::kNotEvaluated) {
return; // Don't polyfill @const expressions
}
switch (bin_op->op) {
case ast::BinaryOp::kShiftLeft:
case ast::BinaryOp::kShiftRight: {
if (polyfill.bitshift_modulo) {
ctx.Replace(bin_op, [bin_op, &s] { return s.BitshiftModulo(bin_op); });
made_changes = true;
}
break;
}
break;
case ast::BinaryOp::kDivide:
case ast::BinaryOp::kModulo: {
if (polyfill.int_div_mod) {
auto* lhs_ty = src->TypeOf(bin_op->lhs)->UnwrapRef();
if (lhs_ty->is_integer_scalar_or_vector()) {
ctx.Replace(bin_op, [bin_op, &s] { return s.IntDivMod(bin_op); });
made_changes = true;
}
}
break;
}
default:
break;
}
default:
break;
}
}
},
[&](const ast::StorageTexture* tex) {
if (polyfill.bgra8unorm && tex->format == ast::TexelFormat::kBgra8Unorm) {
ctx.Replace(tex, [&ctx, tex] {
return ctx.dst->ty.storage_texture(tex->dim, ast::TexelFormat::kRgba8Unorm,
tex->access);
});
made_changes = true;
}
});
}
if (!made_changes) {

View File

@ -47,6 +47,8 @@ class BuiltinPolyfill final : public Castable<BuiltinPolyfill, Transform> {
bool asinh = false;
/// What level should `atanh` be polyfilled?
Level atanh = Level::kNone;
/// Should storage textures of format 'bgra8unorm' be replaced with 'rgba8unorm'?
bool bgra8unorm = false;
/// Should the RHS of `<<` and `>>` be wrapped in a modulo bit-width of LHS?
bool bitshift_modulo = false;
/// Should `clamp()` be polyfilled for integer values (scalar or vector)?

View File

@ -380,6 +380,138 @@ fn f() {
EXPECT_EQ(expect, str(got));
}
////////////////////////////////////////////////////////////////////////////////
// bgra8unorm
////////////////////////////////////////////////////////////////////////////////
DataMap polyfillBgra8unorm() {
BuiltinPolyfill::Builtins builtins;
builtins.bgra8unorm = true;
DataMap data;
data.Add<BuiltinPolyfill::Config>(builtins);
return data;
}
TEST_F(BuiltinPolyfillTest, ShouldRunBgra8unorm_StorageTextureVar) {
auto* src = R"(
@group(0) @binding(0) var tex : texture_storage_3d<bgra8unorm, write>;
)";
EXPECT_FALSE(ShouldRun<BuiltinPolyfill>(src));
EXPECT_TRUE(ShouldRun<BuiltinPolyfill>(src, polyfillBgra8unorm()));
}
TEST_F(BuiltinPolyfillTest, ShouldRunBgra8unorm_StorageTextureParam) {
auto* src = R"(
fn f(tex : texture_storage_3d<bgra8unorm, write>) {
}
)";
EXPECT_FALSE(ShouldRun<BuiltinPolyfill>(src));
EXPECT_TRUE(ShouldRun<BuiltinPolyfill>(src, polyfillBgra8unorm()));
}
TEST_F(BuiltinPolyfillTest, Bgra8unorm_StorageTextureVar) {
auto* src = R"(
@group(0) @binding(0) var tex : texture_storage_3d<bgra8unorm, write>;
)";
auto* expect = R"(
@group(0) @binding(0) var tex : texture_storage_3d<rgba8unorm, write>;
)";
auto got = Run<BuiltinPolyfill>(src, polyfillBgra8unorm());
EXPECT_EQ(expect, str(got));
}
TEST_F(BuiltinPolyfillTest, Bgra8unorm_StorageTextureParam) {
auto* src = R"(
fn f(tex : texture_storage_3d<bgra8unorm, write>) {
}
)";
auto* expect = R"(
fn f(tex : texture_storage_3d<rgba8unorm, write>) {
}
)";
auto got = Run<BuiltinPolyfill>(src, polyfillBgra8unorm());
EXPECT_EQ(expect, str(got));
}
TEST_F(BuiltinPolyfillTest, Bgra8unorm_TextureStore) {
auto* src = R"(
@group(0) @binding(0) var tex : texture_storage_2d<bgra8unorm, write>;
fn f(coords : vec2<i32>, value : vec4<f32>) {
textureStore(tex, coords, value);
}
)";
auto* expect = R"(
@group(0) @binding(0) var tex : texture_storage_2d<rgba8unorm, write>;
fn f(coords : vec2<i32>, value : vec4<f32>) {
textureStore(tex, coords, value.bgra);
}
)";
auto got = Run<BuiltinPolyfill>(src, polyfillBgra8unorm());
EXPECT_EQ(expect, str(got));
}
TEST_F(BuiltinPolyfillTest, Bgra8unorm_TextureStore_Param) {
auto* src = R"(
fn f(tex : texture_storage_2d<bgra8unorm, write>, coords : vec2<i32>, value : vec4<f32>) {
textureStore(tex, coords, value);
}
)";
auto* expect = R"(
fn f(tex : texture_storage_2d<rgba8unorm, write>, coords : vec2<i32>, value : vec4<f32>) {
textureStore(tex, coords, value.bgra);
}
)";
auto got = Run<BuiltinPolyfill>(src, polyfillBgra8unorm());
EXPECT_EQ(expect, str(got));
}
TEST_F(BuiltinPolyfillTest, Bgra8unorm_TextureStore_WithAtanh) {
auto* src = R"(
@group(0) @binding(0) var tex : texture_storage_2d<bgra8unorm, write>;
fn f(coords : vec2<i32>, value : vec4<f32>) {
textureStore(tex, coords, atanh(value));
}
)";
auto* expect = R"(
fn tint_atanh(x : vec4<f32>) -> vec4<f32> {
return (log(((1 + x) / (1 - x))) * 0.5);
}
@group(0) @binding(0) var tex : texture_storage_2d<rgba8unorm, write>;
fn f(coords : vec2<i32>, value : vec4<f32>) {
textureStore(tex, coords, tint_atanh(value).bgra);
}
)";
BuiltinPolyfill::Builtins builtins;
builtins.atanh = BuiltinPolyfill::Level::kFull;
builtins.bgra8unorm = true;
DataMap data;
data.Add<BuiltinPolyfill::Config>(builtins);
auto got = Run<BuiltinPolyfill>(src, std::move(data));
EXPECT_EQ(expect, str(got));
}
////////////////////////////////////////////////////////////////////////////////
// bitshiftModulo
////////////////////////////////////////////////////////////////////////////////

View File

@ -63,6 +63,7 @@ Type* StorageTexture::SubtypeFor(ast::TexelFormat format, Manager& type_mgr) {
return type_mgr.Get<I32>();
}
case ast::TexelFormat::kBgra8Unorm:
case ast::TexelFormat::kRgba8Unorm:
case ast::TexelFormat::kRgba8Snorm:
case ast::TexelFormat::kR32Float:

View File

@ -110,46 +110,6 @@ bool last_is_break(const ast::BlockStatement* stmts) {
return IsAnyOf<ast::BreakStatement>(stmts->Last());
}
const char* convert_texel_format_to_glsl(const ast::TexelFormat format) {
switch (format) {
case ast::TexelFormat::kR32Uint:
return "r32ui";
case ast::TexelFormat::kR32Sint:
return "r32i";
case ast::TexelFormat::kR32Float:
return "r32f";
case ast::TexelFormat::kRgba8Unorm:
return "rgba8";
case ast::TexelFormat::kRgba8Snorm:
return "rgba8_snorm";
case ast::TexelFormat::kRgba8Uint:
return "rgba8ui";
case ast::TexelFormat::kRgba8Sint:
return "rgba8i";
case ast::TexelFormat::kRg32Uint:
return "rg32ui";
case ast::TexelFormat::kRg32Sint:
return "rg32i";
case ast::TexelFormat::kRg32Float:
return "rg32f";
case ast::TexelFormat::kRgba16Uint:
return "rgba16ui";
case ast::TexelFormat::kRgba16Sint:
return "rgba16i";
case ast::TexelFormat::kRgba16Float:
return "rgba16f";
case ast::TexelFormat::kRgba32Uint:
return "rgba32ui";
case ast::TexelFormat::kRgba32Sint:
return "rgba32i";
case ast::TexelFormat::kRgba32Float:
return "rgba32f";
case ast::TexelFormat::kUndefined:
return "unknown";
}
return "unknown";
}
void PrintF32(std::ostream& out, float value) {
if (std::isinf(value)) {
out << "0.0f " << (value >= 0 ? "/* inf */" : "/* -inf */");
@ -191,6 +151,7 @@ SanitizedResult Sanitize(const Program* in,
transform::BuiltinPolyfill::Builtins polyfills;
polyfills.acosh = transform::BuiltinPolyfill::Level::kRangeCheck;
polyfills.atanh = transform::BuiltinPolyfill::Level::kRangeCheck;
polyfills.bgra8unorm = true;
polyfills.bitshift_modulo = true;
polyfills.count_leading_zeros = true;
polyfills.count_trailing_zeros = true;
@ -2069,7 +2030,65 @@ bool GeneratorImpl::EmitHandleVariable(const ast::Var* var, const sem::Variable*
return true;
}
if (auto* storage = type->As<type::StorageTexture>()) {
out << "layout(" << convert_texel_format_to_glsl(storage->texel_format()) << ") ";
out << "layout(";
switch (storage->texel_format()) {
case ast::TexelFormat::kBgra8Unorm:
TINT_ICE(Writer, diagnostics_)
<< "bgra8unorm should have been polyfilled to rgba8unorm";
break;
case ast::TexelFormat::kR32Uint:
out << "r32ui";
break;
case ast::TexelFormat::kR32Sint:
out << "r32i";
break;
case ast::TexelFormat::kR32Float:
out << "r32f";
break;
case ast::TexelFormat::kRgba8Unorm:
out << "rgba8";
break;
case ast::TexelFormat::kRgba8Snorm:
out << "rgba8_snorm";
break;
case ast::TexelFormat::kRgba8Uint:
out << "rgba8ui";
break;
case ast::TexelFormat::kRgba8Sint:
out << "rgba8i";
break;
case ast::TexelFormat::kRg32Uint:
out << "rg32ui";
break;
case ast::TexelFormat::kRg32Sint:
out << "rg32i";
break;
case ast::TexelFormat::kRg32Float:
out << "rg32f";
break;
case ast::TexelFormat::kRgba16Uint:
out << "rgba16ui";
break;
case ast::TexelFormat::kRgba16Sint:
out << "rgba16i";
break;
case ast::TexelFormat::kRgba16Float:
out << "rgba16f";
break;
case ast::TexelFormat::kRgba32Uint:
out << "rgba32ui";
break;
case ast::TexelFormat::kRgba32Sint:
out << "rgba32i";
break;
case ast::TexelFormat::kRgba32Float:
out << "rgba32f";
break;
case ast::TexelFormat::kUndefined:
TINT_ICE(Writer, diagnostics_) << "invalid texel format";
return false;
}
out << ") ";
}
if (!EmitTypeAndName(out, type, sem->AddressSpace(), sem->Access(), name)) {
return false;

View File

@ -88,6 +88,7 @@ const char kTempNamePrefix[] = "tint_tmp";
const char* image_format_to_rwtexture_type(ast::TexelFormat image_format) {
switch (image_format) {
case ast::TexelFormat::kBgra8Unorm:
case ast::TexelFormat::kRgba8Unorm:
case ast::TexelFormat::kRgba8Snorm:
case ast::TexelFormat::kRgba16Float:

View File

@ -4079,6 +4079,10 @@ void Builder::AddInterpolationDecorations(uint32_t id,
SpvImageFormat Builder::convert_texel_format_to_spv(const ast::TexelFormat format) {
switch (format) {
case ast::TexelFormat::kBgra8Unorm:
TINT_ICE(Writer, builder_.Diagnostics())
<< "bgra8unorm should have been polyfilled to rgba8unorm";
return SpvImageFormatUnknown;
case ast::TexelFormat::kR32Uint:
return SpvImageFormatR32ui;
case ast::TexelFormat::kR32Sint:

View File

@ -57,6 +57,7 @@ SanitizedResult Sanitize(const Program* in, const Options& options) {
transform::BuiltinPolyfill::Builtins polyfills;
polyfills.acosh = transform::BuiltinPolyfill::Level::kRangeCheck;
polyfills.atanh = transform::BuiltinPolyfill::Level::kRangeCheck;
polyfills.bgra8unorm = true;
polyfills.bitshift_modulo = true;
polyfills.clamp_int = true;
polyfills.count_leading_zeros = true;

View File

@ -0,0 +1,44 @@
// Copyright 2023 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
@group(1) @binding(0) var arg_0: texture_storage_3d<bgra8unorm, write>;
// fn textureDimensions(texture: texture_storage_3d<bgra8unorm, write>) -> vec3<u32>
fn textureDimensions_5b4b10() {
var res: vec3<u32> = textureDimensions(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureDimensions_5b4b10();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureDimensions_5b4b10();
}
@compute @workgroup_size(1)
fn compute_main() {
textureDimensions_5b4b10();
}

View File

@ -0,0 +1,34 @@
RWTexture3D<float4> arg_0 : register(u0, space1);
void textureDimensions_5b4b10() {
int3 tint_tmp;
arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
uint3 res = tint_tmp;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureDimensions_5b4b10();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureDimensions_5b4b10();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureDimensions_5b4b10();
return;
}

View File

@ -0,0 +1,34 @@
RWTexture3D<float4> arg_0 : register(u0, space1);
void textureDimensions_5b4b10() {
int3 tint_tmp;
arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
uint3 res = tint_tmp;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureDimensions_5b4b10();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureDimensions_5b4b10();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureDimensions_5b4b10();
return;
}

View File

@ -0,0 +1,52 @@
#version 310 es
layout(rgba8) uniform highp writeonly image3D arg_0;
void textureDimensions_5b4b10() {
uvec3 res = uvec3(imageSize(arg_0));
}
vec4 vertex_main() {
textureDimensions_5b4b10();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
layout(rgba8) uniform highp writeonly image3D arg_0;
void textureDimensions_5b4b10() {
uvec3 res = uvec3(imageSize(arg_0));
}
void fragment_main() {
textureDimensions_5b4b10();
}
void main() {
fragment_main();
return;
}
#version 310 es
layout(rgba8) uniform highp writeonly image3D arg_0;
void textureDimensions_5b4b10() {
uvec3 res = uvec3(imageSize(arg_0));
}
void compute_main() {
textureDimensions_5b4b10();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void textureDimensions_5b4b10(texture3d<float, access::write> tint_symbol_1) {
uint3 res = uint3(tint_symbol_1.get_width(), tint_symbol_1.get_height(), tint_symbol_1.get_depth());
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner(texture3d<float, access::write> tint_symbol_2) {
textureDimensions_5b4b10(tint_symbol_2);
return float4(0.0f);
}
vertex tint_symbol vertex_main(texture3d<float, access::write> tint_symbol_3 [[texture(0)]]) {
float4 const inner_result = vertex_main_inner(tint_symbol_3);
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main(texture3d<float, access::write> tint_symbol_4 [[texture(0)]]) {
textureDimensions_5b4b10(tint_symbol_4);
return;
}
kernel void compute_main(texture3d<float, access::write> tint_symbol_5 [[texture(0)]]) {
textureDimensions_5b4b10(tint_symbol_5);
return;
}

View File

@ -0,0 +1,76 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 37
; Schema: 0
OpCapability Shader
OpCapability ImageQuery
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %arg_0 "arg_0"
OpName %textureDimensions_5b4b10 "textureDimensions_5b4b10"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %arg_0 NonReadable
OpDecorate %arg_0 DescriptorSet 1
OpDecorate %arg_0 Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%11 = OpTypeImage %float 3D 0 0 0 2 Rgba8
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Function_v3uint = OpTypePointer Function %v3uint
%22 = OpConstantNull %v3uint
%23 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureDimensions_5b4b10 = OpFunction %void None %12
%15 = OpLabel
%res = OpVariable %_ptr_Function_v3uint Function %22
%19 = OpLoad %11 %arg_0
%16 = OpImageQuerySize %v3uint %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %23
%25 = OpLabel
%26 = OpFunctionCall %void %textureDimensions_5b4b10
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%28 = OpLabel
%29 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %29
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%32 = OpLabel
%33 = OpFunctionCall %void %textureDimensions_5b4b10
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%35 = OpLabel
%36 = OpFunctionCall %void %textureDimensions_5b4b10
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,21 @@
@group(1) @binding(0) var arg_0 : texture_storage_3d<bgra8unorm, write>;
fn textureDimensions_5b4b10() {
var res : vec3<u32> = textureDimensions(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureDimensions_5b4b10();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureDimensions_5b4b10();
}
@compute @workgroup_size(1)
fn compute_main() {
textureDimensions_5b4b10();
}

View File

@ -0,0 +1,44 @@
// Copyright 2023 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
@group(1) @binding(0) var arg_0: texture_storage_1d<bgra8unorm, write>;
// fn textureDimensions(texture: texture_storage_1d<bgra8unorm, write>) -> u32
fn textureDimensions_84f363() {
var res: u32 = textureDimensions(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureDimensions_84f363();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureDimensions_84f363();
}
@compute @workgroup_size(1)
fn compute_main() {
textureDimensions_84f363();
}

View File

@ -0,0 +1,34 @@
RWTexture1D<float4> arg_0 : register(u0, space1);
void textureDimensions_84f363() {
int tint_tmp;
arg_0.GetDimensions(tint_tmp);
uint res = tint_tmp;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureDimensions_84f363();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureDimensions_84f363();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureDimensions_84f363();
return;
}

View File

@ -0,0 +1,34 @@
RWTexture1D<float4> arg_0 : register(u0, space1);
void textureDimensions_84f363() {
int tint_tmp;
arg_0.GetDimensions(tint_tmp);
uint res = tint_tmp;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureDimensions_84f363();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureDimensions_84f363();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureDimensions_84f363();
return;
}

View File

@ -0,0 +1,52 @@
#version 310 es
layout(rgba8) uniform highp writeonly image2D arg_0;
void textureDimensions_84f363() {
uint res = uvec2(imageSize(arg_0)).x;
}
vec4 vertex_main() {
textureDimensions_84f363();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
layout(rgba8) uniform highp writeonly image2D arg_0;
void textureDimensions_84f363() {
uint res = uvec2(imageSize(arg_0)).x;
}
void fragment_main() {
textureDimensions_84f363();
}
void main() {
fragment_main();
return;
}
#version 310 es
layout(rgba8) uniform highp writeonly image2D arg_0;
void textureDimensions_84f363() {
uint res = uvec2(imageSize(arg_0)).x;
}
void compute_main() {
textureDimensions_84f363();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void textureDimensions_84f363(texture1d<float, access::write> tint_symbol_1) {
uint res = tint_symbol_1.get_width(0);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner(texture1d<float, access::write> tint_symbol_2) {
textureDimensions_84f363(tint_symbol_2);
return float4(0.0f);
}
vertex tint_symbol vertex_main(texture1d<float, access::write> tint_symbol_3 [[texture(0)]]) {
float4 const inner_result = vertex_main_inner(tint_symbol_3);
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main(texture1d<float, access::write> tint_symbol_4 [[texture(0)]]) {
textureDimensions_84f363(tint_symbol_4);
return;
}
kernel void compute_main(texture1d<float, access::write> tint_symbol_5 [[texture(0)]]) {
textureDimensions_84f363(tint_symbol_5);
return;
}

View File

@ -0,0 +1,76 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 36
; Schema: 0
OpCapability Shader
OpCapability Image1D
OpCapability ImageQuery
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %arg_0 "arg_0"
OpName %textureDimensions_84f363 "textureDimensions_84f363"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %arg_0 NonReadable
OpDecorate %arg_0 DescriptorSet 1
OpDecorate %arg_0 Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%11 = OpTypeImage %float 1D 0 0 0 2 Rgba8
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%_ptr_Function_uint = OpTypePointer Function %uint
%21 = OpConstantNull %uint
%22 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureDimensions_84f363 = OpFunction %void None %12
%15 = OpLabel
%res = OpVariable %_ptr_Function_uint Function %21
%18 = OpLoad %11 %arg_0
%16 = OpImageQuerySize %uint %18
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %22
%24 = OpLabel
%25 = OpFunctionCall %void %textureDimensions_84f363
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%27 = OpLabel
%28 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %28
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%31 = OpLabel
%32 = OpFunctionCall %void %textureDimensions_84f363
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%34 = OpLabel
%35 = OpFunctionCall %void %textureDimensions_84f363
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,21 @@
@group(1) @binding(0) var arg_0 : texture_storage_1d<bgra8unorm, write>;
fn textureDimensions_84f363() {
var res : u32 = textureDimensions(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureDimensions_84f363();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureDimensions_84f363();
}
@compute @workgroup_size(1)
fn compute_main() {
textureDimensions_84f363();
}

View File

@ -0,0 +1,44 @@
// Copyright 2023 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
@group(1) @binding(0) var arg_0: texture_storage_2d_array<bgra8unorm, write>;
// fn textureDimensions(texture: texture_storage_2d_array<bgra8unorm, write>) -> vec2<u32>
fn textureDimensions_d1b882() {
var res: vec2<u32> = textureDimensions(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureDimensions_d1b882();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureDimensions_d1b882();
}
@compute @workgroup_size(1)
fn compute_main() {
textureDimensions_d1b882();
}

View File

@ -0,0 +1,34 @@
RWTexture2DArray<float4> arg_0 : register(u0, space1);
void textureDimensions_d1b882() {
int3 tint_tmp;
arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
uint2 res = tint_tmp.xy;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureDimensions_d1b882();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureDimensions_d1b882();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureDimensions_d1b882();
return;
}

View File

@ -0,0 +1,34 @@
RWTexture2DArray<float4> arg_0 : register(u0, space1);
void textureDimensions_d1b882() {
int3 tint_tmp;
arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
uint2 res = tint_tmp.xy;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureDimensions_d1b882();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureDimensions_d1b882();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureDimensions_d1b882();
return;
}

View File

@ -0,0 +1,52 @@
#version 310 es
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureDimensions_d1b882() {
uvec2 res = uvec2(imageSize(arg_0).xy);
}
vec4 vertex_main() {
textureDimensions_d1b882();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureDimensions_d1b882() {
uvec2 res = uvec2(imageSize(arg_0).xy);
}
void fragment_main() {
textureDimensions_d1b882();
}
void main() {
fragment_main();
return;
}
#version 310 es
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureDimensions_d1b882() {
uvec2 res = uvec2(imageSize(arg_0).xy);
}
void compute_main() {
textureDimensions_d1b882();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void textureDimensions_d1b882(texture2d_array<float, access::write> tint_symbol_1) {
uint2 res = uint2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
textureDimensions_d1b882(tint_symbol_2);
return float4(0.0f);
}
vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
float4 const inner_result = vertex_main_inner(tint_symbol_3);
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
textureDimensions_d1b882(tint_symbol_4);
return;
}
kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
textureDimensions_d1b882(tint_symbol_5);
return;
}

View File

@ -0,0 +1,78 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 39
; Schema: 0
OpCapability Shader
OpCapability ImageQuery
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %arg_0 "arg_0"
OpName %textureDimensions_d1b882 "textureDimensions_d1b882"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %arg_0 NonReadable
OpDecorate %arg_0 DescriptorSet 1
OpDecorate %arg_0 Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%11 = OpTypeImage %float 2D 0 1 0 2 Rgba8
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v2uint = OpTypeVector %uint 2
%v3uint = OpTypeVector %uint 3
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
%24 = OpConstantNull %v2uint
%25 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureDimensions_d1b882 = OpFunction %void None %12
%15 = OpLabel
%res = OpVariable %_ptr_Function_v2uint Function %24
%21 = OpLoad %11 %arg_0
%19 = OpImageQuerySize %v3uint %21
%16 = OpVectorShuffle %v2uint %19 %19 0 1
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %25
%27 = OpLabel
%28 = OpFunctionCall %void %textureDimensions_d1b882
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%30 = OpLabel
%31 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %31
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%34 = OpLabel
%35 = OpFunctionCall %void %textureDimensions_d1b882
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%37 = OpLabel
%38 = OpFunctionCall %void %textureDimensions_d1b882
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,21 @@
@group(1) @binding(0) var arg_0 : texture_storage_2d_array<bgra8unorm, write>;
fn textureDimensions_d1b882() {
var res : vec2<u32> = textureDimensions(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureDimensions_d1b882();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureDimensions_d1b882();
}
@compute @workgroup_size(1)
fn compute_main() {
textureDimensions_d1b882();
}

View File

@ -0,0 +1,44 @@
// Copyright 2023 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
@group(1) @binding(0) var arg_0: texture_storage_2d<bgra8unorm, write>;
// fn textureDimensions(texture: texture_storage_2d<bgra8unorm, write>) -> vec2<u32>
fn textureDimensions_fbb15a() {
var res: vec2<u32> = textureDimensions(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureDimensions_fbb15a();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureDimensions_fbb15a();
}
@compute @workgroup_size(1)
fn compute_main() {
textureDimensions_fbb15a();
}

View File

@ -0,0 +1,34 @@
RWTexture2D<float4> arg_0 : register(u0, space1);
void textureDimensions_fbb15a() {
int2 tint_tmp;
arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
uint2 res = tint_tmp;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureDimensions_fbb15a();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureDimensions_fbb15a();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureDimensions_fbb15a();
return;
}

View File

@ -0,0 +1,34 @@
RWTexture2D<float4> arg_0 : register(u0, space1);
void textureDimensions_fbb15a() {
int2 tint_tmp;
arg_0.GetDimensions(tint_tmp.x, tint_tmp.y);
uint2 res = tint_tmp;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureDimensions_fbb15a();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureDimensions_fbb15a();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureDimensions_fbb15a();
return;
}

View File

@ -0,0 +1,52 @@
#version 310 es
layout(rgba8) uniform highp writeonly image2D arg_0;
void textureDimensions_fbb15a() {
uvec2 res = uvec2(imageSize(arg_0));
}
vec4 vertex_main() {
textureDimensions_fbb15a();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
layout(rgba8) uniform highp writeonly image2D arg_0;
void textureDimensions_fbb15a() {
uvec2 res = uvec2(imageSize(arg_0));
}
void fragment_main() {
textureDimensions_fbb15a();
}
void main() {
fragment_main();
return;
}
#version 310 es
layout(rgba8) uniform highp writeonly image2D arg_0;
void textureDimensions_fbb15a() {
uvec2 res = uvec2(imageSize(arg_0));
}
void compute_main() {
textureDimensions_fbb15a();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void textureDimensions_fbb15a(texture2d<float, access::write> tint_symbol_1) {
uint2 res = uint2(tint_symbol_1.get_width(), tint_symbol_1.get_height());
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
textureDimensions_fbb15a(tint_symbol_2);
return float4(0.0f);
}
vertex tint_symbol vertex_main(texture2d<float, access::write> tint_symbol_3 [[texture(0)]]) {
float4 const inner_result = vertex_main_inner(tint_symbol_3);
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main(texture2d<float, access::write> tint_symbol_4 [[texture(0)]]) {
textureDimensions_fbb15a(tint_symbol_4);
return;
}
kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
textureDimensions_fbb15a(tint_symbol_5);
return;
}

View File

@ -0,0 +1,76 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 37
; Schema: 0
OpCapability Shader
OpCapability ImageQuery
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %arg_0 "arg_0"
OpName %textureDimensions_fbb15a "textureDimensions_fbb15a"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %arg_0 NonReadable
OpDecorate %arg_0 DescriptorSet 1
OpDecorate %arg_0 Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%11 = OpTypeImage %float 2D 0 0 0 2 Rgba8
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v2uint = OpTypeVector %uint 2
%_ptr_Function_v2uint = OpTypePointer Function %v2uint
%22 = OpConstantNull %v2uint
%23 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureDimensions_fbb15a = OpFunction %void None %12
%15 = OpLabel
%res = OpVariable %_ptr_Function_v2uint Function %22
%19 = OpLoad %11 %arg_0
%16 = OpImageQuerySize %v2uint %19
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %23
%25 = OpLabel
%26 = OpFunctionCall %void %textureDimensions_fbb15a
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%28 = OpLabel
%29 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %29
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%32 = OpLabel
%33 = OpFunctionCall %void %textureDimensions_fbb15a
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%35 = OpLabel
%36 = OpFunctionCall %void %textureDimensions_fbb15a
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,21 @@
@group(1) @binding(0) var arg_0 : texture_storage_2d<bgra8unorm, write>;
fn textureDimensions_fbb15a() {
var res : vec2<u32> = textureDimensions(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureDimensions_fbb15a();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureDimensions_fbb15a();
}
@compute @workgroup_size(1)
fn compute_main() {
textureDimensions_fbb15a();
}

View File

@ -0,0 +1,44 @@
// Copyright 2023 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
@group(1) @binding(0) var arg_0: texture_storage_2d_array<bgra8unorm, write>;
// fn textureNumLayers(texture: texture_storage_2d_array<bgra8unorm, write>) -> u32
fn textureNumLayers_1f858a() {
var res: u32 = textureNumLayers(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureNumLayers_1f858a();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureNumLayers_1f858a();
}
@compute @workgroup_size(1)
fn compute_main() {
textureNumLayers_1f858a();
}

View File

@ -0,0 +1,34 @@
RWTexture2DArray<float4> arg_0 : register(u0, space1);
void textureNumLayers_1f858a() {
int3 tint_tmp;
arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
uint res = tint_tmp.z;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureNumLayers_1f858a();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureNumLayers_1f858a();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureNumLayers_1f858a();
return;
}

View File

@ -0,0 +1,34 @@
RWTexture2DArray<float4> arg_0 : register(u0, space1);
void textureNumLayers_1f858a() {
int3 tint_tmp;
arg_0.GetDimensions(tint_tmp.x, tint_tmp.y, tint_tmp.z);
uint res = tint_tmp.z;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureNumLayers_1f858a();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureNumLayers_1f858a();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureNumLayers_1f858a();
return;
}

View File

@ -0,0 +1,52 @@
#version 310 es
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureNumLayers_1f858a() {
uint res = uint(imageSize(arg_0).z);
}
vec4 vertex_main() {
textureNumLayers_1f858a();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureNumLayers_1f858a() {
uint res = uint(imageSize(arg_0).z);
}
void fragment_main() {
textureNumLayers_1f858a();
}
void main() {
fragment_main();
return;
}
#version 310 es
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureNumLayers_1f858a() {
uint res = uint(imageSize(arg_0).z);
}
void compute_main() {
textureNumLayers_1f858a();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void textureNumLayers_1f858a(texture2d_array<float, access::write> tint_symbol_1) {
uint res = tint_symbol_1.get_array_size();
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
textureNumLayers_1f858a(tint_symbol_2);
return float4(0.0f);
}
vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
float4 const inner_result = vertex_main_inner(tint_symbol_3);
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
textureNumLayers_1f858a(tint_symbol_4);
return;
}
kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
textureNumLayers_1f858a(tint_symbol_5);
return;
}

View File

@ -0,0 +1,77 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 38
; Schema: 0
OpCapability Shader
OpCapability ImageQuery
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %arg_0 "arg_0"
OpName %textureNumLayers_1f858a "textureNumLayers_1f858a"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %arg_0 NonReadable
OpDecorate %arg_0 DescriptorSet 1
OpDecorate %arg_0 Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%11 = OpTypeImage %float 2D 0 1 0 2 Rgba8
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Function_uint = OpTypePointer Function %uint
%23 = OpConstantNull %uint
%24 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%textureNumLayers_1f858a = OpFunction %void None %12
%15 = OpLabel
%res = OpVariable %_ptr_Function_uint Function %23
%20 = OpLoad %11 %arg_0
%18 = OpImageQuerySize %v3uint %20
%16 = OpCompositeExtract %uint %18 2
OpStore %res %16
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %24
%26 = OpLabel
%27 = OpFunctionCall %void %textureNumLayers_1f858a
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%29 = OpLabel
%30 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %30
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%33 = OpLabel
%34 = OpFunctionCall %void %textureNumLayers_1f858a
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%36 = OpLabel
%37 = OpFunctionCall %void %textureNumLayers_1f858a
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,21 @@
@group(1) @binding(0) var arg_0 : texture_storage_2d_array<bgra8unorm, write>;
fn textureNumLayers_1f858a() {
var res : u32 = textureNumLayers(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureNumLayers_1f858a();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureNumLayers_1f858a();
}
@compute @workgroup_size(1)
fn compute_main() {
textureNumLayers_1f858a();
}

View File

@ -0,0 +1,44 @@
// Copyright 2023 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
@group(1) @binding(0) var arg_0: texture_storage_2d_array<bgra8unorm, write>;
// fn textureStore(texture: texture_storage_2d_array<bgra8unorm, write>, coords: vec2<u32>, array_index: i32, value: vec4<f32>)
fn textureStore_27063a() {
textureStore(arg_0, vec2<u32>(1u), 1i, vec4<f32>(1.f));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureStore_27063a();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureStore_27063a();
}
@compute @workgroup_size(1)
fn compute_main() {
textureStore_27063a();
}

View File

@ -0,0 +1,32 @@
RWTexture2DArray<float4> arg_0 : register(u0, space1);
void textureStore_27063a() {
arg_0[uint3((1u).xx, uint(1))] = (1.0f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureStore_27063a();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureStore_27063a();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureStore_27063a();
return;
}

View File

@ -0,0 +1,32 @@
RWTexture2DArray<float4> arg_0 : register(u0, space1);
void textureStore_27063a() {
arg_0[uint3((1u).xx, uint(1))] = (1.0f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureStore_27063a();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureStore_27063a();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureStore_27063a();
return;
}

View File

@ -0,0 +1,52 @@
#version 310 es
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureStore_27063a() {
imageStore(arg_0, ivec3(uvec3(uvec2(1u), uint(1))), vec4(1.0f));
}
vec4 vertex_main() {
textureStore_27063a();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureStore_27063a() {
imageStore(arg_0, ivec3(uvec3(uvec2(1u), uint(1))), vec4(1.0f));
}
void fragment_main() {
textureStore_27063a();
}
void main() {
fragment_main();
return;
}
#version 310 es
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureStore_27063a() {
imageStore(arg_0, ivec3(uvec3(uvec2(1u), uint(1))), vec4(1.0f));
}
void compute_main() {
textureStore_27063a();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void textureStore_27063a(texture2d_array<float, access::write> tint_symbol_1) {
tint_symbol_1.write(float4(1.0f), uint2(uint2(1u)), 1);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
textureStore_27063a(tint_symbol_2);
return float4(0.0f);
}
vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
float4 const inner_result = vertex_main_inner(tint_symbol_3);
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
textureStore_27063a(tint_symbol_4);
return;
}
kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
textureStore_27063a(tint_symbol_5);
return;
}

View File

@ -0,0 +1,80 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 44
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %arg_0 "arg_0"
OpName %textureStore_27063a "textureStore_27063a"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %arg_0 NonReadable
OpDecorate %arg_0 DescriptorSet 1
OpDecorate %arg_0 Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%11 = OpTypeImage %float 2D 0 1 0 2 Rgba8
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%v2uint = OpTypeVector %uint 2
%uint_1 = OpConstant %uint 1
%22 = OpConstantComposite %v2uint %uint_1 %uint_1
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%float_1 = OpConstant %float 1
%30 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%31 = OpTypeFunction %v4float
%textureStore_27063a = OpFunction %void None %12
%15 = OpLabel
%17 = OpLoad %11 %arg_0
%23 = OpCompositeExtract %uint %22 0
%24 = OpCompositeExtract %uint %22 1
%25 = OpBitcast %uint %int_1
%28 = OpCompositeConstruct %v3uint %23 %24 %25
OpImageWrite %17 %28 %30
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %31
%33 = OpLabel
%34 = OpFunctionCall %void %textureStore_27063a
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%36 = OpLabel
%37 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %37
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%39 = OpLabel
%40 = OpFunctionCall %void %textureStore_27063a
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%42 = OpLabel
%43 = OpFunctionCall %void %textureStore_27063a
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,21 @@
@group(1) @binding(0) var arg_0 : texture_storage_2d_array<bgra8unorm, write>;
fn textureStore_27063a() {
textureStore(arg_0, vec2<u32>(1u), 1i, vec4<f32>(1.0f));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureStore_27063a();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureStore_27063a();
}
@compute @workgroup_size(1)
fn compute_main() {
textureStore_27063a();
}

View File

@ -0,0 +1,44 @@
// Copyright 2023 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
@group(1) @binding(0) var arg_0: texture_storage_2d<bgra8unorm, write>;
// fn textureStore(texture: texture_storage_2d<bgra8unorm, write>, coords: vec2<i32>, value: vec4<f32>)
fn textureStore_2e4245() {
textureStore(arg_0, vec2<i32>(1i), vec4<f32>(1.f));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureStore_2e4245();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureStore_2e4245();
}
@compute @workgroup_size(1)
fn compute_main() {
textureStore_2e4245();
}

View File

@ -0,0 +1,32 @@
RWTexture2D<float4> arg_0 : register(u0, space1);
void textureStore_2e4245() {
arg_0[(1).xx] = (1.0f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureStore_2e4245();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureStore_2e4245();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureStore_2e4245();
return;
}

View File

@ -0,0 +1,32 @@
RWTexture2D<float4> arg_0 : register(u0, space1);
void textureStore_2e4245() {
arg_0[(1).xx] = (1.0f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureStore_2e4245();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureStore_2e4245();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureStore_2e4245();
return;
}

View File

@ -0,0 +1,52 @@
#version 310 es
layout(rgba8) uniform highp writeonly image2D arg_0;
void textureStore_2e4245() {
imageStore(arg_0, ivec2(1), vec4(1.0f));
}
vec4 vertex_main() {
textureStore_2e4245();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
layout(rgba8) uniform highp writeonly image2D arg_0;
void textureStore_2e4245() {
imageStore(arg_0, ivec2(1), vec4(1.0f));
}
void fragment_main() {
textureStore_2e4245();
}
void main() {
fragment_main();
return;
}
#version 310 es
layout(rgba8) uniform highp writeonly image2D arg_0;
void textureStore_2e4245() {
imageStore(arg_0, ivec2(1), vec4(1.0f));
}
void compute_main() {
textureStore_2e4245();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void textureStore_2e4245(texture2d<float, access::write> tint_symbol_1) {
tint_symbol_1.write(float4(1.0f), uint2(int2(1)));
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
textureStore_2e4245(tint_symbol_2);
return float4(0.0f);
}
vertex tint_symbol vertex_main(texture2d<float, access::write> tint_symbol_3 [[texture(0)]]) {
float4 const inner_result = vertex_main_inner(tint_symbol_3);
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main(texture2d<float, access::write> tint_symbol_4 [[texture(0)]]) {
textureStore_2e4245(tint_symbol_4);
return;
}
kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
textureStore_2e4245(tint_symbol_5);
return;
}

View File

@ -0,0 +1,73 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 37
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %arg_0 "arg_0"
OpName %textureStore_2e4245 "textureStore_2e4245"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %arg_0 NonReadable
OpDecorate %arg_0 DescriptorSet 1
OpDecorate %arg_0 Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%11 = OpTypeImage %float 2D 0 0 0 2 Rgba8
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%int_1 = OpConstant %int 1
%21 = OpConstantComposite %v2int %int_1 %int_1
%float_1 = OpConstant %float 1
%23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%24 = OpTypeFunction %v4float
%textureStore_2e4245 = OpFunction %void None %12
%15 = OpLabel
%17 = OpLoad %11 %arg_0
OpImageWrite %17 %21 %23
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %24
%26 = OpLabel
%27 = OpFunctionCall %void %textureStore_2e4245
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%29 = OpLabel
%30 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %30
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%32 = OpLabel
%33 = OpFunctionCall %void %textureStore_2e4245
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%35 = OpLabel
%36 = OpFunctionCall %void %textureStore_2e4245
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,21 @@
@group(1) @binding(0) var arg_0 : texture_storage_2d<bgra8unorm, write>;
fn textureStore_2e4245() {
textureStore(arg_0, vec2<i32>(1i), vec4<f32>(1.0f));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureStore_2e4245();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureStore_2e4245();
}
@compute @workgroup_size(1)
fn compute_main() {
textureStore_2e4245();
}

View File

@ -0,0 +1,44 @@
// Copyright 2023 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
@group(1) @binding(0) var arg_0: texture_storage_2d_array<bgra8unorm, write>;
// fn textureStore(texture: texture_storage_2d_array<bgra8unorm, write>, coords: vec2<i32>, array_index: i32, value: vec4<f32>)
fn textureStore_319029() {
textureStore(arg_0, vec2<i32>(1i), 1i, vec4<f32>(1.f));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureStore_319029();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureStore_319029();
}
@compute @workgroup_size(1)
fn compute_main() {
textureStore_319029();
}

View File

@ -0,0 +1,32 @@
RWTexture2DArray<float4> arg_0 : register(u0, space1);
void textureStore_319029() {
arg_0[int3((1).xx, 1)] = (1.0f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureStore_319029();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureStore_319029();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureStore_319029();
return;
}

View File

@ -0,0 +1,32 @@
RWTexture2DArray<float4> arg_0 : register(u0, space1);
void textureStore_319029() {
arg_0[int3((1).xx, 1)] = (1.0f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureStore_319029();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureStore_319029();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureStore_319029();
return;
}

View File

@ -0,0 +1,52 @@
#version 310 es
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureStore_319029() {
imageStore(arg_0, ivec3(ivec2(1), 1), vec4(1.0f));
}
vec4 vertex_main() {
textureStore_319029();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureStore_319029() {
imageStore(arg_0, ivec3(ivec2(1), 1), vec4(1.0f));
}
void fragment_main() {
textureStore_319029();
}
void main() {
fragment_main();
return;
}
#version 310 es
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureStore_319029() {
imageStore(arg_0, ivec3(ivec2(1), 1), vec4(1.0f));
}
void compute_main() {
textureStore_319029();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void textureStore_319029(texture2d_array<float, access::write> tint_symbol_1) {
tint_symbol_1.write(float4(1.0f), uint2(int2(1)), 1);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
textureStore_319029(tint_symbol_2);
return float4(0.0f);
}
vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
float4 const inner_result = vertex_main_inner(tint_symbol_3);
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
textureStore_319029(tint_symbol_4);
return;
}
kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
textureStore_319029(tint_symbol_5);
return;
}

View File

@ -0,0 +1,77 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 41
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %arg_0 "arg_0"
OpName %textureStore_319029 "textureStore_319029"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %arg_0 NonReadable
OpDecorate %arg_0 DescriptorSet 1
OpDecorate %arg_0 Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%11 = OpTypeImage %float 2D 0 1 0 2 Rgba8
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%v2int = OpTypeVector %int 2
%int_1 = OpConstant %int 1
%22 = OpConstantComposite %v2int %int_1 %int_1
%float_1 = OpConstant %float 1
%27 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%28 = OpTypeFunction %v4float
%textureStore_319029 = OpFunction %void None %12
%15 = OpLabel
%17 = OpLoad %11 %arg_0
%23 = OpCompositeExtract %int %22 0
%24 = OpCompositeExtract %int %22 1
%25 = OpCompositeConstruct %v3int %23 %24 %int_1
OpImageWrite %17 %25 %27
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %28
%30 = OpLabel
%31 = OpFunctionCall %void %textureStore_319029
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%33 = OpLabel
%34 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %34
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%36 = OpLabel
%37 = OpFunctionCall %void %textureStore_319029
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%39 = OpLabel
%40 = OpFunctionCall %void %textureStore_319029
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,21 @@
@group(1) @binding(0) var arg_0 : texture_storage_2d_array<bgra8unorm, write>;
fn textureStore_319029() {
textureStore(arg_0, vec2<i32>(1i), 1i, vec4<f32>(1.0f));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureStore_319029();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureStore_319029();
}
@compute @workgroup_size(1)
fn compute_main() {
textureStore_319029();
}

View File

@ -0,0 +1,44 @@
// Copyright 2023 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
@group(1) @binding(0) var arg_0: texture_storage_2d_array<bgra8unorm, write>;
// fn textureStore(texture: texture_storage_2d_array<bgra8unorm, write>, coords: vec2<i32>, array_index: u32, value: vec4<f32>)
fn textureStore_76affd() {
textureStore(arg_0, vec2<i32>(1i), 1u, vec4<f32>(1.f));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureStore_76affd();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureStore_76affd();
}
@compute @workgroup_size(1)
fn compute_main() {
textureStore_76affd();
}

View File

@ -0,0 +1,32 @@
RWTexture2DArray<float4> arg_0 : register(u0, space1);
void textureStore_76affd() {
arg_0[int3((1).xx, int(1u))] = (1.0f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureStore_76affd();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureStore_76affd();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureStore_76affd();
return;
}

View File

@ -0,0 +1,32 @@
RWTexture2DArray<float4> arg_0 : register(u0, space1);
void textureStore_76affd() {
arg_0[int3((1).xx, int(1u))] = (1.0f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureStore_76affd();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureStore_76affd();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureStore_76affd();
return;
}

View File

@ -0,0 +1,52 @@
#version 310 es
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureStore_76affd() {
imageStore(arg_0, ivec3(ivec2(1), int(1u)), vec4(1.0f));
}
vec4 vertex_main() {
textureStore_76affd();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureStore_76affd() {
imageStore(arg_0, ivec3(ivec2(1), int(1u)), vec4(1.0f));
}
void fragment_main() {
textureStore_76affd();
}
void main() {
fragment_main();
return;
}
#version 310 es
layout(rgba8) uniform highp writeonly image2DArray arg_0;
void textureStore_76affd() {
imageStore(arg_0, ivec3(ivec2(1), int(1u)), vec4(1.0f));
}
void compute_main() {
textureStore_76affd();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void textureStore_76affd(texture2d_array<float, access::write> tint_symbol_1) {
tint_symbol_1.write(float4(1.0f), uint2(int2(1)), 1u);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner(texture2d_array<float, access::write> tint_symbol_2) {
textureStore_76affd(tint_symbol_2);
return float4(0.0f);
}
vertex tint_symbol vertex_main(texture2d_array<float, access::write> tint_symbol_3 [[texture(0)]]) {
float4 const inner_result = vertex_main_inner(tint_symbol_3);
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_4 [[texture(0)]]) {
textureStore_76affd(tint_symbol_4);
return;
}
kernel void compute_main(texture2d_array<float, access::write> tint_symbol_5 [[texture(0)]]) {
textureStore_76affd(tint_symbol_5);
return;
}

View File

@ -0,0 +1,80 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 44
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %arg_0 "arg_0"
OpName %textureStore_76affd "textureStore_76affd"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %arg_0 NonReadable
OpDecorate %arg_0 DescriptorSet 1
OpDecorate %arg_0 Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%11 = OpTypeImage %float 2D 0 1 0 2 Rgba8
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%v2int = OpTypeVector %int 2
%int_1 = OpConstant %int 1
%22 = OpConstantComposite %v2int %int_1 %int_1
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%float_1 = OpConstant %float 1
%30 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%31 = OpTypeFunction %v4float
%textureStore_76affd = OpFunction %void None %12
%15 = OpLabel
%17 = OpLoad %11 %arg_0
%23 = OpCompositeExtract %int %22 0
%24 = OpCompositeExtract %int %22 1
%25 = OpBitcast %int %uint_1
%28 = OpCompositeConstruct %v3int %23 %24 %25
OpImageWrite %17 %28 %30
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %31
%33 = OpLabel
%34 = OpFunctionCall %void %textureStore_76affd
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%36 = OpLabel
%37 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %37
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%39 = OpLabel
%40 = OpFunctionCall %void %textureStore_76affd
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%42 = OpLabel
%43 = OpFunctionCall %void %textureStore_76affd
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,21 @@
@group(1) @binding(0) var arg_0 : texture_storage_2d_array<bgra8unorm, write>;
fn textureStore_76affd() {
textureStore(arg_0, vec2<i32>(1i), 1u, vec4<f32>(1.0f));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureStore_76affd();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureStore_76affd();
}
@compute @workgroup_size(1)
fn compute_main() {
textureStore_76affd();
}

View File

@ -0,0 +1,44 @@
// Copyright 2023 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
@group(1) @binding(0) var arg_0: texture_storage_3d<bgra8unorm, write>;
// fn textureStore(texture: texture_storage_3d<bgra8unorm, write>, coords: vec3<u32>, value: vec4<f32>)
fn textureStore_9aedd3() {
textureStore(arg_0, vec3<u32>(1u), vec4<f32>(1.f));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureStore_9aedd3();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureStore_9aedd3();
}
@compute @workgroup_size(1)
fn compute_main() {
textureStore_9aedd3();
}

View File

@ -0,0 +1,32 @@
RWTexture3D<float4> arg_0 : register(u0, space1);
void textureStore_9aedd3() {
arg_0[(1u).xxx] = (1.0f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureStore_9aedd3();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureStore_9aedd3();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureStore_9aedd3();
return;
}

View File

@ -0,0 +1,32 @@
RWTexture3D<float4> arg_0 : register(u0, space1);
void textureStore_9aedd3() {
arg_0[(1u).xxx] = (1.0f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureStore_9aedd3();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureStore_9aedd3();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureStore_9aedd3();
return;
}

View File

@ -0,0 +1,52 @@
#version 310 es
layout(rgba8) uniform highp writeonly image3D arg_0;
void textureStore_9aedd3() {
imageStore(arg_0, ivec3(uvec3(1u)), vec4(1.0f));
}
vec4 vertex_main() {
textureStore_9aedd3();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
layout(rgba8) uniform highp writeonly image3D arg_0;
void textureStore_9aedd3() {
imageStore(arg_0, ivec3(uvec3(1u)), vec4(1.0f));
}
void fragment_main() {
textureStore_9aedd3();
}
void main() {
fragment_main();
return;
}
#version 310 es
layout(rgba8) uniform highp writeonly image3D arg_0;
void textureStore_9aedd3() {
imageStore(arg_0, ivec3(uvec3(1u)), vec4(1.0f));
}
void compute_main() {
textureStore_9aedd3();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void textureStore_9aedd3(texture3d<float, access::write> tint_symbol_1) {
tint_symbol_1.write(float4(1.0f), uint3(uint3(1u)));
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner(texture3d<float, access::write> tint_symbol_2) {
textureStore_9aedd3(tint_symbol_2);
return float4(0.0f);
}
vertex tint_symbol vertex_main(texture3d<float, access::write> tint_symbol_3 [[texture(0)]]) {
float4 const inner_result = vertex_main_inner(tint_symbol_3);
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main(texture3d<float, access::write> tint_symbol_4 [[texture(0)]]) {
textureStore_9aedd3(tint_symbol_4);
return;
}
kernel void compute_main(texture3d<float, access::write> tint_symbol_5 [[texture(0)]]) {
textureStore_9aedd3(tint_symbol_5);
return;
}

View File

@ -0,0 +1,73 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 37
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %arg_0 "arg_0"
OpName %textureStore_9aedd3 "textureStore_9aedd3"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %arg_0 NonReadable
OpDecorate %arg_0 DescriptorSet 1
OpDecorate %arg_0 Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%11 = OpTypeImage %float 3D 0 0 0 2 Rgba8
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%uint_1 = OpConstant %uint 1
%21 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
%float_1 = OpConstant %float 1
%23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%24 = OpTypeFunction %v4float
%textureStore_9aedd3 = OpFunction %void None %12
%15 = OpLabel
%17 = OpLoad %11 %arg_0
OpImageWrite %17 %21 %23
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %24
%26 = OpLabel
%27 = OpFunctionCall %void %textureStore_9aedd3
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%29 = OpLabel
%30 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %30
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%32 = OpLabel
%33 = OpFunctionCall %void %textureStore_9aedd3
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%35 = OpLabel
%36 = OpFunctionCall %void %textureStore_9aedd3
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,21 @@
@group(1) @binding(0) var arg_0 : texture_storage_3d<bgra8unorm, write>;
fn textureStore_9aedd3() {
textureStore(arg_0, vec3<u32>(1u), vec4<f32>(1.0f));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureStore_9aedd3();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureStore_9aedd3();
}
@compute @workgroup_size(1)
fn compute_main() {
textureStore_9aedd3();
}

View File

@ -0,0 +1,44 @@
// Copyright 2023 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
////////////////////////////////////////////////////////////////////////////////
// File generated by tools/src/cmd/gen
// using the template:
// test/tint/builtins/gen/gen.wgsl.tmpl
//
// Do not modify this file directly
////////////////////////////////////////////////////////////////////////////////
@group(1) @binding(0) var arg_0: texture_storage_2d<bgra8unorm, write>;
// fn textureStore(texture: texture_storage_2d<bgra8unorm, write>, coords: vec2<u32>, value: vec4<f32>)
fn textureStore_a165b8() {
textureStore(arg_0, vec2<u32>(1u), vec4<f32>(1.f));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureStore_a165b8();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureStore_a165b8();
}
@compute @workgroup_size(1)
fn compute_main() {
textureStore_a165b8();
}

View File

@ -0,0 +1,32 @@
RWTexture2D<float4> arg_0 : register(u0, space1);
void textureStore_a165b8() {
arg_0[(1u).xx] = (1.0f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureStore_a165b8();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureStore_a165b8();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureStore_a165b8();
return;
}

View File

@ -0,0 +1,32 @@
RWTexture2D<float4> arg_0 : register(u0, space1);
void textureStore_a165b8() {
arg_0[(1u).xx] = (1.0f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
textureStore_a165b8();
return (0.0f).xxxx;
}
tint_symbol vertex_main() {
const float4 inner_result = vertex_main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
void fragment_main() {
textureStore_a165b8();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
textureStore_a165b8();
return;
}

View File

@ -0,0 +1,52 @@
#version 310 es
layout(rgba8) uniform highp writeonly image2D arg_0;
void textureStore_a165b8() {
imageStore(arg_0, ivec2(uvec2(1u)), vec4(1.0f));
}
vec4 vertex_main() {
textureStore_a165b8();
return vec4(0.0f);
}
void main() {
gl_PointSize = 1.0;
vec4 inner_result = vertex_main();
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
layout(rgba8) uniform highp writeonly image2D arg_0;
void textureStore_a165b8() {
imageStore(arg_0, ivec2(uvec2(1u)), vec4(1.0f));
}
void fragment_main() {
textureStore_a165b8();
}
void main() {
fragment_main();
return;
}
#version 310 es
layout(rgba8) uniform highp writeonly image2D arg_0;
void textureStore_a165b8() {
imageStore(arg_0, ivec2(uvec2(1u)), vec4(1.0f));
}
void compute_main() {
textureStore_a165b8();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void textureStore_a165b8(texture2d<float, access::write> tint_symbol_1) {
tint_symbol_1.write(float4(1.0f), uint2(uint2(1u)));
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner(texture2d<float, access::write> tint_symbol_2) {
textureStore_a165b8(tint_symbol_2);
return float4(0.0f);
}
vertex tint_symbol vertex_main(texture2d<float, access::write> tint_symbol_3 [[texture(0)]]) {
float4 const inner_result = vertex_main_inner(tint_symbol_3);
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
fragment void fragment_main(texture2d<float, access::write> tint_symbol_4 [[texture(0)]]) {
textureStore_a165b8(tint_symbol_4);
return;
}
kernel void compute_main(texture2d<float, access::write> tint_symbol_5 [[texture(0)]]) {
textureStore_a165b8(tint_symbol_5);
return;
}

View File

@ -0,0 +1,73 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 37
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %arg_0 "arg_0"
OpName %textureStore_a165b8 "textureStore_a165b8"
OpName %vertex_main_inner "vertex_main_inner"
OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
OpDecorate %value BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %arg_0 NonReadable
OpDecorate %arg_0 DescriptorSet 1
OpDecorate %arg_0 Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%11 = OpTypeImage %float 2D 0 0 0 2 Rgba8
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%void = OpTypeVoid
%12 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v2uint = OpTypeVector %uint 2
%uint_1 = OpConstant %uint 1
%21 = OpConstantComposite %v2uint %uint_1 %uint_1
%float_1 = OpConstant %float 1
%23 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%24 = OpTypeFunction %v4float
%textureStore_a165b8 = OpFunction %void None %12
%15 = OpLabel
%17 = OpLoad %11 %arg_0
OpImageWrite %17 %21 %23
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %24
%26 = OpLabel
%27 = OpFunctionCall %void %textureStore_a165b8
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %12
%29 = OpLabel
%30 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %30
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %12
%32 = OpLabel
%33 = OpFunctionCall %void %textureStore_a165b8
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %12
%35 = OpLabel
%36 = OpFunctionCall %void %textureStore_a165b8
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,21 @@
@group(1) @binding(0) var arg_0 : texture_storage_2d<bgra8unorm, write>;
fn textureStore_a165b8() {
textureStore(arg_0, vec2<u32>(1u), vec4<f32>(1.0f));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
textureStore_a165b8();
return vec4<f32>();
}
@fragment
fn fragment_main() {
textureStore_a165b8();
}
@compute @workgroup_size(1)
fn compute_main() {
textureStore_a165b8();
}

Some files were not shown because too many files have changed in this diff Show More