mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 08:27:05 +00:00
Implement textureWrite()
Bug: tint:368 Bug: tint:140 Bug: tint:143 Bug: tint:144 Bug: tint:145 Bug: tint:146 Bug: tint:147 Change-Id: I1b6943d8663fbac8fbaa77a4804afb5a20fdb5e6 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35320 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
3a7bba8c98
commit
591268db48
@@ -266,7 +266,7 @@ bool IsTextureIntrinsic(Intrinsic i) {
|
||||
i == Intrinsic::kTextureSampleLevel ||
|
||||
i == Intrinsic::kTextureSampleBias ||
|
||||
i == Intrinsic::kTextureSampleCompare ||
|
||||
i == Intrinsic::kTextureSampleGrad;
|
||||
i == Intrinsic::kTextureSampleGrad || i == Intrinsic::kTextureStore;
|
||||
}
|
||||
|
||||
} // namespace intrinsic
|
||||
|
||||
@@ -91,6 +91,7 @@ enum class Intrinsic {
|
||||
kTextureSampleCompare,
|
||||
kTextureSampleGrad,
|
||||
kTextureSampleLevel,
|
||||
kTextureStore,
|
||||
kTrunc
|
||||
};
|
||||
|
||||
@@ -143,6 +144,8 @@ struct TextureSignature : public Signature {
|
||||
size_t sample_index = kNotUsed;
|
||||
/// `texture` parameter index.
|
||||
size_t texture = kNotUsed;
|
||||
/// `value` parameter index.
|
||||
size_t value = kNotUsed;
|
||||
};
|
||||
/// The indices of all possible parameters.
|
||||
Index idx;
|
||||
|
||||
@@ -1976,6 +1976,90 @@ std::vector<TextureOverloadCase> TextureOverloadCase::ValidCases() {
|
||||
b->vec3<i32>(1, 2, 3)); // coords
|
||||
},
|
||||
},
|
||||
{
|
||||
ValidTextureOverload::kStoreWO1dRgba32float,
|
||||
"textureStore(t : texture_storage_wo_1d<F>,\n"
|
||||
" coords : i32,\n"
|
||||
" value : vec4<T>) -> void",
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::type::ImageFormat::kRgba32Float,
|
||||
type::TextureDimension::k1d,
|
||||
TextureDataType::kF32,
|
||||
"textureStore",
|
||||
[](Builder* b) {
|
||||
return b->ExprList("texture", // t
|
||||
1, // coords
|
||||
b->vec4<f32>(2.f, 3.f, 4.f, 5.f)); // value
|
||||
},
|
||||
},
|
||||
{
|
||||
ValidTextureOverload::kStoreWO1dArrayRgba32float,
|
||||
"textureStore(t : texture_storage_wo_1d_array<F>,\n"
|
||||
" coords : i32,\n"
|
||||
" array_index : i32,\n"
|
||||
" value : vec4<T>) -> void",
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::type::ImageFormat::kRgba32Float,
|
||||
type::TextureDimension::k1dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureStore",
|
||||
[](Builder* b) {
|
||||
return b->ExprList("texture", // t
|
||||
1, // coords
|
||||
2, // array_index
|
||||
b->vec4<f32>(3.f, 4.f, 5.f, 6.f)); // value
|
||||
},
|
||||
},
|
||||
{
|
||||
ValidTextureOverload::kStoreWO2dRgba32float,
|
||||
"textureStore(t : texture_storage_wo_2d<F>,\n"
|
||||
" coords : vec2<i32>,\n"
|
||||
" value : vec4<T>) -> void",
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::type::ImageFormat::kRgba32Float,
|
||||
type::TextureDimension::k2d,
|
||||
TextureDataType::kF32,
|
||||
"textureStore",
|
||||
[](Builder* b) {
|
||||
return b->ExprList("texture", // t
|
||||
b->vec2<i32>(1, 2), // coords
|
||||
b->vec4<f32>(3.f, 4.f, 5.f, 6.f)); // value
|
||||
},
|
||||
},
|
||||
{
|
||||
ValidTextureOverload::kStoreWO2dArrayRgba32float,
|
||||
"textureStore(t : texture_storage_wo_2d_array<F>,\n"
|
||||
" coords : vec2<i32>,\n"
|
||||
" array_index : i32,\n"
|
||||
" value : vec4<T>) -> void",
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::type::ImageFormat::kRgba32Float,
|
||||
type::TextureDimension::k2dArray,
|
||||
TextureDataType::kF32,
|
||||
"textureStore",
|
||||
[](Builder* b) {
|
||||
return b->ExprList("texture", // t
|
||||
b->vec2<i32>(1, 2), // coords
|
||||
3, // array_index
|
||||
b->vec4<f32>(4.f, 5.f, 6.f, 7.f)); // value
|
||||
},
|
||||
},
|
||||
{
|
||||
ValidTextureOverload::kStoreWO3dRgba32float,
|
||||
"textureStore(t : texture_storage_wo_3d<F>,\n"
|
||||
" coords : vec3<i32>,\n"
|
||||
" value : vec4<T>) -> void",
|
||||
ast::AccessControl::kWriteOnly,
|
||||
ast::type::ImageFormat::kRgba32Float,
|
||||
type::TextureDimension::k3d,
|
||||
TextureDataType::kF32,
|
||||
"textureStore",
|
||||
[](Builder* b) {
|
||||
return b->ExprList("texture", // t
|
||||
b->vec3<i32>(1, 2, 3), // coords
|
||||
b->vec4<f32>(4.f, 5.f, 6.f, 7.f)); // value
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -142,6 +142,11 @@ enum class ValidTextureOverload {
|
||||
kLoadStorageRO2dRgba32float,
|
||||
kLoadStorageRO2dArrayRgba32float, // Not permutated for all texel formats
|
||||
kLoadStorageRO3dRgba32float, // Not permutated for all texel formats
|
||||
kStoreWO1dRgba32float, // Not permutated for all texel formats
|
||||
kStoreWO1dArrayRgba32float, // Not permutated for all texel formats
|
||||
kStoreWO2dRgba32float, // Not permutated for all texel formats
|
||||
kStoreWO2dArrayRgba32float, // Not permutated for all texel formats
|
||||
kStoreWO3dRgba32float, // Not permutated for all texel formats
|
||||
};
|
||||
|
||||
/// Describes a texture intrinsic overload
|
||||
|
||||
Reference in New Issue
Block a user