Skip to content

Commit

Permalink
[tint] Update generator to add GLSL desktop flag
Browse files Browse the repository at this point in the history
For the tint end2end tests which will only run on GLSL desktop (storage
to an `rg` format or a `cube_array`) we add the flag to enable desktop
generation mode so the expectations will generate without error.

Bug: 42251044
Change-Id: I26b83dc3bb85ac4805c3143503883ce94391277e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/207194
Reviewed-by: James Price <[email protected]>
Commit-Queue: dan sinclair <[email protected]>
  • Loading branch information
dj2 authored and Dawn LUCI CQ committed Sep 18, 2024
1 parent 9da23b7 commit e28f132
Show file tree
Hide file tree
Showing 1,115 changed files with 16,539 additions and 25,140 deletions.
17 changes: 17 additions & 0 deletions test/tint/builtins/gen/gen.wgsl.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ See:

{{- /* Generate the optional flag on HLSL shader model */ -}}
{{- template "HLSLShaderModel" $overload -}}
{{- /* Generate the optional flag for GLSL desktop */ -}}
{{- template "GLSLShaderModel" $overload -}}

{{- /* Generate enable directives */ -}}
{{- template "EnableDirectives" $overload -}}
Expand Down Expand Up @@ -235,6 +237,21 @@ fn vertex_main() -> VertexOutput {
{{- end -}}


{{- /* ------------------------------------------------------------------ */ -}}
{{- define "GLSLShaderModel" -}}
{{- /* Emits the optional GLSL shader model for a given overload */ -}}
{{- /* ------------------------------------------------------------------ */ -}}
{{- $permutation := . -}}
{{- $overload := $permutation.Overload -}}
{{- $builtin_name := $permutation.Intrinsic.Name -}}

{{- if OverloadNeedsDesktopGLSL $overload }}
// flags: --glsl-desktop
{{ end -}}

{{- end -}}


{{- /* ------------------------------------------------------------------ */ -}}
{{- define "HLSLShaderModel" -}}
{{- /* Emits the optional HLSL shader model for a given overload */ -}}
Expand Down
2 changes: 2 additions & 0 deletions test/tint/builtins/gen/literal/textureDimensions/00229f.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
////////////////////////////////////////////////////////////////////////////////


// flags: --glsl-desktop

enable chromium_internal_graphite;

@group(0) @binding(0) var<storage, read_write> prevent_dce : vec3<u32>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,94 +1,81 @@
SKIP: FAILED
#version 460

#version 310 es

layout(r8) uniform highp readonly image3D arg_0;
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uvec3 inner;
uint pad;
} prevent_dce;

void textureDimensions_00229f() {
layout(binding = 0, r8) uniform highp readonly image3D arg_0;
uvec3 textureDimensions_00229f() {
uvec3 res = uvec3(imageSize(arg_0));
prevent_dce.inner = res;
}

vec4 vertex_main() {
textureDimensions_00229f();
return vec4(0.0f);
return res;
}

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;
}
error: Error parsing GLSL shader:
ERROR: 0:3: 'image load-store format' : not supported with this profile: es
ERROR: 0:3: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.



#version 310 es
precision highp float;
precision highp int;

layout(r8) uniform highp readonly image3D arg_0;
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uvec3 inner;
uint pad;
} prevent_dce;

void textureDimensions_00229f() {
uvec3 res = uvec3(imageSize(arg_0));
prevent_dce.inner = res;
}
struct VertexOutput {
vec4 pos;
uvec3 prevent_dce;
};

void fragment_main() {
textureDimensions_00229f();
prevent_dce.inner = textureDimensions_00229f();
}

void main() {
fragment_main();
return;
}
error: Error parsing GLSL shader:
ERROR: 0:5: 'image load-store format' : not supported with this profile: es
ERROR: 0:5: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.


#version 460

#version 310 es

layout(r8) uniform highp readonly image3D arg_0;
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uvec3 inner;
uint pad;
} prevent_dce;

void textureDimensions_00229f() {
layout(binding = 0, r8) uniform highp readonly image3D arg_0;
uvec3 textureDimensions_00229f() {
uvec3 res = uvec3(imageSize(arg_0));
prevent_dce.inner = res;
return res;
}

struct VertexOutput {
vec4 pos;
uvec3 prevent_dce;
};

void compute_main() {
textureDimensions_00229f();
prevent_dce.inner = textureDimensions_00229f();
}

layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}
error: Error parsing GLSL shader:
ERROR: 0:3: 'image load-store format' : not supported with this profile: es
ERROR: 0:3: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.
#version 460

layout(location = 0) flat out uvec3 prevent_dce_1;
layout(binding = 0, r8) uniform highp readonly image3D arg_0;
uvec3 textureDimensions_00229f() {
uvec3 res = uvec3(imageSize(arg_0));
return res;
}

struct VertexOutput {
vec4 pos;
uvec3 prevent_dce;
};

VertexOutput vertex_main() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f), uvec3(0u, 0u, 0u));
tint_symbol.pos = vec4(0.0f);
tint_symbol.prevent_dce = textureDimensions_00229f();
return tint_symbol;
}

void main() {
gl_PointSize = 1.0;
VertexOutput inner_result = vertex_main();
gl_Position = inner_result.pos;
prevent_dce_1 = inner_result.prevent_dce;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,59 @@
SKIP: FAILED
#version 460
precision highp float;
precision highp int;

<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1423 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureDimensions
********************************************************************
* The tint shader compiler has encountered an unexpected error. *
* *
* Please help us fix this issue by submitting a bug report at *
* crbug.com/tint with the source program that triggered the bug. *
********************************************************************
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
uvec3 tint_symbol;
} v;
layout(binding = 0, r8) uniform highp readonly image3D arg_0;
uvec3 textureDimensions_00229f() {
uvec3 res = uvec3(imageSize(arg_0));
return res;
}
void main() {
v.tint_symbol = textureDimensions_00229f();
}
#version 460

tint executable returned error: signal: trace/BPT trap
layout(binding = 0, std430)
buffer tint_symbol_1_1_ssbo {
uvec3 tint_symbol;
} v;
layout(binding = 0, r8) uniform highp readonly image3D arg_0;
uvec3 textureDimensions_00229f() {
uvec3 res = uvec3(imageSize(arg_0));
return res;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
v.tint_symbol = textureDimensions_00229f();
}
#version 460


struct VertexOutput {
vec4 pos;
uvec3 prevent_dce;
};

layout(binding = 0, r8) uniform highp readonly image3D arg_0;
layout(location = 0) flat out uvec3 vertex_main_loc0_Output;
uvec3 textureDimensions_00229f() {
uvec3 res = uvec3(imageSize(arg_0));
return res;
}
VertexOutput vertex_main_inner() {
VertexOutput tint_symbol = VertexOutput(vec4(0.0f), uvec3(0u));
tint_symbol.pos = vec4(0.0f);
tint_symbol.prevent_dce = textureDimensions_00229f();
return tint_symbol;
}
void main() {
VertexOutput v = vertex_main_inner();
gl_Position = v.pos;
gl_Position[1u] = -(gl_Position.y);
gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
vertex_main_loc0_Output = v.prevent_dce;
gl_PointSize = 1.0f;
}
2 changes: 2 additions & 0 deletions test/tint/builtins/gen/literal/textureDimensions/01e21e.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
////////////////////////////////////////////////////////////////////////////////


// flags: --glsl-desktop

@group(0) @binding(0) var<storage, read_write> prevent_dce : u32;

@group(1) @binding(0) var arg_0: texture_storage_1d<rg32uint, read_write>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,91 +1,41 @@
SKIP: FAILED
#version 460

#version 310 es

layout(rg32ui) uniform highp writeonly uimage2D arg_0;
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uint inner;
} prevent_dce;

void textureDimensions_01e21e() {
layout(binding = 0, rg32ui) uniform highp writeonly uimage2D arg_0;
uint textureDimensions_01e21e() {
uint res = uvec2(imageSize(arg_0)).x;
prevent_dce.inner = res;
}

vec4 vertex_main() {
textureDimensions_01e21e();
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;
}
error: Error parsing GLSL shader:
ERROR: 0:3: 'image load-store format' : not supported with this profile: es
ERROR: 0:3: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.



#version 310 es
precision highp float;
precision highp int;

layout(rg32ui) uniform highp writeonly uimage2D arg_0;
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uint inner;
} prevent_dce;

void textureDimensions_01e21e() {
uint res = uvec2(imageSize(arg_0)).x;
prevent_dce.inner = res;
return res;
}

void fragment_main() {
textureDimensions_01e21e();
prevent_dce.inner = textureDimensions_01e21e();
}

void main() {
fragment_main();
return;
}
error: Error parsing GLSL shader:
ERROR: 0:5: 'image load-store format' : not supported with this profile: es
ERROR: 0:5: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.

#version 460


#version 310 es

layout(rg32ui) uniform highp writeonly uimage2D arg_0;
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uint inner;
} prevent_dce;

void textureDimensions_01e21e() {
layout(binding = 0, rg32ui) uniform highp writeonly uimage2D arg_0;
uint textureDimensions_01e21e() {
uint res = uvec2(imageSize(arg_0)).x;
prevent_dce.inner = res;
return res;
}

void compute_main() {
textureDimensions_01e21e();
prevent_dce.inner = textureDimensions_01e21e();
}

layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}
error: Error parsing GLSL shader:
ERROR: 0:3: 'image load-store format' : not supported with this profile: es
ERROR: 0:3: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.



2 changes: 2 additions & 0 deletions test/tint/builtins/gen/literal/textureDimensions/029589.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
////////////////////////////////////////////////////////////////////////////////


// flags: --glsl-desktop

@group(0) @binding(0) var<storage, read_write> prevent_dce : vec2<u32>;

@group(1) @binding(0) var arg_0: texture_storage_2d_array<rg32float, read_write>;
Expand Down
Loading

0 comments on commit e28f132

Please sign in to comment.