mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 05:57:51 +00:00
HLSL: force FXC to never unroll loops
Emit the "[loop]" attribute on "for" and "while" so that FXC does not attempt to unroll them. This is to work around an FXC bug where it fails to unroll loops with gradient operations. FXC ostensibly unrolls such loops because gradient operations require uniform control flow, and loops that have varying iterations may possibly not be uniform. Tint will eventually validate that control flow is indeed uniform, so forcing FXC to avoid unrolling in these cases should be fine. Bug: tint:1112 Change-Id: I10077f8b62fbbb230a0003f3864c75a8fe0e1d18 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/69880 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
1704fe53f5
commit
11d09f2fe7
@@ -8,7 +8,7 @@ void some_loop_body() {
|
||||
|
||||
void f() {
|
||||
{
|
||||
for(int i = 0; (i < 5); i = (i + 1)) {
|
||||
[loop] for(int i = 0; (i < 5); i = (i + 1)) {
|
||||
some_loop_body();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ void f() {
|
||||
int j = 0;
|
||||
{
|
||||
int i = 0;
|
||||
while (true) {
|
||||
[loop] while (true) {
|
||||
bool tint_tmp = (i < 5);
|
||||
if (tint_tmp) {
|
||||
tint_tmp = (j < 10);
|
||||
|
||||
@@ -6,7 +6,7 @@ void unused_entry_point() {
|
||||
void f() {
|
||||
int i = 0;
|
||||
{
|
||||
for(; (i < 4); ) {
|
||||
[loop] for(; (i < 4); ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ void unused_entry_point() {
|
||||
void f() {
|
||||
int i = 0;
|
||||
{
|
||||
for(; ; i = (i + 1)) {
|
||||
[loop] for(; ; i = (i + 1)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ void unused_entry_point() {
|
||||
|
||||
void f() {
|
||||
{
|
||||
for(; ; ) {
|
||||
[loop] for(; ; ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ void unused_entry_point() {
|
||||
|
||||
void f() {
|
||||
{
|
||||
for(int i = 0; ; ) {
|
||||
[loop] for(int i = 0; ; ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ void unused_entry_point() {
|
||||
|
||||
void f() {
|
||||
{
|
||||
for(int must_not_collide = 0; ; ) {
|
||||
[loop] for(int must_not_collide = 0; ; ) {
|
||||
}
|
||||
}
|
||||
int must_not_collide = 0;
|
||||
|
||||
Reference in New Issue
Block a user