Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5fba24d
starter wgpu init
nice0hack Jun 27, 2026
20fa4d5
full implementation of fyrox-graphics-wgpu module
nice0hack Jul 1, 2026
1df6706
add GLSL transpiler to extend naga library compatibility
nice0hack Jul 1, 2026
d77b871
compilation of all shaders has been fixed
nice0hack Jul 2, 2026
124395c
fixed a bug when creating a graphics pipeline
nice0hack Jul 2, 2026
b32984f
fix texture aspect detection
nice0hack Jul 2, 2026
31c7cea
convert all shaders to wgpu
nice0hack Jul 4, 2026
d9f26d9
fix gui rendering
nice0hack Jul 7, 2026
b171f02
fix editor crushes
nice0hack Jul 7, 2026
d41b385
fix double lightening and highlighting selected objects
nice0hack Jul 7, 2026
1e78ee6
automatic selection of the preferred backend
nice0hack Jul 9, 2026
ade4d63
added docs
nice0hack Jul 9, 2026
004789b
added format helpers
nice0hack Jul 10, 2026
433b3b5
fixed the display of materials and rendering has been slightly optimized
nice0hack Jul 14, 2026
cad71e9
fixed window resizing
nice0hack Jul 20, 2026
a87c8f5
GL editor shaders restored
nice0hack Jul 21, 2026
9888a53
GL fyrox-impl shaders restored
nice0hack Jul 21, 2026
58b5cd9
GL fyrox-material shaders restored
nice0hack Jul 21, 2026
58c3293
GL gltf shader restored and two backends support implemented
nice0hack Jul 21, 2026
e7b4bc8
terrain crash fixed
nice0hack Jul 22, 2026
ffd2401
labels removed and layout caching implemented.
nice0hack Jul 24, 2026
b7a2e71
optimize build vertex layouts
nice0hack Jul 24, 2026
53baa55
all rendering is collected into one request and thus highly optimized
nice0hack Jul 24, 2026
dd3578d
texture storage optimization
nice0hack Jul 24, 2026
e535c30
fix point light shader
nice0hack Jul 24, 2026
b45ee41
Merge branch 'FyroxEngine:master' into master
nice0hack Jul 26, 2026
c1ee1c7
optimize dependencies
nice0hack Jul 26, 2026
f264ff9
update wgpu version from 29.0.3 to 30.0.0
nice0hack Jul 26, 2026
ee61911
implemented generate_mipmap() and copy_attachment_texture()
nice0hack Jul 26, 2026
3b68e95
implemented set_polygon_fill_mode()
nice0hack Jul 26, 2026
d171620
add scissor box handling
nice0hack Jul 26, 2026
e903dc1
minor bug fixes, micro-optimization, and documentation
nice0hack Jul 26, 2026
c962986
Merge branch 'FyroxEngine:master' into master
nice0hack Jul 26, 2026
59b65b4
fyrox project manager support wgpu
nice0hack Jul 31, 2026
90040ca
fix uniform buffer size > 16320
nice0hack Jul 31, 2026
27ae1eb
tmp fix displaying models in deferred rendering
nice0hack Jul 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ members = [
"fyrox-texture",
"fyrox-autotile",
"fyrox-material",
"fyrox-graphics-gl"]
"fyrox-graphics-gl",
"fyrox-graphics-wgpu"]
resolver = "2"

[profile.editor-standalone]
Expand Down
7 changes: 6 additions & 1 deletion editor-standalone/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@ include = ["/src/**/*", "/Cargo.toml", "/LICENSE", "/README.md"]

[dependencies]
fyrox = { version = "2.0.0-rc.1", path = "../fyrox" }
fyroxed_base = { version = "2.0.0-rc.1", path = "../editor" }
fyroxed_base = { version = "2.0.0-rc.1", path = "../editor", default-features = false }
clap = { version = "4", features = ["derive"] }

[features]
default = ["backend_opengl"]
backend_opengl = ["fyroxed_base/backend_opengl"]
backend_wgpu = ["fyroxed_base/backend_wgpu"]
4 changes: 3 additions & 1 deletion editor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ notify = "8"
bitflags = "2.9.1"

[features]
default = ["fyrox/default"]
default = ["fyrox/default", "backend_opengl"]
dylib_engine = ["fyrox/dylib"]
backend_opengl = ["fyrox/backend_opengl"]
backend_wgpu = ["fyrox/backend_wgpu"]
98 changes: 98 additions & 0 deletions editor/resources/shaders/wgpu/gizmo.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
(
name: "GizmoShader",

resources: [
(
name: "properties",
kind: PropertyGroup([
(
name: "diffuseColor",
kind: Color(r: 255, g: 255, b: 255, a: 255),
),
]),
binding: 0
),
(
name: "fyrox_instanceData",
kind: PropertyGroup([
// Autogenerated
]),
binding: 1
),
],

disabled_passes: ["GBuffer", "DirectionalShadow", "PointShadow", "SpotShadow"],

passes: [
(
name: "Forward",
draw_parameters: DrawParameters(
cull_face: None,
color_write: ColorMask(
red: true,
green: true,
blue: true,
alpha: true,
),
depth_write: true,
stencil_test: None,
depth_test: Some(Less),
blend: Some(BlendParameters(
func: BlendFunc(
sfactor: SrcAlpha,
dfactor: OneMinusSrcAlpha,
alpha_sfactor: SrcAlpha,
alpha_dfactor: OneMinusSrcAlpha,
),
equation: BlendEquation(
rgb: Add,
alpha: Add
)
)),
stencil_op: StencilOp(
fail: Keep,
zfail: Keep,
zpass: Keep,
write_mask: 0xFFFF_FFFF,
),
scissor_box: None
),
vertex_shader:
r#"
struct VertexInput {
@location(0) vertexPosition: vec3f,
};

struct VertexOutput {
@builtin(position) position: vec4f,
};

@vertex
fn vs_main(input: VertexInput) -> VertexOutput {
var output: VertexOutput;
output.position = fyrox_instanceData.worldViewProjection * vec4f(input.vertexPosition, 1.0);
return output;
}
"#,

fragment_shader:
r#"
struct FragOutput {
@location(0) color: vec4f,
@builtin(frag_depth) depth: f32,
};

@fragment
fn fs_main(@builtin(position) fragCoord: vec4f) -> FragOutput {
var output: FragOutput;
output.color = properties.diffuseColor;

// Pull depth towards near clipping plane so the gizmo will be drawn on top
// of everything, but its parts will be correctly handled by depth test.
output.depth = fragCoord.z * 0.001;
return output;
}
"#,
),
],
)
215 changes: 215 additions & 0 deletions editor/resources/shaders/wgpu/grid.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
(
name: "GridShader",

resources: [
(
name: "properties",
kind: PropertyGroup([
(
name: "diffuseColor",
kind: Color(r: 40, g: 40, b: 40, a: 255),
),
(
name: "xAxisColor",
kind: Color(r: 255, g: 0, b: 0, a: 255),
),
(
name: "yAxisColor",
kind: Color(r: 0, g: 255, b: 0, a: 255),
),
(
name: "zAxisColor",
kind: Color(r: 0, g: 0, b: 255, a: 255),
),
(
name: "orientation",
kind: Int(value: 0),
),
(
name: "isPerspective",
kind: Bool(value: false)
),
(
name: "scale",
kind: Vector2(value: (1.0, 1.0))
)
]),
binding: 0
),
(
name: "fyrox_cameraData",
kind: PropertyGroup([
// Autogenerated
]),
binding: 1
),
],

disabled_passes: ["GBuffer", "DirectionalShadow", "PointShadow", "SpotShadow"],

passes: [
(
name: "Forward",
draw_parameters: DrawParameters(
cull_face: None,
color_write: ColorMask(
red: true,
green: true,
blue: true,
alpha: true,
),
depth_write: true,
stencil_test: None,
depth_test: Some(Less),
blend: Some(BlendParameters(
func: BlendFunc(
sfactor: SrcAlpha,
dfactor: OneMinusSrcAlpha,
alpha_sfactor: SrcAlpha,
alpha_dfactor: OneMinusSrcAlpha,
),
equation: BlendEquation(
rgb: Add,
alpha: Add
)
)),
stencil_op: StencilOp(
fail: Keep,
zfail: Keep,
zpass: Keep,
write_mask: 0xFFFF_FFFF,
),
scissor_box: None
),
vertex_shader:
r#"
struct VertexInput {
@location(0) vertexPosition: vec3f,
};

struct VertexOutput {
@builtin(position) position: vec4f,
@location(0) nearPoint: vec3f,
@location(1) farPoint: vec3f,
};

fn Unproject(x: f32, y: f32, z: f32, matrix: mat4x4f) -> vec3f {
var position = matrix * vec4f(x, y, z, 1.0);
return position.xyz / position.w;
}

@vertex
fn vs_main(input: VertexInput) -> VertexOutput {
var output: VertexOutput;
var invViewProj = inverse_mat4(fyrox_cameraData.viewProjectionMatrix);
output.nearPoint = Unproject(input.vertexPosition.x, input.vertexPosition.y, 0.0, invViewProj);
output.farPoint = Unproject(input.vertexPosition.x, input.vertexPosition.y, 1.0, invViewProj);
output.position = vec4f(input.vertexPosition, 1.0);
return output;
}
"#,

fragment_shader:
r#"
// Original code: https://asliceofrendering.com/scene%20helper/2020/01/05/InfiniteGrid/
// Fixed and adapted for Fyrox.

struct FragOutput {
@location(0) color: vec4f,
@builtin(frag_depth) depth: f32,
};

fn grid(fragPos3D: vec3f) -> vec4f {
var projection: vec2f;
var planeNormal: vec3f;
var xColor: vec4f;
var yColor: vec4f;
if (properties.orientation == 0) {
projection = fragPos3D.xz;
planeNormal = vec3f(0.0, 1.0, 0.0);
xColor = properties.xAxisColor;
yColor = properties.zAxisColor;
} else if (properties.orientation == 1) {
projection = fragPos3D.xy;
planeNormal = vec3f(0.0, 0.0, 1.0);
xColor = properties.yAxisColor;
yColor = properties.xAxisColor;
} else if (properties.orientation == 2) {
projection = fragPos3D.zy;
planeNormal = vec3f(1.0, 0.0, 0.0);
xColor = properties.zAxisColor;
yColor = properties.yAxisColor;
}

var coord = projection * properties.scale;
var derivative = fwidth(coord);
var gridVal = abs(fract(coord - vec2f(0.5)) - vec2f(0.5)) / derivative;
var lineVal = min(gridVal.x, gridVal.y);
var minX = 0.5 * min(derivative.x, 1.0);
var minY = 0.5 * min(derivative.y, 1.0);

var color = properties.diffuseColor;
var alpha = 1.0 - min(lineVal, 1.0);
// Sharpen lines a bit.
color.a = select(0.0, 1.0, alpha >= 0.5);

if (projection.x > -minX && projection.x < minX) {
color = vec4f(xColor.xyz, color.a);
} else if (projection.y > -minY && projection.y < minY) {
color = vec4f(yColor.xyz, color.a);
} else {
var viewDir = fragPos3D - fyrox_cameraData.position;
// This helps to negate moire pattern at large distances.
var cosAngle = abs(dot(planeNormal, normalize(viewDir)));
color.a *= cosAngle;
}

return color;
}

fn computeDepth(pos: vec3f) -> f32 {
var clip_space_pos = fyrox_cameraData.viewProjectionMatrix * vec4f(pos.xyz, 1.0);
return (clip_space_pos.z / clip_space_pos.w);
}

@fragment
fn fs_main(@location(0) nearPoint: vec3f, @location(1) farPoint: vec3f, @builtin(position) fragCoord: vec4f) -> FragOutput {
var nearCoord: f32;
var farCoord: f32;
if (properties.orientation == 0) {
nearCoord = nearPoint.y;
farCoord = farPoint.y;
} else if (properties.orientation == 1) {
nearCoord = nearPoint.z;
farCoord = farPoint.z;
} else if (properties.orientation == 2) {
nearCoord = nearPoint.x;
farCoord = farPoint.x;
}

var denominator = farCoord - nearCoord;
var t = select(0.0, -nearCoord / denominator, denominator != 0.0);

var fragPos3D = nearPoint + t * (farPoint - nearPoint);

var depth = computeDepth(fragPos3D);

var output: FragOutput;
output.depth = depth;

output.color = grid(fragPos3D);
if (properties.isPerspective != 0u) {
output.color.a *= f32(t > 0.0);
}

// Alpha test to prevent blending issues.
if (output.color.a < 0.01) {
discard;
}

return output;
}
"#,
),
],
)
Loading
Loading