WIP: uv-simple-select #1

Closed
Chris Blackbourn wants to merge 182 commits from uv-simple-select into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
12 changed files with 56 additions and 73 deletions
Showing only changes of commit da4908248b - Show all commits

View File

@ -225,7 +225,7 @@ set(SRC
DRW_select_buffer.h
intern/DRW_gpu_wrapper.hh
intern/DRW_render.h
intern/draw_attributes.h
intern/draw_attributes.hh
intern/draw_cache.h
intern/draw_cache_extract.hh
intern/draw_cache_impl.h
@ -234,7 +234,7 @@ set(SRC
intern/draw_command.hh
intern/draw_common.h
intern/draw_common_shader_shared.h
intern/draw_curves_private.h
intern/draw_curves_private.hh
intern/draw_debug.h
intern/draw_debug.hh
intern/draw_hair_private.h

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2022 Blender Foundation. All rights reserved. */
#include "draw_attributes.h"
#include "draw_attributes.hh"
/* Return true if the given DRW_AttributeRequest is already in the requests. */
static bool drw_attributes_has_request(const DRW_Attributes *requests, DRW_AttributeRequest req)

View File

@ -9,9 +9,7 @@
#pragma once
#ifdef __cplusplus
#include <mutex>
#endif
#include "DNA_customdata_types.h"
@ -24,23 +22,19 @@
#include "GPU_shader.h"
#include "GPU_vertex_format.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct DRW_AttributeRequest {
struct DRW_AttributeRequest {
eCustomDataType cd_type;
int layer_index;
eAttrDomain domain;
char attribute_name[64];
} DRW_AttributeRequest;
};
typedef struct DRW_Attributes {
struct DRW_Attributes {
DRW_AttributeRequest requests[GPU_MAX_ATTR];
int num_requests;
} DRW_Attributes;
};
typedef struct DRW_MeshCDMask {
struct DRW_MeshCDMask {
uint32_t uv : 8;
uint32_t tan : 8;
uint32_t orco : 1;
@ -50,7 +44,7 @@ typedef struct DRW_MeshCDMask {
* Edit uv layer is from the base edit mesh as modifiers could remove it. (see #68857)
*/
uint32_t edit_uv : 1;
} DRW_MeshCDMask;
};
/* Keep `DRW_MeshCDMask` struct within a `uint32_t`.
* bit-wise and atomic operations are used to compare and update the struct.
@ -59,11 +53,9 @@ BLI_STATIC_ASSERT(sizeof(DRW_MeshCDMask) <= sizeof(uint32_t), "DRW_MeshCDMask ex
void drw_attributes_clear(DRW_Attributes *attributes);
#ifdef __cplusplus
void drw_attributes_merge(DRW_Attributes *dst,
const DRW_Attributes *src,
std::mutex &render_mutex);
#endif
/* Return true if all requests in b are in a. */
bool drw_attributes_overlap(const DRW_Attributes *a, const DRW_Attributes *b);
@ -78,7 +70,3 @@ bool drw_custom_data_match_attribute(const CustomData *custom_data,
const char *name,
int *r_layer_index,
eCustomDataType *r_type);
#ifdef __cplusplus
}
#endif

View File

@ -22,7 +22,7 @@
#include "GPU_index_buffer.h"
#include "GPU_vertex_buffer.h"
#include "draw_attributes.h"
#include "draw_attributes.hh"
struct DRWSubdivCache;
struct MeshRenderData;

View File

@ -34,10 +34,10 @@
#include "DRW_render.h"
#include "draw_attributes.h"
#include "draw_attributes.hh"
#include "draw_cache_impl.h" /* own include */
#include "draw_cache_inline.h"
#include "draw_curves_private.h" /* own include */
#include "draw_curves_private.hh" /* own include */
#include "draw_shader.h"
using blender::ColorGeometry4f;

View File

@ -25,7 +25,7 @@
#include "GPU_batch.h"
#include "GPU_material.h"
#include "draw_attributes.h"
#include "draw_attributes.hh"
#include "draw_cache_impl.h"
#include "draw_cache_inline.h"
#include "draw_pointcloud_private.hh" /* own include */

View File

@ -26,7 +26,7 @@
#include "DRW_render.h"
#include "draw_cache_impl.h"
#include "draw_curves_private.h"
#include "draw_curves_private.hh"
#include "draw_hair_private.h"
#include "draw_manager.h"
#include "draw_shader.h"

View File

@ -10,26 +10,23 @@
#include "BKE_attribute.h"
#include "GPU_shader.h"
#include "draw_attributes.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "draw_attributes.hh"
struct Curves;
struct GPUVertBuf;
struct GPUBatch;
struct GPUMaterial;
#define MAX_THICKRES 2 /* see eHairType */
#define MAX_HAIR_SUBDIV 4 /* see hair_subdiv rna */
typedef enum CurvesEvalShader {
enum CurvesEvalShader {
CURVES_EVAL_CATMULL_ROM = 0,
CURVES_EVAL_BEZIER = 1,
} CurvesEvalShader;
};
#define CURVES_EVAL_SHADER_NUM 3
typedef struct CurvesEvalFinalCache {
struct CurvesEvalFinalCache {
/* Output of the subdivision stage: vertex buffer sized to subdiv level. */
GPUVertBuf *proc_buf;
@ -58,10 +55,10 @@ typedef struct CurvesEvalFinalCache {
/* Output of the subdivision stage: vertex buffers sized to subdiv level. This is only attributes
* on point domain. */
GPUVertBuf *attributes_buf[GPU_MAX_ATTR];
} CurvesEvalFinalCache;
};
/* Curves procedural display: Evaluation is done on the GPU. */
typedef struct CurvesEvalCache {
struct CurvesEvalCache {
/* Control point positions on evaluated data-block combined with parameter data. */
GPUVertBuf *proc_point_buf;
@ -82,19 +79,15 @@ typedef struct CurvesEvalCache {
int strands_len;
int elems_len;
int point_len;
} CurvesEvalCache;
};
/**
* Ensure all necessary textures and buffers exist for GPU accelerated drawing.
*/
bool curves_ensure_procedural_data(struct Curves *curves,
struct CurvesEvalCache **r_hair_cache,
struct GPUMaterial *gpu_material,
bool curves_ensure_procedural_data(Curves *curves,
CurvesEvalCache **r_hair_cache,
GPUMaterial *gpu_material,
int subdiv,
int thickness_res);
void drw_curves_get_attribute_sampler_name(const char *layer_name, char r_sampler_name[32]);
#ifdef __cplusplus
}
#endif

View File

@ -7,7 +7,7 @@
#include "DRW_pbvh.hh"
#include "draw_attributes.h"
#include "draw_attributes.hh"
#include "draw_manager.h"
#include "draw_pbvh.h"

View File

@ -21,7 +21,7 @@
#include "DRW_gpu_wrapper.hh"
#include "DRW_render.h"
#include "draw_attributes.h"
#include "draw_attributes.hh"
#include "draw_cache_impl.h"
#include "draw_common.h"
#include "draw_manager.h"

View File

@ -7,36 +7,38 @@
#pragma once
#include "draw_curves_private.h"
#ifdef __cplusplus
# include "draw_curves_private.hh"
# include "draw_hair_private.h"
struct GPUShader;
enum eParticleRefineShaderType {
PART_REFINE_SHADER_TRANSFORM_FEEDBACK,
PART_REFINE_SHADER_TRANSFORM_FEEDBACK_WORKAROUND,
PART_REFINE_SHADER_COMPUTE,
};
/* draw_shader.cc */
GPUShader *DRW_shader_hair_refine_get(ParticleRefineShader refinement,
eParticleRefineShaderType sh_type);
GPUShader *DRW_shader_curves_refine_get(CurvesEvalShader type, eParticleRefineShaderType sh_type);
GPUShader *DRW_shader_debug_print_display_get();
GPUShader *DRW_shader_debug_draw_display_get();
GPUShader *DRW_shader_draw_visibility_compute_get();
GPUShader *DRW_shader_draw_view_finalize_get();
GPUShader *DRW_shader_draw_resource_finalize_get();
GPUShader *DRW_shader_draw_command_generate_get();
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct GPUShader;
typedef enum eParticleRefineShaderType {
PART_REFINE_SHADER_TRANSFORM_FEEDBACK,
PART_REFINE_SHADER_TRANSFORM_FEEDBACK_WORKAROUND,
PART_REFINE_SHADER_COMPUTE,
} eParticleRefineShaderType;
/* draw_shader.cc */
struct GPUShader *DRW_shader_hair_refine_get(ParticleRefineShader refinement,
eParticleRefineShaderType sh_type);
struct GPUShader *DRW_shader_curves_refine_get(CurvesEvalShader type,
eParticleRefineShaderType sh_type);
struct GPUShader *DRW_shader_debug_print_display_get(void);
struct GPUShader *DRW_shader_debug_draw_display_get(void);
struct GPUShader *DRW_shader_draw_visibility_compute_get(void);
struct GPUShader *DRW_shader_draw_view_finalize_get(void);
struct GPUShader *DRW_shader_draw_resource_finalize_get(void);
struct GPUShader *DRW_shader_draw_command_generate_get(void);
void DRW_shaders_free(void);
#ifdef __cplusplus

View File

@ -17,7 +17,7 @@
#include "BKE_attribute.hh"
#include "BKE_mesh.h"
#include "draw_attributes.h"
#include "draw_attributes.hh"
#include "draw_subdivision.h"
#include "extract_mesh.hh"