Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_manager_exec.c
| Show First 20 Lines • Show All 315 Lines • ▼ Show 20 Lines | if ((test = CHANGED_TO(DRW_STATE_SHADOW_OFFSET))) { | ||||
| } | } | ||||
| else { | else { | ||||
| glDisable(GL_POLYGON_OFFSET_FILL); | glDisable(GL_POLYGON_OFFSET_FILL); | ||||
| glDisable(GL_POLYGON_OFFSET_LINE); | glDisable(GL_POLYGON_OFFSET_LINE); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* Logic Ops */ | |||||
| { | |||||
| int test; | |||||
| if ((test = CHANGED_TO(DRW_STATE_LOGIC_INVERT))) { | |||||
| if (test == 1) { | |||||
| glLogicOp(GL_INVERT); | |||||
| glEnable(GL_COLOR_LOGIC_OP); | |||||
| } | |||||
| else { | |||||
| glLogicOp(GL_COPY); | |||||
| glDisable(GL_COLOR_LOGIC_OP); | |||||
| } | |||||
| } | |||||
| } | |||||
| /* Clip Planes */ | /* Clip Planes */ | ||||
| { | { | ||||
| int test; | int test; | ||||
| if ((test = CHANGED_TO(DRW_STATE_CLIP_PLANES))) { | if ((test = CHANGED_TO(DRW_STATE_CLIP_PLANES))) { | ||||
| if (test == 1) { | if (test == 1) { | ||||
| for (int i = 0; i < DST.view_active->clip_planes_len; i++) { | for (int i = 0; i < DST.view_active->clip_planes_len; i++) { | ||||
| glEnable(GL_CLIP_DISTANCE0 + i); | glEnable(GL_CLIP_DISTANCE0 + i); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 653 Lines • ▼ Show 20 Lines | static void draw_update_uniforms(DRWShadingGroup *shgroup, | ||||
| BLI_assert(ubo_bindings_validate(shgroup)); | BLI_assert(ubo_bindings_validate(shgroup)); | ||||
| } | } | ||||
| BLI_INLINE void draw_select_buffer(DRWShadingGroup *shgroup, | BLI_INLINE void draw_select_buffer(DRWShadingGroup *shgroup, | ||||
| DRWCommandsState *state, | DRWCommandsState *state, | ||||
| GPUBatch *batch, | GPUBatch *batch, | ||||
| const DRWResourceHandle *handle) | const DRWResourceHandle *handle) | ||||
| { | { | ||||
| const bool is_instancing = (batch->inst != NULL); | const bool is_instancing = (batch->inst[0] != NULL); | ||||
| int start = 0; | int start = 0; | ||||
| int count = 1; | int count = 1; | ||||
| int tot = is_instancing ? batch->inst->vertex_len : batch->verts[0]->vertex_len; | int tot = is_instancing ? batch->inst[0]->vertex_len : batch->verts[0]->vertex_len; | ||||
| /* Hack : get "vbo" data without actually drawing. */ | /* Hack : get "vbo" data without actually drawing. */ | ||||
| int *select_id = (void *)state->select_buf->data; | int *select_id = (void *)state->select_buf->data; | ||||
| /* Batching */ | /* Batching */ | ||||
| if (!is_instancing) { | if (!is_instancing) { | ||||
| /* FIXME: Meh a bit nasty. */ | /* FIXME: Meh a bit nasty. */ | ||||
| if (batch->gl_prim_type == convert_prim_type_to_gl(GPU_PRIM_TRIS)) { | if (batch->gl_prim_type == convert_prim_type_to_gl(GPU_PRIM_TRIS)) { | ||||
| count = 3; | count = 3; | ||||
| ▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static void draw_call_single_do(DRWShadingGroup *shgroup, | static void draw_call_single_do(DRWShadingGroup *shgroup, | ||||
| DRWCommandsState *state, | DRWCommandsState *state, | ||||
| GPUBatch *batch, | GPUBatch *batch, | ||||
| DRWResourceHandle handle, | DRWResourceHandle handle, | ||||
| int vert_first, | int vert_first, | ||||
| int vert_count, | int vert_count, | ||||
| int inst_count) | int inst_count, | ||||
| bool do_base_instance) | |||||
| { | { | ||||
| draw_call_batching_flush(shgroup, state); | draw_call_batching_flush(shgroup, state); | ||||
| draw_call_resource_bind(state, &handle); | draw_call_resource_bind(state, &handle); | ||||
| /* TODO This is Legacy. Need to be removed. */ | /* TODO This is Legacy. Need to be removed. */ | ||||
| if (state->obmats_loc == -1 && | if (state->obmats_loc == -1 && | ||||
| (state->obmat_loc != -1 || state->obinv_loc != -1 || state->mvp_loc != -1)) { | (state->obmat_loc != -1 || state->obinv_loc != -1 || state->mvp_loc != -1)) { | ||||
| Show All 10 Lines | else { | ||||
| GPU_select_load_id(state->select_id); | GPU_select_load_id(state->select_id); | ||||
| } | } | ||||
| } | } | ||||
| draw_geometry_execute(shgroup, | draw_geometry_execute(shgroup, | ||||
| batch, | batch, | ||||
| vert_first, | vert_first, | ||||
| vert_count, | vert_count, | ||||
| DRW_handle_id_get(&handle), | do_base_instance ? DRW_handle_id_get(&handle) : 0, | ||||
| inst_count, | inst_count, | ||||
| state->baseinst_loc); | state->baseinst_loc); | ||||
| } | } | ||||
| static void draw_call_batching_start(DRWCommandsState *state) | static void draw_call_batching_start(DRWCommandsState *state) | ||||
| { | { | ||||
| state->neg_scale = false; | state->neg_scale = false; | ||||
| state->resource_chunk = 0; | state->resource_chunk = 0; | ||||
| ▲ Show 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | #endif | ||||
| break; | break; | ||||
| case DRW_CMD_SELECTID: | case DRW_CMD_SELECTID: | ||||
| state.select_id = cmd->select_id.select_id; | state.select_id = cmd->select_id.select_id; | ||||
| state.select_buf = cmd->select_id.select_buf; | state.select_buf = cmd->select_id.select_buf; | ||||
| break; | break; | ||||
| case DRW_CMD_DRAW: | case DRW_CMD_DRAW: | ||||
| if (!USE_BATCHING || state.obmats_loc == -1 || (G.f & G_FLAG_PICKSEL) || | if (!USE_BATCHING || state.obmats_loc == -1 || (G.f & G_FLAG_PICKSEL) || | ||||
| cmd->draw.batch->inst) { | cmd->draw.batch->inst) { | ||||
| draw_call_single_do(shgroup, &state, cmd->draw.batch, cmd->draw.handle, 0, 0, 0); | draw_call_single_do(shgroup, &state, cmd->draw.batch, cmd->draw.handle, 0, 0, 0, true); | ||||
| } | } | ||||
| else { | else { | ||||
| draw_call_batching_do(shgroup, &state, &cmd->draw); | draw_call_batching_do(shgroup, &state, &cmd->draw); | ||||
| } | } | ||||
| break; | break; | ||||
| case DRW_CMD_DRAW_PROCEDURAL: | case DRW_CMD_DRAW_PROCEDURAL: | ||||
| draw_call_single_do(shgroup, | draw_call_single_do(shgroup, | ||||
| &state, | &state, | ||||
| cmd->procedural.batch, | cmd->procedural.batch, | ||||
| cmd->procedural.handle, | cmd->procedural.handle, | ||||
| 0, | 0, | ||||
| cmd->procedural.vert_count, | cmd->procedural.vert_count, | ||||
| 1); | 1, | ||||
| true); | |||||
| break; | break; | ||||
| case DRW_CMD_DRAW_INSTANCE: | case DRW_CMD_DRAW_INSTANCE: | ||||
| draw_call_single_do(shgroup, | draw_call_single_do(shgroup, | ||||
| &state, | &state, | ||||
| cmd->instance.batch, | cmd->instance.batch, | ||||
| cmd->instance.handle, | cmd->instance.handle, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| cmd->instance.inst_count); | cmd->instance.inst_count, | ||||
| cmd->instance.use_attribs == 0); | |||||
| break; | break; | ||||
| case DRW_CMD_DRAW_RANGE: | case DRW_CMD_DRAW_RANGE: | ||||
| draw_call_single_do(shgroup, | draw_call_single_do(shgroup, | ||||
| &state, | &state, | ||||
| cmd->range.batch, | cmd->range.batch, | ||||
| (DRWResourceHandle)0, | (DRWResourceHandle)0, | ||||
| cmd->range.vert_first, | cmd->range.vert_first, | ||||
| cmd->range.vert_count, | cmd->range.vert_count, | ||||
| 1); | 1, | ||||
| true); | |||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| draw_call_batching_finish(shgroup, &state); | draw_call_batching_finish(shgroup, &state); | ||||
| } | } | ||||
| if (use_tfeedback) { | if (use_tfeedback) { | ||||
| ▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines | |||||