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-09-22Metal: First set of Geometry Shader alternative implementations using SSBO ↵Jason Fielder
vertex shader fetch. These implementations remove dependency on the Geometry pass by instead invoking one vertex shader instance for each expected output vertex, matching what a geometry shader would emit. Each vertex shader instance is then responsible for calculating the same output position based on its vertex_id as the logic would in the geometry shader version. SSBO Vertex fetch enables full random-access into a vertex buffer by binding it as a read-only SSBO. This enables each instance to read neighbouring vertex data to perform contextual calculations as a geometry shader would, for cases where attribute Multiload is not supported. Authored by Apple: Michael Parkin-White Ref T96261 Reviewed By: fclem Differential Revision: https://developer.blender.org/D15901
2022-09-22Metal: MTLContext implementation and immediate mode rendering support.Thomas Dinges
MTLContext provides functionality for command encoding, binding management and graphics device management. MTLImmediate provides simple draw enablement with dynamically encoded data. These draws utilise temporary scratch buffer memory to provide minimal bandwidth overhead during workload submission. This patch also contains empty placeholders for MTLBatch and MTLDrawList to enable testing of first pixels on-screen without failure. The Metal API also requires access to the GHOST_Context to ensure the same pre-initialized Metal GPU device is used by the viewport. Given the explicit nature of Metal, explicit control is also needed over presentation, to ensure correct work scheduling and rendering pipeline state. Authored by Apple: Michael Parkin-White Ref T96261 (The diff is based on 043f59cb3b5835ba1a0bbf6f1cbad080b527f7f6) Reviewed By: fclem Differential Revision: https://developer.blender.org/D15953
2022-09-17GL: Framebuffer: Add support for empty framebuffer (no attachments)Clément Foucault
This allows to reduce the memory footprint of very large framebuffers if there is no need for any attachment.
2022-09-16Eevee: Add support for Nishita sky textureLukas Stockner
Sun Disc is currently not supported because it'll need special handling - on the one hand, I'm not sure if Eevee would handle a 1e6 coming out of a background shader without issues, and on the other hand it won't actually cast sharp shadows anyways. I guess we'd want to internally add a sun to the lamps if Sun Disc is enabled, but getting that right is tricky since the user could e.g. swap RGB channels in the node tree and the lamp wouldn't match that. Anyways, that can be handled later, the sky itself is already a start. Reviewed By: fclem Differential Revision: https://developer.blender.org/D13522
2022-09-14Sculpt: Separate hide status from face sets, use generic attributeHans Goudey
Whether faces are hidden and face sets are orthogonal concepts, but currently sculpt mode stores them together in the face set array. This means that if anything is hidden, there must be face sets, and if there are face sets, we have to keep track of what is hidden. In other words, it adds a bunch of redundant work and state tracking. On the user level it's nice that face sets and hiding are consistent, but we don't need to store them together to accomplish that. This commit uses the `".hide_poly"` attribute from rB2480b55f216c to read and change hiding in sculpt mode. Face sets don't need to be negative anymore, and a bunch of "face set <-> hide status" conversion can be removed. Plus some other benefits: - We don't need to allocate either array quite as much. - The hide status can be read from 1/4 the memory as face sets. - Updates when entering or exiting sculpt mode can be removed. - More opportunities for early-outs when nothing is hidden. - Separating concerns makes sculpt code more obvious. - It will be easier to convert face sets into a generic int attribute. Differential Revision: https://developer.blender.org/D15950
2022-09-13EEVEE-Next: Cryptomatte render passes.Jeroen Bakker
This change adds cryptomatte render passes to EEVEE-Next. Due to the upcoming viewport compositor we also improved cryptomatte so it will be real-time. This also allows viewing the cryptomatte passes in the viewport directly. {F13482749} A surface shader would store any active cryptomatte layer to a texture. Object hash is stored as R, Asset hash as G and Material hash as B. Hashes are only calculated when the cryptomatte layer is active to reduce any unneeded work. During film accumulation the hashes are separated and stored in a texture array that matches the cryptomatte standard. For the real-time use case sorting is skipped. For final rendering the samples are sorted and normalized. NOTE: Eventually we should also do sample normalization in the viewport in order to extract the correct mask when using the viewport compositor. Reviewed By: fclem Maniphest Tasks: T99390 Differential Revision: https://developer.blender.org/D15753
2022-09-12When these features aren't used, there is no sense in storing theHans Goudey
corresponding data layers and using their values for computations. Avoiding that should increase performance in many operations that would otherwise have to read, write, or propagate these values. It also means decreased memory usage-- not just for sculpt mode but for any mesh that was in sculpt mode. Previously the mask, face set, and hide status layers were *always* allocated by sculpt mode. Here are a few basic tests when masking and face sets are not used: | Test | Before | After | | Subsurf Modifier | 148 ms | 126 ms | | Sculpt Overlay Extraction | 24 ms every redraw | 0 ms | | Memory usage | 252 MB | 236 MB | I wouldn't expect any difference when they are used though. The code changes are mostly just making sculpt features safe for when the layers aren't stored, and some changes to the conversion to and from the hide layers. Use of the ".hide_poly" attribute replaces testing whether face sets are negative in many places. Differential Revision: https://developer.blender.org/D15937
2022-09-07Cleanup: Tweak naming for recently added mesh accessorsHans Goudey
Use `verts` instead of `vertices` and `polys` instead of `polygons` in the API added in 05952aa94d33eeb50. This aligns better with existing naming where the shorter names are much more common.
2022-09-06Cleanup: spelling in comments, formatting, move comments into headersCampbell Barton
2022-09-06ShaderBuilder: Fix compilation error due to recent changes.Jeroen Bakker
Added CustomData_get_layer to stub.
2022-09-06GPU: remove 'GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR'Germano Cavalcante
The only difference between `GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR` and `GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR` is that in the vertex shader the 2D version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses `vec4(pos, 1.0)`. But VBOs with 2D attributes work perfectly in shaders that use 3D attributes. Components not specified are filled with components from `vec4(0.0, 0.0, 0.0, 1.0)`. So there is no real benefit to having two different shader versions.
2022-09-06GPU: remove 'GPU_SHADER_3D_IMAGE_MODULATE_ALPHA'Germano Cavalcante
`GPU_SHADER_3D_IMAGE_MODULATE_ALPHA` can be seamlessly replaced by `GPU_SHADER_3D_IMAGE_COLOR` with no real harm done.
2022-09-05GPU: convert 'GPU_SHADER_2D_IMAGE_COLOR' to 3DGermano Cavalcante
3D shaders work in both 2D and 3D viewports. This shader is a good candidate to be exposed in Python.
2022-09-05GPU: remove 'GPU_SHADER_2D_SMOOTH_COLOR'Germano Cavalcante
The only real difference between `GPU_SHADER_2D_SMOOTH_COLOR` and `GPU_SHADER_3D_SMOOTH_COLOR` is that in the vertex shader the 2D version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses `vec4(pos, 1.0)`. But VBOs with 2D attributes work perfectly in shaders that use 3D attributes. Components not specified are filled with components from `vec4(0.0, 0.0, 0.0, 1.0)`. So there is no real benefit to having two different shader versions. This will simplify porting shaders to python as it will not be necessary to use a 3D and a 2D version of the shaders. In python the new name for '2D_SMOOTH_COLOR' and '3D_SMOOTH_COLOR' is 'SMOOTH_COLOR', but the old names still work for backward compatibility.
2022-09-05GPU: remove 'GPU_SHADER_2D_IMAGE'Germano Cavalcante
The only real difference between `GPU_SHADER_2D_IMAGE` and `GPU_SHADER_3D_IMAGE` is that in the vertex shader the 2D version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses `vec4(pos, 1.0)`. But VBOs with 2D attributes work perfectly in shaders that use 3D attributes. Components not specified are filled with components from `vec4(0.0, 0.0, 0.0, 1.0)`. So there is no real benefit to having two different shader versions. This will simplify porting shaders to python as it will not be necessary to use a 3D and a 2D version of the shaders. In python the new name for '2D_IMAGE' and '3D_IMAGE' is 'IMAGE', but the old names still work for backward compatibility.
2022-09-05GPU: remove 'GPU_SHADER_2D_FLAT_COLOR'Germano Cavalcante
The only real difference between `GPU_SHADER_2D_FLAT_COLOR` and `GPU_SHADER_3D_FLAT_COLOR` is that in the vertex shader the 2D version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses `vec4(pos, 1.0)`. But VBOs with 2D attributes work perfectly in shaders that use 3D attributes. Components not specified are filled with components from `vec4(0.0, 0.0, 0.0, 1.0)`. So there is no real benefit to having two different shader versions. This will simplify porting shaders to python as it will not be necessary to use a 3D and a 2D version of the shaders. In python the new name for '2D_FLAT_COLOR'' and '3D_FLAT_COLOR' is 'FLAT_COLOR', but the old names still work for backward compatibility.
2022-09-05GPU: remove 'GPU_SHADER_2D_UNIFORM_COLOR'Germano Cavalcante
The only real difference between `GPU_SHADER_2D_UNIFORM_COLOR` and `GPU_SHADER_3D_UNIFORM_COLOR` is that in the vertex shader the 2D version uses `vec4(pos, 0.0, 1.0)` and the 3D version uses `vec4(pos, 1.0)`. But VBOs with 2D attributes work perfectly in shaders that use 3D attributes. Components not specified are filled with components from `vec4(0.0, 0.0, 0.0, 1.0)`. So there is no real benefit to having two different shader versions. This will simplify porting shaders to python as it will not be necessary to use a 3D and a 2D version of the shaders. In python the new name for '2D_UNIFORM_COLOR'' and '3D_UNIFORM_COLOR' is 'UNIFORM_COLOR', but the old names still work for backward compatibility. Differential Revision: https://developer.blender.org/D15836
2022-09-05Mesh: Remove redundant custom data pointersHans Goudey
For copy-on-write, we want to share attribute arrays between meshes where possible. Mutable pointers like `Mesh.mvert` make that difficult by making ownership vague. They also make code more complex by adding redundancy. The simplest solution is just removing them and retrieving layers from `CustomData` as needed. Similar changes have already been applied to curves and point clouds (e9f82d3dc7ee, 410a6efb747f). Removing use of the pointers generally makes code more obvious and more reusable. Mesh data is now accessed with a C++ API (`Mesh::edges()` or `Mesh::edges_for_write()`), and a C API (`BKE_mesh_edges(mesh)`). The CoW changes this commit makes possible are described in T95845 and T95842, and started in D14139 and D14140. The change also simplifies the ongoing mesh struct-of-array refactors from T95965. **RNA/Python Access Performance** Theoretically, accessing mesh elements with the RNA API may become slower, since the layer needs to be found on every random access. However, overhead is already high enough that this doesn't make a noticible differenc, and performance is actually improved in some cases. Random access can be up to 10% faster, but other situations might be a bit slower. Generally using `foreach_get/set` are the best way to improve performance. See the differential revision for more discussion about Python performance. Cycles has been updated to use raw pointers and the internal Blender mesh types, mostly because there is no sense in having this overhead when it's already compiled with Blender. In my tests this roughly halves the Cycles mesh creation time (0.19s to 0.10s for a 1 million face grid). Differential Revision: https://developer.blender.org/D15488
2022-09-05Cleanup: make formatBrecht Van Lommel
2022-09-02DRW-Next: Add uniform attributes (object attributes) supportClément Foucault
This replaces the direct shader uniform layout declaration by a linear search through a global buffer. Each instance has an attribute offset inside the global buffer and an attribute count. This removes any padding and tighly pack all uniform attributes inside a single buffer. This would also remove the limit of 8 attribute but it is kept because of compatibility with the old system that is still used by the old draw manager.
2022-09-02Cleanup: GPU: UniformAttribute: Improve const correctnessClément Foucault
Removes a warning and tidy the API.
2022-09-02DRWManager: New implementation.Clément Foucault
This is a new implementation of the draw manager using modern rendering practices and GPU driven culling. This only ports features that are not considered deprecated or to be removed. The old DRW API is kept working along side this new one, and does not interfeer with it. However this needed some more hacking inside the draw_view_lib.glsl. At least the create info are well separated. The reviewer might start by looking at `draw_pass_test.cc` to see the API in usage. Important files are `draw_pass.hh`, `draw_command.hh`, `draw_command_shared.hh`. In a nutshell (for a developper used to old DRW API): - `DRWShadingGroups` are replaced by `Pass<T>::Sub`. - Contrary to DRWShadingGroups, all commands recorded inside a pass or sub-pass (even binds / push_constant / uniforms) will be executed in order. - All memory is managed per object (except for Sub-Pass which are managed by their parent pass) and not from draw manager pools. So passes "can" potentially be recorded once and submitted multiple time (but this is not really encouraged for now). The only implicit link is between resource lifetime and `ResourceHandles` - Sub passes can be any level deep. - IMPORTANT: All state propagate from sub pass to subpass. There is no state stack concept anymore. Ensure the correct render state is set before drawing anything using `Pass::state_set()`. - The drawcalls now needs a `ResourceHandle` instead of an `Object *`. This is to remove any implicit dependency between `Pass` and `Manager`. This was a huge problem in old implementation since the manager did not know what to pull from the object. Now it is explicitly requested by the engine. - The pases need to be submitted to a `draw::Manager` instance which can be retrieved using `DRW_manager_get()` (for now). Internally: - All object data are stored in contiguous storage buffers. Removing a lot of complexity in the pass submission. - Draw calls are sorted and visibility tested on GPU. Making more modern culling and better instancing usage possible in the future. - Unit Tests have been added for regression testing and avoid most API breakage. - `draw::View` now contains culling data for all objects in the scene allowing caching for multiple views. - Bounding box and sphere final setup is moved to GPU. - Some global resources locations have been hardcoded to reduce complexity. What is missing: - ~~Workaround for lack of gl_BaseInstanceARB.~~ Done - ~~Object Uniform Attributes.~~ Done (Not in this patch) - Workaround for hardware supporting a maximum of 8 SSBO. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D15817
2022-09-02Merge branch 'blender-v3.3-release'Clément Foucault
# Conflicts: # release/scripts/addons
2022-09-02Fix T98190: EEVEE: Very slow rendering on Intel HD Graphics 4400Clément Foucault
This particular GPU driver does not constant fold all the way in order to discard the unused branches. To workaround that, we introduce a series of material flag that generates defines that only keep used branches. Reviewed By: jbakker Differential Revision: https://developer.blender.org/D15852
2022-09-02Fix build error after recent Metal GPU commitHans Goudey
These definitions were in the patch but didn't make it to the commit.
2022-09-01Metal: MTLShader and MTLShaderGenerator implementation.Thomas Dinges
Full support for translation and compilation of shaders in Metal, using GPUShaderCreateInfo. Includes render pipeline state creation and management, enabling all standard GPU viewport rendering features in Metal. Authored by Apple: Michael Parkin-White, Marco Giordano Ref T96261 Reviewed By: fclem Maniphest Tasks: T96261 Differential Revision: https://developer.blender.org/D15563
2022-09-01Metal: Minimum per-vertex stride, 3D texture size + Transform feedback ↵Jason Fielder
GPUCapabilities expansion. - Adding in compatibility paths to support minimum per-vertex strides for vertex formats. OpenGL supports a minimum stride of 1 byte, in Metal, this minimum stride is 4 bytes. Meaing a vertex format must be atleast 4-bytes in size. - Replacing transform feedback compile-time check to conditional look-up, given TF is supported on macOS with Metal. - 3D texture size safety check added as a general capability, rather than being in the gl backend only. Also required for Metal. Authored by Apple: Michael Parkin-White Ref T96261 Reviewed By: fclem Maniphest Tasks: T96261 Differential Revision: https://developer.blender.org/D14510
2022-09-01Metal: MTLIndexBuf class implementation.Jason Fielder
Implementation also contains a number of optimisations and feature enablements specific to the Metal API and Apple Silicon GPUs. Ref T96261 Reviewed By: fclem Maniphest Tasks: T96261 Differential Revision: https://developer.blender.org/D15369
2022-09-01Cleanup: make formatJacques Lucke
2022-09-01GPUMaterial: Make uniform attrib precompute hash and attribute safe nameClément Foucault
This avoids redundant operation at draw time. The per attrib hash is to be used with the future implementation.
2022-09-01PyGPU: GPUShader: implementation of 'attrs_info_get' methodGermano Cavalcante
With the new `attrs_info_get` method, we can get information about the attributes used in a `GPUShader` and thus have more freedom in the automatic creation of `GPUVertFormat`s Reviewed By: fclem, campbellbarton Differential Revision: https://developer.blender.org/D15764
2022-08-31Cleanup: Use const for node data in compositorHans Goudey
Push the const usage a bit further for compositor nodes, so that they are more explicit about not modifying original nodes from the editor. Differential Revision: https://developer.blender.org/D15822
2022-08-31Mesh: Move material indices to a generic attributeHans Goudey
This patch moves material indices from the mesh `MPoly` struct to a generic integer attribute. The builtin material index was already exposed in geometry nodes, but this makes it a "proper" attribute accessible with Python and visible in the "Attributes" panel. The goals of the refactor are code simplification and memory and performance improvements, mainly because the attribute doesn't have to be stored and processed if there are no materials. However, until 4.0, material indices will still be read and written in the old format, meaning there may be a temporary increase in memory usage. Further notes: * Completely removing the `MPoly.mat_nr` after 4.0 may require changes to DNA or introducing a new `MPoly` type. * Geometry nodes regression tests didn't look at material indices, so the change reveals a bug in the realize instances node that I fixed. * Access to material indices from the RNA `MeshPolygon` type is slower with this patch. The `material_index` attribute can be used instead. * Cycles is changed to read from the attribute instead. * BMesh isn't changed in this patch. Theoretically it could be though, to save 2 bytes per face when less than two materials are used. * Eventually we could use a 16 bit integer attribute type instead. Ref T95967 Differential Revision: https://developer.blender.org/D15675
2022-08-31GPUCapabilities: Add GPU_shader_draw_parameters_supportClément Foucault
This checks for the availability of `gl_BaseInstanceARB` or equivalent. Disabling for any workaround that disables shader_image_load_store_support as a preventive measure.
2022-08-31Cleanup: formatCampbell Barton
2022-08-30GPUBatch: Add multi_draw_indirect capability and indirect buffer offsetClément Foucault
This is for completion and to be used by the new draw manager.
2022-08-30GPUMaterial: Expose debug name getterClément Foucault
This also makes it mandatory, but reduced length for release.
2022-08-30GPUCodegen: Do not rely on auto resource locationClément Foucault
This allows the render engine to expect non-overlapping resources in the generated create info. Textures are indexed from 0 and up. Nodetree ubo is bound to slot 0. Uniform attributes ubo is bound to slot 1.
2022-08-30GPUBatch: Add draw parameter getterClément Foucault
This is used to populate indirect draw commands in the draw manager.
2022-08-30GPUStorageBuf: Add `read()` function to readback buffer data to hostClément Foucault
This is not expected to be fast. This is only for inspecting the content of the buffer for debugging or validation purpose.
2022-08-30Cleanup: Use const for custom data layersHans Goudey
2022-08-23Cleanup: Avoid using invalid attribute domainHans Goudey
The number of attribute domains isn't an attribute domain, so storing ATTR_DOMAIN_NUM in a variable with an eAttrDomain type isn't correct. In the cases it was used, the value wouldn't be accessed anyway.
2022-08-23Cleanup: match names between functions & declarationsCampbell Barton
2022-08-22Fix: Memory leak in realtime compositorOmar Emara
There was a memory leak in the GPU code generator for the compositor output. It was just due to a missing free in the GPU code generator destructor, so this patch makes sure it is freed.
2022-08-19Merge branch 'blender-v3.3-release'Brecht Van Lommel
2022-08-19Fix build error on mips64el architectureBrecht Van Lommel
Same as D12194, name "mips" conflicts on such systems.
2022-08-16GPU: ShaderCreateInfo: Use variadic template instead of default argumentsClément Foucault
This should reduce the issue described in T100431. This is also cleaner and without arbitrary argument limit.
2022-08-15GPU: replace GLEW with libepoxyChristian Rauch
With libepoxy we can choose between EGL and GLX at runtime, as well as dynamically open EGL and GLX libraries without linking to them. This will make it possible to build with Wayland, EGL, GLVND support while still running on systems that only have X11, GLX and libGL. It also paves the way for headless rendering through EGL. libepoxy is a new library dependency, and is included in the precompiled libraries. GLEW is no longer a dependency, and WITH_SYSTEM_GLEW was removed. Includes contributions by Brecht Van Lommel, Ray Molenkamp, Campbell Barton and Sergey Sharybin. Ref T76428 Differential Revision: https://developer.blender.org/D15291
2022-08-15Cleanup: fix typosBrecht Van Lommel
Contributed by luzpaz. Differential Revision: https://developer.blender.org/D15680
2022-08-14GPU: Fix shader builder compilationClément Foucault
Was missing a stub.