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-31Cleanup: comments and minor changes to GPU_select codeCampbell Barton
- Remove outdated references to glReadPixels & OpenGL. - Rename GPUPickState.{gl => gpu} - Add doc-string for MAXPICKELEMS. - Use doxygen comments & other minor doc-string improvements.
2022-01-31Cleanup: use struct for GPU the select bufferCampbell Barton
GPU_select originally used GL_SELECT which defined the format for storing the selection result. Now this is no longer the case, define our own struct - making the code easier to follow: - Avoid having to deal with arrays in both `uint*` and `uint(*)[4]` multiplying offsets by 4 in some cases & not others. - No magic numbers for the offsets of depth & selection-ID. - No need to allocate unused members to match GL_SELECT (halving the buffer size).
2022-01-31Cleanup: use enum type for selection mode & internal algorithm enumCampbell Barton
2022-01-31Cleanup: use our own conventions for tags in commentsCampbell Barton
2022-01-28Cleanup: Clang-tidy warnings.Jeroen Bakker
Silence Clang-tidy warnings in gpu module.
2022-01-28Cleanup: spelling in commentsCampbell Barton
Also minor wording improvements.
2022-01-28GPUShader: Abort in case of dependency issues.Clément Foucault
This is to avoid being flooded with compilation errors that are not helpful.
2022-01-27Fix crash on older platform due to unsupported clear commandClément Foucault
Clearing using GPU_texture_create_2d for unorm texture needs to use GPU_DATA_FLOAT to match the conversion requirements.
2022-01-27GPUShaderCreateInfo: Add optionnal check for optimized out resourcesClément Foucault
This opt-in functionnality enabled developper keep track of unused resources present in the `GPUShaderCreateInfo` descriptors of their shaders. The output is pretty noisy at the moment so we do not enforce its usage.
2022-01-27GPUShaderCreateInfo: Remove push_constant indexingClément Foucault
This is too much impractical and offers no real benefit.
2022-01-26DRW: Fix builtin uniform name mismatchClément Foucault
This lead to severe unreported regression, like volume rendering broken in workbench.
2022-01-26Cleanup: GPUShaderShared: Complete vector supportClément Foucault
Move some declaration from `GPU_shader_shared.h` to the main common file and add missing vector declarations.
2022-01-26GPUShader: Add GLSL source modification pass to support enumsClément Foucault
This uses a light parser / string modification pass to convert C++ enum declaration syntax to GLSL compatible one. GLSL having no support for enums, we are forced to convert the enum values to a series of constant uints. The parser (not really one by the way), being stupidly simple, will not change anything to the values and thus make some C++ syntax (like omitting the values) not work. The string replacement happens on all GLSL files on startup. I did not measure significant changes in blender startup speed. There is plans to do all of this at compile time. We limit the scope of the search to `.h` and `.hh` files to prevent confusing syntax in `.glsl` files. There is basic error reporting with file, line and char logging for easy debuggabiliy. The requirements to use this enum sharing system are already listed in `gpu_shader_shared_utils.h` and repeated on top of the preprocessor function.
2022-01-26Fix T94900: Fix drawing artifacts sequencer+node editor.Jeroen Bakker
The VSE and node editor only uses an overlay buffer to draw to the screen. The GPUViewport assumes that platforms clears all textures during creation, but they do not on selected platforms. What would lead to drawing from uncleared memory. This patch fixes this by clearing all viewport textures during creation.
2022-01-26D13910: Workbench: Port shaders to use GPUShaderCreateInfoClément Foucault
Also adds a few things to GPUShader for easily create shaders. Heavy usage of macros to compose the createInfo and avoid duplications and copy paste bugs. This makes the link between the shader request functions (in workbench_shader.cc) and the actual createInfo a bit obscure since the names are composed and not searchable. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D13910
2022-01-26Gizmo: optimize intersection tests, fix selection biasCampbell Barton
Use more efficient logic for detecting when gizmos are under the cursor. Even though this isn't a bottleneck, it runs on cursor motion in the 3D viewport, so avoiding any lag here is beneficial. The common case for cursor motion without any gizmos was always drawing two passes (one small, then again if nothing was found). Now a single draw call at the larger size is used. In isolation this gives around 1.2x-1.4x speedup. When there are multiple gizmos a depth-buffer picking is used (similar to object / bone selection) which is more involved but still only performs 2x draw calls since the result is cached for reuse. See note in gizmo_find_intersected_3d for a more detailed explanation. Also restore the depth values in the selection result as they're needed for gizmos to use selection bias. Broken since support for GL_SELECT was removed.
2022-01-26Fix error using GPU selection cache for selection pickingCampbell Barton
When calling GPU_select_cache_begin, checking the selection mode used the last used selection mode, not the one about to be used. Using border select, then picking would not use the selection cache. This wasn't noticeable by users as failing to use cache just completes the selection without it (drawing the depth buffer unnecessarily).
2022-01-26Cleanup: spelling in commentsCampbell Barton
2022-01-25Cycles: add Point Info nodeBrecht Van Lommel
With (center) position, radius and random value outputs. Eevee does not yet support rendering point clouds, but an untested implementation of this node was added for when it does. Ref T92573
2022-01-25GPUShader: Add optionnal single shader stage interface for in and outClément Foucault
This makes optionnal the use of a different interface for the geometry shader stage output. When the vertex and geometry interface instance name matches, a `_in` and `_out` suffix is added to the end of the instance name. This makes it easier to have optional geometry shader stages. # Conflicts: # source/blender/gpu/intern/gpu_shader_create_info.hh
2022-01-25Draw: Migrate hair refine compute shader to use create info.Jeroen Bakker
This patch migrates the draw manager hair refine compute shader to use GPUShaderCreateInfo. Reviewed By: fclem Differential Revision: https://developer.blender.org/D13915
2022-01-25GPU: Add GPU_shader_create_from_info_nameJeroen Bakker
This function will be used as the way to build shaders from create_infos. The previous used method was using a private function.
2022-01-25Cleanup: Correct location of node function declarationsHans Goudey
Currently there are many function declarations in `BKE_node.h` that don't actually have implementations in blenkernel. This commit moves the declarations to `NOD_composite.h`, `NOD_texture.h`, and `NOD_shader.h` instead. This helps to clarify the purpose of the different modules. Differential Revision: https://developer.blender.org/D13869
2022-01-24GPUShaderCreateInfo: Add manual validation of bindpointsClément Foucault
Some drivers/glsl compilers will not warn about multiple resources using the same binding, creating silent errors. This patch checks for this case and outputs a descriptive error message if a particular createInfo merge error is founds. Other validation can be added later.
2022-01-24Cleanup: spelling in commentsCampbell Barton
2022-01-21Fix error in previous commit.Jeroen Bakker
2022-01-21GPU: Disable create info for 2d image overlay merge.Jeroen Bakker
This shader needs to use the same interface as the OCIO shader. On Linux and Windows this seems to be the case. On MacOS however there is a mismatch that makes the overlay texture to be completely black when switching to workbench in the Shader workspace. This is just a temporarily work-around as this should be solved. Due to the poor GPU debugging facilities on Mac we haven't been able to pin-point the root cause.
2022-01-20Cleanup: spelling in commentsCampbell Barton
2022-01-20Cleanup: clang-formatCampbell Barton
2022-01-19GPUShaderCreateInfo: Rework geometry shader layout supportClément Foucault
This merge the description into one struct only that can be more easily copied during `finalize()`. The in and out layout parameters are better named and extended with the invocation count (with fallback support)
2022-01-18GPU: Create Info for GPU_SHADER_2D_IMAGE_MULTI_RECT_COLOR.Jeroen Bakker
This patch converts GPU_SHADER_2D_IMAGE_MULTI_RECT_COLOR shader to use the GPUShaderCreateInfo pattern. It can be used as a reference when converting other shaders. In this special case the flat uniform vector cannot be used anymore as it doesn't fit as push constants. To solve this a uniform buffer is used.
2022-01-18Cleanup: spelling in commentsCampbell Barton
2022-01-18Cleanup: quite old-style-declaration warning, strip trailing spaceCampbell Barton
2022-01-17Revert "Revert "GPUShaderCreateInfo for interface abstraction""Jeroen Bakker
This reverts commit edee5a947b7ea3e1324aa334a22c7c9bbf47f5f7. Fixes compilation error (Missing file BLI_float2.hh)
2022-01-17Revert "GPUShaderCreateInfo for interface abstraction"Jeroen Bakker
This reverts commit 8fb2ff458ba579dba08bfdf57d043ad158b5db07. Missing some files.
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-13Refactor: Move normals out of MVert, lazy calculationHans Goudey
As described in T91186, this commit moves mesh vertex normals into a contiguous array of float vectors in a custom data layer, how face normals are currently stored. The main interface is documented in `BKE_mesh.h`. Vertex and face normals are now calculated on-demand and cached, retrieved with an "ensure" function. Since the logical state of a mesh is now "has normals when necessary", they can be retrieved from a `const` mesh. The goal is to use on-demand calculation for all derived data, but leave room for eager calculation for performance purposes (modifier evaluation is threaded, but viewport data generation is not). **Benefits** This moves us closer to a SoA approach rather than the current AoS paradigm. Accessing a contiguous `float3` is much more efficient than retrieving data from a larger struct. The memory requirements for accessing only normals or vertex locations are smaller, and at the cost of more memory usage for just normals, they now don't have to be converted between float and short, which also simplifies code In the future, the remaining items can be removed from `MVert`, leaving only `float3`, which has similar benefits (see T93602). Removing the combination of derived and original data makes it conceptually simpler to only calculate normals when necessary. This is especially important now that we have more opportunities for temporary meshes in geometry nodes. **Performance** In addition to the theoretical future performance improvements by making `MVert == float3`, I've done some basic performance testing on this patch directly. The data is fairly rough, but it gives an idea about where things stand generally. - Mesh line primitive 4m Verts: 1.16x faster (36 -> 31 ms), showing that accessing just `MVert` is now more efficient. - Spring Splash Screen: 1.03-1.06 -> 1.06-1.11 FPS, a very slight change that at least shows there is no regression. - Sprite Fright Snail Smoosh: 3.30-3.40 -> 3.42-3.50 FPS, a small but observable speedup. - Set Position Node with Scaled Normal: 1.36x faster (53 -> 39 ms), shows that using normals in geometry nodes is faster. - Normal Calculation 1.6m Vert Cube: 1.19x faster (25 -> 21 ms), shows that calculating normals is slightly faster now. - File Size of 1.6m Vert Cube: 1.03x smaller (214.7 -> 208.4 MB), Normals are not saved in files, which can help with large meshes. As for memory usage, it may be slightly more in some cases, but I didn't observe any difference in the production files I tested. **Tests** Some modifiers and cycles test results need to be updated with this commit, for two reasons: - The subdivision surface modifier is not responsible for calculating normals anymore. In master, the modifier creates different normals than the result of the `Mesh` normal calculation, so this is a bug fix. - There are small differences in the results of some modifiers that use normals because they are not converted to and from `short` anymore. **Future improvements** - Remove `ModifierTypeInfo::dependsOnNormals`. Code in each modifier already retrieves normals if they are needed anyway. - Copy normals as part of a better CoW system for attributes. - Make more areas use lazy instead of eager normal calculation. - Remove `BKE_mesh_normals_tag_dirty` in more places since that is now the default state of a new mesh. - Possibly apply a similar change to derived face corner normals. Differential Revision: https://developer.blender.org/D12770
2022-01-10Remove GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR.Jeroen Bakker
Shader isn't used and not accessible via py-api.
2022-01-10Remove GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR.Jeroen Bakker
Shader isn't used and not accessible via py-api.
2022-01-10Remove GPU_SHADER_2D_POINT_UNIFORM_SIZE_VARYING_COLOR_OUTLINE_AA.Jeroen Bakker
Shader isn't used and not accessible via py-api.
2022-01-10Remove GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR.Jeroen Bakker
Shader isn't used and not accessible via py-api.
2022-01-10Remove GPU_SHADER_3D_POINT_VARYING_SIZE_UNIFORM_COLOR.Jeroen Bakker
Shader isn't used and not accessible via the py-api.
2022-01-10Remove GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA.Jeroen Bakker
Shader isn't used and isn't accessible via py-api.
2022-01-10Cleanup: Remove unused source files.Jeroen Bakker
2022-01-10Cleanup: Consistent naming GPU_SHADER_2D_AREA_BORDERS.Jeroen Bakker
2022-01-10GPU: Remove unused UV shaders.Jeroen Bakker
The UV shaders have been migrated to the overlay engine and aren't accessible via the python API.
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-06Cleanup: move public doc-strings into headersCampbell Barton
Some recent changes re-introduced public-style doc-strings in the source file.
2022-01-06Cleanup: spelling in commentsCampbell Barton
2022-01-06Cleanup: Clang-tidy: modernize-redundant-void-argAaron Carlisle