Merge branch 'blender-v2.83-release'

This commit is contained in:
Clément Foucault 2020-05-14 16:23:24 +02:00
commit bd80c21635
19 changed files with 72 additions and 67 deletions

View File

@ -494,16 +494,18 @@ vector<DeviceInfo> Device::available_devices(uint mask)
}
#endif
#ifdef WITH_CUDA
if (mask & DEVICE_MASK_CUDA) {
#if defined(WITH_CUDA) || defined(WITH_OPTIX)
if (mask & (DEVICE_MASK_CUDA | DEVICE_MASK_OPTIX)) {
if (!(devices_initialized_mask & DEVICE_MASK_CUDA)) {
if (device_cuda_init()) {
device_cuda_info(cuda_devices);
}
devices_initialized_mask |= DEVICE_MASK_CUDA;
}
foreach (DeviceInfo &info, cuda_devices) {
devices.push_back(info);
if (mask & DEVICE_MASK_CUDA) {
foreach (DeviceInfo &info, cuda_devices) {
devices.push_back(info);
}
}
}
#endif
@ -512,7 +514,7 @@ vector<DeviceInfo> Device::available_devices(uint mask)
if (mask & DEVICE_MASK_OPTIX) {
if (!(devices_initialized_mask & DEVICE_MASK_OPTIX)) {
if (device_optix_init()) {
device_optix_info(optix_devices);
device_optix_info(cuda_devices, optix_devices);
}
devices_initialized_mask |= DEVICE_MASK_OPTIX;
}

View File

@ -45,7 +45,7 @@ Device *device_multi_create(DeviceInfo &info, Stats &stats, Profiler &profiler,
void device_cpu_info(vector<DeviceInfo> &devices);
void device_opencl_info(vector<DeviceInfo> &devices);
void device_cuda_info(vector<DeviceInfo> &devices);
void device_optix_info(vector<DeviceInfo> &devices);
void device_optix_info(const vector<DeviceInfo> &cuda_devices, vector<DeviceInfo> &devices);
void device_network_info(vector<DeviceInfo> &devices);
string device_cpu_capabilities();

View File

@ -1534,14 +1534,11 @@ bool device_optix_init()
return true;
}
void device_optix_info(vector<DeviceInfo> &devices)
void device_optix_info(const vector<DeviceInfo> &cuda_devices, vector<DeviceInfo> &devices)
{
// Simply add all supported CUDA devices as OptiX devices again
vector<DeviceInfo> cuda_devices;
device_cuda_info(cuda_devices);
for (auto it = cuda_devices.begin(); it != cuda_devices.end();) {
DeviceInfo &info = *it;
for (const DeviceInfo &cuda_info : cuda_devices) {
DeviceInfo info = cuda_info;
assert(info.type == DEVICE_CUDA);
info.type = DEVICE_OPTIX;
info.id += "_OptiX";
@ -1564,13 +1561,10 @@ void device_optix_info(vector<DeviceInfo> &devices)
}
// Only add devices with RTX support
if (rtcore_version == 0 && !getenv("CYCLES_OPTIX_TEST"))
it = cuda_devices.erase(it);
else
++it;
if (rtcore_version != 0 || getenv("CYCLES_OPTIX_TEST")) {
devices.push_back(info);
}
}
devices.insert(devices.end(), cuda_devices.begin(), cuda_devices.end());
}
Device *device_optix_create(DeviceInfo &info, Stats &stats, Profiler &profiler, bool background)

@ -1 +1 @@
Subproject commit 590710871b7b2e1f7f50bb622f1409b794ad38c2
Subproject commit 47a32a5370d36942674621e5a03e57e8dd4986d8

View File

@ -66,6 +66,7 @@ void OVERLAY_edit_curve_cache_init(OVERLAY_Data *vedata)
sh = OVERLAY_shader_edit_curve_point();
pd->edit_curve_points_grp = grp = DRW_shgroup_create(sh, psl->edit_curve_handle_ps);
DRW_shgroup_uniform_bool_copy(grp, "showCurveHandles", pd->edit_curve.show_handles);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
}
}
@ -94,7 +95,7 @@ void OVERLAY_edit_curve_cache_populate(OVERLAY_Data *vedata, Object *ob)
DRW_shgroup_call_no_cull(pd->edit_curve_handle_grp, geom, ob);
}
geom = DRW_cache_curve_vert_overlay_get(ob, pd->edit_curve.show_handles);
geom = DRW_cache_curve_vert_overlay_get(ob);
if (geom) {
DRW_shgroup_call_no_cull(pd->edit_curve_points_grp, geom, ob);
}
@ -110,7 +111,7 @@ void OVERLAY_edit_surf_cache_populate(OVERLAY_Data *vedata, Object *ob)
DRW_shgroup_call_no_cull(pd->edit_curve_handle_grp, geom, ob);
}
geom = DRW_cache_curve_vert_overlay_get(ob, false);
geom = DRW_cache_curve_vert_overlay_get(ob);
if (geom) {
DRW_shgroup_call_no_cull(pd->edit_curve_points_grp, geom, ob);
}

View File

@ -60,8 +60,10 @@ void OVERLAY_grid_init(OVERLAY_Data *vedata)
const bool show_ortho_grid = (pd->v3d_gridflag & V3D_SHOW_ORTHO_GRID) != 0;
shd->grid_flag = 0;
shd->zneg_flag = 0;
shd->zpos_flag = 0;
if (pd->hide_overlays || !(show_axis_y || show_axis_z || show_floor || show_ortho_grid)) {
if (pd->hide_overlays || !pd->v3d_gridflag) {
return;
}

View File

@ -1,7 +1,8 @@
/* Keep the same value of `ACTIVE_NURB` in `draw_cache_imp_curve.c` */
#define ACTIVE_NURB 1 << 2
#define EVEN_U_BIT 1 << 3
#define EVEN_U_BIT 1 << 4
#define COLOR_SHIFT 5
layout(lines) in;
layout(triangle_strip, max_vertices = 10) out;
@ -37,7 +38,7 @@ void main()
vec4 v2 = gl_in[1].gl_Position;
int is_active_nurb = (vertFlag[1] & ACTIVE_NURB);
int color_id = (vertFlag[1] >> 4);
int color_id = (vertFlag[1] >> COLOR_SHIFT);
/* Don't output any edges if we don't show handles */
if (!showCurveHandles && (color_id < 5)) {

View File

@ -1,4 +1,9 @@
/* Keep the same value of `BEZIER_HANDLE` in `draw_cache_imp_curve.c` */
#define BEZIER_HANDLE 1 << 3
uniform bool showCurveHandles;
in vec3 pos;
in int data;
@ -26,4 +31,9 @@ void main()
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance(world_pos);
#endif
if (!showCurveHandles && ((data & BEZIER_HANDLE) != 0)) {
/* We set the vertex at the camera origin to generate 0 fragments. */
gl_Position = vec4(0.0, 0.0, -3e36, 0.0);
}
}

View File

@ -113,7 +113,6 @@ static void workbench_cache_sculpt_populate(WORKBENCH_PrivateData *wpd,
Object *ob,
eV3DShadingColorType color_type)
{
const bool use_vcol = ELEM(color_type, V3D_SHADING_VERTEX_COLOR);
const bool use_single_drawcall = !ELEM(color_type, V3D_SHADING_MATERIAL_COLOR);
BLI_assert(wpd->shading.color_type != V3D_SHADING_TEXTURE_COLOR);

View File

@ -2898,12 +2898,12 @@ GPUBatch *DRW_cache_curve_edge_overlay_get(Object *ob)
return DRW_curve_batch_cache_get_edit_edges(cu);
}
GPUBatch *DRW_cache_curve_vert_overlay_get(Object *ob, bool handles)
GPUBatch *DRW_cache_curve_vert_overlay_get(Object *ob)
{
BLI_assert(ELEM(ob->type, OB_CURVE, OB_SURF));
struct Curve *cu = ob->data;
return DRW_curve_batch_cache_get_edit_verts(cu, handles);
return DRW_curve_batch_cache_get_edit_verts(cu);
}
GPUBatch *DRW_cache_curve_surface_get(Object *ob)

View File

@ -150,7 +150,7 @@ struct GPUBatch *DRW_cache_curve_edge_detection_get(struct Object *ob, bool *r_i
/* edit-mode */
struct GPUBatch *DRW_cache_curve_edge_normal_get(struct Object *ob);
struct GPUBatch *DRW_cache_curve_edge_overlay_get(struct Object *ob);
struct GPUBatch *DRW_cache_curve_vert_overlay_get(struct Object *ob, bool handles);
struct GPUBatch *DRW_cache_curve_vert_overlay_get(struct Object *ob);
/* Font */
struct GPUBatch *DRW_cache_text_surface_get(struct Object *ob);

View File

@ -93,7 +93,7 @@ struct GPUBatch *DRW_curve_batch_cache_get_wire_edge(struct Curve *cu);
struct GPUBatch *DRW_curve_batch_cache_get_normal_edge(struct Curve *cu);
struct GPUBatch *DRW_curve_batch_cache_get_edge_detection(struct Curve *cu, bool *r_is_manifold);
struct GPUBatch *DRW_curve_batch_cache_get_edit_edges(struct Curve *cu);
struct GPUBatch *DRW_curve_batch_cache_get_edit_verts(struct Curve *cu, bool handles);
struct GPUBatch *DRW_curve_batch_cache_get_edit_verts(struct Curve *cu);
struct GPUBatch *DRW_curve_batch_cache_get_triangles_with_normals(struct Curve *cu);
struct GPUBatch **DRW_curve_batch_cache_get_surface_shaded(struct Curve *cu,

View File

@ -49,7 +49,9 @@
#define SELECT 1
#define ACTIVE_NURB 1 << 2
#define EVEN_U_BIT 1 << 3 /* Alternate this bit for every U vert. */
#define BEZIER_HANDLE 1 << 3
#define EVEN_U_BIT 1 << 4 /* Alternate this bit for every U vert. */
#define COLOR_SHIFT 5
/* Used as values of `color_id` in `edit_curve_overlay_handle_geom.glsl` */
enum {
@ -376,7 +378,7 @@ typedef struct CurveBatchCache {
GPUIndexBuf *curves_lines;
GPUIndexBuf *edges_adj_lines;
/* Edit mode */
GPUIndexBuf *edit_verts_points; /* Only control points. Not handles. */
GPUIndexBuf *edit_verts;
GPUIndexBuf *edit_lines;
} ibo;
@ -387,7 +389,6 @@ typedef struct CurveBatchCache {
/* control handles and vertices */
GPUBatch *edit_edges;
GPUBatch *edit_verts;
GPUBatch *edit_handles_verts;
GPUBatch *edit_normals;
GPUBatch *edge_detection;
} batch;
@ -497,7 +498,6 @@ void DRW_curve_batch_cache_dirty_tag(Curve *cu, int mode)
GPU_BATCH_DISCARD_SAFE(cache->batch.edit_edges);
GPU_BATCH_DISCARD_SAFE(cache->batch.edit_verts);
GPU_BATCH_DISCARD_SAFE(cache->batch.edit_handles_verts);
break;
default:
BLI_assert(0);
@ -686,14 +686,15 @@ static void curve_create_edit_curves_nor(CurveRenderData *rdata, GPUVertBuf *vbo
}
static char beztriple_vflag_get(
CurveRenderData *rdata, char flag, char col_id, int v_idx, int nu_id)
CurveRenderData *rdata, char flag, char col_id, int v_idx, int nu_id, bool handle_point)
{
char vflag = 0;
SET_FLAG_FROM_TEST(vflag, (flag & SELECT), VFLAG_VERT_SELECTED);
SET_FLAG_FROM_TEST(vflag, (v_idx == rdata->actvert && nu_id == rdata->actnu), VFLAG_VERT_ACTIVE);
SET_FLAG_FROM_TEST(vflag, (nu_id == rdata->actnu), ACTIVE_NURB);
SET_FLAG_FROM_TEST(vflag, handle_point, BEZIER_HANDLE);
/* handle color id */
vflag |= col_id << 4; /* << 4 because of EVEN_U_BIT */
vflag |= col_id << COLOR_SHIFT;
return vflag;
}
@ -704,7 +705,7 @@ static char bpoint_vflag_get(CurveRenderData *rdata, char flag, int v_idx, int n
SET_FLAG_FROM_TEST(vflag, (v_idx == rdata->actvert && nu_id == rdata->actnu), VFLAG_VERT_ACTIVE);
SET_FLAG_FROM_TEST(vflag, (nu_id == rdata->actnu), ACTIVE_NURB);
SET_FLAG_FROM_TEST(vflag, ((u % 2) == 0), EVEN_U_BIT);
vflag |= COLOR_NURB_ULINE_ID << 4; /* << 4 because of EVEN_U_BIT */
vflag |= COLOR_NURB_ULINE_ID << COLOR_SHIFT;
return vflag;
}
@ -760,7 +761,9 @@ static void curve_create_edit_data_and_handles(CurveRenderData *rdata,
}
if (elbp_verts) {
GPU_indexbuf_add_point_vert(elbp_verts, vbo_len_used + 0);
GPU_indexbuf_add_point_vert(elbp_verts, vbo_len_used + 1);
GPU_indexbuf_add_point_vert(elbp_verts, vbo_len_used + 2);
}
if (elbp_lines) {
GPU_indexbuf_add_line_verts(elbp_lines, vbo_len_used + 1, vbo_len_used + 0);
@ -768,9 +771,9 @@ static void curve_create_edit_data_and_handles(CurveRenderData *rdata,
}
if (vbo_data) {
const char vflag[3] = {
beztriple_vflag_get(rdata, bezt->f1, bezt->h1, a, nu_id),
beztriple_vflag_get(rdata, bezt->f2, bezt->h1, a, nu_id),
beztriple_vflag_get(rdata, bezt->f3, bezt->h2, a, nu_id),
beztriple_vflag_get(rdata, bezt->f1, bezt->h1, a, nu_id, true),
beztriple_vflag_get(rdata, bezt->f2, bezt->h1, a, nu_id, false),
beztriple_vflag_get(rdata, bezt->f3, bezt->h2, a, nu_id, true),
};
for (int j = 0; j < 3; j++) {
GPU_vertbuf_attr_set(vbo_data, attr_id.data, vbo_len_used + j, &vflag[j]);
@ -859,15 +862,10 @@ GPUBatch *DRW_curve_batch_cache_get_edit_edges(Curve *cu)
return DRW_batch_request(&cache->batch.edit_edges);
}
GPUBatch *DRW_curve_batch_cache_get_edit_verts(Curve *cu, bool handles)
GPUBatch *DRW_curve_batch_cache_get_edit_verts(Curve *cu)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
if (handles) {
return DRW_batch_request(&cache->batch.edit_handles_verts);
}
else {
return DRW_batch_request(&cache->batch.edit_verts);
}
return DRW_batch_request(&cache->batch.edit_verts);
}
GPUBatch *DRW_curve_batch_cache_get_triangles_with_normals(struct Curve *cu)
@ -965,14 +963,10 @@ void DRW_curve_batch_cache_create_requested(Object *ob)
DRW_vbo_request(cache->batch.edit_edges, &cache->edit.data);
}
if (DRW_batch_requested(cache->batch.edit_verts, GPU_PRIM_POINTS)) {
DRW_ibo_request(cache->batch.edit_verts, &cache->ibo.edit_verts_points);
DRW_ibo_request(cache->batch.edit_verts, &cache->ibo.edit_verts);
DRW_vbo_request(cache->batch.edit_verts, &cache->edit.pos);
DRW_vbo_request(cache->batch.edit_verts, &cache->edit.data);
}
if (DRW_batch_requested(cache->batch.edit_handles_verts, GPU_PRIM_POINTS)) {
DRW_vbo_request(cache->batch.edit_handles_verts, &cache->edit.pos);
DRW_vbo_request(cache->batch.edit_handles_verts, &cache->edit.data);
}
if (DRW_batch_requested(cache->batch.edit_normals, GPU_PRIM_LINES)) {
DRW_vbo_request(cache->batch.edit_normals, &cache->edit.curves_nor);
}
@ -1012,7 +1006,7 @@ void DRW_curve_batch_cache_create_requested(Object *ob)
DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->edit.data, CU_DATATYPE_OVERLAY);
DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->edit.curves_nor, CU_DATATYPE_NORMAL);
DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->edit.curves_weight, CU_DATATYPE_OVERLAY);
DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.edit_verts_points, CU_DATATYPE_OVERLAY);
DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.edit_verts, CU_DATATYPE_OVERLAY);
DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.edit_lines, CU_DATATYPE_OVERLAY);
for (int i = 0; i < cache->mat_len; i++) {
@ -1065,13 +1059,9 @@ void DRW_curve_batch_cache_create_requested(Object *ob)
}
if (DRW_vbo_requested(cache->edit.pos) || DRW_vbo_requested(cache->edit.data) ||
DRW_ibo_requested(cache->ibo.edit_verts_points) ||
DRW_ibo_requested(cache->ibo.edit_lines)) {
curve_create_edit_data_and_handles(rdata,
cache->edit.pos,
cache->edit.data,
cache->ibo.edit_verts_points,
cache->ibo.edit_lines);
DRW_ibo_requested(cache->ibo.edit_verts) || DRW_ibo_requested(cache->ibo.edit_lines)) {
curve_create_edit_data_and_handles(
rdata, cache->edit.pos, cache->edit.data, cache->ibo.edit_verts, cache->ibo.edit_lines);
}
if (DRW_vbo_requested(cache->edit.curves_nor)) {
curve_create_edit_curves_nor(rdata, cache->edit.curves_nor);

View File

@ -381,7 +381,7 @@ static void dial_ghostarc_draw_with_helplines(const float angle_ofs,
{
/* Coordinate at which the arc drawing will be started. */
const float co_outer[4] = {0.0f, DIAL_WIDTH, 0.0f};
const float color_arc_inner[4] = {0.8f, 0.8f, 0.8f, 0.4f};
const float color_arc_inner[4] = {0.8f, 0.8f, 0.8f, 0.2f};
dial_ghostarc_draw(angle_ofs, angle_delta, arc_inner_factor, color_arc_inner);
float line_width = (draw_options & ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_VALUE) ? 3.0f : 1.0f;

View File

@ -269,7 +269,7 @@ static void draw_azone_arrow(float x1, float y1, float x2, float y2, AZEdge edge
GPU_blend(false);
}
static void region_draw_azone_tab_arrow(AZone *az)
static void region_draw_azone_tab_arrow(ScrArea *area, ARegion *region, AZone *az)
{
GPU_blend(true);
@ -289,7 +289,9 @@ static void region_draw_azone_tab_arrow(AZone *az)
break;
}
float color[4] = {0.05f, 0.05f, 0.05f, 0.4f};
/* Workaround for different color spaces between normal areas and the ones using GPUViewports. */
float alpha = WM_region_use_viewport(area, region) ? 0.6f : 0.4f;
float color[4] = {0.05f, 0.05f, 0.05f, alpha};
UI_draw_roundbox_aa(
true, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, color);
@ -330,7 +332,7 @@ static void region_draw_azones(ScrArea *area, ARegion *region)
if (az->region) {
/* only display tab or icons when the region is hidden */
if (az->region->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) {
region_draw_azone_tab_arrow(az);
region_draw_azone_tab_arrow(area, region, az);
}
}
}

View File

@ -347,7 +347,7 @@ static void gizmo_get_axis_color(const int axis_idx,
if (axis_idx >= MAN_AXIS_RANGE_ROT_START && axis_idx < MAN_AXIS_RANGE_ROT_END) {
/* Never fade rotation rings. */
/* trackball rotation axis is a special case, we only draw a slight overlay */
alpha_fac = (axis_idx == MAN_AXIS_ROT_T) ? 0.1f : 1.0f;
alpha_fac = (axis_idx == MAN_AXIS_ROT_T) ? 0.05f : 1.0f;
}
else {
bool is_plane = false;

View File

@ -35,4 +35,6 @@ void main()
if (butCo > 0.0) {
fragColor.a = 1.0;
}
fragColor = blender_srgb_to_framebuffer_space(fragColor);
}

View File

@ -870,6 +870,8 @@ void WM_generic_callback_free(struct wmGenericCallback *callback);
void WM_generic_user_data_free(struct wmGenericUserData *user_data);
bool WM_region_use_viewport(struct ScrArea *area, struct ARegion *region);
#ifdef WITH_XR_OPENXR
/* wm_xr.c */
bool WM_xr_session_exists(const wmXrData *xr);

View File

@ -293,7 +293,7 @@ static bool wm_region_use_viewport_by_type(short space_type, short region_type)
return (ELEM(space_type, SPACE_VIEW3D, SPACE_IMAGE) && region_type == RGN_TYPE_WINDOW);
}
static bool wm_region_use_viewport(ScrArea *area, ARegion *region)
bool WM_region_use_viewport(ScrArea *area, ARegion *region)
{
return wm_region_use_viewport_by_type(area->spacetype, region->regiontype);
}
@ -658,7 +658,7 @@ static void wm_draw_window_offscreen(bContext *C, wmWindow *win, bool stereo)
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
if (region->visible && region->do_draw) {
CTX_wm_region_set(C, region);
bool use_viewport = wm_region_use_viewport(area, region);
bool use_viewport = WM_region_use_viewport(area, region);
if (stereo && wm_draw_region_stereo_set(bmain, area, region, STEREO_LEFT_ID)) {
wm_draw_region_buffer_create(region, true, use_viewport);
@ -1042,7 +1042,7 @@ void WM_draw_region_free(ARegion *region, bool hide)
void wm_draw_region_test(bContext *C, ScrArea *area, ARegion *region)
{
/* Function for redraw timer benchmark. */
bool use_viewport = wm_region_use_viewport(area, region);
bool use_viewport = WM_region_use_viewport(area, region);
wm_draw_region_buffer_create(region, false, use_viewport);
wm_draw_region_bind(region, 0);
ED_region_do_draw(C, region);