mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-17 04:41:23 +00:00
tint/transform: Fix index 0 accessing in DecomposeMemoryAccess
This patch fix a bug in DecomposeMemoryAccess, allowing access index 0 of a member in uniform and storage buffer being recognized as constant index. Bug: tint:1652 Change-Id: Ia428de17c860bdafe87c3af9e46426c74fe8fd68 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99480 Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com> Reviewed-by: Ben Clayton <bclayton@google.com> Auto-Submit: Zhaoming Jiang <zhaoming.jiang@intel.com> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
dce63f5717
commit
ff1330240b
@ -328,7 +328,7 @@ struct DecomposeMemoryAccess::State {
|
|||||||
/// @returns an Offset for the given ast::Expression
|
/// @returns an Offset for the given ast::Expression
|
||||||
const Offset* ToOffset(const ast::Expression* expr) {
|
const Offset* ToOffset(const ast::Expression* expr) {
|
||||||
if (auto* lit = expr->As<ast::IntLiteralExpression>()) {
|
if (auto* lit = expr->As<ast::IntLiteralExpression>()) {
|
||||||
if (lit->value > 0) {
|
if (lit->value >= 0) {
|
||||||
return offsets_.Create<OffsetLiteral>(static_cast<uint32_t>(lit->value));
|
return offsets_.Create<OffsetLiteral>(static_cast<uint32_t>(lit->value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,6 @@ S tint_symbol_4(ByteAddressBuffer buffer, uint offset) {
|
|||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
[numthreads(1, 1, 1)]
|
||||||
void main() {
|
void main() {
|
||||||
tint_symbol_2(tint_symbol_1, (4u * 0u), tint_symbol_4(tint_symbol, (4u * 0u)));
|
tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,6 @@ S tint_symbol_4(ByteAddressBuffer buffer, uint offset) {
|
|||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
[numthreads(1, 1, 1)]
|
||||||
void main() {
|
void main() {
|
||||||
tint_symbol_2(tint_symbol_1, (4u * 0u), tint_symbol_4(tint_symbol, (4u * 0u)));
|
tint_symbol_2(tint_symbol_1, 0u, tint_symbol_4(tint_symbol, 0u));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -60,10 +60,10 @@ int tint_atomicLoad_1(RWByteAddressBuffer buffer, uint offset) {
|
|||||||
void doIgnore() {
|
void doIgnore() {
|
||||||
uint g43 = uniforms[0].x;
|
uint g43 = uniforms[0].x;
|
||||||
uint kj6 = dbg.Load(20u);
|
uint kj6 = dbg.Load(20u);
|
||||||
uint b53 = tint_atomicLoad(counters, (4u * 0u));
|
uint b53 = tint_atomicLoad(counters, 0u);
|
||||||
uint rwg = indices.Load((4u * 0u));
|
uint rwg = indices.Load(0u);
|
||||||
float rb5 = asfloat(positions.Load((4u * 0u)));
|
float rb5 = asfloat(positions.Load(0u));
|
||||||
int g55 = tint_atomicLoad_1(LUT, (4u * 0u));
|
int g55 = tint_atomicLoad_1(LUT, 0u);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol_1 {
|
struct tint_symbol_1 {
|
||||||
|
@ -60,10 +60,10 @@ int tint_atomicLoad_1(RWByteAddressBuffer buffer, uint offset) {
|
|||||||
void doIgnore() {
|
void doIgnore() {
|
||||||
uint g43 = uniforms[0].x;
|
uint g43 = uniforms[0].x;
|
||||||
uint kj6 = dbg.Load(20u);
|
uint kj6 = dbg.Load(20u);
|
||||||
uint b53 = tint_atomicLoad(counters, (4u * 0u));
|
uint b53 = tint_atomicLoad(counters, 0u);
|
||||||
uint rwg = indices.Load((4u * 0u));
|
uint rwg = indices.Load(0u);
|
||||||
float rb5 = asfloat(positions.Load((4u * 0u)));
|
float rb5 = asfloat(positions.Load(0u));
|
||||||
int g55 = tint_atomicLoad_1(LUT, (4u * 0u));
|
int g55 = tint_atomicLoad_1(LUT, 0u);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol_1 {
|
struct tint_symbol_1 {
|
||||||
|
@ -28,7 +28,7 @@ Particle tint_symbol_2(ByteAddressBuffer buffer, uint offset) {
|
|||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
[numthreads(1, 1, 1)]
|
||||||
void main() {
|
void main() {
|
||||||
Particle particle = tint_symbol_2(particles, (176u * 0u));
|
Particle particle = tint_symbol_2(particles, 0u);
|
||||||
{
|
{
|
||||||
float3 tint_symbol_1[8] = particle.position;
|
float3 tint_symbol_1[8] = particle.position;
|
||||||
tint_symbol_1[sim[0].x] = particle.position[sim[0].x];
|
tint_symbol_1[sim[0].x] = particle.position[sim[0].x];
|
||||||
|
@ -28,7 +28,7 @@ Particle tint_symbol_2(ByteAddressBuffer buffer, uint offset) {
|
|||||||
|
|
||||||
[numthreads(1, 1, 1)]
|
[numthreads(1, 1, 1)]
|
||||||
void main() {
|
void main() {
|
||||||
Particle particle = tint_symbol_2(particles, (176u * 0u));
|
Particle particle = tint_symbol_2(particles, 0u);
|
||||||
{
|
{
|
||||||
float3 tint_symbol_1[8] = particle.position;
|
float3 tint_symbol_1[8] = particle.position;
|
||||||
tint_symbol_1[sim[0].x] = particle.position[sim[0].x];
|
tint_symbol_1[sim[0].x] = particle.position[sim[0].x];
|
||||||
|
@ -23,8 +23,7 @@ void main_1() {
|
|||||||
const float4 x_21 = q;
|
const float4 x_21 = q;
|
||||||
p = float3(x_21.x, x_21.y, x_21.z);
|
p = float3(x_21.x, x_21.y, x_21.z);
|
||||||
const float x_27 = p.x;
|
const float x_27 = p.x;
|
||||||
const uint scalar_offset_4 = ((208u + (16u * 0u))) / 4;
|
const float x_41 = asfloat(x_14[13].x);
|
||||||
const float x_41 = asfloat(x_14[scalar_offset_4 / 4][scalar_offset_4 % 4]);
|
|
||||||
const float x_45 = position.y;
|
const float x_45 = position.y;
|
||||||
const float x_49 = asfloat(x_14[4].x);
|
const float x_49 = asfloat(x_14[4].x);
|
||||||
p.x = (x_27 + sin(((x_41 * x_45) + x_49)));
|
p.x = (x_27 + sin(((x_41 * x_45) + x_49)));
|
||||||
|
@ -23,8 +23,7 @@ void main_1() {
|
|||||||
const float4 x_21 = q;
|
const float4 x_21 = q;
|
||||||
p = float3(x_21.x, x_21.y, x_21.z);
|
p = float3(x_21.x, x_21.y, x_21.z);
|
||||||
const float x_27 = p.x;
|
const float x_27 = p.x;
|
||||||
const uint scalar_offset_4 = ((208u + (16u * 0u))) / 4;
|
const float x_41 = asfloat(x_14[13].x);
|
||||||
const float x_41 = asfloat(x_14[scalar_offset_4 / 4][scalar_offset_4 % 4]);
|
|
||||||
const float x_45 = position.y;
|
const float x_45 = position.y;
|
||||||
const float x_49 = asfloat(x_14[4].x);
|
const float x_49 = asfloat(x_14[4].x);
|
||||||
p.x = (x_27 + sin(((x_41 * x_45) + x_49)));
|
p.x = (x_27 + sin(((x_41 * x_45) + x_49)));
|
||||||
|
@ -57,10 +57,10 @@ int tint_atomicLoad_1(RWByteAddressBuffer buffer, uint offset) {
|
|||||||
void doIgnore() {
|
void doIgnore() {
|
||||||
uint g42 = uniforms[0].x;
|
uint g42 = uniforms[0].x;
|
||||||
uint kj6 = dbg.Load(20u);
|
uint kj6 = dbg.Load(20u);
|
||||||
uint b53 = tint_atomicLoad(counters, (4u * 0u));
|
uint b53 = tint_atomicLoad(counters, 0u);
|
||||||
uint rwg = indices.Load((4u * 0u));
|
uint rwg = indices.Load(0u);
|
||||||
float rb5 = asfloat(positions.Load((4u * 0u)));
|
float rb5 = asfloat(positions.Load(0u));
|
||||||
int g55 = tint_atomicLoad_1(LUT, (4u * 0u));
|
int g55 = tint_atomicLoad_1(LUT, 0u);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol_1 {
|
struct tint_symbol_1 {
|
||||||
|
@ -57,10 +57,10 @@ int tint_atomicLoad_1(RWByteAddressBuffer buffer, uint offset) {
|
|||||||
void doIgnore() {
|
void doIgnore() {
|
||||||
uint g42 = uniforms[0].x;
|
uint g42 = uniforms[0].x;
|
||||||
uint kj6 = dbg.Load(20u);
|
uint kj6 = dbg.Load(20u);
|
||||||
uint b53 = tint_atomicLoad(counters, (4u * 0u));
|
uint b53 = tint_atomicLoad(counters, 0u);
|
||||||
uint rwg = indices.Load((4u * 0u));
|
uint rwg = indices.Load(0u);
|
||||||
float rb5 = asfloat(positions.Load((4u * 0u)));
|
float rb5 = asfloat(positions.Load(0u));
|
||||||
int g55 = tint_atomicLoad_1(LUT, (4u * 0u));
|
int g55 = tint_atomicLoad_1(LUT, 0u);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol_1 {
|
struct tint_symbol_1 {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
ByteAddressBuffer data : register(t1, space0);
|
ByteAddressBuffer data : register(t1, space0);
|
||||||
|
|
||||||
int foo() {
|
int foo() {
|
||||||
return asint(data.Load((4u * 0u)));
|
return asint(data.Load(0u));
|
||||||
}
|
}
|
||||||
|
|
||||||
[numthreads(16, 16, 1)]
|
[numthreads(16, 16, 1)]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
ByteAddressBuffer data : register(t1, space0);
|
ByteAddressBuffer data : register(t1, space0);
|
||||||
|
|
||||||
int foo() {
|
int foo() {
|
||||||
return asint(data.Load((4u * 0u)));
|
return asint(data.Load(0u));
|
||||||
}
|
}
|
||||||
|
|
||||||
[numthreads(16, 16, 1)]
|
[numthreads(16, 16, 1)]
|
||||||
|
@ -199,7 +199,7 @@ void main1() {
|
|||||||
if ((x_e52.x == 2.0f)) {
|
if ((x_e52.x == 2.0f)) {
|
||||||
{
|
{
|
||||||
const float3 x_e59 = a_Normal1;
|
const float3 x_e59 = a_Normal1;
|
||||||
const Mat4x2_ x_e64 = tint_symbol_8(global1, (32u * 0u));
|
const Mat4x2_ x_e64 = tint_symbol_8(global1, 0u);
|
||||||
const float2 x_e68 = Mul2(x_e64, float4(a_Normal1, 1.0f));
|
const float2 x_e68 = Mul2(x_e64, float4(a_Normal1, 1.0f));
|
||||||
v_TexCoord = x_e68.xy;
|
v_TexCoord = x_e68.xy;
|
||||||
return;
|
return;
|
||||||
@ -207,7 +207,7 @@ void main1() {
|
|||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
const float2 x_e73 = a_UV1;
|
const float2 x_e73 = a_UV1;
|
||||||
const Mat4x2_ x_e79 = tint_symbol_8(global1, (32u * 0u));
|
const Mat4x2_ x_e79 = tint_symbol_8(global1, 0u);
|
||||||
const float2 x_e84 = Mul2(x_e79, float4(a_UV1, 1.0f, 1.0f));
|
const float2 x_e84 = Mul2(x_e79, float4(a_UV1, 1.0f, 1.0f));
|
||||||
v_TexCoord = x_e84.xy;
|
v_TexCoord = x_e84.xy;
|
||||||
return;
|
return;
|
||||||
|
@ -199,7 +199,7 @@ void main1() {
|
|||||||
if ((x_e52.x == 2.0f)) {
|
if ((x_e52.x == 2.0f)) {
|
||||||
{
|
{
|
||||||
const float3 x_e59 = a_Normal1;
|
const float3 x_e59 = a_Normal1;
|
||||||
const Mat4x2_ x_e64 = tint_symbol_8(global1, (32u * 0u));
|
const Mat4x2_ x_e64 = tint_symbol_8(global1, 0u);
|
||||||
const float2 x_e68 = Mul2(x_e64, float4(a_Normal1, 1.0f));
|
const float2 x_e68 = Mul2(x_e64, float4(a_Normal1, 1.0f));
|
||||||
v_TexCoord = x_e68.xy;
|
v_TexCoord = x_e68.xy;
|
||||||
return;
|
return;
|
||||||
@ -207,7 +207,7 @@ void main1() {
|
|||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
const float2 x_e73 = a_UV1;
|
const float2 x_e73 = a_UV1;
|
||||||
const Mat4x2_ x_e79 = tint_symbol_8(global1, (32u * 0u));
|
const Mat4x2_ x_e79 = tint_symbol_8(global1, 0u);
|
||||||
const float2 x_e84 = Mul2(x_e79, float4(a_UV1, 1.0f, 1.0f));
|
const float2 x_e84 = Mul2(x_e79, float4(a_UV1, 1.0f, 1.0f));
|
||||||
v_TexCoord = x_e84.xy;
|
v_TexCoord = x_e84.xy;
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user