-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[glsl] Inject default
gl_PointSize = 1.0
in vertex shaders if `FORC…
…E_POINT_SIZE` option was set (#2223) According to https://registry.khronos.org/OpenGL/specs/es/3.2/GLSL_ES_Specification_3.20.html#built-in-language-variables > The variable gl_PointSize is intended for a shader to write the size of the point to be rasterized. It is measured in pixels. If gl_PointSize is not written to, its value is undefined in subsequent pipe stages. - Write warn message if `ClipDistance` and `CullDistance` are used on unsupported version --------- Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
- Loading branch information
Showing
6 changed files
with
94 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
( | ||
glsl: ( | ||
version: Embedded ( | ||
version: 300, | ||
is_webgl: true | ||
), | ||
writer_flags: (bits: 16), | ||
binding_map: {}, | ||
zero_initialize_workgroup_memory: true, | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// AUTHOR: REASY | ||
// ISSUE: https://github.com/gfx-rs/wgpu/issues/3179 | ||
// FIX: https://github.com/gfx-rs/wgpu/pull/3440 | ||
@vertex | ||
fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4<f32> { | ||
let x = f32(i32(in_vertex_index) - 1); | ||
let y = f32(i32(in_vertex_index & 1u) * 2 - 1); | ||
return vec4<f32>(x, y, 0.0, 1.0); | ||
} | ||
|
||
@fragment | ||
fn fs_main() -> @location(0) vec4<f32> { | ||
return vec4<f32>(1.0, 0.0, 0.0, 1.0); | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/out/glsl/force_point_size_vertex_shader_webgl.fs_main.Fragment.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#version 300 es | ||
|
||
precision highp float; | ||
precision highp int; | ||
|
||
layout(location = 0) out vec4 _fs2p_location0; | ||
|
||
void main() { | ||
_fs2p_location0 = vec4(1.0, 0.0, 0.0, 1.0); | ||
return; | ||
} | ||
|
15 changes: 15 additions & 0 deletions
15
tests/out/glsl/force_point_size_vertex_shader_webgl.vs_main.Vertex.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#version 300 es | ||
|
||
precision highp float; | ||
precision highp int; | ||
|
||
|
||
void main() { | ||
uint in_vertex_index = uint(gl_VertexID); | ||
float x = float((int(in_vertex_index) - 1)); | ||
float y = float(((int((in_vertex_index & 1u)) * 2) - 1)); | ||
gl_Position = vec4(x, y, 0.0, 1.0); | ||
gl_PointSize = 1.0; | ||
return; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters