Commit graph

82 commits

Author SHA1 Message Date
Rémi Verschelde
022ae53191
Merge pull request #23126 from QbieShay/nine_uv
UV for ninepatch now maps to the proper  ninepatch mapped UV.
2018-12-11 16:05:20 +01:00
Bastiaan Olij
0b4b477674 Remapped ACTIVE to shader_active, now works 2018-12-01 21:10:04 +11:00
QbieShay
09faac9e01 Added PROCESSED_UV for accessing ninepatch processed uv in the shader 2018-11-22 19:06:43 +01:00
Juan Linietsky
631cf676c3 Removed noperspective (not in GLSL ES 3.0), do not write smooth if not specified. Fixes #20435 2018-11-21 23:07:09 -03:00
Juan Linietsky
78eae047c6 Fixed how floats are printed to the GLSL shader, closes #19803 2018-11-19 23:41:18 -03:00
Juan Linietsky
984063cf0b Cleaned up and fixed the base_changed function in rasterizers, also fixes #15617 2018-11-14 09:32:39 -03:00
Juan Linietsky
f00b522705 Avoid double underscore from breaking glsl compiler, fixes #12880 2018-11-10 10:48:18 -03:00
QbieShay
ac04e14a51 Added the ability to write to gl_FragDepth. It doesn't affect the depth prepass. 2018-10-06 19:34:50 +02:00
Rémi Verschelde
7b081a7fc8 Fix warnings about unhandled enum value in switch [-Wswitch]
Fixes GCC 5 warnings of the form:

core/io/http_client.cpp:288:9: warning: enumeration value 'STATUS_SSL_HANDSHAKE_ERROR' not handled in switch [-Wswitch]
core/io/marshalls.cpp:806:9: warning: enumeration value 'AABB' not handled in switch [-Wswitch]

Those can be trivial cases where adding a default fallback is the solution,
or more complex issues/hidden bugs where missed values are actually meant
to be handled.
2018-09-27 18:34:30 +02:00
Juan Linietsky
65fd37c149 -Rewrote GLES2 lighting and shadows and optimized state changes, did many optimizations, added vertex lighting.
-Did some fixes to GLES3 too
2018-09-23 12:14:50 -03:00
Rémi Verschelde
277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Rémi Verschelde
52466d57e9 Make some debug prints verbose-only, remove others 2018-08-24 14:59:01 +02:00
Juan Linietsky
b67f982723
Merge pull request #20681 from DavidSichma/master
Keeping track of discard
2018-08-08 09:54:59 -03:00
David Sichma
c101dd5fa6 Keeping track of discard
Shader compilation now keeps track of the discard key word.

Previously only variables were monitored. But discard, which needs
special treatment in some cases, went unnoticed by the compiler as
discard is not a variable but a flow control.

This commit adds monitoring for discard.
2018-08-02 21:55:02 +02:00
Thomas Herzog
b4d3f541e7 add 3D textures 2018-07-30 12:20:27 +02:00
Hein-Pieter van Braam
0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
This commit makes operator[] on Vector const and adds a write proxy to it.  From
now on writes to Vectors need to happen through the .write proxy. So for
instance:

Vector<int> vec;
vec.push_back(10);
std::cout << vec[0] << std::endl;
vec.write[0] = 20;

Failing to use the .write proxy will cause a compilation error.

In addition COWable datatypes can now embed a CowData pointer to their data.
This means that String, CharString, and VMap no longer use or derive from
Vector.

_ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug
builds. This is a lot faster for Vector in the editor and while running tests.
The reason why this difference used to exist is because force-inlined methods
used to give a bad debugging experience. After extensive testing with modern
compilers this is no longer the case.
2018-07-26 00:54:16 +02:00
Rémi Verschelde
00dfc9c8eb Shader lang: Properly assign INSTANCE_ID to gl_InstanceID
Note that gl_InstanceID is not supported in OpenGL ES 2.0,
so in the gles2 backend we assign it to 0.

Also clean up some duplicates/commented out code.
Fixes #20088.
2018-07-22 14:26:46 +02:00
Alex Roman
2ce1118faa Add disable ambient light flag to shaders and materials 2018-07-17 21:30:43 +02:00
JFonS
c8cf71753c Add render mode to ensure correct normals when using non-uniform scaling 2018-06-21 00:12:12 +02:00
Juan Linietsky
3051bb8a81
Merge pull request #17845 from JFonS/disable_spatial_shadows
Added flag on SpatialMaterial to disable shadows
2018-05-07 16:18:25 -03:00
Pieter-Jan Briers
25ba49fd88 Fixes canvas light shaders.
Fixes #16904

Restore more out functionality, fix built-ins.

Requested changes, I think?
2018-04-13 15:18:28 +02:00
JFonS
9c307d4b6c Added flag on SpatialMaterial to disable shadows 2018-03-29 18:46:42 +02:00
karroffel
bb655856e2 using TIME in light shader enables uses_fragment_time
The GLES3 shader compiler performs certain checks to enable or disable
the usage of certain uniform variables (and with that the set-up of UBOs).

If the `TIME` variable gets used inside the `vertex` function then the
renderer knows that it has to insert that value into the UBO.
The same applies to the `fragment` function.

The `light` function gets executed inside the fragment shader for every
light source that is relevant to the current pixel. If the `TIME` variable
gets used in that function then it needs to be present in the fragment-UBO.
The check for this was missing, so if a shader uses `TIME` inside `light`
but not inside `fragment` then the uniform will not actually be set up.
2018-02-07 11:56:52 +01:00
binbitten
de8f43d95d Fix mat2 alignment 2018-01-12 22:26:50 +01:00
Juan Linietsky
0041efec1d Fix mat2 alignment 2018-01-12 12:45:16 -03:00
Juan Linietsky
f4d603b902 Fix uniform alignment, closes #14962 2018-01-12 12:43:26 -03:00
AlmightyScientist
4820910648 Shader Language: Fixes EXTRA_MATRIX undefined.
Fixes #15453.
2018-01-10 12:37:28 +01:00
Juan Linietsky
a195f81a6a Improve detection of variable writing in shader, fixes #15177 2018-01-06 09:56:47 -03:00
Rémi Verschelde
e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde
b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Juan Linietsky
2b31155baa Fix sidedness check in material. Also remove SIDE built-in. 2017-12-26 11:09:52 -03:00
Arnaud PEZEL
6f114c50a7 Fixes built-In "LIGHT" causing fragment compilation error
Add a rename for shader LIGHT built-in, Fix bug #14537
2017-12-14 14:58:13 +01:00
Rémi Verschelde
028f959fb1 PropertyEditor: Filter out resource_local_to_scene
This lets the empty "Global" category disappear again.
Also silence a debug print.
2017-12-10 00:18:10 +01:00
Scayze
b0fb6b1380 Added interpolation modifiers to shaderlang 2017-11-27 16:47:46 +01:00
George Marques
78441b486a
Enable light shaders when light variables are used 2017-11-14 13:08:03 -02:00
Juan Linietsky
4785e66eea
Merge pull request #12288 from tagcup/expose_viewport_size
Expose VIEWPORT_SIZE in shader language.
2017-10-30 19:32:21 -03:00
Scayze
2c00b68175 Fix shader compiler typo gl_FrotFace 2017-10-27 15:31:24 +02:00
Ferenc Arn
a0fc641f25 Expose VIEWPORT_SIZE in shader language.
Fixes #11710.
2017-10-26 15:00:28 -04:00
Rémi Verschelde
abea816e54 Revert "Rename Schlick GGX to GGX." 2017-10-23 07:42:36 +02:00
Ferenc Arn
cb0bf1edea Rename Schlick GGX to GGX.
Schlick's approximation and GGX are orthogonal concepts.

Furthermore, it's usage so far has been inconsistent: we don't even use it with anisotropic SchlickGGX, and Burley (Disney) diffuse does use it while its name doesn't indicate it.

The use of Schlick's approximation in Burley and GGX is an implementation detail and doesn't need to be reflected to the namig.
2017-10-21 19:35:54 -04:00
Hiroshi Ogawa
59544c74fe Fix render mode specular schlick ggx 2017-10-14 19:32:13 +09:00
Juan Linietsky
d4e20555e8 Ability to set a custom FOV makes it possible to use sky on orthogonal view. Closes #9186 2017-09-29 18:56:52 -03:00
Juan Linietsky
4f39ce32b9 Fixes to light shaders, should work now.. 2017-09-27 21:45:47 -03:00
Juan Linietsky
81c9cfdc1b Added light affect parameter to baked AO 2017-09-23 23:10:34 -03:00
Juan Linietsky
bf371dcb32 Added proximity and distance fade to SpatialMaterial 2017-09-21 15:20:28 -03:00
Rémi Verschelde
e73e00d369 Style: Apply clang-format to @reduz's changes
[ci skip]
2017-09-13 09:13:34 +02:00
Juan Linietsky
7eb8760477 Added support for for, break and continue. Closes #10560, closes #10661 2017-09-05 15:25:34 -03:00
Juan Linietsky
281fb4e4fb Added transmission shader parameter. 2017-09-03 10:30:37 -03:00
Juan Linietsky
089cf8176e removed DISCARD built in variable, replaced by actual discard GLSL instruction, fixes #9677 2017-08-29 10:15:49 -03:00
Rémi Verschelde
7ad14e7a3e Dead code tells no tales 2017-08-27 22:13:45 +02:00