Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-01-17GPUShaderCreateInfo for interface abstractionJeroen Bakker
This is a first part of the Shader Create Info system could be. A shader create info provides a way to define shader structure, resources and interfaces. This makes for a quick way to provide backend agnostic binding informations while also making shader variations easy to declare. - Clear source input (only one file). Cleans up the GPU api since we can create a shader from one descriptor - Resources and interfaces are generated by the backend (much simpler than parsing). - Bindings are explicit from position in the array. - GPUShaderInterface becomes a trivial translation of enums and string copy. - No external dependency to third party lib. - Cleaner code, less fragmentation of resources in several libs. - Easy to modify / extend at runtime. - no parser involve, very easy to code. - Does not hold any data, can be static and kept on disc. - Could hold precompiled bytecode for static shaders. This also includes a new global dependency system. GLSL shaders can include other sources by using #pragma BLENDER_REQUIRE(...). This patch already migrated several builtin shaders. Other shaders should be migrated one at a time, and could be done inside master. There is a new compile directive `WITH_GPU_SHADER_BUILDER` this is an optional directive for linting shaders to increase turn around time. What is remaining: - pyGPU API {T94975} - Migration of other shaders. This could be a community effort. Reviewed By: jbakker Maniphest Tasks: T94975 Differential Revision: https://developer.blender.org/D13360
2022-01-07Cleanup: remove redundant const qualifiers for POD typesCampbell Barton
MSVC used to warn about const mismatch for arguments passed by value. Remove these as newer versions of MSVC no longer show this warning.
2022-01-06Bone Overlay: support changing bone wireframe opacity.Alexander Gavrilov
When weight painting the bone overlay is extremely intrusive, effectively requiring either extensive use of hiding individual bones, or disabling the whole bone overlay between selections. This addresses the issue by adding a bone opacity slider that is used for the 'wireframe' armature drawing mode. It directly controls the uniform opacity as a straightforward option. Differential Revision: https://developer.blender.org/D11804
2022-01-06Cleanup: spelling in commentsCampbell Barton
2022-01-06Cleanup: Clang-tidy: modernize-redundant-void-argAaron Carlisle
2021-12-27Render: move editor/render module to c++Jacques Lucke
Doing this in preparation for some work on asset preview generation. Differential Revision: https://developer.blender.org/D13676
2021-12-27OpenSubDiv: add support for an OpenGL evaluatorKévin Dietrich
This evaluator is used in order to evaluate subdivision at render time, allowing for faster renders of meshes with a subdivision surface modifier placed at the last position in the modifier list. When evaluating the subsurf modifier, we detect whether we can delegate evaluation to the draw code. If so, the subdivision is first evaluated on the GPU using our own custom evaluator (only the coarse data needs to be initially sent to the GPU), then, buffers for the final `MeshBufferCache` are filled on the GPU using a set of compute shaders. However, some buffers are still filled on the CPU side, if doing so on the GPU is impractical (e.g. the line adjacency buffer used for x-ray, whose logic is hardly GPU compatible). This is done at the mesh buffer extraction level so that the result can be readily used in the various OpenGL engines, without having to write custom geometry or tesselation shaders. We use our own subdivision evaluation shaders, instead of OpenSubDiv's vanilla one, in order to control the data layout, and interpolation. For example, we store vertex colors as compressed 16-bit integers, while OpenSubDiv's default evaluator only work for float types. In order to still access the modified geometry on the CPU side, for use in modifiers or transform operators, a dedicated wrapper type is added `MESH_WRAPPER_TYPE_SUBD`. Subdivision will be lazily evaluated via `BKE_object_get_evaluated_mesh` which will create such a wrapper if possible. If the final subdivision surface is not needed on the CPU side, `BKE_object_get_evaluated_mesh_no_subsurf` should be used. Enabling or disabling GPU subdivision can be done through the user preferences (under Viewport -> Subdivision). See patch description for benchmarks. Reviewed By: campbellbarton, jbakker, fclem, brecht, #eevee_viewport Differential Revision: https://developer.blender.org/D12406
2021-12-20Fix T94262: Grease Pencil Blur Effect DoF mode wrongPhilipp Oeser
This was visible outside of camera view and was not respecting the "Depth of Field" checkbox on the Camera properties. Now return early if DoF should not be visible. Maniphest Tasks: T94262 Differential Revision: https://developer.blender.org/D13631
2021-12-14Cleanup: correct unbalanced doxygen groupsCampbell Barton
Also add groups in some files.
2021-12-08Cleanup: move public doc-strings into headers for 'draw'Campbell Barton
Ref T92709
2021-12-07Fix crash when switching back from render preview.Jeroen Bakker
Issue is that external engine uses the gpu info. but overwrote the instance data. The draw manager would then detect instance data and required the engine type to have a instance free callback. The solution is to save some space in the engine data to hold an empty and unused instance_data attribute to comply with `ViewportEngineData` struct.
2021-12-07DrawManager: Engine Instance Data.Jeroen Bakker
In the original design draw engines had to copy with a limitation that they were not allowed to reuse complex data structures between drawing calls. Data that could be reused were limited to: - GPUFramebuffers - GPUTextures - Memory that could be removed calling MEM_freeN (storage list) - DRWPass This is fine when the storage list contains arrays or structs but when more complex data types (vectors, maps) etc wasn't possible. This patch adds instance_data that can be reused between drawing calls. The instance_data is controlled by the draw engine and doesn't need to be limited as described above. When an engines stores instance_data it must implement the `DrawEngineType.instance_free` callback to free the data. The patch originates from eevee rewrite. But was added to master as the image engine rewrite also has a need for it. Reviewed By: fclem Differential Revision: https://developer.blender.org/D13425
2021-12-07Cleanup: Fix various source typosluzpaz
This is a continuation of D13462 to clean up source typos. Differential Revision: https://developer.blender.org/D13471
2021-12-02Fix T84710: Instances with only mesh edges or vertices are invisibleHans Goudey
Wire-only meshes have a special case in the overlay drawing to give the wire shader a special color (which avoids the lines being dashed, somehow). The fast path for duplis didn't have that special case. Differential Revision: https://developer.blender.org/D13196
2021-12-02Merge branch 'blender-v3.0-release'Hans Goudey
2021-12-02Fix T93525: Crash with curve/text armature bone gizmoHans Goudey
The problem is that drw_batch_cache_generate_requested_delayed is called on the object, which uses the original object data type to choose which data type to get info for. So for curves and text it uses the incorrect type (not the evaluated mesh like we hardcoded in the armature overlay code). To fix this I hardcoded the "delayed" generation to only use the evaluated mesh. Luckily it wasn't use elsewhere besides this armature overlay system. That seems like the simplest fix for 3.0. A proper solution should rewrite this whole area anyway. Differential Revision: https://developer.blender.org/D13439
2021-11-30Cleanup: clang-format, trailing spaceCampbell Barton
2021-11-30Cleanup: capitalize NOTE tagCampbell Barton
2021-11-24Merge branch 'blender-v3.0-release'Hans Goudey
2021-11-24Fix T92120 (partially): No bone custom shape with curve object meshesHans Goudey
This part of the drawing code assumes that the bone custom object has only one evaluated geometry component, and it also uses the object type to check which data to draw, with the functions like `DRW_cache_object_surface_get` that just take an object input. Those functions usually work on evaluated objects, which use the instancing system to access a temporary object with `object.data` replaced for data types that don't match the original object. That assumption used to work, but now curve, point cloud, or volume objects can have an evaluated mesh which is not accessed with the same object for render engine drawing. The "correct" solution for the way this code is structured would be to loop through all of the geometry components and try to get GPU batches from every one of them. However, that significantly increases complexity in an area that should probably be refactored anyway. This patch treats the mesh as a special case, and only draws the evaluated mesh. The **best** solution in my opinion might be refactoring this area to use the instancing system with some sort of viewport-only flag so the custom shape instances aren't added in the render. The solution is "partial" because the "Wireframe" option only works for meshes from mesh objects, even after this fix, and because other data besides meshes is not displayed at all. Differential Revision: https://developer.blender.org/D13038
2021-11-24Cleanup: Renamed DefaultDrawingMode ImageSpaceDrawingMode.Jeroen Bakker
Explains more what it does, not how it is used.
2021-11-24ImageEngine: Remove unneeded check for tiled image.Jeroen Bakker
Regular images are also tiled images, but with a default tile that leads to the same result.
2021-11-23Merge branch 'blender-v3.0-release'Jacques Lucke
2021-11-23Fix T93297: incorrect eevee motion blur with geometry instancesJacques Lucke
This disables motion blur for geometry instances in eevee, which did not work correctly anyway. See code comment for more details. Differential Revision: https://developer.blender.org/D13334
2021-11-19Merge branch 'blender-v3.0-release'Hans Goudey
2021-11-19Fix T92682: EEVEE motion blur crash with curve objectsHans Goudey
After rBb9febb54a492, the evaluated mesh from a curve is now presented to render engines as a separate mesh object, but some code still assumed that a curve object itself could have an evaluated mesh. However, this is still true for surface objects and metaballs, which don't use geometry sets yet. Differential Revision: https://developer.blender.org/D13272
2021-11-19Cleanup: fix typos in comments and docsBrecht Van Lommel
Contributed by luzpaz. Differential Revision: https://developer.blender.org/D13264
2021-11-18Merge remote-tracking branch 'origin/blender-v3.0-release'Sybren A. Stüvel
2021-11-18Fix T92442: undo removal of Eevee cryptomatte accurate mode optionBrecht Van Lommel
The Cycles accurate mode was removed, but the Eevee option for this has a different meaning and should not have been removed. The Eevee accurate makes cryptomatte accumulate for every sample, which Cycles has always done regardless of any option.
2021-11-09Merge branch 'blender-v3.0-release'Hans Goudey
2021-11-09Viewport: Remove different outline color for instancesHans Goudey
With instancing becoming more common with geometry nodes, instances are less of a separate thing and more of an essential part of evaluated data. Displaying them with a separate outline, while helpful in some cases, is not worth the lack of visibility or confusion about selected/active status. Information about the performance of the scene due to instancing is always available with the statistics like vertex count, etc. The problems were compounded by the fact that the instancing system is used to output geometry components that don't correspond to the object's original type. So this patch also fixes that problem. Fixes T92079, T81010 Ref T91310 Differential Revision: https://developer.blender.org/D13133
2021-11-09Cleanup: clang-formatCampbell Barton
2021-11-08Basic engine shaders testJarrett Johnson
This patch adds shader compilation tests for the basic engine in `shaders_test.cc` Addresses T92701 Reviewed By: jbakker Differential Revision: https://developer.blender.org/D13066
2021-11-08Fix ASAN issue in image editor.Jeroen Bakker
Adding virtual constructors to base classes.
2021-11-05Cleanup: Remove redundant scope qualifiers.Jeroen Bakker
2021-11-05Cleanup: Split image engine into ImageEngine, SpaceAccessor and DrawingMode.Jeroen Bakker
Image engine is used to draw an image into a space. The current structure wasn't clear and couldn't be easilly extended. This refactor spliced the image draw engine into 3 main components. - Space accessors: contains an interface to communicate with space data (Image editor, UV Editor, Node Editor) in a common way. This reduced the branching in the code base. - DrawingMode: contains an interface to the used tactic to draw an image inside the space framebuffer. Currently only one mode is implemented; in the future there could be a separate drawing mode for huge images. - ImageEngine: the core that connects the draw manager with the space data and drawing mode.
2021-11-03Merge branch 'blender-v3.0-release'Campbell Barton
2021-11-03Cleanup: spellingCampbell Barton
2021-11-02Fix: Build error on windows.Ray Molenkamp
External symbols in C files need to be marked as such otherwise the linker will not find them.
2021-11-02Removed compilation warning nullptr check in image engine.Jeroen Bakker
2021-11-02Merge branch 'blender-v3.0-release'Jacques Lucke
2021-11-02Images: refactor how failed image load attempts are rememberedJacques Lucke
Previously, `ImageTile->ok` and `ImageUser->ok` were used to indicate whether an image failed to load. There were three possible values which (probably) had the following meanings: * `0`: There was an error while loading the image. Don't try to load again. * `1`: Default value. Try to load the image. * `2`: The image was loaded successfully. This image-wide flag did not make sense unfortunately, because loading may work for some frames of an image sequence but not for others. Remember than an image data block can also contain a movie. The purpose of the `->ok` flag was to serve as an optimization to avoid trying to load a file over and over again when there is an error (e.g. the file does not exist or is invalid). To get the optimization back, the patch is changing `MovieCache` so that it can also cache failed load attempts. As a consequence, `ibuf` is allowed to be `NULL` in a few more places. I added the appropriate null checks. This also solves issues when image sequences are used with the Image Texture node in Geometry nodes (also see D12827). Differential Revision: https://developer.blender.org/D12957
2021-11-02Merge branch 'blender-v3.0-release'Philipp Oeser
2021-11-02Cleanup: clang-tidyCampbell Barton
2021-11-02Fix T92608: Image Editor does not display stereo imagesPhilipp Oeser
Caused by own {rB5aa3167e48b2}. Related commit: {rBebaa3fcedd23}. For stereo renders, `BKE_image_is_multilayer` is true, however we seem to get to down to `space_image_gpu_texture_get` [where this is called] from `IMAGE_cache_init` with a NULL Image->RenderResult. So what then happens is that `BKE_image_multilayer_index` is called and even though it has an appropriate codepath for stereo, it earlies out and does not set multi_index correctly. Still a bit puzzled why RenderResult is NULL for a render, but since other places also check for a valid RenderResult before going down the _multilayer_ route (and doing _multiview_ instead), now do the same thing, BKE_image_multiview_index is now called in these cases (and seems to behave correctly, checked with layers and passes and all seems to display correctly, either in stereo or choosing individual eyes). thx @jbakker & @brecht for double-checking. Maniphest Tasks: T92608 Differential Revision: https://developer.blender.org/D13063
2021-11-02Cleanup: Change image engine to CPP.Jeroen Bakker
Added namespace blender::draw::image_engine. Code is still C-a-like. Only changed the obvious code style to CPP (structs, nullptr, casts).
2021-11-01Pointcloud selection supportJarrett Johnson
This patch adds support for selecting pointclouds. Since pointclouds were not properly drawn to the selection buffer (as diagonsed by output from `glReadPixels` and Renderdoc), they were not able to be selectable by depth picking or occlusion queries. In `basic_engine`, objects were rendered with a shader which draws to a depth buffer but only assumes a single position vertex attribute. Pointclouds, though, require at least another vertex attribute `pos_inst` which provides the instance offsets. Thus, this patch adds another shader variant for pointclouds which supports these two attributes and renders the points appropriately. {F11652666} Addresses T92415 Reviewed By: fclem Differential Revision: https://developer.blender.org/D13059
2021-11-01Pointcloud selection supportJarrett Johnson
This patch adds support for selecting pointclouds. Since pointclouds were not properly drawn to the selection buffer (as diagonsed by output from `glReadPixels` and Renderdoc), they were not able to be selectable by depth picking or occlusion queries. In `basic_engine`, objects were rendered with a shader which draws to a depth buffer but only assumes a single position vertex attribute. Pointclouds, though, require at least another vertex attribute `pos_inst` which provides the instance offsets. Thus, this patch adds another shader variant for pointclouds which supports these two attributes and renders the points appropriately. {F11652666} Addresses T92415 Reviewed By: fclem Differential Revision: https://developer.blender.org/D13059
2021-11-01Revert "Pointcloud selection support"Clément Foucault
This reverts commit a50f8b3fd8e74d7cc0f2224f110c85493acee1cc.
2021-11-01Pointcloud selection supportJarrett Johnson
This patch adds support for selecting pointclouds. Since pointclouds were not properly drawn to the selection buffer (as diagonsed by output from `glReadPixels` and Renderdoc), they were not able to be selectable by depth picking or occlusion queries. In `basic_engine`, objects were rendered with a shader which draws to a depth buffer but only assumes a single position vertex attribute. Pointclouds, though, require at least another vertex attribute `pos_inst` which provides the instance offsets. Thus, this patch adds another shader variant for pointclouds which supports these two attributes and renders the points appropriately. {F11652666} Addresses T92415 Reviewed By: fclem Differential Revision: https://developer.blender.org/D13059