Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shader compilation errors when using MSDF fonts with Label3D nodes #100678

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Changes from all commits
Commits
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
8 changes: 3 additions & 5 deletions scene/resources/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,12 +932,10 @@ uniform float msdf_outline_size : hint_range(0.0, 250.0, 1.0);
// If alpha antialiasing isn't off, add in the edge variable.
if (alpha_antialiasing_mode != ALPHA_ANTIALIASING_OFF &&
(transparency == TRANSPARENCY_ALPHA_SCISSOR || transparency == TRANSPARENCY_ALPHA_HASH)) {
code += R"(
uniform float alpha_antialiasing_edge : hint_range(0.0, 1.0, 0.01);
uniform ivec2 albedo_texture_size;
)";
code += "uniform float alpha_antialiasing_edge : hint_range(0.0, 1.0, 0.01);\n";
}

code += "uniform ivec2 albedo_texture_size;\n";
code += "uniform float point_size : hint_range(0.1, 128.0, 0.1);\n";

if (!orm) {
Expand Down Expand Up @@ -1515,7 +1513,7 @@ void fragment() {)";
vec3(1.0 + 0.055) * pow(albedo_tex.rgb, vec3(1.0 / 2.4)) - vec3(0.055),
vec3(12.92) * albedo_tex.rgb,
lessThan(albedo_tex.rgb, vec3(0.0031308)));
vec2 msdf_size = vec2(msdf_pixel_range) / vec2(albedo_texture_size));
vec2 msdf_size = vec2(msdf_pixel_range) / vec2(albedo_texture_size);
)";
if (flags[FLAG_USE_POINT_SIZE]) {
code += " vec2 dest_size = vec2(1.0) / fwidth(POINT_COORD);\n";
Expand Down