Vulkan: Clearing Storage Buffers #105487

Merged
Jeroen Bakker merged 94 commits from Jeroen-Bakker/blender:vulkan-storage-buffer-clear into main 2023-03-17 13:48:50 +01:00
31 changed files with 131 additions and 597 deletions
Showing only changes of commit 556ef545b3 - Show all commits

View File

@ -1437,6 +1437,9 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
BVHOptiX *const blas = static_cast<BVHOptiX *>(ob->get_geometry()->bvh);
OptixTraversableHandle handle = blas->traversable_handle;
if (handle == 0) {
continue;
}
OptixInstance &instance = instances[num_instances++];
memset(&instance, 0, sizeof(instance));

View File

@ -401,13 +401,15 @@ static bool checkLayerSupport(vector<VkLayerProperties> &layers_available, const
static void enableLayer(vector<VkLayerProperties> &layers_available,
vector<const char *> &layers_enabled,
const char *layer_name)
const char *layer_name,
const bool debug)
{
if (checkLayerSupport(layers_available, layer_name)) {
layers_enabled.push_back(layer_name);
}
else {
fprintf(stderr, "Error: %s not supported.\n", layer_name);
else if (debug) {
fprintf(
stderr, "Warning: Layer requested, but not supported by the platform. [%s]\n", layer_name);
}
}
@ -862,7 +864,7 @@ GHOST_TSuccess GHOST_ContextVK::initializeDrawingContext()
vector<const char *> layers_enabled;
if (m_debug) {
enableLayer(layers_available, layers_enabled, "VK_LAYER_KHRONOS_validation");
enableLayer(layers_available, layers_enabled, "VK_LAYER_KHRONOS_validation", m_debug);
}
vector<const char *> extensions_device;

View File

@ -157,6 +157,7 @@ const UserDef U_default = {
.glalphaclip = 0.004,
.autokey_mode = (AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON),
.autokey_flag = AUTOKEY_FLAG_XYZ2RGB,
.animation_flag = USER_ANIM_HIGH_QUALITY_DRAWING,
.text_render = 0,
.navigation_mode = VIEW_NAVIGATION_WALK,
.view_rotate_sensitivity_turntable = DEG2RAD(0.4),

View File

@ -107,16 +107,9 @@ class GRAPH_MT_view(Menu):
layout.separator()
layout.prop(st, "show_markers")
layout.separator()
layout.prop(st, "use_beauty_drawing")
layout.separator()
layout.prop(st, "show_extrapolation")
layout.prop(st, "show_handles")
layout.prop(st, "use_only_selected_curves_handles")
layout.prop(st, "use_only_selected_keyframe_handles")
layout.prop(st, "show_seconds")

View File

@ -559,6 +559,8 @@ class USERPREF_PT_animation_fcurves(AnimationPanel, CenterAlignMixIn, Panel):
flow.prop(edit, "keyframe_new_handle_type", text="Default Handles")
flow.prop(edit, "use_insertkey_xyz_to_rgb", text="XYZ to RGB")
flow.prop(edit, "use_anim_channel_group_colors")
flow.prop(edit, "show_only_selected_curve_keyframes")
flow.prop(edit, "use_fcurve_high_quality_drawing")
# -----------------------------------------------------------------------------

View File

@ -25,7 +25,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 1
#define BLENDER_FILE_SUBVERSION 2
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and show a warning if the file

View File

@ -72,7 +72,7 @@ void BKE_callback_exec_id_depsgraph(struct Main *bmain,
void BKE_callback_exec_string(struct Main *bmain, eCbEvent evt, const char *str)
{
PointerRNA str_ptr;
PrimitiveStringRNA data = {};
PrimitiveStringRNA data = {NULL};
data.value = str;
RNA_pointer_create(NULL, &RNA_PrimitiveString, &data, &str_ptr);

View File

@ -783,6 +783,10 @@ void blo_do_versions_userdef(UserDef *userdef)
}
}
if (!USER_VERSION_ATLEAST(306, 2)) {
userdef->animation_flag |= USER_ANIM_HIGH_QUALITY_DRAWING;
}
/**
* Versioning code until next subversion bump goes here.
*

View File

@ -823,7 +823,6 @@ if(WITH_GTESTS)
tests/draw_pass_test.cc
tests/draw_testing.cc
tests/eevee_test.cc
tests/shaders_test.cc
tests/draw_testing.hh
)

View File

@ -1,416 +0,0 @@
/* SPDX-License-Identifier: Apache-2.0 */
#include "testing/testing.h"
#include "draw_testing.hh"
#include "GPU_context.h"
#include "GPU_index_buffer.h"
#include "GPU_init_exit.h"
#include "GPU_shader.h"
#include "GPU_texture.h"
#include "GPU_vertex_buffer.h"
#include "intern/draw_manager_testing.h"
#include "engines/basic/basic_private.h"
#include "engines/eevee/eevee_private.h"
#include "engines/gpencil/gpencil_engine.h"
#include "engines/image/image_private.hh"
#include "engines/overlay/overlay_private.hh"
#include "engines/workbench/workbench_private.h"
#include "intern/draw_shader.h"
namespace blender::draw {
using namespace blender::draw::image_engine;
static void test_workbench_glsl_shaders()
{
const int MAX_WPD = 6;
WORKBENCH_PrivateData wpds[MAX_WPD];
wpds[0].sh_cfg = GPU_SHADER_CFG_DEFAULT;
wpds[0].shading.light = V3D_LIGHTING_FLAT;
wpds[1].sh_cfg = GPU_SHADER_CFG_DEFAULT;
wpds[1].shading.light = V3D_LIGHTING_MATCAP;
wpds[2].sh_cfg = GPU_SHADER_CFG_DEFAULT;
wpds[2].shading.light = V3D_LIGHTING_STUDIO;
wpds[3].sh_cfg = GPU_SHADER_CFG_CLIPPED;
wpds[3].shading.light = V3D_LIGHTING_FLAT;
wpds[4].sh_cfg = GPU_SHADER_CFG_CLIPPED;
wpds[4].shading.light = V3D_LIGHTING_MATCAP;
wpds[5].sh_cfg = GPU_SHADER_CFG_CLIPPED;
wpds[5].shading.light = V3D_LIGHTING_STUDIO;
for (int wpd_index = 0; wpd_index < MAX_WPD; wpd_index++) {
WORKBENCH_PrivateData *wpd = &wpds[wpd_index];
EXPECT_NE(workbench_shader_opaque_get(wpd, WORKBENCH_DATATYPE_MESH), nullptr);
EXPECT_NE(workbench_shader_opaque_get(wpd, WORKBENCH_DATATYPE_HAIR), nullptr);
EXPECT_NE(workbench_shader_opaque_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD), nullptr);
EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_MESH, false), nullptr);
EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_MESH, true), nullptr);
EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_HAIR, false), nullptr);
EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_HAIR, true), nullptr);
EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD, false),
nullptr);
EXPECT_NE(workbench_shader_opaque_image_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD, true),
nullptr);
EXPECT_NE(workbench_shader_composite_get(wpd), nullptr);
EXPECT_NE(workbench_shader_merge_infront_get(wpd), nullptr);
EXPECT_NE(workbench_shader_transparent_get(wpd, WORKBENCH_DATATYPE_MESH), nullptr);
EXPECT_NE(workbench_shader_transparent_get(wpd, WORKBENCH_DATATYPE_HAIR), nullptr);
EXPECT_NE(workbench_shader_transparent_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD), nullptr);
EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_MESH, false),
nullptr);
EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_MESH, true), nullptr);
EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_HAIR, false),
nullptr);
EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_HAIR, true), nullptr);
EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD, false),
nullptr);
EXPECT_NE(workbench_shader_transparent_image_get(wpd, WORKBENCH_DATATYPE_POINTCLOUD, true),
nullptr);
EXPECT_NE(workbench_shader_transparent_resolve_get(wpd), nullptr);
}
EXPECT_NE(workbench_shader_shadow_pass_get(false), nullptr);
EXPECT_NE(workbench_shader_shadow_pass_get(true), nullptr);
EXPECT_NE(workbench_shader_shadow_fail_get(false, false), nullptr);
EXPECT_NE(workbench_shader_shadow_fail_get(false, true), nullptr);
EXPECT_NE(workbench_shader_shadow_fail_get(true, false), nullptr);
EXPECT_NE(workbench_shader_shadow_fail_get(true, true), nullptr);
/* NOTE: workbench_shader_cavity_get(false, false) isn't a valid option. */
EXPECT_NE(workbench_shader_cavity_get(false, true), nullptr);
EXPECT_NE(workbench_shader_cavity_get(true, false), nullptr);
EXPECT_NE(workbench_shader_cavity_get(true, true), nullptr);
EXPECT_NE(workbench_shader_outline_get(), nullptr);
EXPECT_NE(workbench_shader_antialiasing_accumulation_get(), nullptr);
EXPECT_NE(workbench_shader_antialiasing_get(0), nullptr);
EXPECT_NE(workbench_shader_antialiasing_get(1), nullptr);
EXPECT_NE(workbench_shader_antialiasing_get(2), nullptr);
EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_LINEAR, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_LINEAR, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_CUBIC, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_CUBIC, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_CLOSEST, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, false, WORKBENCH_VOLUME_INTERP_CLOSEST, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_LINEAR, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_LINEAR, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_CUBIC, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_CUBIC, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_CLOSEST, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(false, true, WORKBENCH_VOLUME_INTERP_CLOSEST, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_LINEAR, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_LINEAR, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_CUBIC, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_CUBIC, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_CLOSEST, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, false, WORKBENCH_VOLUME_INTERP_CLOSEST, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_LINEAR, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_LINEAR, true),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_CUBIC, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_CUBIC, true), nullptr);
EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_CLOSEST, false),
nullptr);
EXPECT_NE(workbench_shader_volume_get(true, true, WORKBENCH_VOLUME_INTERP_CLOSEST, true),
nullptr);
GPUShader *dof_prepare_sh;
GPUShader *dof_downsample_sh;
GPUShader *dof_blur1_sh;
GPUShader *dof_blur2_sh;
GPUShader *dof_resolve_sh;
workbench_shader_depth_of_field_get(
&dof_prepare_sh, &dof_downsample_sh, &dof_blur1_sh, &dof_blur2_sh, &dof_resolve_sh);
EXPECT_NE(dof_prepare_sh, nullptr);
EXPECT_NE(dof_downsample_sh, nullptr);
EXPECT_NE(dof_blur1_sh, nullptr);
EXPECT_NE(dof_blur2_sh, nullptr);
EXPECT_NE(dof_resolve_sh, nullptr);
workbench_shader_free();
}
DRAW_TEST(workbench_glsl_shaders)
static void test_gpencil_glsl_shaders()
{
EXPECT_NE(GPENCIL_shader_antialiasing(0), nullptr);
EXPECT_NE(GPENCIL_shader_antialiasing(1), nullptr);
EXPECT_NE(GPENCIL_shader_antialiasing(2), nullptr);
EXPECT_NE(GPENCIL_shader_geometry_get(), nullptr);
EXPECT_NE(GPENCIL_shader_layer_blend_get(), nullptr);
EXPECT_NE(GPENCIL_shader_mask_invert_get(), nullptr);
EXPECT_NE(GPENCIL_shader_depth_merge_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_blur_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_colorize_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_composite_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_transform_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_glow_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_pixelize_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_rim_get(), nullptr);
EXPECT_NE(GPENCIL_shader_fx_shadow_get(), nullptr);
GPENCIL_shader_free();
}
DRAW_TEST(gpencil_glsl_shaders)
static void test_image_glsl_shaders()
{
EXPECT_NE(IMAGE_shader_image_get(), nullptr);
EXPECT_NE(IMAGE_shader_depth_get(), nullptr);
IMAGE_shader_free();
}
DRAW_TEST(image_glsl_shaders)
static void test_overlay_glsl_shaders()
{
for (int i = 0; i < 2; i++) {
eGPUShaderConfig sh_cfg = i == 0 ? GPU_SHADER_CFG_DEFAULT : GPU_SHADER_CFG_CLIPPED;
DRW_draw_state_init_gtests(sh_cfg);
EXPECT_NE(OVERLAY_shader_antialiasing(), nullptr);
EXPECT_NE(OVERLAY_shader_armature_degrees_of_freedom_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_armature_degrees_of_freedom_solid(), nullptr);
EXPECT_NE(OVERLAY_shader_armature_envelope(false), nullptr);
EXPECT_NE(OVERLAY_shader_armature_envelope(true), nullptr);
EXPECT_NE(OVERLAY_shader_armature_shape(false), nullptr);
EXPECT_NE(OVERLAY_shader_armature_shape(true), nullptr);
EXPECT_NE(OVERLAY_shader_armature_shape_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_armature_sphere(false), nullptr);
EXPECT_NE(OVERLAY_shader_armature_sphere(true), nullptr);
EXPECT_NE(OVERLAY_shader_armature_stick(), nullptr);
EXPECT_NE(OVERLAY_shader_armature_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_background(), nullptr);
EXPECT_NE(OVERLAY_shader_clipbound(), nullptr);
EXPECT_NE(OVERLAY_shader_depth_only(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_curve_handle(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_curve_point(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_curve_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_gpencil_guide_point(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_gpencil_point(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_gpencil_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_lattice_point(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_lattice_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_analysis(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_depth(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_edge(false), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_edge(true), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_face(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_facedot(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_normal(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_skin_root(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_mesh_vert(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_particle_strand(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_particle_point(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_edges_get(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_face_get(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_face_dots_get(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_verts_get(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_stretching_area_get(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_stretching_angle_get(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_tiled_image_borders_get(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_stencil_image(), nullptr);
EXPECT_NE(OVERLAY_shader_edit_uv_mask_image(), nullptr);
EXPECT_NE(OVERLAY_shader_extra(false), nullptr);
EXPECT_NE(OVERLAY_shader_extra(true), nullptr);
EXPECT_NE(OVERLAY_shader_extra_groundline(), nullptr);
EXPECT_NE(OVERLAY_shader_extra_wire(false, false), nullptr);
EXPECT_NE(OVERLAY_shader_extra_wire(false, true), nullptr);
EXPECT_NE(OVERLAY_shader_extra_wire(true, false), nullptr);
EXPECT_NE(OVERLAY_shader_extra_wire(true, true), nullptr);
EXPECT_NE(OVERLAY_shader_extra_loose_point(), nullptr);
EXPECT_NE(OVERLAY_shader_extra_point(), nullptr);
EXPECT_NE(OVERLAY_shader_facing(), nullptr);
EXPECT_NE(OVERLAY_shader_gpencil_canvas(), nullptr);
EXPECT_NE(OVERLAY_shader_grid(), nullptr);
EXPECT_NE(OVERLAY_shader_grid_image(), nullptr);
EXPECT_NE(OVERLAY_shader_image(), nullptr);
EXPECT_NE(OVERLAY_shader_motion_path_line(), nullptr);
EXPECT_NE(OVERLAY_shader_motion_path_vert(), nullptr);
EXPECT_NE(OVERLAY_shader_uniform_color(), nullptr);
EXPECT_NE(OVERLAY_shader_uniform_color_pointcloud(), nullptr);
EXPECT_NE(OVERLAY_shader_outline_prepass(false), nullptr);
EXPECT_NE(OVERLAY_shader_outline_prepass(true), nullptr);
EXPECT_NE(OVERLAY_shader_outline_prepass_curves(), nullptr);
EXPECT_NE(OVERLAY_shader_outline_prepass_gpencil(), nullptr);
EXPECT_NE(OVERLAY_shader_outline_prepass_pointcloud(), nullptr);
EXPECT_NE(OVERLAY_shader_extra_grid(), nullptr);
EXPECT_NE(OVERLAY_shader_outline_detect(), nullptr);
EXPECT_NE(OVERLAY_shader_paint_face(), nullptr);
EXPECT_NE(OVERLAY_shader_paint_point(), nullptr);
EXPECT_NE(OVERLAY_shader_paint_texture(), nullptr);
EXPECT_NE(OVERLAY_shader_paint_vertcol(), nullptr);
EXPECT_NE(OVERLAY_shader_paint_weight(false), nullptr);
EXPECT_NE(OVERLAY_shader_paint_weight(true), nullptr);
EXPECT_NE(OVERLAY_shader_paint_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_particle_dot(), nullptr);
EXPECT_NE(OVERLAY_shader_particle_shape(), nullptr);
EXPECT_NE(OVERLAY_shader_sculpt_mask(), nullptr);
EXPECT_NE(OVERLAY_shader_sculpt_curves_selection(), nullptr);
EXPECT_NE(OVERLAY_shader_viewer_attribute_curve(), nullptr);
EXPECT_NE(OVERLAY_shader_viewer_attribute_curves(), nullptr);
EXPECT_NE(OVERLAY_shader_viewer_attribute_mesh(), nullptr);
EXPECT_NE(OVERLAY_shader_viewer_attribute_pointcloud(), nullptr);
EXPECT_NE(OVERLAY_shader_volume_velocity(false, false), nullptr);
EXPECT_NE(OVERLAY_shader_volume_velocity(false, true), nullptr);
EXPECT_NE(OVERLAY_shader_volume_velocity(true, false), nullptr);
EXPECT_NE(OVERLAY_shader_wireframe(false), nullptr);
EXPECT_NE(OVERLAY_shader_wireframe(true), nullptr);
EXPECT_NE(OVERLAY_shader_wireframe_select(), nullptr);
EXPECT_NE(OVERLAY_shader_xray_fade(), nullptr);
}
OVERLAY_shader_free();
}
DRAW_TEST(overlay_glsl_shaders)
static void test_eevee_glsl_shaders_static()
{
EEVEE_shaders_material_shaders_init();
EXPECT_NE(EEVEE_shaders_bloom_blit_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_bloom_blit_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_bloom_downsample_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_bloom_downsample_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_bloom_upsample_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_bloom_upsample_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_bloom_resolve_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_bloom_resolve_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_bokeh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_setup_get(), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_flatten_tiles_get(), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_dilate_tiles_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_dilate_tiles_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_downsample_get(), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_reduce_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_reduce_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_FOREGROUND, false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_FOREGROUND, true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_BACKGROUND, false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_BACKGROUND, true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_HOLEFILL, false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_gather_get(DOF_GATHER_HOLEFILL, true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_filter_get(), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_scatter_get(false, false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_scatter_get(false, true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_scatter_get(true, false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_scatter_get(true, true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_resolve_get(false, true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_resolve_get(false, false), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_resolve_get(true, true), nullptr);
EXPECT_NE(EEVEE_shaders_depth_of_field_resolve_get(true, false), nullptr);
EXPECT_NE(EEVEE_shaders_effect_downsample_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_downsample_cube_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_minz_downlevel_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_maxz_downlevel_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_minz_downdepth_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_maxz_downdepth_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_minz_downdepth_layer_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_maxz_downdepth_layer_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_maxz_copydepth_layer_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_minz_copydepth_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_maxz_copydepth_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_mist_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_motion_blur_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_motion_blur_object_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_motion_blur_hair_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_motion_blur_velocity_tiles_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_motion_blur_velocity_tiles_expand_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_ambient_occlusion_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_ambient_occlusion_debug_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_ggx_lut_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_ggx_refraction_lut_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_filter_glossy_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_filter_diffuse_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_filter_visibility_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_grid_fill_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_planar_downsample_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_renderpasses_post_process_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_cryptomatte_sh_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_cryptomatte_sh_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_shadow_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_shadow_accum_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_subsurface_first_pass_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_subsurface_second_pass_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_clear_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_clear_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_scatter_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_scatter_with_lights_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_integration_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_resolve_sh_get(false), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_resolve_sh_get(true), nullptr);
EXPECT_NE(EEVEE_shaders_volumes_accum_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_studiolight_probe_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_studiolight_background_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_cube_display_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_grid_display_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_probe_planar_display_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_update_noise_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_velocity_resolve_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_taa_resolve_sh_get(EFFECT_TAA), nullptr);
EXPECT_NE(EEVEE_shaders_taa_resolve_sh_get(EFFECT_TAA_REPROJECT), nullptr);
EXPECT_NE(EEVEE_shaders_effect_reflection_trace_sh_get(), nullptr);
EXPECT_NE(EEVEE_shaders_effect_reflection_resolve_sh_get(), nullptr);
EEVEE_shaders_free();
}
DRAW_TEST(eevee_glsl_shaders_static)
static void test_draw_shaders(eParticleRefineShaderType sh_type)
{
DRW_shaders_free();
EXPECT_NE(DRW_shader_hair_refine_get(PART_REFINE_CATMULL_ROM, sh_type), nullptr);
DRW_shaders_free();
}
static void test_draw_glsl_shaders()
{
#ifndef __APPLE__
test_draw_shaders(PART_REFINE_SHADER_TRANSFORM_FEEDBACK);
test_draw_shaders(PART_REFINE_SHADER_COMPUTE);
#endif
test_draw_shaders(PART_REFINE_SHADER_TRANSFORM_FEEDBACK_WORKAROUND);
}
DRAW_TEST(draw_glsl_shaders)
static void test_basic_glsl_shaders()
{
for (int i = 0; i < GPU_SHADER_CFG_LEN; i++) {
eGPUShaderConfig sh_cfg = static_cast<eGPUShaderConfig>(i);
BASIC_shaders_depth_sh_get(sh_cfg);
BASIC_shaders_pointcloud_depth_sh_get(sh_cfg);
BASIC_shaders_curves_depth_sh_get(sh_cfg);
BASIC_shaders_depth_conservative_sh_get(sh_cfg);
BASIC_shaders_pointcloud_depth_conservative_sh_get(sh_cfg);
}
BASIC_shaders_free();
}
DRAW_TEST(basic_glsl_shaders)
} // namespace blender::draw

View File

@ -264,7 +264,7 @@ static bool graphedit_get_context(bAnimContext *ac, SpaceGraph *sipo)
ac->ads = sipo->ads;
/* set settings for Graph Editor - "Selected = Editable" */
if (sipo->flag & SIPO_SELCUVERTSONLY) {
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) {
sipo->ads->filterflag |= ADS_FILTER_SELEDIT;
}
else {

View File

@ -5809,7 +5809,6 @@ void uiLayoutSetTooltipFunc(uiLayout *layout,
if (copy_arg != nullptr && arg_used) {
arg = copy_arg(arg);
}
arg_used = true;
if (item->type == ITEM_BUTTON) {
uiButtonItem *bitem = (uiButtonItem *)item;
@ -5817,9 +5816,11 @@ void uiLayoutSetTooltipFunc(uiLayout *layout,
continue;
}
UI_but_func_tooltip_set(bitem->but, func, arg, free_arg);
arg_used = true;
}
else {
uiLayoutSetTooltipFunc((uiLayout *)item, func, arg, copy_arg, free_arg);
arg_used = true;
}
}

View File

@ -406,7 +406,7 @@ static void draw_fcurve_handles(SpaceGraph *sipo, FCurve *fcu)
uint color = GPU_vertformat_attr_add(
format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(true);
}
GPU_blend(GPU_BLEND_ALPHA);
@ -482,7 +482,7 @@ static void draw_fcurve_handles(SpaceGraph *sipo, FCurve *fcu)
immEnd();
immUnbindProgram();
GPU_blend(GPU_BLEND_NONE);
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(false);
}
}
@ -515,7 +515,7 @@ static void draw_fcurve_sample_control(
}
/* helper func - draw keyframe vertices only for an F-Curve */
static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *region, FCurve *fcu)
static void draw_fcurve_samples(ARegion *region, FCurve *fcu)
{
FPoint *first, *last;
float hsize, xscale, yscale;
@ -531,7 +531,7 @@ static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *region, FCurve *fcu)
/* draw */
if (first && last) {
/* anti-aliased lines for more consistent appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(true);
}
GPU_blend(GPU_BLEND_ALPHA);
@ -547,7 +547,7 @@ static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *region, FCurve *fcu)
immUnbindProgram();
GPU_blend(GPU_BLEND_NONE);
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(false);
}
}
@ -565,7 +565,6 @@ static void draw_fcurve_curve(bAnimContext *ac,
const bool use_nla_remap,
const bool draw_extrapolation)
{
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
short mapping_flag = ANIM_get_normalization_flags(ac);
/* when opening a blend file on a different sized screen or while dragging the toolbar this can
@ -601,7 +600,7 @@ static void draw_fcurve_curve(bAnimContext *ac,
float pixels_per_sample = 1.5f;
float samplefreq = pixels_per_sample / UI_view2d_scale_get_x(v2d);
if (sipo->flag & SIPO_BEAUTYDRAW_OFF) {
if (!(U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING)) {
/* Low Precision = coarse lower-bound clamping
*
* Although the "Beauty Draw" flag was originally for AA'd
@ -1030,7 +1029,7 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
}
/* anti-aliased lines for less jagged appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(true);
}
GPU_blend(GPU_BLEND_ALPHA);
@ -1105,7 +1104,7 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
immUnbindProgram();
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(false);
}
GPU_blend(GPU_BLEND_NONE);
@ -1115,7 +1114,8 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
* - If the option to only show controls if the F-Curve is selected is enabled,
* we must obey this.
*/
if (!(sipo->flag & SIPO_SELCUVERTSONLY) || (fcu->flag & FCURVE_SELECTED)) {
if (!(U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) ||
(fcu->flag & FCURVE_SELECTED)) {
if (!BKE_fcurve_are_keyframes_usable(fcu) && !(fcu->fpt && fcu->totvert)) {
/* only draw controls if this is the active modifier */
if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) {
@ -1153,7 +1153,7 @@ static void draw_fcurve(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, bAn
}
else {
/* samples: only draw two indicators at either end as indicators */
draw_fcurve_samples(sipo, region, fcu);
draw_fcurve_samples(region, fcu);
}
GPU_matrix_pop();
@ -1300,7 +1300,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region
GPU_line_width(3.0f);
/* anti-aliased lines for less jagged appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(true);
}
GPU_blend(GPU_BLEND_ALPHA);
@ -1333,7 +1333,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region
immUnbindProgram();
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
if (U.animation_flag & USER_ANIM_HIGH_QUALITY_DRAWING) {
GPU_line_smooth(false);
}
GPU_blend(GPU_BLEND_NONE);

View File

@ -172,8 +172,9 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
*/
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY |
ANIMFILTER_NODUPLIS | ANIMFILTER_FCURVESONLY);
if (sipo->flag &
SIPO_SELCUVERTSONLY) { /* FIXME: this should really be check for by the filtering code... */
if (U.animation_flag &
USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) { /* FIXME: this should really be check for by the
filtering code... */
filter |= ANIMFILTER_SEL;
}
mapping_flag |= ANIM_get_normalization_flags(ac);
@ -336,7 +337,6 @@ void deselect_graph_keys(bAnimContext *ac, bool test, short sel, bool do_channel
bAnimListElem *ale;
int filter;
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
KeyframeEditData ked = {{NULL}};
KeyframeEditFunc test_cb, sel_cb;
@ -374,7 +374,7 @@ void deselect_graph_keys(bAnimContext *ac, bool test, short sel, bool do_channel
if (do_channels) {
/* Only change selection of channel when the visibility of keyframes
* doesn't depend on this. */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
if ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) == 0) {
/* deactivate the F-Curve, and deselect if deselecting keyframes.
* otherwise select the F-Curve too since we've selected all the keyframes
*/
@ -496,11 +496,11 @@ static rctf initialize_box_select_coords(const bAnimContext *ac, const rctf *rec
return rectf;
}
static int initialize_animdata_selection_filter(const SpaceGraph *sipo)
static int initialize_animdata_selection_filter(void)
{
int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY |
ANIMFILTER_NODUPLIS);
if (sipo->flag & SIPO_SELCUVERTSONLY) {
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) {
filter |= ANIMFILTER_FOREDIT | ANIMFILTER_SELEDIT;
}
return filter;
@ -513,8 +513,7 @@ static ListBase initialize_box_select_anim_data(const int filter, bAnimContext *
return anim_data;
}
static void initialize_box_select_key_editing_data(const SpaceGraph *sipo,
const bool incl_handles,
static void initialize_box_select_key_editing_data(const bool incl_handles,
const short mode,
bAnimContext *ac,
void *data,
@ -540,7 +539,7 @@ static void initialize_box_select_key_editing_data(const SpaceGraph *sipo,
r_ked->data = scaled_rectf;
break;
}
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
if (sipo->flag & SIPO_SELVHANDLESONLY) {
r_ked->iterflags |= KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE;
}
@ -574,14 +573,13 @@ static bool box_select_graphkeys(bAnimContext *ac,
void *data)
{
const rctf rectf = initialize_box_select_coords(ac, rectf_view);
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
const int filter = initialize_animdata_selection_filter(sipo);
const int filter = initialize_animdata_selection_filter();
ListBase anim_data = initialize_box_select_anim_data(filter, ac);
rctf scaled_rectf;
KeyframeEditData ked;
int mapping_flag;
initialize_box_select_key_editing_data(
sipo, incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag);
incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag);
/* Get beztriple editing/validation functions. */
const KeyframeEditFunc select_cb = ANIM_editkeyframes_select(selectmode);
@ -633,7 +631,7 @@ static bool box_select_graphkeys(bAnimContext *ac,
any_key_selection_changed = true;
/* Only change selection of channel when the visibility of keyframes
* doesn't depend on this. */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
if ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) == 0) {
/* select the curve too now that curve will be touched */
if (selectmode == SELECT_ADD) {
fcu->flag |= FCURVE_SELECTED;
@ -733,14 +731,13 @@ static void box_select_graphcurves(bAnimContext *ac,
const bool incl_handles,
void *data)
{
const SpaceGraph *sipo = (SpaceGraph *)ac->sl;
const int filter = initialize_animdata_selection_filter(sipo);
const int filter = initialize_animdata_selection_filter();
ListBase anim_data = initialize_box_select_anim_data(filter, ac);
rctf scaled_rectf;
KeyframeEditData ked;
int mapping_flag;
initialize_box_select_key_editing_data(
sipo, incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag);
incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag);
FCurve *last_selected_curve = NULL;
@ -1707,7 +1704,7 @@ static int mouse_graph_keys(bAnimContext *ac,
/* Deselect other channels too, but only do this if selection of channel
* when the visibility of keyframes doesn't depend on this. */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
if ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) == 0) {
ANIM_anim_channels_select_set(ac, ACHANNEL_SETFLAG_CLEAR);
}
}
@ -1780,7 +1777,7 @@ static int mouse_graph_keys(bAnimContext *ac,
}
/* only change selection of channel when the visibility of keyframes doesn't depend on this */
if ((sipo->flag & SIPO_SELCUVERTSONLY) == 0) {
if ((U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) == 0) {
/* select or deselect curve? */
if (bezt) {
/* take selection status from item that got hit, to prevent flip/flop on channel

View File

@ -49,7 +49,6 @@ void get_graph_keyframe_extents(bAnimContext *ac,
const bool include_handles)
{
Scene *scene = ac->scene;
SpaceGraph *sipo = (SpaceGraph *)ac->sl;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
@ -58,7 +57,7 @@ void get_graph_keyframe_extents(bAnimContext *ac,
/* Get data to filter, from Dopesheet. */
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY |
ANIMFILTER_NODUPLIS);
if (sipo->flag & SIPO_SELCUVERTSONLY) {
if (U.animation_flag & USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) {
filter |= ANIMFILTER_SEL;
}

View File

@ -68,7 +68,7 @@ static SpaceLink *graph_create(const ScrArea *UNUSED(area), const Scene *scene)
/* settings for making it easier by default to just see what you're interested in tweaking */
sipo->ads->filterflag |= ADS_FILTER_ONLYSEL;
sipo->flag |= SIPO_SELVHANDLESONLY | SIPO_SHOW_MARKERS;
sipo->flag |= SIPO_SHOW_MARKERS;
/* header */
region = MEM_callocN(sizeof(ARegion), "header for graphedit");

View File

@ -811,7 +811,6 @@ if(WITH_GTESTS)
tests/gpu_index_buffer_test.cc
tests/gpu_push_constants_test.cc
tests/gpu_shader_builtin_test.cc
tests/gpu_shader_test.cc
tests/gpu_storage_buffer_test.cc

View File

@ -1,68 +0,0 @@
/* SPDX-License-Identifier: Apache-2.0 */
#include "gpu_testing.hh"
#include "GPU_shader.h"
namespace blender::gpu::tests {
static void test_compile_builtin_shader(eGPUBuiltinShader shader_type, eGPUShaderConfig sh_cfg)
{
GPUShader *sh = GPU_shader_get_builtin_shader_with_config(shader_type, sh_cfg);
EXPECT_NE(sh, nullptr);
}
static void test_compile_builtin_shader(eGPUBuiltinShader shader_type)
{
test_compile_builtin_shader(shader_type, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(shader_type, GPU_SHADER_CFG_CLIPPED);
}
static void test_shader_builtin()
{
GPU_shader_free_builtin_shaders();
test_compile_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
test_compile_builtin_shader(GPU_SHADER_3D_SMOOTH_COLOR);
test_compile_builtin_shader(GPU_SHADER_3D_DEPTH_ONLY);
test_compile_builtin_shader(GPU_SHADER_3D_FLAT_COLOR);
test_compile_builtin_shader(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
test_compile_builtin_shader(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA);
test_compile_builtin_shader(GPU_SHADER_TEXT, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_KEYFRAME_SHAPE, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_SIMPLE_LIGHTING, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_IMAGE, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_IMAGE_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_IMAGE_DESATURATE_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_IMAGE_RECT_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_ICON_MULTI, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_CHECKER, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_DIAG_STRIPES, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR,
GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_POLYLINE_FLAT_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_IMAGE_OVERLAYS_MERGE, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_IMAGE_OVERLAYS_STEREO_MERGE, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA,
GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA,
GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR,
GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_GPENCIL_STROKE, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_AREA_BORDERS, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_WIDGET_BASE, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_WIDGET_BASE_INST, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_WIDGET_SHADOW, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_NODELINK, GPU_SHADER_CFG_DEFAULT);
test_compile_builtin_shader(GPU_SHADER_2D_NODELINK_INST, GPU_SHADER_CFG_DEFAULT);
}
GPU_TEST(shader_builtin)
} // namespace blender::gpu::tests

View File

@ -19,6 +19,7 @@
#include "MEM_guardedalloc.h"
#include "gpu_shader_create_info.hh"
#include "gpu_shader_create_info_private.hh"
#include "gpu_shader_dependency_private.h"
#include "gpu_testing.hh"
@ -26,6 +27,12 @@ namespace blender::gpu::tests {
using namespace blender::gpu::shader;
static void test_shader_compile_statically_defined()
{
EXPECT_TRUE(gpu_shader_create_info_compile_all());
}
GPU_TEST(shader_compile_statically_defined)
static void test_gpu_shader_compute_2d()
{

View File

@ -70,35 +70,53 @@ bool VKBuffer::create(VKContext &context,
VkResult result = vmaCreateBuffer(
allocator, &create_info, &vma_create_info, &vk_buffer_, &allocation_, nullptr);
return result == VK_SUCCESS;
}
bool VKBuffer::update(VKContext &context, const void *data)
{
void *mapped_memory;
bool result = map(context, &mapped_memory);
if (result) {
memcpy(mapped_memory, data, size_in_bytes_);
unmap(context);
if (result != VK_SUCCESS) {
return false;
}
return result;
/* All buffers are mapped to virtual memory. */
return map(context);
}
bool VKBuffer::map(VKContext &context, void **r_mapped_memory) const
void VKBuffer::update(const void *data) const
{
BLI_assert_msg(is_mapped(), "Cannot update a non-mapped buffer.");
memcpy(mapped_memory_, data, size_in_bytes_);
}
void VKBuffer::read(void *data) const
{
BLI_assert_msg(is_mapped(), "Cannot read a non-mapped buffer.");
memcpy(data, mapped_memory_, size_in_bytes_);
}
bool VKBuffer::is_mapped() const
{
return mapped_memory_ != nullptr;
}
bool VKBuffer::map(VKContext &context)
{
BLI_assert(!is_mapped());
VmaAllocator allocator = context.mem_allocator_get();
VkResult result = vmaMapMemory(allocator, allocation_, r_mapped_memory);
VkResult result = vmaMapMemory(allocator, allocation_, &mapped_memory_);
return result == VK_SUCCESS;
}
void VKBuffer::unmap(VKContext &context) const
void VKBuffer::unmap(VKContext &context)
{
BLI_assert(is_mapped());
VmaAllocator allocator = context.mem_allocator_get();
vmaUnmapMemory(allocator, allocation_);
mapped_memory_ = nullptr;
}
bool VKBuffer::free(VKContext &context)
{
if (is_mapped()) {
unmap(context);
}
VmaAllocator allocator = context.mem_allocator_get();
vmaDestroyBuffer(allocator, vk_buffer_, allocation_);
return true;

View File

@ -21,6 +21,8 @@ class VKBuffer {
int64_t size_in_bytes_;
VkBuffer vk_buffer_ = VK_NULL_HANDLE;
VmaAllocation allocation_ = VK_NULL_HANDLE;
/* Pointer to the virtually mapped memory. */
void *mapped_memory_ = nullptr;
public:
VKBuffer() = default;
@ -33,10 +35,9 @@ class VKBuffer {
int64_t size,
GPUUsageType usage,
VkBufferUsageFlagBits buffer_usage);
bool update(VKContext &context, const void *data);
void update(const void *data) const;
void read(void *data) const;
bool free(VKContext &context);
bool map(VKContext &context, void **r_mapped_memory) const;
void unmap(VKContext &context) const;
int64_t size_in_bytes() const
{
@ -47,5 +48,11 @@ class VKBuffer {
{
return vk_buffer_;
}
private:
/** Check if this buffer is mapped. */
bool is_mapped() const;
bool map(VKContext &context);
void unmap(VKContext &context);
};
} // namespace blender::gpu

View File

@ -35,11 +35,7 @@ void VKIndexBuffer::read(uint32_t *data) const
VKCommandBuffer &command_buffer = context.command_buffer_get();
command_buffer.submit();
void *mapped_memory;
if (buffer_.map(context, &mapped_memory)) {
memcpy(data, mapped_memory, size_get());
buffer_.unmap(context);
}
buffer_.read(data);
}
void VKIndexBuffer::update_sub(uint /*start*/, uint /*len*/, const void * /*data*/)

View File

@ -14,11 +14,11 @@ namespace blender::gpu {
void VKStorageBuffer::update(const void *data)
{
VKContext &context = *VKContext::get();
if (!buffer_.is_allocated()) {
VKContext &context = *VKContext::get();
allocate(context);
}
buffer_.update(context, data);
buffer_.update(data);
}
void VKStorageBuffer::allocate(VKContext &context)
@ -65,11 +65,7 @@ void VKStorageBuffer::read(void *data)
VKCommandBuffer &command_buffer = context.command_buffer_get();
command_buffer.submit();
void *mapped_memory;
if (buffer_.map(context, &mapped_memory)) {
memcpy(data, mapped_memory, size_in_bytes_);
buffer_.unmap(context);
}
buffer_.read(data);
}
} // namespace blender::gpu

View File

@ -78,17 +78,13 @@ void *VKTexture::read(int mip, eGPUDataFormat format)
command_buffer.copy(staging_buffer, *this, Span<VkBufferImageCopy>(&region, 1));
command_buffer.submit();
void *mapped_data;
staging_buffer.map(context, &mapped_data);
void *data = MEM_mallocN(host_memory_size, __func__);
/* TODO: add conversion when data format is different. */
BLI_assert_msg(device_memory_size == host_memory_size,
"Memory data conversions not implemented yet");
memcpy(data, mapped_data, host_memory_size);
staging_buffer.unmap(context);
staging_buffer.read(data);
return data;
}

View File

@ -12,11 +12,11 @@ namespace blender::gpu {
void VKUniformBuffer::update(const void *data)
{
VKContext &context = *VKContext::get();
if (!buffer_.is_allocated()) {
VKContext &context = *VKContext::get();
allocate(context);
}
buffer_.update(context, data);
buffer_.update(data);
}
void VKUniformBuffer::allocate(VKContext &context)

View File

@ -49,12 +49,7 @@ void VKVertexBuffer::read(void *data) const
VKContext &context = *VKContext::get();
VKCommandBuffer &command_buffer = context.command_buffer_get();
command_buffer.submit();
void *mapped_memory;
if (buffer_.map(context, &mapped_memory)) {
memcpy(data, mapped_memory, size_used_get());
buffer_.unmap(context);
}
buffer_.read(data);
}
void VKVertexBuffer::acquire_data()

View File

@ -488,8 +488,6 @@ typedef enum eGraphEdit_Flag {
/* SIPO_NODRAWCFRANUM = (1 << 3), DEPRECATED */
/* show timing in seconds instead of frames */
SIPO_DRAWTIME = (1 << 4),
/* only show keyframes for selected F-Curves */
SIPO_SELCUVERTSONLY = (1 << 5),
/* draw names of F-Curves beside the respective curves */
/* NOTE: currently not used */
/* SIPO_DRAWNAMES = (1 << 6), */ /* UNUSED */
@ -501,8 +499,6 @@ typedef enum eGraphEdit_Flag {
SIPO_SELVHANDLESONLY = (1 << 9),
/* don't perform realtime updates */
SIPO_NOREALTIMEUPDATES = (1 << 11),
/* don't draw curves with AA ("beauty-draw") for performance */
SIPO_BEAUTYDRAW_OFF = (1 << 12),
/* draw grouped channels with colors set in group */
/* SIPO_NODRAWGCOLORS = (1 << 13), DEPRECATED */
/* normalize curves on display */

View File

@ -1220,6 +1220,8 @@ typedef enum eAutokey_Flag {
*/
typedef enum eUserpref_Anim_Flags {
USER_ANIM_SHOW_CHANNEL_GROUP_COLORS = (1 << 0),
USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS = (1 << 1),
USER_ANIM_HIGH_QUALITY_DRAWING = (1 << 2),
} eUserpref_Anim_Flags;
/** #UserDef.transopts */

View File

@ -6329,27 +6329,12 @@ static void rna_def_space_graph(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Handles", "Show handles of Bezier control points");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
prop = RNA_def_property(srna, "use_only_selected_curves_handles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELCUVERTSONLY);
RNA_def_property_ui_text(prop,
"Only Selected Curve Keyframes",
"Only keyframes of selected F-Curves are visible and editable");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
prop = RNA_def_property(srna, "use_only_selected_keyframe_handles", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELVHANDLESONLY);
RNA_def_property_ui_text(
prop, "Only Selected Keyframes Handles", "Only show and edit handles of selected keyframes");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
prop = RNA_def_property(srna, "use_beauty_drawing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_BEAUTYDRAW_OFF);
RNA_def_property_ui_text(prop,
"Use High Quality Display",
"Display F-Curves using Anti-Aliasing and other fancy effects "
"(disable for better performance)");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
prop = RNA_def_property(srna, "show_markers", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SHOW_MARKERS);
RNA_def_property_ui_text(

View File

@ -5175,6 +5175,23 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
"background of the Graph Editor");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
/* FCurve keyframe visibility. */
prop = RNA_def_property(srna, "show_only_selected_curve_keyframes", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(
prop, NULL, "animation_flag", USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS);
RNA_def_property_ui_text(prop,
"Only Show Selected F-Curve Keyframes",
"Only keyframes of selected F-Curves are visible and editable");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
/* Graph Editor line drawing quality. */
prop = RNA_def_property(srna, "use_fcurve_high_quality_drawing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "animation_flag", USER_ANIM_HIGH_QUALITY_DRAWING);
RNA_def_property_ui_text(prop,
"F-Curve High Quality Drawing",
"Draw F-Curves using Anti-Aliasing (disable for better performance)");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
/* grease pencil */
prop = RNA_def_property(srna, "grease_pencil_manhattan_distance", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "gp_manhattandist");

View File

@ -1499,6 +1499,8 @@ struct GeometryNodesLazyFunctionGraphBuilder {
multi_input_socket_nodes_.add_new(&bsocket, &lf_multi_input_node);
for (lf::InputSocket *lf_multi_input_socket : lf_multi_input_node.inputs()) {
mapping_->bsockets_by_lf_socket_map.add(lf_multi_input_socket, &bsocket);
const void *default_value = lf_multi_input_socket->type().default_value();
lf_multi_input_socket->set_default_value(default_value);
}
}
else {
@ -2740,7 +2742,8 @@ class UsedSocketVisualizeOptions : public lf::Graph::ToDotOptions {
socket_name_suffixes_.add(lf_socket, suffix);
}
}
else if (lf::OutputSocket *lf_socket = builder_.output_socket_map_.lookup(bsocket)) {
else if (lf::OutputSocket *lf_socket = builder_.output_socket_map_.lookup_default(bsocket,
nullptr)) {
socket_font_colors_.add(lf_socket, color_str);
socket_name_suffixes_.add(lf_socket, suffix);
}