Commit graph

604 commits

Author SHA1 Message Date
Hein-Pieter van Braam d308eb091a Fix many asan and ubsan reported issues
This allows most demos to run without any ubsan or asan errors. There
are still some things in thirdpart/ and some things in AudioServer that
needs a look but this fixes a lot of issues. This should help debug less
obvious issues, hopefully.

This fixes #25217 and fixes #25218
2019-01-30 06:43:56 +01:00
Rémi Verschelde d0f289b0d9
Merge pull request #25314 from marxin/fix-24417-class-memaccess
Fix class memaccess
2019-01-27 21:32:26 +01:00
Juan Linietsky 0c60d4c682 Properly get proxy texture size for canvas light, fixes #17067 2019-01-27 16:57:05 -03:00
Juan Linietsky 1253b9c038 Add a check to help find transforms that are passes invalid. 2019-01-26 19:10:11 -03:00
marxin 3e4dab5386 Use placement new in visual_server_scene.cpp (#24417). 2019-01-25 12:41:55 +01:00
Juan Linietsky 46af4b0a4b Changes to GLES2 renderer to not use cube shadows if not available, fixes #25132 2019-01-22 10:05:23 -03:00
Rémi Verschelde 769341e180 Cleanup after @reduz :)
Fixes #25172.
2019-01-21 11:12:55 +01:00
Juan Linietsky 7478f468b2 Fixes to 2D lights, closes #24750 2019-01-17 10:40:36 -03:00
Bojidar Marinov d1406bfeb4
Fix a nested ysort invalid memory read again
Fixes #24755
2019-01-09 14:22:54 +02:00
Rémi Verschelde 1504c96112
Merge pull request #24539 from BastiaanOlij/override_gl_position
Override GL_position
2019-01-04 15:40:05 +01:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Bastiaan Olij c1a53d8b06 Always treat exponent as float 2018-12-30 13:10:58 +01:00
Bastiaan Olij 9f266cf7e5 Override GL_position 2018-12-29 23:56:50 +11:00
DiogoASTeixeira 13e8b5ed8f Added UV and UV2 to shader function light() built-in 2018-12-19 20:22:52 +00:00
Bastiaan Olij f3dd3c0830 Adding option to re-orient our sky 2018-12-15 19:41:34 +11:00
Rémi Verschelde ac87560fda
Merge pull request #23469 from clayjohn/fragment_camera_matrix
Added CAMERA_MATRIX to fragment shader
2018-12-12 13:46:58 +01:00
Rémi Verschelde 37e198c320
Merge pull request #23483 from clayjohn/fragment_camera_view
Make VIEW vector available in fragment shader
2018-12-11 20:44:41 +01:00
clayjohn 2042d6214e make VIEW vector available in fragment 2018-12-11 09:44:38 -08:00
Rémi Verschelde 0a9a2b1d62
Merge pull request #24163 from clayjohn/light_uv_const
Make LIGHT_UV constant in canvas_item light shader
2018-12-11 15:25:18 +01:00
Bojidar Marinov 02b569297e
Fix error when adding children to YSort
If it weren't for this warning, it would have crashed in release builds.
Fix #23889, fixup 6b8d6e3b07
2018-12-04 21:11:40 +02:00
clayjohn 4740dd343e make LIGHT_UV constant 2018-12-04 10:10:47 -08:00
Juan Linietsky af8d941c55 Added luminance capping to avoid glitches on small dots. closes #17996 2018-11-28 01:22:20 -03:00
Kanabenki 33a7fae127 Allow *= operator between vec and mat types in shaders 2018-11-24 18:57:29 +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
Rémi Verschelde 3df9aa3339
Merge pull request #23878 from bojidar-bg/23775-ysort-crash
Fix YSort crash when removing a child
2018-11-21 15:35:03 +01:00
Bojidar Marinov d2750ce593
Fix YSort crash when removing a child
Fixup of 8e4837f357
Fixes #23775
2018-11-21 15:01:11 +02:00
Juan Linietsky d304228003 Do not draw particles if they are not processing at all, fixes #19507 2018-11-19 20:34:29 -03:00
JFonS fb92c7b0fa Use hint_color when getting shader default params 2018-11-16 12:20:23 +01:00
Juan Linietsky d2e642b2dc Proper validation of out arguments in built-in shader functions, closes #16244 2018-11-14 18:56:19 -03:00
Juan Linietsky 55f5f4757e
Merge pull request #23248 from dlasalle/fog
Add parameters for fog end depth and use alpha as density.
2018-11-14 10:24:55 -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
Dominique LaSalle 6eae6247e4 Add parameter for fog max depth and use alpha as density. 2018-11-13 17:19:11 -08:00
Rémi Verschelde 8e4837f357
Merge pull request #23407 from bojidar-bg/3281-ysort-recursive
Y-Sort children together in nested YSorts
2018-11-12 20:42:55 +01:00
Juan Linietsky baa8678d2a Do not allow samplers where they dont belong (variables/return types), fixes #15133 2018-11-12 08:36:26 -03:00
Juan Linietsky 555fb3a317 Effectively ensure that surface materials are the right size when setting them, fixes #23596 2018-11-08 15:58:52 -03:00
JFonS 85ce4a67ed Remove animation loop from ParticlesMaterial + improvements to CPUParticles2D
Remove animation loop from ParticlesMaterial and move it to
SpatialMaterial for 3D particles and Particles2D for the 2D case.

Added animation to CPUParticles2D as well as the "Convert to
CPUParticles2D" to the PAarticles2D menu.
2018-11-04 15:58:12 +01:00
clayjohn 34d4faa227 added CAMERA_MATRIX to fragment shader 2018-11-02 23:14:42 -07:00
Pedro J. Estébanez cf8976de41 Fix canvas stacking not deterministic on same layer
Fixes #22687.
2018-10-30 21:53:00 +01:00
Bojidar Marinov 6b8d6e3b07
Y-Sort children together in nested YSorts
Closes #3281
2018-10-30 20:53:46 +02:00
Simon Wenner 9fcf9ee813 fixed uninitialized variables and false positives found by CppCheck 2018-10-25 20:38:17 +02:00
Dualtagh Murray b902a2f2a7 Fixing warnings generated by MSVC
Fixes #22684.
2018-10-19 11:45:24 +02:00
Rémi Verschelde 8b56ea3138
Merge pull request #22800 from QbieShay/depth_write
Added the ability to write to gl_FragDepth.
2018-10-11 17:31:50 +02:00
Aaron Franke 4f7b33cdcf Remove redundant "== false" code
Some of this code has been re-organized.
f
2018-10-06 16:20:41 -04: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 123931f7eb
Merge pull request #22574 from BastiaanOlij/mobile_vr_gles2
Moving lens distortion shader into drivers and adding GLES2 support
2018-10-02 15:08:59 +02:00
Rémi Verschelde c026e3957a Fix warnings on virtual methods [-Woverloaded-virtual] [-Wdelete-non-virtual-dtor]
Fixes the following Clang 7 warnings:
```
editor/editor_help.h:123:7: warning: 'EditorHelpIndex::popup' hides overloaded virtual function [-Woverloaded-virtual]
editor/editor_help.h:95:7: warning: 'EditorHelpSearch::popup' hides overloaded virtual function [-Woverloaded-virtual]
editor/editor_help.h:96:7: warning: 'EditorHelpSearch::popup' hides overloaded virtual function [-Woverloaded-virtual]
editor/plugins/curve_editor_plugin.h:141:15: warning: 'CurvePreviewGenerator::generate' hides overloaded virtual function [-Woverloaded-virtual]
editor/plugins/script_editor_plugin.h:70:7: warning: 'ScriptEditorQuickOpen::popup' hides overloaded virtual function [-Woverloaded-virtual]
editor/quick_open.h:69:7: warning: 'EditorQuickOpen::popup' hides overloaded virtual function [-Woverloaded-virtual]
main/tests/test_io.cpp:53:15: warning: 'TestIO::TestMainLoop::input_event' hides overloaded virtual function [-Woverloaded-virtual]
servers/audio/effects/audio_effect_record.h:69:15: warning: 'AudioEffectRecordInstance::process_silence' hides overloaded virtual function [-Woverloaded-virtual]

core/os/memory.h:119:2: warning: destructor called on non-final 'ContextGL_X11' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'EditorScriptCodeCompletionCache' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'Engine' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'PhysicalBone::JointData' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'VisualServerScene' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
core/os/memory.h:119:2: warning: destructor called on non-final 'VisualServerViewport' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
```
2018-10-02 13:40:17 +02:00
Bastiaan Olij a6df366b23 Moving lens distortion shader into drivers and adding GLES2 support 2018-10-02 17:14:43 +10:00
Rémi Verschelde b1b625f4f5 Fix various Clang 7 warnings about unused stuff
Namely:
[-Wunneeded-internal-declaration]
[-Wunused-comparison]
[-Wunused-const-variable]
[-Wunused-function]
[-Wunused-private-fields]

Fixes the following Clang 7 warnings:
```
editor/plugins/script_editor_plugin.cpp:1417:20: warning: function '_find_node_with_script' is not needed and will not be emitted [-Wunneeded-internal-declaration]
editor/scene_tree_dock.cpp:1859:14: warning: function '_find_last_visible' is not needed and will not be emitted [-Wunneeded-internal-declaration]

modules/gdscript/gdscript_parser.cpp:7838:19: warning: equality comparison result unused [-Wunused-comparison]

scene/resources/mesh.cpp:549:35: warning: unused variable '_array_types' [-Wunused-const-variable]
scene/resources/mesh.cpp:563:18: warning: unused variable '_format_translate' [-Wunused-const-variable]

drivers/gles3/rasterizer_scene_gles3.cpp:54:28: warning: unused function 'store_transform2d' [-Wunused-function]

core/io/file_access_network.h:50:6: warning: private field 'ml' is not used [-Wunused-private-field]
core/io/file_access_zip.h:93:14: warning: private field 'archive' is not used [-Wunused-private-field]
core/io/resource_format_binary.h:122:6: warning: private field 'bin_meta_idx' is not used [-Wunused-private-field]
core/message_queue.h:47:9: warning: private field 'mutex' is not used [-Wunused-private-field]
main/tests/test_gui.cpp:63:11: warning: private field 'control' is not used [-Wunused-private-field]
modules/gdscript/gdscript_parser.h:558:7: warning: private field 'completion_static' is not used [-Wunused-private-field]
platform/x11/os_x11.h:148:11: warning: private field 'ip_unix' is not used [-Wunused-private-field]
platform/x11/os_x11.h:180:7: warning: private field 'net_wm_icon' is not used [-Wunused-private-field]
platform/x11/os_x11.h:189:6: warning: private field 'audio_driver_index' is not used [-Wunused-private-field]
platform/x11/os_x11.h:190:15: warning: private field 'capture_idle' is not used [-Wunused-private-field]
servers/physics/body_pair_sw.h:79:6: warning: private field 'cc' is not used [-Wunused-private-field]
servers/visual/visual_server_raster.h:62:7: warning: private field 'draw_extra_frame' is not used [-Wunused-private-field]
```
2018-10-01 17:32:12 +02:00
Juan Linietsky c83742ba86 -Lightmap and lightmap capture support for GLES2
-Added hint to not show some properties when running on low end gfx
2018-09-28 20:33:18 -03:00
Juan Linietsky f2ed26d71e Reflection probe support in GLES2 back-end. 2018-09-28 16:42:47 -03:00
Rémi Verschelde 3a2ca68af3 SCons: Build thirdparty code in own env, disable warnings
Also remove unnecessary `Export('env')` in other SCsubs,
Export should only be used when exporting *new* objects.
2018-09-28 14:07:39 +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
Rémi Verschelde d95bbb8922 Fix warnings about set but unused variables [-Wunused-but-set-variable]
Fixes the following GCC 5 warnings:
```
drivers/gles2/rasterizer_canvas_gles2.cpp:814:8: warning: variable 'rt_size' set but not used [-Wunused-but-set-variable]
drivers/gles2/rasterizer_scene_gles2.cpp:2270:11: warning: variable 'vp_height' set but not used [-Wunused-but-set-variable]
drivers/gles2/rasterizer_scene_gles2.cpp:2673:22: warning: variable 'e' set but not used [-Wunused-but-set-variable]
drivers/gles2/rasterizer_scene_gles2.cpp:715:7: warning: variable 'no_cull' set but not used [-Wunused-but-set-variable]
drivers/gles2/shader_gles2.cpp:693:14: warning: variable 'cc' set but not used [-Wunused-but-set-variable]
drivers/gles3/rasterizer_canvas_gles3.cpp:1226:8: warning: variable 'rt_size' set but not used [-Wunused-but-set-variable]
drivers/gles3/rasterizer_scene_gles3.cpp:3039:10: warning: variable 'contrib' set but not used [-Wunused-but-set-variable]
drivers/gles3/rasterizer_scene_gles3.cpp:4504:32: warning: variable 'vp_height' set but not used [-Wunused-but-set-variable]
editor/editor_inspector.cpp:272:9: warning: variable 'guide_color' set but not used [-Wunused-but-set-variable]
editor/editor_themes.cpp:1067:14: warning: variable 'alpha3' set but not used [-Wunused-but-set-variable]
editor/editor_themes.cpp:263:8: warning: variable 'script_bg_color' set but not used [-Wunused-but-set-variable]
editor/plugins/collision_shape_2d_editor_plugin.cpp:326:11: warning: variable 'cpoint' set but not used [-Wunused-but-set-variable]
editor/plugins/mesh_editor_plugin.cpp:72:9: warning: variable 'size' set but not used [-Wunused-but-set-variable]
editor/plugins/shader_editor_plugin.cpp:471:12: warning: variable 'mpos' set but not used [-Wunused-but-set-variable]
editor/plugins/shader_editor_plugin.cpp:89:8: warning: variable 'basetype_color' set but not used [-Wunused-but-set-variable]
editor/plugins/shader_editor_plugin.cpp:90:8: warning: variable 'type_color' set but not used [-Wunused-but-set-variable]
editor/plugins/shader_editor_plugin.cpp:92:8: warning: variable 'string_color' set but not used [-Wunused-but-set-variable]
modules/visual_script/visual_script_editor.cpp:2521:7: warning: variable 'seq_connect' set but not used [-Wunused-but-set-variable]
platform/android/export/export.cpp:580:12: warning: variable 'styles_count' set but not used [-Wunused-but-set-variable]
platform/android/export/export.cpp:584:12: warning: variable 'styles_offset' set but not used [-Wunused-but-set-variable]
platform/osx/export/export.cpp:464:9: warning: variable 'zerr' set but not used [-Wunused-but-set-variable]
scene/2d/tile_map.cpp:260:10: warning: variable 'tcenter' set but not used [-Wunused-but-set-variable]
scene/3d/light.cpp:166:7: warning: variable 'editor_ok' set but not used [-Wunused-but-set-variable]
scene/3d/navigation.cpp:566:11: warning: variable 'closest_navmesh' set but not used [-Wunused-but-set-variable]
scene/gui/rich_text_label.cpp:869:8: warning: variable 'size' set but not used [-Wunused-but-set-variable]
scene/main/viewport.cpp:705:14: warning: variable 'xform' set but not used [-Wunused-but-set-variable]
scene/main/viewport.cpp:706:8: warning: variable 'ss' set but not used [-Wunused-but-set-variable]
scene/main/viewport.cpp:726:14: warning: variable 'xform' set but not used [-Wunused-but-set-variable]
scene/main/viewport.cpp:727:8: warning: variable 'ss' set but not used [-Wunused-but-set-variable]
scene/resources/material.cpp:430:7: warning: variable 'using_world' set but not used [-Wunused-but-set-variable]
servers/visual/shader_language.cpp:2026:7: warning: variable 'all_const' set but not used [-Wunused-but-set-variable]
servers/visual/visual_server_scene.cpp:1383:28: warning: variable 'z_max_cam' set but not used [-Wunused-but-set-variable]
```

Also fixes two [-Wunused-value] warnings:
```
scene/gui/text_edit.cpp:4405:20: warning: statement has no effect [-Wunused-value]
servers/visual/visual_server_scene.cpp:905:48: warning: value computed is not used [-Wunused-value]
```

Some of those are bugs and need further work, they are identified with
`// FIXME` comments.
2018-09-27 16:25:24 +02:00
Rémi Verschelde cda5b0bfe1 Fix warnings about unused variables [-Wunused-variable]
Fixes the following GCC 5 warnings:
```
drivers/gles2/rasterizer_scene_gles2.cpp:1139:15: warning: unused variable 'offset' [-Wunused-variable]
drivers/gles2/rasterizer_scene_gles2.cpp:1205:39: warning: unused variable 'multi_mesh' [-Wunused-variable]
drivers/gles2/rasterizer_storage_gles2.cpp:359:7: warning: unused variable 'srgb' [-Wunused-variable]
drivers/gles2/shader_gles2.cpp:1016:45: warning: unused variable 'texture_hints' [-Wunused-variable]
editor/animation_track_editor.cpp:776:9: warning: unused variable 'keys_to' [-Wunused-variable]
editor/editor_inspector.cpp:273:7: warning: unused variable 'vs_height' [-Wunused-variable]
editor/editor_themes.cpp:202:10: warning: unused variable 'begin_time' [-Wunused-variable]
editor/editor_themes.cpp:239:10: warning: unused variable 'end_time' [-Wunused-variable]
editor/plugins/animation_blend_tree_editor_plugin.cpp:726:17: warning: unused variable 'an' [-Wunused-variable]
editor/plugins/script_text_editor.cpp:1278:8: warning: unused variable 'fold_state' [-Wunused-variable]
main/main.cpp:132:13: warning: 'use_vsync' defined but not used [-Wunused-variable]
modules/cvtt/image_compress_cvtt.cpp:231:8: warning: unused variable 'y_end' [-Wunused-variable]
modules/cvtt/image_compress_cvtt.cpp:311:6: warning: unused variable 'shift' [-Wunused-variable]
modules/gdscript/gdscript_editor.cpp:58:7: warning: unused variable 'th' [-Wunused-variable]
modules/gridmap/grid_map.cpp:1084:6: warning: unused variable 'ofs' [-Wunused-variable]
modules/theora/video_stream_theora.cpp:442:9: warning: unused variable 'tr' [-Wunused-variable]
modules/visual_script/visual_script_editor.cpp:2606:6: warning: unused variable 'count' [-Wunused-variable]
modules/visual_script/visual_script_editor.cpp:2829:6: warning: unused variable 'seq_count' [-Wunused-variable]
modules/visual_script/visual_script_editor.cpp:2844:24: warning: unused variable 'vnode_function' [-Wunused-variable]
modules/websocket/lws_peer.cpp:122:12: warning: unused variable 'peer_data' [-Wunused-variable]
modules/websocket/lws_peer.cpp:135:12: warning: unused variable 'peer_data' [-Wunused-variable]
modules/websocket/lws_peer.cpp:63:12: warning: unused variable 'peer_data' [-Wunused-variable]
modules/websocket/lws_peer.cpp:91:12: warning: unused variable 'peer_data' [-Wunused-variable]
platform/android/export/export.cpp:763:16: warning: unused variable 'node_size' [-Wunused-variable]
scene/gui/rich_text_label.cpp:850:10: warning: unused variable 'x_ofs' [-Wunused-variable]
scene/gui/text_edit.cpp:653:8: warning: unused variable 'tab_w' [-Wunused-variable]
scene/resources/bit_mask.cpp:186:6: warning: unused variable 'i' [-Wunused-variable]
scene/resources/mesh.cpp:549:20: warning: '_array_name' defined but not used [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:107:10: warning: unused variable 'v2' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:108:10: warning: unused variable 'v3' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:109:10: warning: unused variable 'v4' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:110:10: warning: unused variable 'v5' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:111:10: warning: unused variable 'v0n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:112:10: warning: unused variable 'v1n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:113:10: warning: unused variable 'v2n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:114:10: warning: unused variable 'v3n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:115:10: warning: unused variable 'v4n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:116:10: warning: unused variable 'v5n' [-Wunused-variable]
servers/visual/default_mouse_cursor.xpm:2:21: warning: 'default_mouse_cursor_xpm' defined but not used [-Wunused-variable]
```
2018-09-27 16:25:24 +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
Chaosus 16e5ef6894 Added missed min/max shader overloads 2018-09-21 20:10:03 +03:00
Ibrahn Sahir bff864818f Fixed an access after free in ShaderLanguage::_reduce_expression.
Passing an element reference of a vector to a push_back call to
that same vector can cause an access after free. This is because push_back
will resize the vector, reallocating if necessary, leaving the reference
referring to the freed memory.
Removed an instance of this usage here.
2018-09-19 14:28:19 +01:00
JFonS 3cedec5f75 Set uniform default values in inspector 2018-09-13 23:05:33 +02:00
Rémi Verschelde 1a16dabfb5
Merge pull request #21982 from luzpaz/misc-typos
Misc. typos
2018-09-13 10:59:00 +02:00
luz.paz 08bde5b2de Misc. typos
Found via `codespell -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"`
2018-09-12 21:39:17 -04: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
JFonS f495cede0b Fix handling of shader constants that caused crash, closes #15166 2018-08-31 19:24:48 +02:00
Juan Linietsky cf834a22dc Ported CPU particles to 2D 2018-08-29 16:48:55 -03:00
Rémi Verschelde 52466d57e9 Make some debug prints verbose-only, remove others 2018-08-24 14:59:01 +02:00
Chaosus 37f5cc5b63 Added FRAGCOORD to spatial light processing 2018-08-20 09:35:47 +03:00
Chaosus 9634d74d31 Allow matrixes in varyings 2018-08-19 15:36:58 +03:00
Juan Linietsky 0fc1c4eda8
Merge pull request #20149 from Overblob/shader_float_typing
Shader language - Add optional float typings
2018-08-10 18:21:28 -03:00
Thomas Herzog b4d3f541e7 add 3D textures 2018-07-30 12:20:27 +02:00
Juan Linietsky 95a9e51975 Remove pointless check for no texture, fixes #7298 2018-07-29 20:47:20 -03:00
Juan Linietsky 7b63c6323d Clear color was not correctly being set, fixes #4939 2018-07-29 15:09:42 -03:00
Juan Linietsky d2aaf460fb Manually fix, merge and close #15168 2018-07-29 12:18:37 -03:00
Juan Linietsky 6a5aec3644 Rename flag to better name 2018-07-27 08:59:18 -03: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
Todd Ross 9423f23ffb allow comments and whitespace before shader_type declaration 2018-07-26 00:17:57 +02:00
Rémi Verschelde 237148e80f
Merge pull request #18368 from Gamblify/RasterizerEngineSync
sync rasterizers with engine
2018-07-25 20:33:37 +02:00
Chaosus ca0a6c3fca Added conversions between matrixes in shaders 2018-07-25 18:14:52 +03:00
Juan Linietsky dc976cac57
Merge pull request #12678 from AndreaCatania/soft
Soft body
2018-07-23 16:04:32 -03:00
AndreaCatania 17ebbfb56d Implemented Soft body
- Soft Body Physics node
- Soft Body Rendering
- Soft body Editor
- Soft body importer
2018-07-23 20:50:23 +02:00
Juan Linietsky ec85fd554b Fix issues with CPUParticles and related conversion from Particles. Closes #20126 2018-07-23 12:28:50 -03:00
AndreaCatania fbf3ad2841 Added some API to visual server so from control VRAM buffer is more easy 2018-07-23 12:59:27 +02:00
Juan Linietsky 2b9902db06 -Fix disable_3d flag
-Add extra flag optimize=[size,speed] to be able to prioritize size
2018-07-21 17:26:49 -03:00
Alex Roman 2ce1118faa Add disable ambient light flag to shaders and materials 2018-07-17 21:30:43 +02:00
Max Hilbrunner 277793439a
Revert "Fix #19507 Not emitted particles affects performance" 2018-07-17 16:52:13 +02:00
Max Hilbrunner 4b626dc114
Merge pull request #19764 from malbach/godot_malbach
Fix #19507 Not emitted particles affects performance
2018-07-17 16:47:41 +02:00
Rémi Verschelde 1d84c4f870
Merge pull request #20158 from Overblob/Fixed_shader_parsing_error_log
Fixed shader parsing error log
2018-07-17 14:16:56 +02:00
Juan Linietsky de910f8c26 Finally figured out how to implement AnimatedTexture properly. 2018-07-16 11:43:49 -03:00
Overblob e6ad5e23b4 * Small hex/float/integer parsing refactoring
* Potential bug fix on hex (cannot be used atm)
* Added optional typing for floats, eg:
"1f" -> "1.0"
"1.f" -> "1.0"
"1.99f" -> "1.99"
"1." -> "1.0"
2018-07-15 14:58:23 +02:00
Juan Linietsky f6ce73f724 Visual Shaders are back. 2018-07-14 18:16:18 -03:00
Overblob 7a74d310aa Fixed error due to bad cursor handling when parsing shader code
Fixed completion error log thrown on "no auto-completion found" for typings with no completion.
2018-07-14 19:59:11 +02:00
Josh Taylor 892a4b175a
Changed minimum visible viewport size
When the viewport's size.y becomes lower than 2, the storage->frame.current_rt->effects.mip_maps[0].sizes Vector during rendering becomes empty, resulting in crashes in at least GLES3. This is a temporary fix to stop rendering a viewport when its size is below 2 rather than below 1.
2018-07-07 17:10:32 -05:00
Juan Linietsky 7dcaabaf19 Support for CPU based particles, which aids compatibility with OpenGL ES 2.0 2018-07-06 20:21:42 -03:00
Rémi Verschelde 92bfde531c
Merge pull request #19786 from JFonS/correct_normal_scaling
Add render mode to ensure correct normals when using non-uniform scaling
2018-07-04 15:09:59 +02:00
Juan Linietsky d280b14e6e Hacked around duplication bug. I think duplicate needs to be even smarter, maybe pass two bools? (containers and/or resources) 2018-07-03 08:34:06 -03:00
Juan Linietsky 7fc2367508 Added ability for SSAO to affect AO textures too 2018-07-02 16:50:52 -03:00
malbach cef8d355d2 Fix #19507 Not emitted particles affects performance 2018-06-25 18:17:28 +02:00
Bastiaan Olij ddc40e5115 Fix typo in y shift 2018-06-23 22:41:29 +10:00
JFonS c8cf71753c Add render mode to ensure correct normals when using non-uniform scaling 2018-06-21 00:12:12 +02:00
Bastiaan Olij 3fc9b5d93f Moved culling, updated lights and shadows into a prepare function so it is only called once for stereo rendering 2018-06-11 21:51:30 +10:00
Gustav Lund 35eb7f2d6a Rasterizers are now in sync with engine
The rasterisers (both GLES3 and GLES2) were calculating their own frame delta time
This fix lets the rasterizers get the frame delta through the draw call
That way any regulations to the frame step from the main script will not cause particle systems to process at a different step than the rest of the Engine.

Remove unused rasterizer storage variable

frame.prev_tick variable were not used anywhere and has been removed
2018-06-05 16:33:02 +02:00
Oliver Rausch 2368b31e1e Fix return type of isnan and isinf in the shader language 2018-06-01 01:34:32 +02:00
nemerle f2ba9a1f65 Fix bad operator check in ShaderLanguage::_validate_assign 2018-05-16 21:28: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
Juan Linietsky 0db4c576f1
Merge pull request #18533 from JFonS/fix_shader_compile
Fix vector reduction in shader language
2018-05-07 14:30:44 -03:00
JFonS 5b50685b38 Fix vector reduction in shader language 2018-05-07 19:25:31 +02:00
Juan Linietsky b96cd25305
Merge pull request #18495 from Zylann/partial_texture_update
Added partial texture update to VisualServer
2018-05-07 13:20:38 -03:00
Juan Linietsky 35322c0678
Merge pull request #18677 from BastiaanOlij/add_no_blend
Add no-blend canvas item render_mode
2018-05-07 09:44:17 -03:00
Bastiaan Olij 6103c8d7a3 Add no-blend canvas item render_mode 2018-05-07 22:41:12 +10:00
Bastiaan Olij 6f7fefa489 Added option to viewport to keep linear color 2018-05-06 19:28:09 +10:00
Juan Linietsky b3e4bc562c Skeleton for 2D WIP 2018-05-03 17:29:56 -03:00
Rémi Verschelde de97339a2d
Merge pull request #18291 from akien-mga/coverity-uninitialized-scalar-var
Fix Coverity reports of uninitialized scalar variable
2018-05-01 19:14:07 +02:00
Rémi Verschelde 4cce6f3417
Merge pull request #18321 from Crazy-P/Fixes-logically-dead-code
Fixes logically dead code (Coverity)
2018-05-01 08:35:10 +02:00
Marc Gilleron c755cced83 Added partial texture update to VisualServer 2018-04-29 03:09:49 +02:00
Hugo Locurcio 1c419531a0 Change ".." punctuation for "..." in editor strings (#16507) 2018-04-22 19:36:01 +02:00
Crazy-P e6deba8d19 Fixes logically dead code (Coverity)
Fixes reported logically dead codes by Coverity

* image.cpp: Doesn't really need any modification. But to remove the bug
report then we have to move the MAX call away from the for loop
statement.

* rasterizer_gles3.cpp: Removes unnecessary elif condition since it is
checked earlier in the function

* collada.cpp: If stamement never reached due to macro ERR_CONTINUE does
the same.

* navigation_mesh.cpp: Variables should always be null - however, also
checked for the very same condition in their function call. Leaving this
for review (whether the function call is necessary or not)

* path_editor_plugin.cpp: If cancel is true, then it should restore the
edited value to the original provided.
http://docs.godotengine.org/en/3.0/classes/class_editorspatialgizmo.html#class-editorspatialgizmo-commit-handle

* spatial_editor_gizmos.cpp: the very condition of i >= 3 is
predetermined in the if case right before it. Thus case 1 is always '1'
and case 2 is always '-1'

* grid_map_editor.cpp: Same as above in spatial_editor_gizmos.cpp

* voxel_light_baker.cpp: Same as above in spatial_editor_gizmos.cpp

* visual_server.cpp: Same as above in spatial_editor_gizmos.cpp

* visual_script_expression.cpp: char '-' is already true in the switch
case mechanism. Thus it can never reach to default case.

* particles.cpp: Case 'PARAM_MAX' is unreachable due to index checking
right before the switch execution.

* shader_language.cpp: Invalid index is handled in switch default case.
`type < TYPE_FLOAT && type > TYPE_VEC4` -> `(type < TYPE_FLOAT || type > TYPE_VEC4`)
Fixes the "always false problem" in TODO comment.
2018-04-21 22:35:23 +08:00
Rémi Verschelde bf7ca623a6 Fix Coverity reports of uninitialized scalar variable
Fixes most current reports on Coverity Scan of uninitialized scalar
variable (CWE-457): https://cwe.mitre.org/data/definitions/457.html

These happen most of the time (in our code) when instanciating structs
without a constructor (or with an incomplete one), and later returning
the instance. This is sometimes intended though, as some parameters are
only used in some situations and should not be double-initialized for
performance reasons (e.g. `constant` in ShaderLanguage::Token).
2018-04-19 15:20:45 +02:00
Rémi Verschelde 9a4110a451
Merge pull request #17391 from PJB3005/18-03-09-fix-canvas-light-shaders
Fixes canvas light shaders.
2018-04-18 13:31:28 +02:00
Poommetee Ketson 59b816679e
Fix typos in shader_language.cpp 2018-04-17 19:21:00 +07: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
Juan Linietsky 8a5fb669ae
Merge pull request #17421 from Chaosus/fixshaderbugs
Fix few bugs in shader definitions
2018-04-08 09:33:12 -03:00
JFonS 9c307d4b6c Added flag on SpatialMaterial to disable shadows 2018-03-29 18:46:42 +02:00
Chaosus d974fa1780 Removed redundant abs shader builtin 2018-03-28 12:50:55 +03:00
Rémi Verschelde aebe55210a
Merge pull request #17532 from BastiaanOlij/arvr_enhancements
A few enhancements on the ARVR Server
2018-03-23 10:15:15 +01:00
robfram 8eedb2afe2 Fix crash in canvas_item_add_polyline when passing more points than colors
When `p_points.size() > p_colors.size()`, it crashed with invalid
array access to `p_colors`. Also, when `p_colors` was an empty
`Vector` it crashed due a missing `else` checking the `size`
condition, as the code handling that special case exists.

This PR fixes the missing `else` for `p_colors.size == 0` and,
following the `canvas_item_add_multiline` spirit, it only uses the
first color for the whole polyline if points and colors differ in
size.

Fix #17621.
2018-03-19 19:22:38 +01:00
Hein-Pieter van Braam 009b0bab49
Merge pull request #17248 from Cygon/implement-extra-culling-margin
Apply culling margin (fixes issue #16115)
2018-03-15 23:45:59 +01:00
JFonS 479f531635 Hinted shader uniforms can have a default value 2018-03-15 15:23:40 +01:00
Bastiaan Olij 5356423377 A few fixes on the ARVR Server 2018-03-15 23:31:02 +11:00
Rémi Verschelde 27a3447790
Merge pull request #17402 from Chaosus/fixmix
Fix invalid mix function overload
2018-03-13 08:43:07 +01:00
Wilson E. Alvarez e9ac87390c Fixed several leaks in VisualServerScene, RasterizerSceneGLES3 and RasterizerGLES3 2018-03-13 00:22:08 -04:00
Chaosus 2d428a350e Fix few bugs in shader definitions 2018-03-10 21:00:18 +03:00
Chaosus 97bef8d908 Fix invalid mix function overload 2018-03-10 12:56:43 +03:00
Saracen b095e21d91 Make the shader token names consistent. 2018-03-07 23:56:47 +00:00
Markus Ewald fc166f3ee1 Implement VisualServerScene::instance_set_extra_visibility_margin() method to actually apply extra culling margin and mark instance AABB dirty 2018-03-04 14:20:59 +01:00
Chaosus c6b6af7bb5 Fix floatBitsToUint function 2018-03-03 16:22:36 +03:00
Juan Linietsky 7cd867c3fe 2D Skeletons WORK IN PROGRESS 2018-02-21 17:24:00 -03:00
Juan Linietsky 9e3a1e5401 Add base support for 2D meshes in Godot, including Sprite -> Mesh2D conversion. 2018-02-21 09:39:09 -03:00
Juan Linietsky 4c56edfb83
Revert "Handle single-argument constructors in uniform default values" 2018-02-20 07:28:22 -03:00
Rémi Verschelde 05a8675f82
Merge pull request #15985 from Nallebeorn/uniforms-single-argument-constructors
Handle single-argument constructors in uniform default values
2018-02-20 11:26:26 +01:00
Chaosus 8f04a13c98 Added missing shader functions 2018-02-18 18:08:18 +03:00
Paolo Perkovic 08d4bfacaf Fix inconsistencies and typos in argument names 2018-02-01 16:47:20 +01:00
Benjamin 311e69aa1e Handle single-argument constructors in shaders.
Expand these (fill vectors, fill matrix diagonals) in _reduce_expression() so they're handled properly even as uniform default values (where they previously caused a crash).
2018-01-22 22:32:35 +01:00
Rémi Verschelde 9f479f096c Fix typos in code and docs with codespell
Using v1.11.0 from https://github.com/lucasdemarchi/codespell
2018-01-18 22:01:42 +01:00
binbitten bccb4840c8 Fix wrong viewport transparent-bg 2018-01-18 19:11:07 +01:00
Juan Linietsky bfeaf27a3e Properly dispose of instance capture data, fixes #14795 2018-01-06 19:06:04 -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 0b07d453f7
Merge pull request #15251 from binbitten/fix-assign-vardecl
Fix premature declaration of shader variables created with assignment
2018-01-04 15:17:10 +01:00
Rémi Verschelde f9f6f250e6
Merge pull request #15191 from Jerome67000/z_renaming
renames "z" Node2D property to "z_index"
2018-01-04 00:41:45 +01:00
Razah e3c9a7ed4f Fix broken Info.plist after copyright update
Fixes #15293.
+ related misc fixes by @akien-mga.
2018-01-03 17:10:07 +01:00
Jerome67000 42ae3525a3 #15078 renamed "z" -> "z_index" property in Node2D 2018-01-03 13:02:26 +01:00
binbitten f141bafba3 Fix premature declaration of shader variables created with assignment 2018-01-03 07:23:04 +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