WIP: Vulkan: Workbench #107886

Closed
Jeroen Bakker wants to merge 88 commits from Jeroen-Bakker:vulkan-draw-manager-workbench into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

88 Commits

Author SHA1 Message Date
Jeroen Bakker 912189f9e7 Merge branch 'main' into vulkan-draw-manager-workbench 2023-06-09 16:29:20 +02:00
Jeroen Bakker a52188830a Merge branch 'main' into vulkan-draw-manager-workbench 2023-06-09 11:55:55 +02:00
Jeroen Bakker de680d302d Merge branch 'main' into vulkan-draw-manager-workbench 2023-06-09 07:55:40 +02:00
Jeroen Bakker 45151faea2 Merge branch 'main' into vulkan-draw-manager-workbench 2023-06-08 16:17:47 +02:00
Jeroen Bakker a34dd7e56b Use meaningfull code block headers. 2023-06-08 15:38:29 +02:00
Jeroen Bakker e1e5f0bf54 Workbench depth of field. 2023-06-08 15:19:20 +02:00
Jeroen Bakker 8c15503c70 silence a vulkan error when starting blender. 2023-06-08 12:58:28 +02:00
Jeroen Bakker ef4525b1ff Experiment with custom vk image views. 2023-06-08 12:47:33 +02:00
Jeroen Bakker 2e75b213ad Merge branch 'main' into vulkan-draw-manager-workbench 2023-06-08 09:51:16 +02:00
Jeroen Bakker 8abf5be800 Remove obsolete code 2023-06-08 09:22:15 +02:00
Jeroen Bakker 16701aac28 Remove double define. 2023-06-08 09:18:37 +02:00
Jeroen Bakker cbee6639ce Merge branch 'main' into vulkan-draw-manager-workbench 2023-06-08 09:17:35 +02:00
Jeroen Bakker 6d839333f1 Merge branch 'main' into vulkan-draw-manager-workbench 2023-06-07 11:44:44 +02:00
Jeroen Bakker 7c2503d11d Merge branch 'main' into vulkan-draw-manager-workbench 2023-06-05 11:27:37 +02:00
Jeroen Bakker 36eebb48b5 Metal: Silence Console Output
This PR silences console output during statup phase of blender. During
startup logging isn't yet initialized and print statements where used.
Logging is initialized during the first construction of a Metal Context.

The console prints are now hidden by behind the '--debug-gpu' command
line option.

Pull Request: #108593
2023-06-05 10:49:39 +02:00
Campbell Barton ddf835bd33 Cleanup: replace list-base count_at_most with is_single for clarity 2023-06-05 10:49:39 +02:00
Campbell Barton 60e0589f68 Cleanup: use BLI_strchr_or_end to simplify new-line stepping
- DRW_draw_region_engine_info:

  - Remove duplicate line drawing for the last line.
  - Remove string copying, pass the length to BLF_draw_default instead.
  - Resolve a potential buffer overflow as the source string length was
    used to define the destinations maximum size.

- CONSOLE_OT_paste:

  - Remove the need to null-terminate each line.
  - Buffer stepping uses const values
  - console_line_insert no longer strips the string it inserts.

- CONSOLE_OT_insert:

  - New lines in the middle of text now reports an error,
    new lines at the end of text is stripped (as before).
2023-06-05 10:49:39 +02:00
Campbell Barton 75a93813e5 BLI_string: add BLI_strchr_or_end
Returning the pointer to the null byte when the character isn't found
is useful when handling null terminated strings that contain newlines.

This means the return value is never null and the line span always ends
at the resulting value.
2023-06-05 10:49:39 +02:00
Campbell Barton 7eeca95502 PyAPI: rename filename to filepath for RNA API functions
- Depsgraph.debug_relations_graphviz
- Depsgraph.debug_stats_gnuplot
- RenderLayer.load_from_file
- RenderResult.load_from_file
- bpy.app.icons.new_triangles_from_file
2023-06-05 10:49:39 +02:00
Campbell Barton bd2ee6b1c1 Cleanup: disambiguate the term 'path'
Use filepath or dirpath, unless the contents might be either,
in that case note that the contents could be both.
Use `rna_path*` in some cases too.
2023-06-05 10:49:39 +02:00
Lukas Stockner a44d153c6a Cycles: Remove MultiGGX code, replace with albedo scaling
While the multiscattering GGX code is cool and solves the darkening problem at higher roughnesses, it's also currently buggy, hard to maintain and often impractical to use due to the higher noise and render time.

In practice, though, having the exact correct directional distribution is not that important as long as the overall albedo is correct and we a) don't get the darkening effect and b) do get the saturation effect at higher roughnesses.

This can simply be achieved by adding a second lobe (https://blog.selfshadow.com/publications/s2017-shading-course/imageworks/s2017_pbs_imageworks_slides_v2.pdf) or scaling the single-scattering GGX lobe (https://blog.selfshadow.com/publications/turquin/ms_comp_final.pdf). Both approaches require the same precomputation and produce outputs of comparable quality, so I went for the simple albedo scaling since it's easier to implement and more efficient.

Overall, the results are pretty good: All scenarios that I tested (Glossy BSDF, Glass BSDF, Principled BSDF with metallic or transmissive = 1) pass the white furnace test (a material with pure-white color in front of a pure-white background should be indistinguishable from the background if it preserves energy), and the overall albedo for non-white materials matches that produced by the real multi-scattering code (with the expected saturation increase as the roughness increases).

In order to produce the precomputed tables, the PR also includes a utility that computes them. This is not built by default, since there's no reason for a user to run it (it only makes sense for documentation/reproducibility purposes and when making changes to the microfacet models).

Pull Request: #107958
2023-06-05 10:49:39 +02:00
Chris Blackbourn d578ce1b6d UV: Add optimal uv packings using precomputed layouts
Produce optimal layouts for `n` squares, where n == 11, 18, 19 and 26.

With thanks:
* Walter Trump
* Pertti Hamalainen
* Robert Wainwright
* Erich Friedman
2023-06-05 10:49:38 +02:00
Chris Blackbourn d12684cb54 Cleanup: format 2023-06-05 10:49:38 +02:00
Lukas Stockner eec118aa4d Fix Principled Hair Absorption Coefficient when using OSL
The additional SocktType::VECTOR argument was being interpreted as flags,
which caused the OSL compiler to skip the input (since the Vector type enum
happens to align with the INTERNAL flag), which caused the OSL shader to
always use the hardcoded default absorption regardless of what was entered.
2023-06-05 10:49:38 +02:00
Lukas Stockner db1b14a3a4 Fix refraction BSDF color when using OSL 2023-06-05 10:49:38 +02:00
Campbell Barton 83b17201e8 Cleanup: replace 'sz' abbreviation with 'size' 2023-06-05 10:49:38 +02:00
Campbell Barton 8771f92903 Cleanup: rename ParticleSettings.child_nbr to child_percent
The old name was only kept to avoid breaking compatibility.
2023-06-05 10:49:38 +02:00
Campbell Barton ff155d6f3d Cleanup: use 'num' suffix for sizes in DNA instead of 'size'
Avoid ambiguity with the term size.
2023-06-05 10:49:38 +02:00
Campbell Barton fed9b2f266 Cleanup: function style casts, use nullptr, printf & size macros 2023-06-05 10:49:38 +02:00
Campbell Barton 7d8c94cb62 Cleanup: remove redundant struct qualifier 2023-06-05 10:49:38 +02:00
Campbell Barton d0360f840d Cleanup: remove NULL literals in C++ (including comments & strings) 2023-06-05 10:49:38 +02:00
Jeroen Bakker 53cf8a8b02 Merge branch 'main' into vulkan-draw-manager-workbench 2023-06-04 08:59:59 +02:00
Jeroen Bakker f8deeec9a4 Small changes to prepare for mipmaps framebuffers 2023-06-02 16:01:05 +02:00
Jeroen Bakker 74fc9d7d28 Merge branch 'main' into vulkan-draw-manager-workbench 2023-06-02 15:41:56 +02:00
Jeroen Bakker 3366a34625 Merge branch 'main' into vulkan-draw-manager-workbench 2023-06-02 10:13:31 +02:00
Jeroen Bakker 1c6556643a Merge branch 'main' into vulkan-draw-manager-workbench 2023-06-02 09:50:57 +02:00
Jeroen Bakker f07dbceb8d Update mipmaps sourced from level 0 2023-06-02 09:31:33 +02:00
Jeroen Bakker bf592b9e9c Add support for UBYTE to SRGB texture. 2023-06-01 15:33:36 +02:00
Jeroen Bakker f7fd0f2a9c Disable depth clamping. 2023-06-01 14:08:05 +02:00
Jeroen Bakker 32a3effee9 Merge branch 'main' into vulkan-draw-manager-workbench 2023-06-01 13:40:54 +02:00
Jeroen Bakker 542bc7b8c8 Fix code formatting. 2023-06-01 13:33:44 +02:00
Jeroen Bakker 3c658d2c2e Skip conversion to half when GPU backend can do it. 2023-05-30 16:10:43 +02:00
Jeroen Bakker 8be011308b Some tweaks to get image engine working. 2023-05-30 15:56:50 +02:00
Jeroen Bakker 9153a0a626 Merge branch 'main' into vulkan-draw-manager-workbench 2023-05-30 13:59:19 +02:00
Jeroen Bakker 4a10381faa Indirect drawing (not working) 2023-05-30 11:38:01 +02:00
Jeroen Bakker fa3f4ef888 Merge branch 'main' into vulkan-draw-manager-workbench 2023-05-30 09:20:17 +02:00
Jeroen Bakker 9987cca307 Merge branch 'main' into vulkan-draw-manager-workbench 2023-05-26 08:36:21 +02:00
Jeroen Bakker 4ecf13457f Enable test cases that pass. 2023-05-25 17:33:59 +02:00
Jeroen Bakker a5c92991a7 Add workaround for devices that don't support 24bit depth formats. 2023-05-25 16:46:44 +02:00
Jeroen Bakker a244399793 Merge branch 'main' into vulkan-draw-manager-workbench 2023-05-25 15:42:18 +02:00
Jeroen Bakker e69cc677d0 Merge branch 'main' into vulkan-draw-manager-workbench 2023-05-25 12:00:17 +02:00
Jeroen Bakker 6e0de2095b Show gpu backend selector in user pref. 2023-05-25 11:59:30 +02:00
Jeroen Bakker 2ce6e73570 Merge branch 'main' into vulkan-draw-manager-workbench 2023-05-25 11:31:58 +02:00
Jeroen Bakker 5b9fc072eb Enable primitive restart 2023-05-23 15:37:05 +02:00
Jeroen Bakker 26c1d55e6b Revert enabling transform feedback. 2023-05-23 15:36:51 +02:00
Jeroen Bakker 6bc2f31be5 Merge branch 'main' into vulkan-draw-manager-workbench 2023-05-23 14:32:37 +02:00
Jeroen Bakker df683c420b Merge branch 'main' into vulkan-draw-manager-workbench 2023-05-22 20:31:45 +02:00
Jeroen Bakker e17eed22aa Fix compute pass hair/curve drawing 2023-05-22 10:57:17 +02:00
Jeroen Bakker 068baff31a Merge branch 'main' into vulkan-draw-manager-workbench 2023-05-22 09:20:04 +02:00
Jeroen Bakker 84298f1f45 Combine textures and texel buffers. 2023-05-19 15:32:08 +02:00
Jeroen Bakker 8edef9da7c Make vertex texture binding optional. 2023-05-19 15:02:53 +02:00
Jeroen Bakker 102da50d33 Merge branch 'main' into vulkan-draw-manager-workbench 2023-05-19 14:50:34 +02:00
Jeroen Bakker 747a714a92 Added support for texel buffers 2023-05-19 14:46:07 +02:00
Jeroen Bakker adc1cb6eee Initial texel buffer 2023-05-19 13:04:03 +02:00
Jeroen Bakker 0111c319a7 Add test case for binding vertex buffer as texture. 2023-05-19 11:58:55 +02:00
Jeroen Bakker a826dbaa49 Texel buffers 2023-05-19 09:09:23 +02:00
Jeroen Bakker a0beda7a5b Make ShaderInterface::debug_print const 2023-05-19 09:08:18 +02:00
Jeroen Bakker f37f6c8c93 Also reallocate fragmented pools 2023-05-19 09:07:58 +02:00
Jeroen Bakker 6371521557 Fix float conversions. 2023-05-19 08:14:06 +02:00
Jeroen Bakker 0b186b5266 Add support for Inf, Nan and clamping 2023-05-17 12:30:08 +02:00
Jeroen Bakker 26d1c4d59a Fix extent height and depth. 2023-05-16 16:14:57 +02:00
Jeroen Bakker 44a405ef55 Many small changes. Nothing worth mentioning as much is still WIP. 2023-05-16 15:57:22 +02:00
Jeroen Bakker 3c70ae669c Fix Clang compilations errors. 2023-05-16 14:02:21 +02:00
Jeroen Bakker 2b1cf45a8a Readback subarea of texture 2023-05-16 11:41:55 +02:00
Jeroen Bakker 4631fd788b Use correct length for color blend attachments. 2023-05-16 10:29:18 +02:00
Jeroen Bakker bae7f296c9 Remove dependency to IMath 2023-05-16 09:49:50 +02:00
Jeroen Bakker 4b39e6b258 GHOST: Select compatible surface 2023-05-16 09:38:43 +02:00
Jeroen Bakker 0013103790 Float conversions. 2023-05-16 09:38:26 +02:00
Jeroen Bakker 01135a8516 Use correct parameters 2023-05-15 21:13:21 +02:00
Jeroen Bakker fbd53f81d4 Added other known numbers. 2023-05-15 21:10:44 +02:00
Jeroen Bakker 6511908936 Data conversion custom float formats 2023-05-15 16:19:09 +02:00
Jeroen Bakker 34d23517f2 Merge branch 'main' into vulkan-draw-manager-workbench 2023-05-15 08:08:04 +02:00
Jeroen Bakker 44548d3edf Added comment where I left for the weekend 2023-05-12 15:45:21 +02:00
Jeroen Bakker 93f6767c8f Add FLOAT R11 G11 B10 conversion. 2023-05-12 15:40:09 +02:00
Jeroen Bakker 2afb3f1169 Vulkan: Construct Blending State Per Attachment 2023-05-12 14:42:27 +02:00
Jeroen Bakker 3a4605a52a Vulkan: Disable Depth Bounds Test
Depth bounds test was always enabled, but should have be disabled.
With this change the outline of the default cube would become visible.
2023-05-12 13:25:21 +02:00
Jeroen Bakker e9d6ee1860 Merge branch 'main' into vulkan-draw-manager-workbench 2023-05-12 12:39:42 +02:00
Jeroen Bakker ab725fddd4 Vulkan: IndexBuffer as Subrange
Add support for index buffers as subrange. When an index buffer
is a subrange it should bind the source buffer and use the index start
as an offset in the buffer.
2023-05-12 11:58:39 +02:00