|
Blender V5.0
|
Go to the source code of this file.
Namespaces | |
| namespace | blender |
| namespace | blender::gpu |
Macros | |
| #define | GPU_SHADER_BUILTIN_LEN (GPU_SHADER_3D_IMAGE_COLOR_SCENE_LINEAR_TO_REC709_SRGB + 1) |
| #define | GPU_SHADER_CFG_LEN (GPU_SHADER_CFG_CLIPPED + 1) |
Functions | |
| blender::gpu::Shader * | GPU_shader_get_builtin_shader_with_config (GPUBuiltinShader shader, GPUShaderConfig sh_cfg) |
| blender::gpu::Shader * | GPU_shader_get_builtin_shader (GPUBuiltinShader shader) |
| void | GPU_shader_builtin_warm_up () |
| void | GPU_shader_free_builtin_shaders () |
Set of shaders used for interface drawing.
2D shaders are not expected to work in 3D. 3D shaders can work with 2D geometry and matrices.
INST suffix means instance, which means the shader is build to leverage instancing capabilities to reduce the number of draw-calls.
For full list of parameters, search for the associated ShaderCreateInfo. Example: GPU_SHADER_ICON is defined by GPU_SHADER_CREATE_INFO(gpu_shader_icon) Some parameters are builtins and are set automatically (ex: ModelViewProjectionMatrix).
Definition in file GPU_shader_builtin.hh.
| #define GPU_SHADER_BUILTIN_LEN (GPU_SHADER_3D_IMAGE_COLOR_SCENE_LINEAR_TO_REC709_SRGB + 1) |
Definition at line 180 of file GPU_shader_builtin.hh.
Referenced by GPU_shader_free_builtin_shaders(), GPU_shader_get_builtin_shader_with_config(), and gpu_shader_warm_builtin_shader_async().
| #define GPU_SHADER_CFG_LEN (GPU_SHADER_CFG_CLIPPED + 1) |
Definition at line 187 of file GPU_shader_builtin.hh.
Referenced by GPU_shader_free_builtin_shaders().
| enum GPUBuiltinShader |
| Enumerator | |||||
|---|---|---|---|---|---|
| GPU_SHADER_TEXT | Glyph drawing shader used by the BLF module. | ||||
| GPU_SHADER_KEYFRAME_SHAPE | Draws keyframe markers. All markers shapes are supported through a single shader. | ||||
| GPU_SHADER_SIMPLE_LIGHTING | Draw solid mesh with a single distant light using a clamped simple dot product. | ||||
| GPU_SHADER_ICON | Draw an icon, leaving a semi-transparent rectangle on top of the icon. | ||||
| GPU_SHADER_2D_IMAGE_RECT_COLOR | Draw a texture with a uniform color multiplied. | ||||
| GPU_SHADER_2D_IMAGE_DESATURATE_COLOR | Draw a texture with a desaturation factor. | ||||
| GPU_SHADER_ICON_MULTI | Draw a group of texture rectangle with an associated color multiplied. | ||||
| GPU_SHADER_2D_CHECKER | Draw a two color checker based on screen position (not UV coordinates). | ||||
| GPU_SHADER_2D_DIAG_STRIPES | Draw diagonal stripes with two alternating colors. | ||||
| GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR | Draw dashed lines with custom dash length and uniform color. | ||||
| GPU_SHADER_3D_DEPTH_ONLY | Draw triangles / lines / points with only depth output. | ||||
| GPU_SHADER_2D_IMAGE_OVERLAYS_MERGE | Merge viewport overlay texture with the render output. | ||||
| GPU_SHADER_2D_IMAGE_OVERLAYS_STEREO_MERGE | |||||
| GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR | Merge viewport overlay texture with the render output. | ||||
| GPU_SHADER_GPENCIL_STROKE | Used for drawing of annotations (former grease pencil). | ||||
| GPU_SHADER_2D_AREA_BORDERS | Draw rounded area borders with silky smooth anti-aliasing without any over-draw. | ||||
| GPU_SHADER_2D_WIDGET_BASE | Multi usage widget shaders for drawing buttons and other UI elements. | ||||
| GPU_SHADER_2D_WIDGET_BASE_INST | |||||
| GPU_SHADER_2D_WIDGET_SHADOW | |||||
| GPU_SHADER_2D_NODE_SOCKET | Draw a node socket given it's bounding rectangle. All socket shapes are supported through a single shader. | ||||
| GPU_SHADER_2D_NODE_SOCKET_INST | |||||
| GPU_SHADER_2D_NODELINK | Draw a node link given an input quadratic Bezier curve. | ||||
| GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR | Draw round points with per vertex size and color. | ||||
| GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA | Draw round points with a uniform size. Disabling blending will disable AA. | ||||
| GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA | |||||
| GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA | Draw round points with a uniform size and an outline. Disabling blending will disable AA. | ||||
| GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR | Draw geometry with uniform color. Has an additional clip plane parameter. | ||||
| GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR | Draw wide lines with uniform color. Has an additional clip plane parameter. | ||||
| GPU_SHADER_SEQUENCER_STRIPS | Draw strip widgets in sequencer timeline. | ||||
| GPU_SHADER_SEQUENCER_THUMBS | Draw strip thumbnails in sequencer timeline. | ||||
| GPU_SHADER_SEQUENCER_SCOPE_RASTER | Rasterize sequencer scope points into buffers via compute. | ||||
| GPU_SHADER_SEQUENCER_SCOPE_RESOLVE | Resolve rasterized scope point buffers to display. | ||||
| GPU_SHADER_SEQUENCER_ZEBRA | Draw sequencer zebra pattern (overexposed regions). | ||||
| GPU_SHADER_XR_RAYCAST | Draw xr raycast as a ruled spline surface. | ||||
| GPU_SHADER_INDEXBUF_POINTS | Compute shaders to generate 2d index buffers (mainly for curve drawing). | ||||
| GPU_SHADER_INDEXBUF_LINES | |||||
| GPU_SHADER_INDEXBUF_TRIS | |||||
| GPU_SHADER_3D_FLAT_COLOR | --------------------— Shaders exposed through pyGPU module --------------------— Avoid breaking the interface of these shaders as they are used by addons. Polyline versions are used for drawing wide lines (> 1px width). Take a 3D position and color for each vertex without color interpolation.
| ||||
| GPU_SHADER_3D_POLYLINE_FLAT_COLOR | |||||
| GPU_SHADER_3D_POINT_FLAT_COLOR | |||||
| GPU_SHADER_3D_SMOOTH_COLOR | Take a 3D position and color for each vertex with perspective correct interpolation.
| ||||
| GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR | |||||
| GPU_SHADER_3D_UNIFORM_COLOR | Take a single color for all the vertices and a 3D position for each vertex.
| ||||
| GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR | |||||
| GPU_SHADER_3D_POINT_UNIFORM_COLOR | |||||
| GPU_SHADER_3D_IMAGE | Draw a sRGB color space texture in 3D. Texture color space is assumed to match the framebuffer. Take a 3D position and a 2D texture coordinate for each vertex. | ||||
| GPU_SHADER_3D_IMAGE_SCENE_LINEAR_TO_REC709_SRGB | Draw a scene linear color space texture in 3D. Texture value is transformed to the Rec.709 sRGB color space. Take a 3D position and a 2D texture coordinate for each vertex. | ||||
| GPU_SHADER_3D_IMAGE_COLOR | Draw a sRGB color space (with Rec.709 primaries) texture in 3D. Take a 3D position and color for each vertex with linear interpolation in window space. | ||||
| GPU_SHADER_3D_IMAGE_COLOR_SCENE_LINEAR_TO_REC709_SRGB | Draw a scene linear color space texture in 3D. Texture value is transformed to the Rec.709 sRGB color space. Take a 3D position and color for each vertex with linear interpolation in window space. | ||||
Definition at line 27 of file GPU_shader_builtin.hh.
| enum GPUShaderConfig |
Support multiple configurations.
| Enumerator | |
|---|---|
| GPU_SHADER_CFG_DEFAULT | |
| GPU_SHADER_CFG_CLIPPED | |
Definition at line 183 of file GPU_shader_builtin.hh.
| void GPU_shader_builtin_warm_up | ( | ) |
Definition at line 248 of file gpu_shader_builtin.cc.
References G, G_DEBUG_GPU, GPU_backend_get_type(), GPU_BACKEND_OPENGL, GPU_SHADER_2D_AREA_BORDERS, GPU_SHADER_2D_DIAG_STRIPES, GPU_SHADER_2D_IMAGE_DESATURATE_COLOR, GPU_SHADER_2D_IMAGE_RECT_COLOR, GPU_SHADER_2D_NODE_SOCKET, GPU_SHADER_2D_WIDGET_BASE, GPU_SHADER_2D_WIDGET_BASE_INST, GPU_SHADER_2D_WIDGET_SHADOW, GPU_SHADER_3D_IMAGE_COLOR, GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR, GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_SHADER_3D_UNIFORM_COLOR, GPU_SHADER_CFG_DEFAULT, GPU_SHADER_TEXT, gpu_shader_warm_builtin_shader_async(), and GPU_use_subprocess_compilation().
Referenced by GPU_init().
| void GPU_shader_free_builtin_shaders | ( | ) |
Definition at line 284 of file gpu_shader_builtin.cc.
References builtin_shaders, GPU_SHADER_BUILTIN_LEN, GPU_SHADER_CFG_LEN, GPU_shader_unbind(), and i.
Referenced by GPU_exit().
| blender::gpu::Shader * GPU_shader_get_builtin_shader | ( | GPUBuiltinShader | shader | ) |
Definition at line 243 of file gpu_shader_builtin.cc.
References GPU_SHADER_CFG_DEFAULT, and GPU_shader_get_builtin_shader_with_config().
Referenced by blender::draw::overlay::Cursor::begin_sync(), bpygpu_shader_is_polyline(), GPU_indexbuf_build_curves_on_device(), immBindBuiltinProgram(), immDrawPixelsTexSetup(), pygpu_batch_draw(), blender::render::hydra::ViewportEngine::render(), blender::ed::vse::sequencer_draw_scopes(), blender::ed::vse::StripsDrawBatch::StripsDrawBatch(), blender::draw::test_draw_pass_all_commands(), blender::draw::test_draw_pass_multi_draw(), blender::draw::test_draw_pass_simple_draw(), blender::draw::test_draw_pass_sub_ordering(), blender::draw::test_draw_resource_id_gen(), blender::draw::test_draw_submit_only(), blender::draw::test_draw_visibility(), blender::ed::vse::ThumbsDrawBatch::ThumbsDrawBatch(), and wm_draw_region_blend().
| blender::gpu::Shader * GPU_shader_get_builtin_shader_with_config | ( | GPUBuiltinShader | shader, |
| GPUShaderConfig | sh_cfg ) |
Definition at line 157 of file gpu_shader_builtin.cc.
References BLI_assert, builtin_shader_create_info_name(), builtin_shader_create_info_name_clipped(), builtin_shaders, ELEM, GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR, GPU_SHADER_3D_POLYLINE_FLAT_COLOR, GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_shader_bind(), GPU_SHADER_BUILTIN_LEN, GPU_SHADER_CFG_CLIPPED, GPU_SHADER_CFG_DEFAULT, GPU_shader_uniform_1i(), and blender::gpu::Shader::is_polyline.
Referenced by GPU_batch_program_set_builtin_with_config(), GPU_shader_get_builtin_shader(), and pygpu_shader_from_builtin().