DRW: Remove support for NormalMatrix
This commit is contained in:
parent
1a99b6fc7e
commit
e2d04229c3
Notes:
blender-bot
2023-02-14 06:00:45 +01:00
Referenced by issue #64379, Crash when Opening Files with Armatures with Custom Shapes Referenced by issue #64363, Texture node in EEVEE makes shader pink in lookDev and render view mode Referenced by issue #64368, Blender 2.8 crashes when I click UV Editing or Texture Paint tabs
|
@ -103,7 +103,6 @@ enum {
|
|||
DRW_CALL_MODELVIEW = (1 << 1),
|
||||
DRW_CALL_MODELVIEWINVERSE = (1 << 2),
|
||||
DRW_CALL_MODELVIEWPROJECTION = (1 << 3),
|
||||
DRW_CALL_NORMALVIEW = (1 << 4),
|
||||
DRW_CALL_ORCOTEXFAC = (1 << 7),
|
||||
DRW_CALL_OBJECTINFO = (1 << 8),
|
||||
};
|
||||
|
@ -124,7 +123,6 @@ typedef struct DRWCallState {
|
|||
float modelview[4][4];
|
||||
float modelviewinverse[4][4];
|
||||
float modelviewprojection[4][4];
|
||||
float normalview[3][3];
|
||||
float orcotexfac[2][3]; /* Not view dependent */
|
||||
float objectinfo[2];
|
||||
} DRWCallState;
|
||||
|
@ -255,7 +253,6 @@ struct DRWShadingGroup {
|
|||
int modelview;
|
||||
int modelviewinverse;
|
||||
int modelviewprojection;
|
||||
int normalview;
|
||||
int orcotexfac;
|
||||
int callid;
|
||||
int objectinfo;
|
||||
|
|
|
@ -837,11 +837,13 @@ static void drw_shgroup_init(DRWShadingGroup *shgroup, GPUShader *shader)
|
|||
shgroup->modelview = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MODELVIEW);
|
||||
shgroup->modelviewinverse = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MODELVIEW_INV);
|
||||
shgroup->modelviewprojection = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MVP);
|
||||
shgroup->normalview = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_NORMAL);
|
||||
shgroup->orcotexfac = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_ORCO);
|
||||
shgroup->objectinfo = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_OBJECT_INFO);
|
||||
shgroup->callid = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_CALLID);
|
||||
|
||||
/* We do not support normal matrix anymore. */
|
||||
BLI_assert(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_NORMAL) == -1);
|
||||
|
||||
shgroup->matflag = 0;
|
||||
if (shgroup->modelinverse > -1) {
|
||||
shgroup->matflag |= DRW_CALL_MODELINVERSE;
|
||||
|
@ -855,9 +857,6 @@ static void drw_shgroup_init(DRWShadingGroup *shgroup, GPUShader *shader)
|
|||
if (shgroup->modelviewprojection > -1) {
|
||||
shgroup->matflag |= DRW_CALL_MODELVIEWPROJECTION;
|
||||
}
|
||||
if (shgroup->normalview > -1) {
|
||||
shgroup->matflag |= DRW_CALL_NORMALVIEW;
|
||||
}
|
||||
if (shgroup->orcotexfac > -1) {
|
||||
shgroup->matflag |= DRW_CALL_ORCOTEXFAC;
|
||||
}
|
||||
|
|
|
@ -792,7 +792,7 @@ static void draw_matrices_model_prepare(DRWCallState *st)
|
|||
return;
|
||||
}
|
||||
/* Order matters */
|
||||
if (st->matflag & (DRW_CALL_MODELVIEW | DRW_CALL_MODELVIEWINVERSE | DRW_CALL_NORMALVIEW)) {
|
||||
if (st->matflag & (DRW_CALL_MODELVIEW | DRW_CALL_MODELVIEWINVERSE)) {
|
||||
mul_m4_m4m4(st->modelview, DST.view_data.matstate.mat[DRW_MAT_VIEW], st->model);
|
||||
}
|
||||
if (st->matflag & DRW_CALL_MODELVIEWINVERSE) {
|
||||
|
@ -801,11 +801,6 @@ static void draw_matrices_model_prepare(DRWCallState *st)
|
|||
if (st->matflag & DRW_CALL_MODELVIEWPROJECTION) {
|
||||
mul_m4_m4m4(st->modelviewprojection, DST.view_data.matstate.mat[DRW_MAT_PERS], st->model);
|
||||
}
|
||||
if (st->matflag & (DRW_CALL_NORMALVIEW)) {
|
||||
copy_m3_m4(st->normalview, st->modelview);
|
||||
invert_m3(st->normalview);
|
||||
transpose_m3(st->normalview);
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_geometry_prepare(DRWShadingGroup *shgroup, DRWCall *call)
|
||||
|
@ -836,10 +831,6 @@ static void draw_geometry_prepare(DRWShadingGroup *shgroup, DRWCall *call)
|
|||
1,
|
||||
(float *)state->modelviewprojection);
|
||||
}
|
||||
if (shgroup->normalview != -1) {
|
||||
GPU_shader_uniform_vector(
|
||||
shgroup->shader, shgroup->normalview, 9, 1, (float *)state->normalview);
|
||||
}
|
||||
if (shgroup->objectinfo != -1) {
|
||||
float objectinfo[4];
|
||||
objectinfo[0] = state->objectinfo[0];
|
||||
|
@ -854,7 +845,6 @@ static void draw_geometry_prepare(DRWShadingGroup *shgroup, DRWCall *call)
|
|||
}
|
||||
}
|
||||
else {
|
||||
BLI_assert((shgroup->normalview == -1));
|
||||
/* For instancing and batching. */
|
||||
float unitmat[4][4];
|
||||
unit_m4(unitmat);
|
||||
|
|
|
@ -1038,7 +1038,6 @@ static char *code_generate_vertex(ListBase *nodes, const char *vert_code, bool u
|
|||
|
||||
BLI_dynstr_append(ds,
|
||||
"#define USE_ATTR\n"
|
||||
"uniform mat3 NormalMatrix;\n"
|
||||
"uniform mat4 ModelMatrixInverse;\n"
|
||||
"uniform mat4 ModelMatrix;\n"
|
||||
"vec3 srgb_to_linear_attr(vec3 c) {\n"
|
||||
|
|
Loading…
Reference in New Issue