| 
									
										
										
										
											2016-09-15 18:41:28 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  * as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  |  * of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software Foundation, | 
					
						
							|  |  |  |  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  |  * The Original Code is Copyright (C) 2016 by Mike Erwin. | 
					
						
							| 
									
										
										
										
											2016-09-15 18:41:28 +02:00
										 |  |  |  * All rights reserved. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-18 08:08:12 +11:00
										 |  |  | /** \file
 | 
					
						
							|  |  |  |  * \ingroup gpu | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |  * Mimics old style opengl immediate mode drawing. | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-11 14:52:57 +11:00
										 |  |  | #ifndef GPU_STANDALONE
 | 
					
						
							|  |  |  | #  include "UI_resources.h"
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2016-10-12 23:01:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | #include "GPU_immediate.h"
 | 
					
						
							| 
									
										
										
										
											2020-07-25 18:40:54 +02:00
										 |  |  | #include "GPU_matrix.h"
 | 
					
						
							| 
									
										
										
										
											2020-07-17 03:20:43 +02:00
										 |  |  | #include "GPU_texture.h"
 | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-08 03:01:45 +02:00
										 |  |  | #include "gpu_context_private.hh"
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  | #include "gpu_immediate_private.hh"
 | 
					
						
							| 
									
										
										
										
											2020-08-14 15:20:35 +02:00
										 |  |  | #include "gpu_shader_private.hh"
 | 
					
						
							| 
									
										
										
										
											2020-09-06 16:40:07 +02:00
										 |  |  | #include "gpu_vertex_buffer_private.hh"
 | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | #include "gpu_vertex_format_private.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  | using namespace blender::gpu; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-08 03:18:49 +02:00
										 |  |  | static thread_local Immediate *imm = NULL; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | void immActivate(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-09-08 04:12:12 +02:00
										 |  |  |   imm = Context::get()->imm; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void immDeactivate(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   imm = NULL; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 23:09:31 +10:00
										 |  |  | GPUVertFormat *immVertexFormat(void) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPU_vertformat_clear(&imm->vertex_format); | 
					
						
							|  |  |  |   return &imm->vertex_format; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-30 01:07:29 +02:00
										 |  |  | void immBindShader(GPUShader *shader) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->shader == NULL); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   imm->shader = shader; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   if (!imm->vertex_format.packed) { | 
					
						
							|  |  |  |     VertexFormat_pack(&imm->vertex_format); | 
					
						
							|  |  |  |     imm->enabled_attr_bits = 0xFFFFu & ~(0xFFFFu << imm->vertex_format.attr_len); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:32:37 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-30 01:07:29 +02:00
										 |  |  |   GPU_shader_bind(shader); | 
					
						
							| 
									
										
										
										
											2020-08-14 15:20:35 +02:00
										 |  |  |   GPU_matrix_bind(shader); | 
					
						
							|  |  |  |   GPU_shader_set_srgb_uniform(shader); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2016-09-15 18:41:28 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-23 14:15:43 +11:00
										 |  |  | void immBindBuiltinProgram(eGPUBuiltinShader shader_id) | 
					
						
							| 
									
										
										
										
											2016-09-15 18:41:28 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   GPUShader *shader = GPU_shader_get_builtin_shader(shader_id); | 
					
						
							| 
									
										
										
										
											2020-07-30 01:07:29 +02:00
										 |  |  |   immBindShader(shader); | 
					
						
							| 
									
										
										
										
											2016-09-15 18:41:28 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2016-10-12 23:01:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | void immUnbindProgram(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->shader != NULL); | 
					
						
							| 
									
										
										
										
											2020-08-30 20:28:30 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-09 00:52:45 +02:00
										 |  |  |   GPU_shader_unbind(); | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   imm->shader = NULL; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-11 15:18:55 +01:00
										 |  |  | /* XXX do not use it. Special hack to use OCIO with batch API. */ | 
					
						
							| 
									
										
										
										
											2020-07-30 01:07:29 +02:00
										 |  |  | GPUShader *immGetShader(void) | 
					
						
							| 
									
										
										
										
											2020-02-11 15:18:55 +01:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   return imm->shader; | 
					
						
							| 
									
										
										
										
											2020-02-11 15:18:55 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-30 20:28:30 +02:00
										 |  |  | #ifndef NDEBUG
 | 
					
						
							| 
									
										
										
										
											2018-07-18 00:12:21 +02:00
										 |  |  | static bool vertex_count_makes_sense_for_primitive(uint vertex_len, GPUPrimType prim_type) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   /* does vertex_len make sense for this primitive type? */ | 
					
						
							|  |  |  |   if (vertex_len == 0) { | 
					
						
							|  |  |  |     return false; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   switch (prim_type) { | 
					
						
							|  |  |  |     case GPU_PRIM_POINTS: | 
					
						
							|  |  |  |       return true; | 
					
						
							|  |  |  |     case GPU_PRIM_LINES: | 
					
						
							|  |  |  |       return vertex_len % 2 == 0; | 
					
						
							|  |  |  |     case GPU_PRIM_LINE_STRIP: | 
					
						
							|  |  |  |     case GPU_PRIM_LINE_LOOP: | 
					
						
							|  |  |  |       return vertex_len >= 2; | 
					
						
							|  |  |  |     case GPU_PRIM_LINE_STRIP_ADJ: | 
					
						
							|  |  |  |       return vertex_len >= 4; | 
					
						
							|  |  |  |     case GPU_PRIM_TRIS: | 
					
						
							|  |  |  |       return vertex_len % 3 == 0; | 
					
						
							|  |  |  |     case GPU_PRIM_TRI_STRIP: | 
					
						
							|  |  |  |     case GPU_PRIM_TRI_FAN: | 
					
						
							|  |  |  |       return vertex_len >= 3; | 
					
						
							|  |  |  |     default: | 
					
						
							|  |  |  |       return false; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 00:12:21 +02:00
										 |  |  | void immBegin(GPUPrimType prim_type, uint vertex_len) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->prim_type == GPU_PRIM_NONE); /* Make sure we haven't already begun. */ | 
					
						
							| 
									
										
										
										
											2020-08-30 20:28:30 +02:00
										 |  |  |   BLI_assert(vertex_count_makes_sense_for_primitive(vertex_len, prim_type)); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   imm->prim_type = prim_type; | 
					
						
							|  |  |  |   imm->vertex_len = vertex_len; | 
					
						
							|  |  |  |   imm->vertex_idx = 0; | 
					
						
							|  |  |  |   imm->unassigned_attr_bits = imm->enabled_attr_bits; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   imm->vertex_data = imm->begin(); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 00:12:21 +02:00
										 |  |  | void immBeginAtMost(GPUPrimType prim_type, uint vertex_len) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-30 20:28:30 +02:00
										 |  |  |   BLI_assert(vertex_len > 0); | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   imm->strict_vertex_len = false; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immBegin(prim_type, vertex_len); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 23:09:31 +10:00
										 |  |  | GPUBatch *immBeginBatch(GPUPrimType prim_type, uint vertex_len) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->prim_type == GPU_PRIM_NONE); /* Make sure we haven't already begun. */ | 
					
						
							| 
									
										
										
										
											2020-08-30 20:28:30 +02:00
										 |  |  |   BLI_assert(vertex_count_makes_sense_for_primitive(vertex_len, prim_type)); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   imm->prim_type = prim_type; | 
					
						
							|  |  |  |   imm->vertex_len = vertex_len; | 
					
						
							|  |  |  |   imm->vertex_idx = 0; | 
					
						
							|  |  |  |   imm->unassigned_attr_bits = imm->enabled_attr_bits; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPUVertBuf *verts = GPU_vertbuf_create_with_format(&imm->vertex_format); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   GPU_vertbuf_data_alloc(verts, vertex_len); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-06 23:45:51 +02:00
										 |  |  |   imm->vertex_data = (uchar *)GPU_vertbuf_get_data(verts); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   imm->batch = GPU_batch_create_ex(prim_type, verts, NULL, GPU_BATCH_OWNS_VBO); | 
					
						
							|  |  |  |   imm->batch->flag |= GPU_BATCH_BUILDING; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   return imm->batch; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 23:09:31 +10:00
										 |  |  | GPUBatch *immBeginBatchAtMost(GPUPrimType prim_type, uint vertex_len) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(vertex_len > 0); | 
					
						
							|  |  |  |   imm->strict_vertex_len = false; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   return immBeginBatch(prim_type, vertex_len); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void immEnd(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* Make sure we're between a Begin/End pair. */ | 
					
						
							|  |  |  |   BLI_assert(imm->vertex_data || imm->batch); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   if (imm->strict_vertex_len) { | 
					
						
							|  |  |  |     BLI_assert(imm->vertex_idx == imm->vertex_len); /* With all vertices defined. */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |     BLI_assert(imm->vertex_idx <= imm->vertex_len); | 
					
						
							|  |  |  |     BLI_assert(imm->vertex_idx == 0 || | 
					
						
							|  |  |  |                vertex_count_makes_sense_for_primitive(imm->vertex_idx, imm->prim_type)); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   if (imm->batch) { | 
					
						
							|  |  |  |     if (imm->vertex_idx < imm->vertex_len) { | 
					
						
							| 
									
										
										
										
											2020-09-10 15:52:00 +02:00
										 |  |  |       GPU_vertbuf_data_resize(imm->batch->verts[0], imm->vertex_idx); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       /* TODO: resize only if vertex count is much smaller */ | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |     GPU_batch_set_shader(imm->batch, imm->shader); | 
					
						
							|  |  |  |     imm->batch->flag &= ~GPU_BATCH_BUILDING; | 
					
						
							|  |  |  |     imm->batch = NULL; /* don't free, batch belongs to caller */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |     imm->end(); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   /* Prepare for next immBegin. */ | 
					
						
							|  |  |  |   imm->prim_type = GPU_PRIM_NONE; | 
					
						
							|  |  |  |   imm->strict_vertex_len = true; | 
					
						
							|  |  |  |   imm->vertex_data = NULL; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | static void setAttrValueBit(uint attr_id) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   uint16_t mask = 1 << attr_id; | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->unassigned_attr_bits & mask); /* not already set */ | 
					
						
							|  |  |  |   imm->unassigned_attr_bits &= ~mask; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* --- generic attribute functions --- */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttr1f(uint attr_id, float x) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPUVertAttr *attr = &imm->vertex_format.attrs[attr_id]; | 
					
						
							|  |  |  |   BLI_assert(attr_id < imm->vertex_format.attr_len); | 
					
						
							| 
									
										
										
										
											2020-08-30 20:28:30 +02:00
										 |  |  |   BLI_assert(attr->comp_type == GPU_COMP_F32); | 
					
						
							|  |  |  |   BLI_assert(attr->comp_len == 1); | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->vertex_idx < imm->vertex_len); | 
					
						
							|  |  |  |   BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   setAttrValueBit(attr_id); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   float *data = (float *)(imm->vertex_data + attr->offset); | 
					
						
							|  |  |  |   /*  printf("%s %td %p\n", __FUNCTION__, (GLubyte*)data - imm->buffer_data, data); */ | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   data[0] = x; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttr2f(uint attr_id, float x, float y) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPUVertAttr *attr = &imm->vertex_format.attrs[attr_id]; | 
					
						
							|  |  |  |   BLI_assert(attr_id < imm->vertex_format.attr_len); | 
					
						
							| 
									
										
										
										
											2020-08-30 20:28:30 +02:00
										 |  |  |   BLI_assert(attr->comp_type == GPU_COMP_F32); | 
					
						
							|  |  |  |   BLI_assert(attr->comp_len == 2); | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->vertex_idx < imm->vertex_len); | 
					
						
							|  |  |  |   BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   setAttrValueBit(attr_id); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   float *data = (float *)(imm->vertex_data + attr->offset); | 
					
						
							|  |  |  |   /*  printf("%s %td %p\n", __FUNCTION__, (GLubyte*)data - imm->buffer_data, data); */ | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   data[0] = x; | 
					
						
							|  |  |  |   data[1] = y; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttr3f(uint attr_id, float x, float y, float z) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPUVertAttr *attr = &imm->vertex_format.attrs[attr_id]; | 
					
						
							|  |  |  |   BLI_assert(attr_id < imm->vertex_format.attr_len); | 
					
						
							| 
									
										
										
										
											2020-08-30 20:28:30 +02:00
										 |  |  |   BLI_assert(attr->comp_type == GPU_COMP_F32); | 
					
						
							|  |  |  |   BLI_assert(attr->comp_len == 3); | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->vertex_idx < imm->vertex_len); | 
					
						
							|  |  |  |   BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   setAttrValueBit(attr_id); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   float *data = (float *)(imm->vertex_data + attr->offset); | 
					
						
							|  |  |  |   /*  printf("%s %td %p\n", __FUNCTION__, (GLubyte*)data - imm->buffer_data, data); */ | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   data[0] = x; | 
					
						
							|  |  |  |   data[1] = y; | 
					
						
							|  |  |  |   data[2] = z; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttr4f(uint attr_id, float x, float y, float z, float w) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPUVertAttr *attr = &imm->vertex_format.attrs[attr_id]; | 
					
						
							|  |  |  |   BLI_assert(attr_id < imm->vertex_format.attr_len); | 
					
						
							| 
									
										
										
										
											2020-08-30 20:28:30 +02:00
										 |  |  |   BLI_assert(attr->comp_type == GPU_COMP_F32); | 
					
						
							|  |  |  |   BLI_assert(attr->comp_len == 4); | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->vertex_idx < imm->vertex_len); | 
					
						
							|  |  |  |   BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   setAttrValueBit(attr_id); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   float *data = (float *)(imm->vertex_data + attr->offset); | 
					
						
							|  |  |  |   /*  printf("%s %td %p\n", __FUNCTION__, (GLubyte*)data - imm->buffer_data, data); */ | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   data[0] = x; | 
					
						
							|  |  |  |   data[1] = y; | 
					
						
							|  |  |  |   data[2] = z; | 
					
						
							|  |  |  |   data[3] = w; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttr1u(uint attr_id, uint x) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPUVertAttr *attr = &imm->vertex_format.attrs[attr_id]; | 
					
						
							|  |  |  |   BLI_assert(attr_id < imm->vertex_format.attr_len); | 
					
						
							| 
									
										
										
										
											2020-08-30 20:28:30 +02:00
										 |  |  |   BLI_assert(attr->comp_type == GPU_COMP_U32); | 
					
						
							|  |  |  |   BLI_assert(attr->comp_len == 1); | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->vertex_idx < imm->vertex_len); | 
					
						
							|  |  |  |   BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   setAttrValueBit(attr_id); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   uint *data = (uint *)(imm->vertex_data + attr->offset); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   data[0] = x; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttr2i(uint attr_id, int x, int y) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPUVertAttr *attr = &imm->vertex_format.attrs[attr_id]; | 
					
						
							|  |  |  |   BLI_assert(attr_id < imm->vertex_format.attr_len); | 
					
						
							| 
									
										
										
										
											2020-08-30 20:28:30 +02:00
										 |  |  |   BLI_assert(attr->comp_type == GPU_COMP_I32); | 
					
						
							|  |  |  |   BLI_assert(attr->comp_len == 2); | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->vertex_idx < imm->vertex_len); | 
					
						
							|  |  |  |   BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   setAttrValueBit(attr_id); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   int *data = (int *)(imm->vertex_data + attr->offset); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   data[0] = x; | 
					
						
							|  |  |  |   data[1] = y; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttr2s(uint attr_id, short x, short y) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPUVertAttr *attr = &imm->vertex_format.attrs[attr_id]; | 
					
						
							|  |  |  |   BLI_assert(attr_id < imm->vertex_format.attr_len); | 
					
						
							| 
									
										
										
										
											2020-08-30 20:28:30 +02:00
										 |  |  |   BLI_assert(attr->comp_type == GPU_COMP_I16); | 
					
						
							|  |  |  |   BLI_assert(attr->comp_len == 2); | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->vertex_idx < imm->vertex_len); | 
					
						
							|  |  |  |   BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   setAttrValueBit(attr_id); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   short *data = (short *)(imm->vertex_data + attr->offset); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   data[0] = x; | 
					
						
							|  |  |  |   data[1] = y; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttr2fv(uint attr_id, const float data[2]) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immAttr2f(attr_id, data[0], data[1]); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttr3fv(uint attr_id, const float data[3]) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immAttr3f(attr_id, data[0], data[1], data[2]); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttr4fv(uint attr_id, const float data[4]) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immAttr4f(attr_id, data[0], data[1], data[2], data[3]); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttr3ub(uint attr_id, uchar r, uchar g, uchar b) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPUVertAttr *attr = &imm->vertex_format.attrs[attr_id]; | 
					
						
							|  |  |  |   BLI_assert(attr_id < imm->vertex_format.attr_len); | 
					
						
							| 
									
										
										
										
											2020-08-30 20:28:30 +02:00
										 |  |  |   BLI_assert(attr->comp_type == GPU_COMP_U8); | 
					
						
							|  |  |  |   BLI_assert(attr->comp_len == 3); | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->vertex_idx < imm->vertex_len); | 
					
						
							|  |  |  |   BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   setAttrValueBit(attr_id); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   uchar *data = imm->vertex_data + attr->offset; | 
					
						
							|  |  |  |   /*  printf("%s %td %p\n", __FUNCTION__, data - imm->buffer_data, data); */ | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   data[0] = r; | 
					
						
							|  |  |  |   data[1] = g; | 
					
						
							|  |  |  |   data[2] = b; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttr4ub(uint attr_id, uchar r, uchar g, uchar b, uchar a) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPUVertAttr *attr = &imm->vertex_format.attrs[attr_id]; | 
					
						
							|  |  |  |   BLI_assert(attr_id < imm->vertex_format.attr_len); | 
					
						
							| 
									
										
										
										
											2020-08-30 20:28:30 +02:00
										 |  |  |   BLI_assert(attr->comp_type == GPU_COMP_U8); | 
					
						
							|  |  |  |   BLI_assert(attr->comp_len == 4); | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->vertex_idx < imm->vertex_len); | 
					
						
							|  |  |  |   BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   setAttrValueBit(attr_id); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   uchar *data = imm->vertex_data + attr->offset; | 
					
						
							|  |  |  |   /*  printf("%s %td %p\n", __FUNCTION__, data - imm->buffer_data, data); */ | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   data[0] = r; | 
					
						
							|  |  |  |   data[1] = g; | 
					
						
							|  |  |  |   data[2] = b; | 
					
						
							|  |  |  |   data[3] = a; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttr3ubv(uint attr_id, const uchar data[3]) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immAttr3ub(attr_id, data[0], data[1], data[2]); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttr4ubv(uint attr_id, const uchar data[4]) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immAttr4ub(attr_id, data[0], data[1], data[2], data[3]); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immAttrSkip(uint attr_id) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(attr_id < imm->vertex_format.attr_len); | 
					
						
							|  |  |  |   BLI_assert(imm->vertex_idx < imm->vertex_len); | 
					
						
							|  |  |  |   BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   setAttrValueBit(attr_id); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void immEndVertex(void) /* and move on to the next vertex */ | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */ | 
					
						
							|  |  |  |   BLI_assert(imm->vertex_idx < imm->vertex_len); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   /* Have all attributes been assigned values?
 | 
					
						
							|  |  |  |    * If not, copy value from previous vertex. */ | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   if (imm->unassigned_attr_bits) { | 
					
						
							|  |  |  |     BLI_assert(imm->vertex_idx > 0); /* first vertex must have all attributes specified */ | 
					
						
							|  |  |  |     for (uint a_idx = 0; a_idx < imm->vertex_format.attr_len; a_idx++) { | 
					
						
							|  |  |  |       if ((imm->unassigned_attr_bits >> a_idx) & 1) { | 
					
						
							|  |  |  |         const GPUVertAttr *a = &imm->vertex_format.attrs[a_idx]; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 01:45:43 +10:00
										 |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |         printf("copying %s from vertex %u to %u\n", a->name, imm->vertex_idx - 1, imm->vertex_idx); | 
					
						
							| 
									
										
										
										
											2019-04-22 01:45:43 +10:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-12 19:48:52 +02:00
										 |  |  |         uchar *data = imm->vertex_data + a->offset; | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |         memcpy(data, data - imm->vertex_format.stride, a->sz); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         /* TODO: consolidate copy of adjacent attributes */ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   imm->vertex_idx++; | 
					
						
							|  |  |  |   imm->vertex_data += imm->vertex_format.stride; | 
					
						
							|  |  |  |   imm->unassigned_attr_bits = imm->enabled_attr_bits; | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immVertex2f(uint attr_id, float x, float y) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immAttr2f(attr_id, x, y); | 
					
						
							|  |  |  |   immEndVertex(); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immVertex3f(uint attr_id, float x, float y, float z) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immAttr3f(attr_id, x, y, z); | 
					
						
							|  |  |  |   immEndVertex(); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immVertex4f(uint attr_id, float x, float y, float z, float w) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immAttr4f(attr_id, x, y, z, w); | 
					
						
							|  |  |  |   immEndVertex(); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immVertex2i(uint attr_id, int x, int y) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immAttr2i(attr_id, x, y); | 
					
						
							|  |  |  |   immEndVertex(); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immVertex2s(uint attr_id, short x, short y) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immAttr2s(attr_id, x, y); | 
					
						
							|  |  |  |   immEndVertex(); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immVertex2fv(uint attr_id, const float data[2]) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immAttr2f(attr_id, data[0], data[1]); | 
					
						
							|  |  |  |   immEndVertex(); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immVertex3fv(uint attr_id, const float data[3]) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immAttr3f(attr_id, data[0], data[1], data[2]); | 
					
						
							|  |  |  |   immEndVertex(); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-29 07:46:25 +11:00
										 |  |  | void immVertex2iv(uint attr_id, const int data[2]) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immAttr2i(attr_id, data[0], data[1]); | 
					
						
							|  |  |  |   immEndVertex(); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* --- generic uniform functions --- */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 23:09:31 +10:00
										 |  |  | void immUniform1f(const char *name, float x) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPU_shader_uniform_1f(imm->shader, name, x); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 23:09:31 +10:00
										 |  |  | void immUniform2f(const char *name, float x, float y) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPU_shader_uniform_2f(imm->shader, name, x, y); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 23:09:31 +10:00
										 |  |  | void immUniform2fv(const char *name, const float data[2]) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPU_shader_uniform_2fv(imm->shader, name, data); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 23:09:31 +10:00
										 |  |  | void immUniform3f(const char *name, float x, float y, float z) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPU_shader_uniform_3f(imm->shader, name, x, y, z); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 23:09:31 +10:00
										 |  |  | void immUniform3fv(const char *name, const float data[3]) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPU_shader_uniform_3fv(imm->shader, name, data); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 23:09:31 +10:00
										 |  |  | void immUniform4f(const char *name, float x, float y, float z, float w) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPU_shader_uniform_4f(imm->shader, name, x, y, z, w); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 23:09:31 +10:00
										 |  |  | void immUniform4fv(const char *name, const float data[4]) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPU_shader_uniform_4fv(imm->shader, name, data); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-03 10:28:10 +02:00
										 |  |  | /* Note array index is not supported for name (i.e: "array[0]"). */ | 
					
						
							|  |  |  | void immUniformArray4fv(const char *name, const float *data, int count) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPU_shader_uniform_4fv_array(imm->shader, name, count, (float(*)[4])data); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 23:09:31 +10:00
										 |  |  | void immUniformMatrix4fv(const char *name, const float data[4][4]) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPU_shader_uniform_mat4(imm->shader, name, data); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-18 23:09:31 +10:00
										 |  |  | void immUniform1i(const char *name, int x) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPU_shader_uniform_1i(imm->shader, name, x); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-17 03:20:43 +02:00
										 |  |  | void immBindTexture(const char *name, GPUTexture *tex) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   int binding = GPU_shader_get_texture_binding(imm->shader, name); | 
					
						
							| 
									
										
										
										
											2020-08-20 12:26:29 +02:00
										 |  |  |   GPU_texture_bind(tex, binding); | 
					
						
							| 
									
										
										
										
											2020-07-17 03:20:43 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void immBindTextureSampler(const char *name, GPUTexture *tex, eGPUSamplerState state) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   int binding = GPU_shader_get_texture_binding(imm->shader, name); | 
					
						
							| 
									
										
										
										
											2020-08-20 12:26:29 +02:00
										 |  |  |   GPU_texture_bind_ex(tex, state, binding, true); | 
					
						
							| 
									
										
										
										
											2020-07-17 03:20:43 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | /* --- convenience functions for setting "uniform vec4 color" --- */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void immUniformColor4f(float r, float g, float b, float a) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   int32_t uniform_loc = GPU_shader_get_builtin_uniform(imm->shader, GPU_UNIFORM_COLOR); | 
					
						
							| 
									
										
										
										
											2020-06-04 14:15:25 +02:00
										 |  |  |   BLI_assert(uniform_loc != -1); | 
					
						
							| 
									
										
										
										
											2020-08-20 12:26:29 +02:00
										 |  |  |   float data[4] = {r, g, b, a}; | 
					
						
							| 
									
										
										
										
											2020-08-31 15:14:47 +02:00
										 |  |  |   GPU_shader_uniform_vector(imm->shader, uniform_loc, 4, 1, data); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void immUniformColor4fv(const float rgba[4]) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immUniformColor4f(rgba[0], rgba[1], rgba[2], rgba[3]); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void immUniformColor3f(float r, float g, float b) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immUniformColor4f(r, g, b, 1.0f); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void immUniformColor3fv(const float rgb[3]) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immUniformColor4f(rgb[0], rgb[1], rgb[2], 1.0f); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void immUniformColor3fvAlpha(const float rgb[3], float a) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immUniformColor4f(rgb[0], rgb[1], rgb[2], a); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-12 12:18:35 +10:00
										 |  |  | void immUniformColor3ub(uchar r, uchar g, uchar b) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   const float scale = 1.0f / 255.0f; | 
					
						
							|  |  |  |   immUniformColor4f(scale * r, scale * g, scale * b, 1.0f); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-12 12:18:35 +10:00
										 |  |  | void immUniformColor4ub(uchar r, uchar g, uchar b, uchar a) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   const float scale = 1.0f / 255.0f; | 
					
						
							|  |  |  |   immUniformColor4f(scale * r, scale * g, scale * b, scale * a); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-12 12:18:35 +10:00
										 |  |  | void immUniformColor3ubv(const uchar rgb[3]) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immUniformColor3ub(rgb[0], rgb[1], rgb[2]); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-12 12:18:35 +10:00
										 |  |  | void immUniformColor3ubvAlpha(const uchar rgb[3], uchar alpha) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immUniformColor4ub(rgb[0], rgb[1], rgb[2], alpha); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-12 12:18:35 +10:00
										 |  |  | void immUniformColor4ubv(const uchar rgba[4]) | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   immUniformColor4ub(rgba[0], rgba[1], rgba[2], rgba[3]); | 
					
						
							| 
									
										
										
										
											2018-07-17 21:11:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-11 14:52:57 +11:00
										 |  |  | #ifndef GPU_STANDALONE
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-16 17:04:17 -04:00
										 |  |  | void immUniformThemeColor(int color_id) | 
					
						
							| 
									
										
										
										
											2016-10-12 23:01:59 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   float color[4]; | 
					
						
							|  |  |  |   UI_GetThemeColor4fv(color_id, color); | 
					
						
							|  |  |  |   immUniformColor4fv(color); | 
					
						
							| 
									
										
										
										
											2016-10-12 23:01:59 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-06 18:28:22 +10:00
										 |  |  | void immUniformThemeColorAlpha(int color_id, float a) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   float color[4]; | 
					
						
							|  |  |  |   UI_GetThemeColor3fv(color_id, color); | 
					
						
							|  |  |  |   color[3] = a; | 
					
						
							|  |  |  |   immUniformColor4fv(color); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-05 10:59:46 +02:00
										 |  |  | void immUniformThemeColor3(int color_id) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   float color[3]; | 
					
						
							|  |  |  |   UI_GetThemeColor3fv(color_id, color); | 
					
						
							|  |  |  |   immUniformColor3fv(color); | 
					
						
							| 
									
										
										
										
											2017-04-05 10:59:46 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-16 17:04:17 -04:00
										 |  |  | void immUniformThemeColorShade(int color_id, int offset) | 
					
						
							| 
									
										
										
										
											2016-10-12 23:01:59 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   float color[4]; | 
					
						
							|  |  |  |   UI_GetThemeColorShade4fv(color_id, offset, color); | 
					
						
							|  |  |  |   immUniformColor4fv(color); | 
					
						
							| 
									
										
										
										
											2016-10-13 20:06:44 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-16 17:04:17 -04:00
										 |  |  | void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset) | 
					
						
							| 
									
										
										
										
											2016-10-13 20:06:44 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   float color[4]; | 
					
						
							|  |  |  |   UI_GetThemeColorShadeAlpha4fv(color_id, color_offset, alpha_offset, color); | 
					
						
							|  |  |  |   immUniformColor4fv(color); | 
					
						
							| 
									
										
										
										
											2016-10-16 17:04:17 -04:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void immUniformThemeColorBlendShade(int color_id1, int color_id2, float fac, int offset) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   float color[4]; | 
					
						
							|  |  |  |   UI_GetThemeColorBlendShade4fv(color_id1, color_id2, fac, offset, color); | 
					
						
							|  |  |  |   immUniformColor4fv(color); | 
					
						
							| 
									
										
										
										
											2016-10-13 20:06:44 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2016-12-13 16:45:59 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | void immUniformThemeColorBlend(int color_id1, int color_id2, float fac) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   uint8_t color[3]; | 
					
						
							|  |  |  |   UI_GetThemeColorBlend3ubv(color_id1, color_id2, fac, color); | 
					
						
							|  |  |  |   immUniformColor3ubv(color); | 
					
						
							| 
									
										
										
										
											2016-12-13 16:45:59 -05:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2017-01-15 19:26:35 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | void immThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   uchar col[4]; | 
					
						
							|  |  |  |   UI_GetThemeColorShadeAlpha4ubv(colorid, coloffset, alphaoffset, col); | 
					
						
							|  |  |  |   immUniformColor4ub(col[0], col[1], col[2], col[3]); | 
					
						
							| 
									
										
										
										
											2017-01-15 19:26:35 -05:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2020-03-11 14:52:57 +11:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif /* GPU_STANDALONE */
 |