Cleanup: DRW: Remove uneeded DRWState values
This removes: - DRW_STATE_TRANS_FEEDBACK - DRW_STATE_WIRE - DRW_STATE_POINT
This commit is contained in:
@@ -106,8 +106,8 @@ static void basic_cache_init(void *vedata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
psl->depth_pass = DRW_pass_create(
|
psl->depth_pass = DRW_pass_create("Depth Pass",
|
||||||
"Depth Pass", DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WIRE);
|
DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL);
|
||||||
stl->g_data->depth_shgrp = DRW_shgroup_create(sh_data->depth, psl->depth_pass);
|
stl->g_data->depth_shgrp = DRW_shgroup_create(sh_data->depth, psl->depth_pass);
|
||||||
if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
|
if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
|
||||||
DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->depth_shgrp, rv3d);
|
DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->depth_shgrp, rv3d);
|
||||||
|
|||||||
@@ -923,8 +923,7 @@ static struct DRWShadingGroup *EEVEE_default_shading_group_get(EEVEE_ViewLayerDa
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vedata->psl->default_pass[options] == NULL) {
|
if (vedata->psl->default_pass[options] == NULL) {
|
||||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_CLIP_PLANES |
|
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_CLIP_PLANES;
|
||||||
DRW_STATE_WIRE;
|
|
||||||
vedata->psl->default_pass[options] = DRW_pass_create("Default Lit Pass", state);
|
vedata->psl->default_pass[options] = DRW_pass_create("Default Lit Pass", state);
|
||||||
|
|
||||||
/* XXX / WATCH: This creates non persistent binds for the ubos and textures.
|
/* XXX / WATCH: This creates non persistent binds for the ubos and textures.
|
||||||
@@ -1017,7 +1016,7 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
DRWState state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WIRE;
|
DRWState state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
|
||||||
psl->depth_pass = DRW_pass_create("Depth Pass", state);
|
psl->depth_pass = DRW_pass_create("Depth Pass", state);
|
||||||
stl->g_data->depth_shgrp = DRW_shgroup_create(e_data.default_prepass_sh, psl->depth_pass);
|
stl->g_data->depth_shgrp = DRW_shgroup_create(e_data.default_prepass_sh, psl->depth_pass);
|
||||||
|
|
||||||
@@ -1026,8 +1025,7 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||||||
stl->g_data->depth_shgrp_cull = DRW_shgroup_create(e_data.default_prepass_sh,
|
stl->g_data->depth_shgrp_cull = DRW_shgroup_create(e_data.default_prepass_sh,
|
||||||
psl->depth_pass_cull);
|
psl->depth_pass_cull);
|
||||||
|
|
||||||
state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CLIP_PLANES |
|
state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CLIP_PLANES;
|
||||||
DRW_STATE_WIRE;
|
|
||||||
psl->depth_pass_clip = DRW_pass_create("Depth Pass Clip", state);
|
psl->depth_pass_clip = DRW_pass_create("Depth Pass Clip", state);
|
||||||
stl->g_data->depth_shgrp_clip = DRW_shgroup_create(e_data.default_prepass_clip_sh,
|
stl->g_data->depth_shgrp_clip = DRW_shgroup_create(e_data.default_prepass_clip_sh,
|
||||||
psl->depth_pass_clip);
|
psl->depth_pass_clip);
|
||||||
@@ -1042,14 +1040,13 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_CLIP_PLANES |
|
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_CLIP_PLANES;
|
||||||
DRW_STATE_WIRE;
|
|
||||||
psl->material_pass = DRW_pass_create("Material Pass", state);
|
psl->material_pass = DRW_pass_create("Material Pass", state);
|
||||||
psl->material_pass_cull = DRW_pass_create("Material Pass Cull", state | DRW_STATE_CULL_BACK);
|
psl->material_pass_cull = DRW_pass_create("Material Pass Cull", state | DRW_STATE_CULL_BACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
DRWState state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WIRE;
|
DRWState state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
|
||||||
psl->refract_depth_pass = DRW_pass_create("Refract Depth Pass", state);
|
psl->refract_depth_pass = DRW_pass_create("Refract Depth Pass", state);
|
||||||
stl->g_data->refract_depth_shgrp = DRW_shgroup_create(e_data.default_prepass_sh,
|
stl->g_data->refract_depth_shgrp = DRW_shgroup_create(e_data.default_prepass_sh,
|
||||||
psl->refract_depth_pass);
|
psl->refract_depth_pass);
|
||||||
@@ -1059,8 +1056,7 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||||||
stl->g_data->refract_depth_shgrp_cull = DRW_shgroup_create(e_data.default_prepass_sh,
|
stl->g_data->refract_depth_shgrp_cull = DRW_shgroup_create(e_data.default_prepass_sh,
|
||||||
psl->refract_depth_pass_cull);
|
psl->refract_depth_pass_cull);
|
||||||
|
|
||||||
state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CLIP_PLANES |
|
state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CLIP_PLANES;
|
||||||
DRW_STATE_WIRE;
|
|
||||||
psl->refract_depth_pass_clip = DRW_pass_create("Refract Depth Pass Clip", state);
|
psl->refract_depth_pass_clip = DRW_pass_create("Refract Depth Pass Clip", state);
|
||||||
stl->g_data->refract_depth_shgrp_clip = DRW_shgroup_create(e_data.default_prepass_clip_sh,
|
stl->g_data->refract_depth_shgrp_clip = DRW_shgroup_create(e_data.default_prepass_clip_sh,
|
||||||
psl->refract_depth_pass_clip);
|
psl->refract_depth_pass_clip);
|
||||||
@@ -1077,22 +1073,20 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
DRWState state = (DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_CLIP_PLANES |
|
DRWState state = (DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_CLIP_PLANES);
|
||||||
DRW_STATE_WIRE);
|
|
||||||
psl->refract_pass = DRW_pass_create("Opaque Refraction Pass", state);
|
psl->refract_pass = DRW_pass_create("Opaque Refraction Pass", state);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
DRWState state = (DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_CLIP_PLANES |
|
DRWState state = (DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_CLIP_PLANES |
|
||||||
DRW_STATE_WIRE | DRW_STATE_WRITE_STENCIL);
|
DRW_STATE_WRITE_STENCIL);
|
||||||
psl->sss_pass = DRW_pass_create("Subsurface Pass", state);
|
psl->sss_pass = DRW_pass_create("Subsurface Pass", state);
|
||||||
psl->sss_pass_cull = DRW_pass_create("Subsurface Pass Cull", state | DRW_STATE_CULL_BACK);
|
psl->sss_pass_cull = DRW_pass_create("Subsurface Pass Cull", state | DRW_STATE_CULL_BACK);
|
||||||
e_data.sss_count = 0;
|
e_data.sss_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CLIP_PLANES |
|
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CLIP_PLANES;
|
||||||
DRW_STATE_WIRE;
|
|
||||||
psl->transparent_pass = DRW_pass_create("Material Transparent Pass", state);
|
psl->transparent_pass = DRW_pass_create("Material Transparent Pass", state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ void EEVEE_subsurface_output_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Dat
|
|||||||
|
|
||||||
/* Make the opaque refraction pass mask the sss. */
|
/* Make the opaque refraction pass mask the sss. */
|
||||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_CLIP_PLANES |
|
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_CLIP_PLANES |
|
||||||
DRW_STATE_WIRE | DRW_STATE_WRITE_STENCIL;
|
DRW_STATE_WRITE_STENCIL;
|
||||||
DRW_pass_state_set(vedata->psl->refract_pass, state);
|
DRW_pass_state_set(vedata->psl->refract_pass, state);
|
||||||
DRW_pass_foreach_shgroup(vedata->psl->refract_pass, &set_shgrp_stencil, NULL);
|
DRW_pass_foreach_shgroup(vedata->psl->refract_pass, &set_shgrp_stencil, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -313,43 +313,47 @@ void DRW_shader_free(struct GPUShader *shader);
|
|||||||
/* Batches */
|
/* Batches */
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
/** Wrtie mask */
|
||||||
DRW_STATE_WRITE_DEPTH = (1 << 0),
|
DRW_STATE_WRITE_DEPTH = (1 << 0),
|
||||||
DRW_STATE_WRITE_COLOR = (1 << 1),
|
DRW_STATE_WRITE_COLOR = (1 << 1),
|
||||||
DRW_STATE_DEPTH_ALWAYS = (1 << 2),
|
DRW_STATE_WRITE_STENCIL = (1 << 2),
|
||||||
DRW_STATE_DEPTH_LESS = (1 << 3),
|
DRW_STATE_WRITE_STENCIL_SHADOW_PASS = (1 << 3),
|
||||||
DRW_STATE_DEPTH_LESS_EQUAL = (1 << 4),
|
DRW_STATE_WRITE_STENCIL_SHADOW_FAIL = (1 << 4),
|
||||||
DRW_STATE_DEPTH_EQUAL = (1 << 5),
|
|
||||||
DRW_STATE_DEPTH_GREATER = (1 << 6),
|
|
||||||
DRW_STATE_DEPTH_GREATER_EQUAL = (1 << 7),
|
|
||||||
DRW_STATE_CULL_BACK = (1 << 8),
|
|
||||||
DRW_STATE_CULL_FRONT = (1 << 9),
|
|
||||||
DRW_STATE_WIRE = (1 << 10), /* TODO remove */
|
|
||||||
DRW_STATE_POINT = (1 << 11), /* TODO remove */
|
|
||||||
/** Polygon offset. Does not work with lines and points. */
|
|
||||||
DRW_STATE_OFFSET_POSITIVE = (1 << 12),
|
|
||||||
/** Polygon offset. Does not work with lines and points. */
|
|
||||||
DRW_STATE_OFFSET_NEGATIVE = (1 << 13),
|
|
||||||
DRW_STATE_WIRE_WIDE = (1 << 14),
|
|
||||||
DRW_STATE_BLEND = (1 << 15),
|
|
||||||
DRW_STATE_ADDITIVE = (1 << 16),
|
|
||||||
DRW_STATE_MULTIPLY = (1 << 17),
|
|
||||||
DRW_STATE_BLEND_PREMUL_UNDER = (1 << 18),
|
|
||||||
DRW_STATE_CLIP_PLANES = (1 << 19),
|
|
||||||
/** Same as DRW_STATE_ADDITIVE but let alpha accumulate without premult. */
|
|
||||||
DRW_STATE_ADDITIVE_FULL = (1 << 20),
|
|
||||||
/** Use that if color is already premult by alpha. */
|
|
||||||
DRW_STATE_BLEND_PREMUL = (1 << 21),
|
|
||||||
DRW_STATE_WIRE_SMOOTH = (1 << 22),
|
|
||||||
DRW_STATE_TRANS_FEEDBACK = (1 << 23),
|
|
||||||
DRW_STATE_BLEND_OIT = (1 << 24),
|
|
||||||
DRW_STATE_FIRST_VERTEX_CONVENTION = (1 << 25),
|
|
||||||
|
|
||||||
DRW_STATE_WRITE_STENCIL = (1 << 27),
|
/** Depth test */
|
||||||
DRW_STATE_WRITE_STENCIL_SHADOW_PASS = (1 << 28),
|
DRW_STATE_DEPTH_ALWAYS = (1 << 5),
|
||||||
DRW_STATE_WRITE_STENCIL_SHADOW_FAIL = (1 << 29),
|
DRW_STATE_DEPTH_LESS = (1 << 6),
|
||||||
DRW_STATE_STENCIL_EQUAL = (1 << 30),
|
DRW_STATE_DEPTH_LESS_EQUAL = (1 << 7),
|
||||||
DRW_STATE_STENCIL_NEQUAL = (1 << 31),
|
DRW_STATE_DEPTH_EQUAL = (1 << 8),
|
||||||
|
DRW_STATE_DEPTH_GREATER = (1 << 9),
|
||||||
|
DRW_STATE_DEPTH_GREATER_EQUAL = (1 << 10),
|
||||||
|
/** Culling test */
|
||||||
|
DRW_STATE_CULL_BACK = (1 << 11),
|
||||||
|
DRW_STATE_CULL_FRONT = (1 << 12),
|
||||||
|
/** Stencil test */
|
||||||
|
DRW_STATE_STENCIL_EQUAL = (1 << 13),
|
||||||
|
DRW_STATE_STENCIL_NEQUAL = (1 << 14),
|
||||||
|
|
||||||
|
/** Blend state */
|
||||||
|
DRW_STATE_ADDITIVE = (1 << 15),
|
||||||
|
/** Same as additive but let alpha accumulate without premult. */
|
||||||
|
DRW_STATE_ADDITIVE_FULL = (1 << 16),
|
||||||
|
DRW_STATE_BLEND = (1 << 17),
|
||||||
|
/** Use that if color is already premult by alpha. */
|
||||||
|
DRW_STATE_BLEND_PREMUL = (1 << 18),
|
||||||
|
DRW_STATE_BLEND_PREMUL_UNDER = (1 << 19),
|
||||||
|
DRW_STATE_BLEND_OIT = (1 << 20),
|
||||||
|
DRW_STATE_MULTIPLY = (1 << 21),
|
||||||
|
|
||||||
|
DRW_STATE_CLIP_PLANES = (1 << 22),
|
||||||
|
DRW_STATE_WIRE_SMOOTH = (1 << 23),
|
||||||
|
DRW_STATE_FIRST_VERTEX_CONVENTION = (1 << 24),
|
||||||
|
/** Polygon offset. Does not work with lines and points. */
|
||||||
|
DRW_STATE_OFFSET_POSITIVE = (1 << 25),
|
||||||
|
/** Polygon offset. Does not work with lines and points. */
|
||||||
|
DRW_STATE_OFFSET_NEGATIVE = (1 << 26),
|
||||||
} DRWState;
|
} DRWState;
|
||||||
|
|
||||||
#define DRW_STATE_DEFAULT \
|
#define DRW_STATE_DEFAULT \
|
||||||
(DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL)
|
(DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL)
|
||||||
#define DRW_STATE_RASTERIZER_ENABLED \
|
#define DRW_STATE_RASTERIZER_ENABLED \
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ static void MPATH_cache_init(void *vedata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_POINT;
|
DRWState state = DRW_STATE_WRITE_COLOR;
|
||||||
psl->points = DRW_pass_create("Motionpath Point Pass", state);
|
psl->points = DRW_pass_create("Motionpath Point Pass", state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -385,7 +385,6 @@ struct DRWCallBuffer *buffer_groundpoints_uniform_color(DRWPass *pass,
|
|||||||
|
|
||||||
DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
|
DRWShadingGroup *grp = DRW_shgroup_create(sh, pass);
|
||||||
DRW_shgroup_uniform_vec4(grp, "color", color, 1);
|
DRW_shgroup_uniform_vec4(grp, "color", color, 1);
|
||||||
DRW_shgroup_state_enable(grp, DRW_STATE_POINT);
|
|
||||||
if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
|
if (sh_cfg == GPU_SHADER_CFG_CLIPPED) {
|
||||||
DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
|
DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,9 +98,9 @@ static GPUShader *hair_refine_shader_get(ParticleRefineShader sh)
|
|||||||
void DRW_hair_init(void)
|
void DRW_hair_init(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_TRANSFORM_FEEDBACK
|
#ifdef USE_TRANSFORM_FEEDBACK
|
||||||
g_tf_pass = DRW_pass_create("Update Hair Pass", DRW_STATE_TRANS_FEEDBACK);
|
g_tf_pass = DRW_pass_create("Update Hair Pass", 0);
|
||||||
#else
|
#else
|
||||||
g_tf_pass = DRW_pass_create("Update Hair Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_POINT);
|
g_tf_pass = DRW_pass_create("Update Hair Pass", DRW_STATE_WRITE_COLOR);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1729,16 +1729,15 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DRW_draw_callbacks_post_scene();
|
DRW_draw_callbacks_post_scene();
|
||||||
|
DRW_state_reset();
|
||||||
|
|
||||||
if (DST.draw_ctx.evil_C) {
|
if (DST.draw_ctx.evil_C) {
|
||||||
DRW_state_reset();
|
|
||||||
ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.ar, REGION_DRAW_POST_VIEW);
|
ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.ar, REGION_DRAW_POST_VIEW);
|
||||||
/* Callback can be nasty and do whatever they want with the state.
|
/* Callback can be nasty and do whatever they want with the state.
|
||||||
* Don't trust them! */
|
* Don't trust them! */
|
||||||
DRW_state_reset();
|
DRW_state_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_state_reset();
|
|
||||||
|
|
||||||
drw_debug_draw();
|
drw_debug_draw();
|
||||||
|
|
||||||
GPU_depth_test(false);
|
GPU_depth_test(false);
|
||||||
|
|||||||
@@ -168,18 +168,11 @@ void drw_state_set(DRWState state)
|
|||||||
/* Wire Width */
|
/* Wire Width */
|
||||||
{
|
{
|
||||||
int test;
|
int test;
|
||||||
if (CHANGED_ANY_STORE_VAR(DRW_STATE_WIRE | DRW_STATE_WIRE_WIDE | DRW_STATE_WIRE_SMOOTH,
|
if ((test = CHANGED_TO(DRW_STATE_WIRE_SMOOTH))) {
|
||||||
test)) {
|
if (test == 1) {
|
||||||
if (test & DRW_STATE_WIRE_WIDE) {
|
|
||||||
GPU_line_width(3.0f);
|
|
||||||
}
|
|
||||||
else if (test & DRW_STATE_WIRE_SMOOTH) {
|
|
||||||
GPU_line_width(2.0f);
|
GPU_line_width(2.0f);
|
||||||
GPU_line_smooth(true);
|
GPU_line_smooth(true);
|
||||||
}
|
}
|
||||||
else if (test & DRW_STATE_WIRE) {
|
|
||||||
GPU_line_width(1.0f);
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
GPU_line_width(1.0f);
|
GPU_line_width(1.0f);
|
||||||
GPU_line_smooth(false);
|
GPU_line_smooth(false);
|
||||||
@@ -187,20 +180,6 @@ void drw_state_set(DRWState state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Points Size */
|
|
||||||
{
|
|
||||||
int test;
|
|
||||||
if ((test = CHANGED_TO(DRW_STATE_POINT))) {
|
|
||||||
if (test == 1) {
|
|
||||||
GPU_enable_program_point_size();
|
|
||||||
glPointSize(5.0f);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
GPU_disable_program_point_size();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Blending (all buffer) */
|
/* Blending (all buffer) */
|
||||||
{
|
{
|
||||||
int test;
|
int test;
|
||||||
@@ -401,6 +380,9 @@ void DRW_state_reset(void)
|
|||||||
{
|
{
|
||||||
DRW_state_reset_ex(DRW_STATE_DEFAULT);
|
DRW_state_reset_ex(DRW_STATE_DEFAULT);
|
||||||
|
|
||||||
|
GPU_point_size(5);
|
||||||
|
GPU_enable_program_point_size();
|
||||||
|
|
||||||
/* Reset blending function */
|
/* Reset blending function */
|
||||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
}
|
}
|
||||||
@@ -689,8 +671,8 @@ bool DRW_culling_sphere_test(BoundSphere *bsphere)
|
|||||||
/* TODO we could test against the inscribed sphere of the frustum to early out positively. */
|
/* TODO we could test against the inscribed sphere of the frustum to early out positively. */
|
||||||
|
|
||||||
/* Test against the 6 frustum planes. */
|
/* Test against the 6 frustum planes. */
|
||||||
/* TODO order planes with sides first then far then near clip. Should be better culling heuristic
|
/* TODO order planes with sides first then far then near clip. Should be better culling
|
||||||
* when sculpting. */
|
* heuristic when sculpting. */
|
||||||
for (int p = 0; p < 6; p++) {
|
for (int p = 0; p < 6; p++) {
|
||||||
float dist = plane_point_side_v3(DST.clipping.frustum_planes[p], bsphere->center);
|
float dist = plane_point_side_v3(DST.clipping.frustum_planes[p], bsphere->center);
|
||||||
if (dist < -bsphere->radius) {
|
if (dist < -bsphere->radius) {
|
||||||
@@ -1101,7 +1083,7 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
|
|||||||
DST.shader = shgroup->shader;
|
DST.shader = shgroup->shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pass_state & DRW_STATE_TRANS_FEEDBACK) != 0 && (shgroup->tfeedback_target != NULL)) {
|
if (shgroup->tfeedback_target != NULL) {
|
||||||
use_tfeedback = GPU_shader_transform_feedback_enable(shgroup->shader,
|
use_tfeedback = GPU_shader_transform_feedback_enable(shgroup->shader,
|
||||||
shgroup->tfeedback_target->vbo_id);
|
shgroup->tfeedback_target->vbo_id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ static void EDIT_ARMATURE_cache_init(void *vedata)
|
|||||||
psl->bone_envelope[i] = DRW_pass_create("Bone Envelope Outline Pass", state);
|
psl->bone_envelope[i] = DRW_pass_create("Bone Envelope Outline Pass", state);
|
||||||
|
|
||||||
state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
||||||
DRW_STATE_BLEND | DRW_STATE_WIRE;
|
DRW_STATE_BLEND;
|
||||||
psl->relationship[i] = DRW_pass_create("Bone Relationship Pass", state);
|
psl->relationship[i] = DRW_pass_create("Bone Relationship Pass", state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -207,9 +207,8 @@ static void EDIT_CURVE_cache_init(void *vedata)
|
|||||||
DRWShadingGroup *grp;
|
DRWShadingGroup *grp;
|
||||||
|
|
||||||
/* Center-Line (wire) */
|
/* Center-Line (wire) */
|
||||||
psl->wire_pass = DRW_pass_create("Curve Wire",
|
psl->wire_pass = DRW_pass_create(
|
||||||
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
|
"Curve Wire", DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL);
|
||||||
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WIRE);
|
|
||||||
EDIT_CURVE_wire_shgrp_create(sh_data,
|
EDIT_CURVE_wire_shgrp_create(sh_data,
|
||||||
v3d,
|
v3d,
|
||||||
rv3d,
|
rv3d,
|
||||||
@@ -217,9 +216,8 @@ static void EDIT_CURVE_cache_init(void *vedata)
|
|||||||
&stl->g_data->wire_shgrp,
|
&stl->g_data->wire_shgrp,
|
||||||
&stl->g_data->wire_normals_shgrp);
|
&stl->g_data->wire_normals_shgrp);
|
||||||
|
|
||||||
psl->wire_pass_xray = DRW_pass_create("Curve Wire Xray",
|
psl->wire_pass_xray = DRW_pass_create(
|
||||||
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
|
"Curve Wire Xray", DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS);
|
||||||
DRW_STATE_DEPTH_ALWAYS | DRW_STATE_WIRE);
|
|
||||||
EDIT_CURVE_wire_shgrp_create(sh_data,
|
EDIT_CURVE_wire_shgrp_create(sh_data,
|
||||||
v3d,
|
v3d,
|
||||||
rv3d,
|
rv3d,
|
||||||
@@ -239,8 +237,7 @@ static void EDIT_CURVE_cache_init(void *vedata)
|
|||||||
}
|
}
|
||||||
stl->g_data->overlay_edge_shgrp = grp;
|
stl->g_data->overlay_edge_shgrp = grp;
|
||||||
|
|
||||||
psl->overlay_vert_pass = DRW_pass_create("Curve Vert Overlay",
|
psl->overlay_vert_pass = DRW_pass_create("Curve Vert Overlay", DRW_STATE_WRITE_COLOR);
|
||||||
DRW_STATE_WRITE_COLOR | DRW_STATE_POINT);
|
|
||||||
|
|
||||||
grp = DRW_shgroup_create(sh_data->overlay_vert_sh, psl->overlay_vert_pass);
|
grp = DRW_shgroup_create(sh_data->overlay_vert_sh, psl->overlay_vert_pass);
|
||||||
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
|
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
|
||||||
|
|||||||
@@ -183,14 +183,14 @@ static void EDIT_LATTICE_cache_init(void *vedata)
|
|||||||
{
|
{
|
||||||
psl->wire_pass = DRW_pass_create("Lattice Wire",
|
psl->wire_pass = DRW_pass_create("Lattice Wire",
|
||||||
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
|
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
|
||||||
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WIRE);
|
DRW_STATE_DEPTH_LESS_EQUAL);
|
||||||
stl->g_data->wire_shgrp = DRW_shgroup_create(sh_data->wire, psl->wire_pass);
|
stl->g_data->wire_shgrp = DRW_shgroup_create(sh_data->wire, psl->wire_pass);
|
||||||
if (rv3d->rflag & RV3D_CLIPPING) {
|
if (rv3d->rflag & RV3D_CLIPPING) {
|
||||||
DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->wire_shgrp, rv3d);
|
DRW_shgroup_world_clip_planes_from_rv3d(stl->g_data->wire_shgrp, rv3d);
|
||||||
}
|
}
|
||||||
|
|
||||||
psl->vert_pass = DRW_pass_create(
|
psl->vert_pass = DRW_pass_create("Lattice Verts",
|
||||||
"Lattice Verts", DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_POINT);
|
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH);
|
||||||
stl->g_data->vert_shgrp = DRW_shgroup_create(sh_data->overlay_vert, psl->vert_pass);
|
stl->g_data->vert_shgrp = DRW_shgroup_create(sh_data->overlay_vert, psl->vert_pass);
|
||||||
DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", G_draw.block_ubo);
|
DRW_shgroup_uniform_block(stl->g_data->vert_shgrp, "globalsBlock", G_draw.block_ubo);
|
||||||
if (rv3d->rflag & RV3D_CLIPPING) {
|
if (rv3d->rflag & RV3D_CLIPPING) {
|
||||||
|
|||||||
@@ -337,8 +337,7 @@ static DRWPass *edit_mesh_create_overlay_pass(float *face_alpha,
|
|||||||
}
|
}
|
||||||
const float depth_ofs = bglPolygonOffsetCalc((float *)winmat, viewdist, 1.0f);
|
const float depth_ofs = bglPolygonOffsetCalc((float *)winmat, viewdist, 1.0f);
|
||||||
|
|
||||||
DRWPass *pass = DRW_pass_create("Edit Mesh Face Overlay Pass",
|
DRWPass *pass = DRW_pass_create("Edit Mesh Face Overlay Pass", DRW_STATE_WRITE_COLOR | statemod);
|
||||||
DRW_STATE_WRITE_COLOR | DRW_STATE_POINT | statemod);
|
|
||||||
|
|
||||||
DRWShadingGroup *grp;
|
DRWShadingGroup *grp;
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ static void EDIT_METABALL_cache_init(void *vedata)
|
|||||||
{
|
{
|
||||||
/* Create a pass */
|
/* Create a pass */
|
||||||
DRWState state = (DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
DRWState state = (DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
||||||
DRW_STATE_BLEND | DRW_STATE_WIRE);
|
DRW_STATE_BLEND);
|
||||||
psl->pass = DRW_pass_create("My Pass", state);
|
psl->pass = DRW_pass_create("My Pass", state);
|
||||||
|
|
||||||
/* Create a shadingGroup using a function in draw_common.c or custom one */
|
/* Create a shadingGroup using a function in draw_common.c or custom one */
|
||||||
|
|||||||
@@ -162,9 +162,8 @@ static void EDIT_TEXT_cache_init(void *vedata)
|
|||||||
|
|
||||||
{
|
{
|
||||||
/* Text outline (fast drawing!) */
|
/* Text outline (fast drawing!) */
|
||||||
psl->wire_pass = DRW_pass_create("Font Wire",
|
psl->wire_pass = DRW_pass_create(
|
||||||
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
|
"Font Wire", DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL);
|
||||||
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WIRE);
|
|
||||||
stl->g_data->wire_shgrp = DRW_shgroup_create(e_data.wire_sh, psl->wire_pass);
|
stl->g_data->wire_shgrp = DRW_shgroup_create(e_data.wire_sh, psl->wire_pass);
|
||||||
|
|
||||||
psl->overlay_select_pass = DRW_pass_create("Font Select",
|
psl->overlay_select_pass = DRW_pass_create("Font Select",
|
||||||
|
|||||||
@@ -1070,8 +1070,7 @@ static void OBJECT_cache_init(void *vedata)
|
|||||||
g_data->custom_shapes = BLI_ghash_ptr_new(__func__);
|
g_data->custom_shapes = BLI_ghash_ptr_new(__func__);
|
||||||
|
|
||||||
{
|
{
|
||||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
|
||||||
DRW_STATE_WIRE;
|
|
||||||
psl->outlines = DRW_pass_create("Outlines Depth Pass", state);
|
psl->outlines = DRW_pass_create("Outlines Depth Pass", state);
|
||||||
|
|
||||||
GPUShader *sh = sh_data->outline_prepass;
|
GPUShader *sh = sh_data->outline_prepass;
|
||||||
@@ -1096,8 +1095,7 @@ static void OBJECT_cache_init(void *vedata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
|
||||||
DRW_STATE_POINT;
|
|
||||||
DRWPass *pass = psl->lightprobes = DRW_pass_create("Object Probe Pass", state);
|
DRWPass *pass = psl->lightprobes = DRW_pass_create("Object Probe Pass", state);
|
||||||
struct GPUBatch *sphere = DRW_cache_sphere_get();
|
struct GPUBatch *sphere = DRW_cache_sphere_get();
|
||||||
struct GPUBatch *quad = DRW_cache_quad_get();
|
struct GPUBatch *quad = DRW_cache_quad_get();
|
||||||
@@ -1236,8 +1234,7 @@ static void OBJECT_cache_init(void *vedata)
|
|||||||
sgl->bone_envelope = psl->bone_envelope[i] = DRW_pass_create("Bone Envelope Outline Pass",
|
sgl->bone_envelope = psl->bone_envelope[i] = DRW_pass_create("Bone Envelope Outline Pass",
|
||||||
state);
|
state);
|
||||||
|
|
||||||
state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
|
||||||
DRW_STATE_WIRE;
|
|
||||||
sgl->bone_axes = psl->bone_axes[i] = DRW_pass_create("Bone Axes Pass", state);
|
sgl->bone_axes = psl->bone_axes[i] = DRW_pass_create("Bone Axes Pass", state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1249,10 +1246,10 @@ static void OBJECT_cache_init(void *vedata)
|
|||||||
struct GPUShader *sh;
|
struct GPUShader *sh;
|
||||||
|
|
||||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
||||||
DRW_STATE_BLEND | DRW_STATE_POINT | DRW_STATE_WIRE;
|
DRW_STATE_BLEND;
|
||||||
sgl->non_meshes = psl->non_meshes[i] = DRW_pass_create("Non Meshes Pass", state);
|
sgl->non_meshes = psl->non_meshes[i] = DRW_pass_create("Non Meshes Pass", state);
|
||||||
|
|
||||||
state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND | DRW_STATE_WIRE;
|
state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND;
|
||||||
sgl->image_empties = psl->image_empties[i] = DRW_pass_create("Image Empties", state);
|
sgl->image_empties = psl->image_empties[i] = DRW_pass_create("Image Empties", state);
|
||||||
|
|
||||||
/* Empties */
|
/* Empties */
|
||||||
@@ -1406,7 +1403,6 @@ static void OBJECT_cache_init(void *vedata)
|
|||||||
DRWShadingGroup *grp = DRW_shgroup_create(sh, sgl->non_meshes);
|
DRWShadingGroup *grp = DRW_shgroup_create(sh, sgl->non_meshes);
|
||||||
DRW_shgroup_uniform_vec4(grp, "color", gb->colorLightNoAlpha, 1);
|
DRW_shgroup_uniform_vec4(grp, "color", gb->colorLightNoAlpha, 1);
|
||||||
DRW_shgroup_uniform_float(grp, "size", &gb->sizeLightCenter, 1);
|
DRW_shgroup_uniform_float(grp, "size", &gb->sizeLightCenter, 1);
|
||||||
DRW_shgroup_state_enable(grp, DRW_STATE_POINT);
|
|
||||||
if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
|
if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
|
||||||
DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
|
DRW_shgroup_world_clip_planes_from_rv3d(grp, DRW_context_state_get()->rv3d);
|
||||||
}
|
}
|
||||||
@@ -1532,7 +1528,7 @@ static void OBJECT_cache_init(void *vedata)
|
|||||||
DRWShadingGroup *grp;
|
DRWShadingGroup *grp;
|
||||||
static float outlineWidth, size;
|
static float outlineWidth, size;
|
||||||
|
|
||||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | DRW_STATE_POINT;
|
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND;
|
||||||
psl->ob_center = DRW_pass_create("Obj Center Pass", state);
|
psl->ob_center = DRW_pass_create("Obj Center Pass", state);
|
||||||
|
|
||||||
outlineWidth = 1.0f * U.pixelsize;
|
outlineWidth = 1.0f * U.pixelsize;
|
||||||
@@ -1578,8 +1574,7 @@ static void OBJECT_cache_init(void *vedata)
|
|||||||
/* Particle Pass */
|
/* Particle Pass */
|
||||||
psl->particle = DRW_pass_create("Particle Pass",
|
psl->particle = DRW_pass_create("Particle Pass",
|
||||||
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
|
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
|
||||||
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_POINT |
|
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND);
|
||||||
DRW_STATE_BLEND);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,10 +123,9 @@ static void particle_cache_init(void *vedata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create a pass */
|
/* Create a pass */
|
||||||
psl->psys_edit_pass = DRW_pass_create("PSys Edit Pass",
|
psl->psys_edit_pass = DRW_pass_create(
|
||||||
(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
|
"PSys Edit Pass",
|
||||||
DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WIRE |
|
(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL));
|
||||||
DRW_STATE_POINT));
|
|
||||||
|
|
||||||
GPUShader *strand_shader = (use_weight) ? e_data.strands_weight_shader : e_data.strands_shader;
|
GPUShader *strand_shader = (use_weight) ? e_data.strands_weight_shader : e_data.strands_shader;
|
||||||
stl->g_data->strands_group = DRW_shgroup_create(strand_shader, psl->psys_edit_pass);
|
stl->g_data->strands_group = DRW_shgroup_create(strand_shader, psl->psys_edit_pass);
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ static void POSE_cache_init(void *vedata)
|
|||||||
psl->bone_envelope[i] = DRW_pass_create("Bone Envelope Outline Pass", state);
|
psl->bone_envelope[i] = DRW_pass_create("Bone Envelope Outline Pass", state);
|
||||||
|
|
||||||
state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
|
||||||
DRW_STATE_BLEND | DRW_STATE_WIRE;
|
DRW_STATE_BLEND;
|
||||||
psl->relationship[i] = DRW_pass_create("Bone Relationship Pass", state);
|
psl->relationship[i] = DRW_pass_create("Bone Relationship Pass", state);
|
||||||
|
|
||||||
ppd->custom_shapes[i] = BLI_ghash_ptr_new(__func__);
|
ppd->custom_shapes[i] = BLI_ghash_ptr_new(__func__);
|
||||||
|
|||||||
Reference in New Issue
Block a user