Fix screenspace_texture example shader compiler error in WebGPU (Browser) (#8682)

# Objective

Fix the screenspace_texture example not working on the WebGPU examples
page. Currently it fails with the following error in the browser
console:

```
1 error(s) generated while compiling the shader:
:213:9 error: redeclaration of 'uv'
    let uv = coords_to_viewport_uv(position.xy, view.viewport);
        ^^

:211:14 note: 'uv' previously declared here
@location(2) uv: vec2<f32>,
```

## Solution

Rename the shader variable `uv` to `viewport_uv` to prevent variable
redeclaration error.
This commit is contained in:
Martin Lysell 2023-05-25 23:54:29 +02:00 committed by GitHub
parent bc9144bcd6
commit 594074149d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,7 +11,7 @@ fn fragment(
@builtin(position) position: vec4<f32>,
#import bevy_pbr::mesh_vertex_output
) -> @location(0) vec4<f32> {
let uv = coords_to_viewport_uv(position.xy, view.viewport);
let color = textureSample(texture, texture_sampler, uv);
let viewport_uv = coords_to_viewport_uv(position.xy, view.viewport);
let color = textureSample(texture, texture_sampler, viewport_uv);
return color;
}