bevyengine / bevyengine/bevy

Using gl_PointCoord in GLSL frag shader causes UnsupportedBuiltIn error

Open
#3,890 0 comments 1 reaction 0 assignees View on GitHub
A-Rendering C-Bug
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version
0.6.0

## Operating system & version
Pop!_OS 20.10

## What you did
I have a GLSL fragment shader that uses [`gl_PointCoord`](https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/gl_PointCoord.xhtml#:~:text=gl_PointCoord%20is%20a%20fragment%20language,read%20from%20gl_PointCoord%20are%20undefined.). It compiles successfully, but when running the application I get an error when calling `App::new()`:
```
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: UnsupportedBuiltIn(16)',
/home/ben/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.12.0/src/backend/direct.rs:1022:45
```
Here's the fragment shader:
```GLSL
#version 450

layout(set = 0, binding = 0) uniform CameraViewProj {
mat4 ViewProj;
mat4 InverseView;
mat4 Projection;
vec3 WorldPosition;
float near;
float far;
float width;
float height;
};

layout (location = 0) in vec2 v_pos;
layout (location = 1) in vec3 v_color;
layout (location = 2) in float v_size;

layout (location = 0) out vec4 f_color;

void main() {
f_color = vec4(v_color, dot(gl_PointCoord.xy, vec2(0.5)));
}
```

## What you expected to happen
Since Bevy supports the point drawing mode, as well as `gl_PointSize`, I would expect it to also support `gl_PointCoord`.

## What actually happened
Error. Here is the full backtrace: [backtrace.txt](https://github.com/bevyengine/bevy/files/8020325/backtrace.txt)

EDIT: I guess this is probably a wgpu issue?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.