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-05-11Cleanup: spelling in commentsCampbell Barton
Revert change from [0] that assumed UNORM was a mis-spelling of UNIFORM. [0]: 2c75857f9fc0dc5d524e4a0407e0a68856e5906e
2022-05-09EEVEE & Viewport: Add a built-in shader called 3D_IMAGE, and expose to the ↵Shashank Shekhar
python API Adds an example python script to the documentation for the 3D_IMAGE shader. The **use-case** is to draw textures with 3D vertex positions, in XR views as well as non-XR views (in a simpler manner). **Testing**: I've tested that this compiles and works on my Macbook (with the example python script included in this change). I don't have access to a Windows or Linux machine right now, but this change doesn't look platform-specific and no new glsl shaders have been added or edited by this change. I'll try to get access to a Windows machine, but if someone does have one, I'd be really grateful if they could try this change. Thanks! **Problem addressed**: The existing 2D_IMAGE shader (exposed in the python API) gets near-clipped when drawn in the XR view, regardless of the near-clip settings. Additionally, the 2D_IMAGE shader only accepts 2D positions for the image vertices, which means drawing textures in 3D requires providing 2D coordinates and then pushing a transform-rotate-scale matrix to the GPU, even for non-XR (i.e. WINDOW) views. The 3D_IMAGE shader is simpler: it accepts 3D vertex positions, and doesn't require any additional work by the scripter. **Workaround**: The current workaround is to use custom shaders in the python script. **Non-intrusive change**: No new glsl shaders were added. This change just bundles two existing shaders: the vertex shader used by the 3D_IMAGE_MODULATE_ALPHA shader, and the fragment shader used by the 2D_IMAGE shader. Reviewed By: #eevee_viewport, jbakker Differential Revision: https://developer.blender.org/D14832
2022-05-02GPUShader: Remove GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZEClément Foucault
This had only one use and it was for debugging. Remove the shader for now. This also simplifies the debug drawing even if slower.
2022-04-19PyGPU: remove outdated function 'code_from_builtin'Germano Cavalcante
Since shader sources are now parsed on demand via `GPUShaderCreateInfo`, sources are not available to be read via `GPU_shader_get_builtin_shader_code`. Currently this results in a crash as the code tries to read `NULL` pointers. `GPU_shader_get_builtin_shader_code` was created with the intention of informing the user how a builtin shader works, thus "replacing" detailed documentation. Therefore this function doesn't really have a practical use in an addon. So, instead of updating the function (which would require several changes to the gpu module), remove it and improve the documentation. Release Notes: https://wiki.blender.org/wiki/Reference/Release_Notes/3.2/Python_API#Breaking_Changes Reviewed By: fclem Differential Revision: https://developer.blender.org/D14678
2022-04-13pyGPU: Port 'StageInterfaceInfo' and 'ShaderCreateInfo' typesGermano Cavalcante
In order to allow GLSL Cross Compilation across platforms, expose in Python the `GPUShaderCreateInfo` strategy as detailed in https://wiki.blender.org/wiki/EEVEE_%26_Viewport/GPU_Module/GLSL_Cross_Compilation The new features can be listed as follows: ``` >>> gpu.types.GPUShaderCreateInfo. define( fragment_out( fragment_source( push_constant( sampler( typedef_source( uniform_buf( vertex_in( vertex_out( vertex_source( >>> gpu.types.GPUStageInterfaceInfo. flat( name no_perspective( smooth( >>> gpu.shader.create_from_info( ``` Reviewed By: fclem, campbellbarton Differential Revision: https://developer.blender.org/D14497
2022-04-04Cleanup: ensure space after file named in headersCampbell Barton
Add blank lines after file references to avoid them being interpreted as doc-strings the following declarations.
2022-02-11File headers: SPDX License migrationCampbell Barton
Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
2022-02-01GPUShader: Expose create_info getterClément Foucault
This allows to check if a create_info extists based on its name.
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-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-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-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: 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.
2021-12-09Cleanup: move public doc-strings into headers for 'gpu'Campbell Barton
Ref T92709
2021-11-05Fix T92807: Incorrect display planar tracking.Jeroen Bakker
Issue introduced in {7e66616b7e15} where the shader was replaced with a 2d image shader. This patch reverts several commits that removed the 3d image shader.
2021-09-23Cleanup: Remove hardcoded values and rename keyframe shape shadersDalai Felinto
No functional change. The shader is complicated by itself, having hardcoded values makes it even more cryptic. I also renamed the shader because the shader is not for the keyfarme diamond only, but for all the keyframe shapes. Differential Revision: https://developer.blender.org/D12615
2021-09-13GPUShader: Expose name for debugging & identifying shadersJon Denning
Added optional `name` argument to `GPUShader` constructor (defaults to `pyGPUShader`), and added `name` getter to `GPUShader`. Ref D12393 Reviewed By: campbellbarton, jbakker
2021-06-28Fix: Crash Requesting GPU_SHADER_GPENCIL_FILL builtin shader.Jeroen Bakker
Shader doesn't have any shader code. Requesting the shader would crash blender. Solved by removing the enum_value.
2021-05-26GPU: Compute Pipeline.Jeroen Bakker
With the compute pipeline calculation can be offloaded to the GPU. This patch only adds the framework for compute. So no changes for users at this moment. NOTE: As this is an OpenGL4.3 feature it must always have a fallback. Use `GPU_compute_shader_support` to check if compute pipeline can be used. Check `gpu_shader_compute*` test cases for usage. This patch also adds support for shader storage buffer objects and device only vertex/index buffers. An alternative that had been discussed was adding this to the `GPUBatch`, this was eventually not chosen as it would lead to more code when used as part of a shading group. The idea is that we add an `eDRWCommandType` in the near future. Reviewed By: fclem Differential Revision: https://developer.blender.org/D10913
2021-02-05Cleanup: correct spelling in commentsCampbell Barton
2020-12-16Cleanup: remove redundant struct declarationsCampbell Barton
2020-11-03Materials: add custom object properties as uniform attributes.Alexander Gavrilov
This patch allows the user to type a property name into the Attribute node, which will then output the value of the property for each individual object, allowing to e.g. customize shaders by object without duplicating the shader. In order to make supporting this easier for Eevee, it is necessary to explicitly choose whether the attribute is varying or uniform via a dropdown option of the Attribute node. The dropdown also allows choosing whether instancing should be taken into account. The Cycles design treats all attributes as one common namespace, so the Blender interface converts the enum to a name prefix that can't be entered using keyboard. In Eevee, the attributes are provided to the shader via a UBO indexed with resource_id, similar to the existing Object Info data. Unlike it, however, it is necessary to maintain a separate buffer for every requested combination of attributes. This is done using a hash table with the attribute set as the key, as it is expected that technically different but similar materials may use the same set of attributes. In addition, in order to minimize wasted memory, a sparse UBO pool is implemented, so that chunks that don't contain any data don't have to be allocated. The back-end Cycles code is already refactored and committed by Brecht. Differential Revision: https://developer.blender.org/D2057
2020-09-16GPUShader: Add meaningful debug names to builtin shadersClément Foucault
This makes the debugging easier.
2020-09-04Cleanup: Clang-Tidy readability-inconsistent-declaration-parameter-name fixSebastian Parborg
No functional changes
2020-08-21GPUShader: Make GPUShader* an opaque pointer to blender::gpu::ShaderClément Foucault
This avoids the misleading inheritance. Also cleanup by setting the blender::gpu::Shader as active shader to avoid some casting.
2020-08-21GPUUniformBuf: Rename struct and change API a bitClément Foucault
This follows the GPU module naming of other buffers. We pass name to distinguish each GPUUniformBuf in debug mode. Also remove DRW_uniform_buffer interface.
2020-08-20GPUShaderInterface: GL backend isolationClément Foucault
2020-08-18GPUShader: Improve auto nameClément Foucault
Use macro to get calling function name. Helps debugging shaders.
2020-08-18GPUShader: GL backend isolationClément Foucault
2020-08-13GPUShader: Add more uniform functionsClément Foucault
2020-08-07Merge branch 'blender-v2.90-release' into masterJacques Lucke
2020-08-07Code Style: use "#pragma once" in source directoryJacques Lucke
This replaces header include guards with `#pragma once`. A couple of include guards are not removed yet (e.g. `__RNA_TYPES_H__`), because they are used in other places. This patch has been generated by P1561 followed by `make format`. Differential Revision: https://developer.blender.org/D8466
2020-07-30GPUBatch & GPUImmediate: Use GPUShader instead of using raw OGL handleClément Foucault
2020-07-18Cleanup: GPUShader: Remove unused builtin shaderClément Foucault
2020-06-04GPUShaderInterface: Add Builtin Uniform blocks queryClément Foucault
This makes the query of theses mandatory uniforms faster.
2020-06-03DRW: Remove automatic bind locations and use hardcoded locations for texturesClément Foucault
This cleanup use the recent changes in shader interface to allow querying the binding location a texture should use. This should aleviate all issue we have with texture state change recompiling the shaders at drawtime. All binds are now treated like persistent binds and will stick until a new shading group bind a different shader. The only difference is that you can still change it with a new subgroup or same shader shgroup. Since unbinding can be heavy we only do it when using `--debug-gpu`.
2020-06-02Cleanup: GPU: Remove GPU_shaderinterface_uniform_ensureClément Foucault
2020-05-03Cleanup: sort file listsCampbell Barton
2020-04-24GPU: Add Polyline shader (wide line emulation)Clément Foucault
This new shader is able to emulate smooth wide lines drawing using a geometry shader. This shader needs viewportSize and lineWidth uniforms to be set. There is multiple variants to replace the usage of wide lines for most shaders. This patch only fix the gizmo_types files and the navigation gizmo. Other areas could be fixed afterward, I just limited the patch size. Fix T57570. Reviewed By: billreynish Differential Revision: https://developer.blender.org/D7487
2020-04-14GPUShader: Implement workaround for gizmo drawing on sRGB framebufferClément Foucault
This solution involves adding a uniform to each fragment shader that is used by gizmo drawing and use the framebuffer state to set this uniform accordingly. This solution can also be carried to external shaders (addons). A single line of code would then be enough to fix the issue. The only trickery here is the dummy define: `#define srgb_to_framebuffer_space(a)` This is in order to avoid breaking other DRW shaders that use the same fragment shader code but do not need the tranformation. Related to T74139 Reviewed By: brecht, campbellbarton Differential Revision: https://developer.blender.org/D7261
2020-03-27Cleanup: GPUShader: Remove unused shadersClément Foucault