Blender  V3.3
gpu_immediate.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2016 by Mike Erwin. All rights reserved. */
3 
10 #ifndef GPU_STANDALONE
11 # include "UI_resources.h"
12 #endif
13 
14 #include "GPU_immediate.h"
15 #include "GPU_matrix.h"
16 #include "GPU_texture.h"
17 
18 #include "gpu_context_private.hh"
19 #include "gpu_immediate_private.hh"
20 #include "gpu_shader_private.hh"
22 
23 using namespace blender::gpu;
24 
25 static thread_local Immediate *imm = nullptr;
26 
28 {
29  imm = Context::get()->imm;
30 }
31 
33 {
34  imm = nullptr;
35 }
36 
38 {
40  return &imm->vertex_format;
41 }
42 
43 void immBindShader(GPUShader *shader)
44 {
45  BLI_assert(imm->shader == nullptr);
46 
47  imm->shader = shader;
48  imm->builtin_shader_bound = GPU_SHADER_TEXT; /* Default value. */
49 
50  if (!imm->vertex_format.packed) {
52  imm->enabled_attr_bits = 0xFFFFu & ~(0xFFFFu << imm->vertex_format.attr_len);
53  }
54 
55  GPU_shader_bind(shader);
56  GPU_matrix_bind(shader);
58 }
59 
61 {
62  GPUShader *shader = GPU_shader_get_builtin_shader(shader_id);
63  immBindShader(shader);
64  imm->builtin_shader_bound = shader_id;
65 }
66 
68 {
69  BLI_assert(imm->shader != nullptr);
70 
72  imm->shader = nullptr;
73 }
74 
76 {
77  return imm->shader;
78 }
79 
80 #ifndef NDEBUG
81 static bool vertex_count_makes_sense_for_primitive(uint vertex_len, GPUPrimType prim_type)
82 {
83  /* does vertex_len make sense for this primitive type? */
84  if (vertex_len == 0) {
85  return false;
86  }
87 
88  switch (prim_type) {
89  case GPU_PRIM_POINTS:
90  return true;
91  case GPU_PRIM_LINES:
92  return vertex_len % 2 == 0;
94  case GPU_PRIM_LINE_LOOP:
95  return vertex_len >= 2;
97  return vertex_len >= 4;
98  case GPU_PRIM_TRIS:
99  return vertex_len % 3 == 0;
100  case GPU_PRIM_TRI_STRIP:
101  case GPU_PRIM_TRI_FAN:
102  return vertex_len >= 3;
103  default:
104  return false;
105  }
106 }
107 #endif
108 
109 /* -------------------------------------------------------------------- */
117 {
119  return;
120  }
121 
122  float line_width = GPU_line_width_get();
123 
124  if (line_width == 1.0f) {
125  /* No need to change the shader. */
126  return;
127  }
128 
129  eGPUBuiltinShader polyline_sh;
130  switch (imm->builtin_shader_bound) {
133  break;
137  break;
140  polyline_sh = GPU_SHADER_3D_POLYLINE_FLAT_COLOR;
141  break;
145  break;
146  default:
147  /* Cannot replace the current shader with a polyline shader. */
148  return;
149  }
150 
152 
154 
155  /* TODO(fclem): Don't use geometry shader and use quad instancing with double load. */
156  // GPU_vertformat_multiload_enable(imm->vertex_format, 2);
157 
158  immBindBuiltinProgram(polyline_sh);
159 
160  float viewport[4];
161  GPU_viewport_size_get_f(viewport);
162  immUniform2fv("viewportSize", &viewport[2]);
163  immUniform1f("lineWidth", line_width);
164 
165  if (GPU_blend_get() == GPU_BLEND_NONE) {
166  /* Disable line smoothing when blending is disabled (see T81827). */
167  immUniform1i("lineSmooth", 0);
168  }
169 
170  if (ELEM(polyline_sh,
174  }
175 }
176 
178 {
179  if (imm->prev_builtin_shader) {
180  if (GPU_blend_get() == GPU_BLEND_NONE) {
181  /* Restore default. */
182  immUniform1i("lineSmooth", 1);
183  }
185 
188  }
189 }
190 
193 void immBegin(GPUPrimType prim_type, uint vertex_len)
194 {
195  BLI_assert(imm->prim_type == GPU_PRIM_NONE); /* Make sure we haven't already begun. */
196  BLI_assert(vertex_count_makes_sense_for_primitive(vertex_len, prim_type));
197 
198  wide_line_workaround_start(prim_type);
199 
200  imm->prim_type = prim_type;
201  imm->vertex_len = vertex_len;
202  imm->vertex_idx = 0;
204 
205  imm->vertex_data = imm->begin();
206 }
207 
208 void immBeginAtMost(GPUPrimType prim_type, uint vertex_len)
209 {
210  BLI_assert(vertex_len > 0);
211  imm->strict_vertex_len = false;
212  immBegin(prim_type, vertex_len);
213 }
214 
215 GPUBatch *immBeginBatch(GPUPrimType prim_type, uint vertex_len)
216 {
217  BLI_assert(imm->prim_type == GPU_PRIM_NONE); /* Make sure we haven't already begun. */
218  BLI_assert(vertex_count_makes_sense_for_primitive(vertex_len, prim_type));
219 
220  imm->prim_type = prim_type;
221  imm->vertex_len = vertex_len;
222  imm->vertex_idx = 0;
224 
226  GPU_vertbuf_data_alloc(verts, vertex_len);
227 
229 
230  imm->batch = GPU_batch_create_ex(prim_type, verts, nullptr, GPU_BATCH_OWNS_VBO);
231  imm->batch->flag |= GPU_BATCH_BUILDING;
232 
233  return imm->batch;
234 }
235 
237 {
238  BLI_assert(vertex_len > 0);
239  imm->strict_vertex_len = false;
240  return immBeginBatch(prim_type, vertex_len);
241 }
242 
243 void immEnd()
244 {
245  BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* Make sure we're between a Begin/End pair. */
247 
248  if (imm->strict_vertex_len) {
249  BLI_assert(imm->vertex_idx == imm->vertex_len); /* With all vertices defined. */
250  }
251  else {
253  BLI_assert(imm->vertex_idx == 0 ||
255  }
256 
257  if (imm->batch) {
258  if (imm->vertex_idx < imm->vertex_len) {
260  /* TODO: resize only if vertex count is much smaller */
261  }
263  imm->batch->flag &= ~GPU_BATCH_BUILDING;
264  imm->batch = nullptr; /* don't free, batch belongs to caller */
265  }
266  else {
267  imm->end();
268  }
269 
270  /* Prepare for next immBegin. */
272  imm->strict_vertex_len = true;
273  imm->vertex_data = nullptr;
274 
276 }
277 
279 {
280  uint16_t mask = 1 << attr_id;
281  BLI_assert(imm->unassigned_attr_bits & mask); /* not already set */
283 }
284 
285 /* --- generic attribute functions --- */
286 
287 void immAttr1f(uint attr_id, float x)
288 {
290  BLI_assert(attr_id < imm->vertex_format.attr_len);
292  BLI_assert(attr->comp_len == 1);
294  BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
296 
297  float *data = (float *)(imm->vertex_data + attr->offset);
298  // printf("%s %td %p\n", __FUNCTION__, (GLubyte*)data - imm->buffer_data, data);
299 
300  data[0] = x;
301 }
302 
303 void immAttr2f(uint attr_id, float x, float y)
304 {
306  BLI_assert(attr_id < imm->vertex_format.attr_len);
308  BLI_assert(attr->comp_len == 2);
310  BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
312 
313  float *data = (float *)(imm->vertex_data + attr->offset);
314  // printf("%s %td %p\n", __FUNCTION__, (GLubyte*)data - imm->buffer_data, data);
315 
316  data[0] = x;
317  data[1] = y;
318 }
319 
320 void immAttr3f(uint attr_id, float x, float y, float z)
321 {
323  BLI_assert(attr_id < imm->vertex_format.attr_len);
325  BLI_assert(attr->comp_len == 3);
327  BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
329 
330  float *data = (float *)(imm->vertex_data + attr->offset);
331  // printf("%s %td %p\n", __FUNCTION__, (GLubyte*)data - imm->buffer_data, data);
332 
333  data[0] = x;
334  data[1] = y;
335  data[2] = z;
336 }
337 
338 void immAttr4f(uint attr_id, float x, float y, float z, float w)
339 {
341  BLI_assert(attr_id < imm->vertex_format.attr_len);
343  BLI_assert(attr->comp_len == 4);
345  BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
347 
348  float *data = (float *)(imm->vertex_data + attr->offset);
349  // printf("%s %td %p\n", __FUNCTION__, (GLubyte*)data - imm->buffer_data, data);
350 
351  data[0] = x;
352  data[1] = y;
353  data[2] = z;
354  data[3] = w;
355 }
356 
358 {
360  BLI_assert(attr_id < imm->vertex_format.attr_len);
362  BLI_assert(attr->comp_len == 1);
364  BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
366 
367  uint *data = (uint *)(imm->vertex_data + attr->offset);
368 
369  data[0] = x;
370 }
371 
372 void immAttr2i(uint attr_id, int x, int y)
373 {
375  BLI_assert(attr_id < imm->vertex_format.attr_len);
377  BLI_assert(attr->comp_len == 2);
379  BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
381 
382  int *data = (int *)(imm->vertex_data + attr->offset);
383 
384  data[0] = x;
385  data[1] = y;
386 }
387 
388 void immAttr2s(uint attr_id, short x, short y)
389 {
391  BLI_assert(attr_id < imm->vertex_format.attr_len);
393  BLI_assert(attr->comp_len == 2);
395  BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
397 
398  short *data = (short *)(imm->vertex_data + attr->offset);
399 
400  data[0] = x;
401  data[1] = y;
402 }
403 
404 void immAttr2fv(uint attr_id, const float data[2])
405 {
406  immAttr2f(attr_id, data[0], data[1]);
407 }
408 
409 void immAttr3fv(uint attr_id, const float data[3])
410 {
411  immAttr3f(attr_id, data[0], data[1], data[2]);
412 }
413 
414 void immAttr4fv(uint attr_id, const float data[4])
415 {
416  immAttr4f(attr_id, data[0], data[1], data[2], data[3]);
417 }
418 
420 {
422  BLI_assert(attr_id < imm->vertex_format.attr_len);
423  BLI_assert(attr->comp_type == GPU_COMP_U8);
424  BLI_assert(attr->comp_len == 3);
426  BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
428 
429  uchar *data = imm->vertex_data + attr->offset;
430  // printf("%s %td %p\n", __FUNCTION__, data - imm->buffer_data, data);
431 
432  data[0] = r;
433  data[1] = g;
434  data[2] = b;
435 }
436 
438 {
440  BLI_assert(attr_id < imm->vertex_format.attr_len);
441  BLI_assert(attr->comp_type == GPU_COMP_U8);
442  BLI_assert(attr->comp_len == 4);
444  BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
446 
447  uchar *data = imm->vertex_data + attr->offset;
448  // printf("%s %td %p\n", __FUNCTION__, data - imm->buffer_data, data);
449 
450  data[0] = r;
451  data[1] = g;
452  data[2] = b;
453  data[3] = a;
454 }
455 
457 {
458  immAttr3ub(attr_id, data[0], data[1], data[2]);
459 }
460 
462 {
463  immAttr4ub(attr_id, data[0], data[1], data[2], data[3]);
464 }
465 
467 {
468  BLI_assert(attr_id < imm->vertex_format.attr_len);
470  BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
472 }
473 
474 static void immEndVertex() /* and move on to the next vertex */
475 {
476  BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
478 
479  /* Have all attributes been assigned values?
480  * If not, copy value from previous vertex. */
481  if (imm->unassigned_attr_bits) {
482  BLI_assert(imm->vertex_idx > 0); /* first vertex must have all attributes specified */
483  for (uint a_idx = 0; a_idx < imm->vertex_format.attr_len; a_idx++) {
484  if ((imm->unassigned_attr_bits >> a_idx) & 1) {
485  const GPUVertAttr *a = &imm->vertex_format.attrs[a_idx];
486 
487 #if 0
488  printf("copying %s from vertex %u to %u\n", a->name, imm->vertex_idx - 1, imm->vertex_idx);
489 #endif
490 
491  uchar *data = imm->vertex_data + a->offset;
492  memcpy(data, data - imm->vertex_format.stride, a->size);
493  /* TODO: consolidate copy of adjacent attributes */
494  }
495  }
496  }
497 
498  imm->vertex_idx++;
501 }
502 
503 void immVertex2f(uint attr_id, float x, float y)
504 {
505  immAttr2f(attr_id, x, y);
506  immEndVertex();
507 }
508 
509 void immVertex3f(uint attr_id, float x, float y, float z)
510 {
511  immAttr3f(attr_id, x, y, z);
512  immEndVertex();
513 }
514 
515 void immVertex4f(uint attr_id, float x, float y, float z, float w)
516 {
517  immAttr4f(attr_id, x, y, z, w);
518  immEndVertex();
519 }
520 
521 void immVertex2i(uint attr_id, int x, int y)
522 {
523  immAttr2i(attr_id, x, y);
524  immEndVertex();
525 }
526 
527 void immVertex2s(uint attr_id, short x, short y)
528 {
529  immAttr2s(attr_id, x, y);
530  immEndVertex();
531 }
532 
533 void immVertex2fv(uint attr_id, const float data[2])
534 {
535  immAttr2f(attr_id, data[0], data[1]);
536  immEndVertex();
537 }
538 
539 void immVertex3fv(uint attr_id, const float data[3])
540 {
541  immAttr3f(attr_id, data[0], data[1], data[2]);
542  immEndVertex();
543 }
544 
545 void immVertex2iv(uint attr_id, const int data[2])
546 {
547  immAttr2i(attr_id, data[0], data[1]);
548  immEndVertex();
549 }
550 
551 /* --- generic uniform functions --- */
552 
553 void immUniform1f(const char *name, float x)
554 {
556 }
557 
558 void immUniform2f(const char *name, float x, float y)
559 {
560  GPU_shader_uniform_2f(imm->shader, name, x, y);
561 }
562 
563 void immUniform2fv(const char *name, const float data[2])
564 {
566 }
567 
568 void immUniform3f(const char *name, float x, float y, float z)
569 {
570  GPU_shader_uniform_3f(imm->shader, name, x, y, z);
571 }
572 
573 void immUniform3fv(const char *name, const float data[3])
574 {
576 }
577 
578 void immUniform4f(const char *name, float x, float y, float z, float w)
579 {
580  GPU_shader_uniform_4f(imm->shader, name, x, y, z, w);
581 }
582 
583 void immUniform4fv(const char *name, const float data[4])
584 {
586 }
587 
588 void immUniformArray4fv(const char *name, const float *data, int count)
589 {
590  GPU_shader_uniform_4fv_array(imm->shader, name, count, (const float(*)[4])data);
591 }
592 
593 void immUniformMatrix4fv(const char *name, const float data[4][4])
594 {
596 }
597 
598 void immUniform1i(const char *name, int x)
599 {
601 }
602 
603 void immBindTexture(const char *name, GPUTexture *tex)
604 {
605  int binding = GPU_shader_get_texture_binding(imm->shader, name);
606  GPU_texture_bind(tex, binding);
607 }
608 
610 {
611  int binding = GPU_shader_get_texture_binding(imm->shader, name);
612  GPU_texture_bind_ex(tex, state, binding, true);
613 }
614 
615 void immBindUniformBuf(const char *name, GPUUniformBuf *ubo)
616 {
617  int binding = GPU_shader_get_uniform_block_binding(imm->shader, name);
618  GPU_uniformbuf_bind(ubo, binding);
619 }
620 
621 /* --- convenience functions for setting "uniform vec4 color" --- */
622 
623 void immUniformColor4f(float r, float g, float b, float a)
624 {
626  BLI_assert(uniform_loc != -1);
627  float data[4] = {r, g, b, a};
628  GPU_shader_uniform_vector(imm->shader, uniform_loc, 4, 1, data);
629  /* For wide Line workaround. */
631 }
632 
633 void immUniformColor4fv(const float rgba[4])
634 {
635  immUniformColor4f(rgba[0], rgba[1], rgba[2], rgba[3]);
636 }
637 
638 void immUniformColor3f(float r, float g, float b)
639 {
640  immUniformColor4f(r, g, b, 1.0f);
641 }
642 
643 void immUniformColor3fv(const float rgb[3])
644 {
645  immUniformColor4f(rgb[0], rgb[1], rgb[2], 1.0f);
646 }
647 
648 void immUniformColor3fvAlpha(const float rgb[3], float a)
649 {
650  immUniformColor4f(rgb[0], rgb[1], rgb[2], a);
651 }
652 
654 {
655  const float scale = 1.0f / 255.0f;
656  immUniformColor4f(scale * r, scale * g, scale * b, 1.0f);
657 }
658 
660 {
661  const float scale = 1.0f / 255.0f;
662  immUniformColor4f(scale * r, scale * g, scale * b, scale * a);
663 }
664 
666 {
667  immUniformColor3ub(rgb[0], rgb[1], rgb[2]);
668 }
669 
671 {
672  immUniformColor4ub(rgb[0], rgb[1], rgb[2], alpha);
673 }
674 
676 {
677  immUniformColor4ub(rgba[0], rgba[1], rgba[2], rgba[3]);
678 }
679 
680 #ifndef GPU_STANDALONE
681 
682 void immUniformThemeColor(int color_id)
683 {
684  float color[4];
685  UI_GetThemeColor4fv(color_id, color);
687 }
688 
689 void immUniformThemeColorAlpha(int color_id, float a)
690 {
691  float color[4];
692  UI_GetThemeColor3fv(color_id, color);
693  color[3] = a;
695 }
696 
697 void immUniformThemeColor3(int color_id)
698 {
699  float color[3];
700  UI_GetThemeColor3fv(color_id, color);
702 }
703 
704 void immUniformThemeColorShade(int color_id, int offset)
705 {
706  float color[4];
709 }
710 
711 void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset)
712 {
713  float color[4];
714  UI_GetThemeColorShadeAlpha4fv(color_id, color_offset, alpha_offset, color);
716 }
717 
718 void immUniformThemeColorBlendShade(int color_id1, int color_id2, float fac, int offset)
719 {
720  float color[4];
721  UI_GetThemeColorBlendShade4fv(color_id1, color_id2, fac, offset, color);
723 }
724 
725 void immUniformThemeColorBlend(int color_id1, int color_id2, float fac)
726 {
727  uint8_t color[3];
728  UI_GetThemeColorBlend3ubv(color_id1, color_id2, fac, color);
730 }
731 
732 void immThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
733 {
734  uchar col[4];
735  UI_GetThemeColorShadeAlpha4ubv(colorid, coloffset, alphaoffset, col);
736  immUniformColor4ub(col[0], col[1], col[2], col[3]);
737 }
738 
739 #endif /* GPU_STANDALONE */
#define BLI_assert(a)
Definition: BLI_assert.h:46
MINLINE void copy_v4_v4(float r[4], const float a[4])
unsigned char uchar
Definition: BLI_sys_types.h:70
unsigned int uint
Definition: BLI_sys_types.h:67
#define ELEM(...)
GPUBatch
Definition: GPU_batch.h:78
void GPU_batch_set_shader(GPUBatch *batch, GPUShader *shader)
Definition: gpu_batch.cc:211
GPUBatch * GPU_batch_create_ex(GPUPrimType prim, GPUVertBuf *vert, GPUIndexBuf *elem, eGPUBatchFlag owns_flag)
Definition: gpu_batch.cc:43
@ GPU_BATCH_OWNS_VBO
Definition: GPU_batch.h:30
@ GPU_BATCH_BUILDING
Definition: GPU_batch.h:44
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
void GPU_matrix_bind(struct GPUShader *shader)
Definition: gpu_matrix.cc:611
GPUPrimType
Definition: GPU_primitive.h:18
@ GPU_PRIM_TRI_FAN
Definition: GPU_primitive.h:25
@ GPU_PRIM_LINE_LOOP
Definition: GPU_primitive.h:23
@ GPU_PRIM_LINE_STRIP_ADJ
Definition: GPU_primitive.h:31
@ GPU_PRIM_NONE
Definition: GPU_primitive.h:33
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:20
@ GPU_PRIM_POINTS
Definition: GPU_primitive.h:19
@ GPU_PRIM_LINE_STRIP
Definition: GPU_primitive.h:22
@ GPU_PRIM_TRI_STRIP
Definition: GPU_primitive.h:24
@ GPU_PRIM_TRIS
Definition: GPU_primitive.h:21
void GPU_shader_unbind(void)
Definition: gpu_shader.cc:513
void GPU_shader_uniform_2fv(GPUShader *sh, const char *name, const float data[2])
Definition: gpu_shader.cc:687
void GPU_shader_set_srgb_uniform(GPUShader *shader)
Definition: gpu_shader.cc:744
struct GPUShader GPUShader
Definition: GPU_shader.h:20
void GPU_shader_uniform_1i(GPUShader *sh, const char *name, int value)
Definition: gpu_shader.cc:652
void GPU_shader_uniform_3f(GPUShader *sh, const char *name, float x, float y, float z)
Definition: gpu_shader.cc:669
void GPU_shader_uniform_2f(GPUShader *sh, const char *name, float x, float y)
Definition: gpu_shader.cc:663
void GPU_shader_uniform_1f(GPUShader *sh, const char *name, float value)
Definition: gpu_shader.cc:681
void GPU_shader_uniform_vector(GPUShader *shader, int location, int length, int arraysize, const float *value)
Definition: gpu_shader.cc:630
void GPU_shader_uniform_3fv(GPUShader *sh, const char *name, const float data[3])
Definition: gpu_shader.cc:693
void GPU_shader_uniform_4fv_array(GPUShader *sh, const char *name, int len, const float(*val)[4])
Definition: gpu_shader.cc:717
int GPU_shader_get_uniform_block_binding(GPUShader *shader, const char *name)
Definition: gpu_shader.cc:592
GPUShader * GPU_shader_get_builtin_shader(eGPUBuiltinShader shader)
void GPU_shader_bind(GPUShader *shader)
Definition: gpu_shader.cc:491
@ GPU_UNIFORM_COLOR
Definition: GPU_shader.h:129
void GPU_shader_uniform_4fv(GPUShader *sh, const char *name, const float data[4])
Definition: gpu_shader.cc:699
void GPU_shader_uniform_4f(GPUShader *sh, const char *name, float x, float y, float z, float w)
Definition: gpu_shader.cc:675
eGPUBuiltinShader
Definition: GPU_shader.h:189
@ GPU_SHADER_3D_SMOOTH_COLOR
Definition: GPU_shader.h:245
@ GPU_SHADER_3D_POLYLINE_SMOOTH_COLOR
Definition: GPU_shader.h:270
@ GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR
Definition: GPU_shader.h:253
@ GPU_SHADER_TEXT
Definition: GPU_shader.h:191
@ GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR
Definition: GPU_shader.h:231
@ GPU_SHADER_2D_SMOOTH_COLOR
Definition: GPU_shader.h:215
@ GPU_SHADER_2D_UNIFORM_COLOR
Definition: GPU_shader.h:201
@ GPU_SHADER_3D_UNIFORM_COLOR
Definition: GPU_shader.h:230
@ GPU_SHADER_3D_FLAT_COLOR
Definition: GPU_shader.h:238
@ GPU_SHADER_3D_POLYLINE_FLAT_COLOR
Definition: GPU_shader.h:262
@ GPU_SHADER_2D_FLAT_COLOR
Definition: GPU_shader.h:208
@ GPU_SHADER_3D_POLYLINE_CLIPPED_UNIFORM_COLOR
Definition: GPU_shader.h:254
void GPU_shader_uniform_mat4(GPUShader *sh, const char *name, const float data[4][4])
Definition: gpu_shader.cc:705
int GPU_shader_get_texture_binding(GPUShader *shader, const char *name)
Definition: gpu_shader.cc:599
int GPU_shader_get_builtin_uniform(GPUShader *shader, int builtin)
Definition: gpu_shader.cc:566
@ GPU_BLEND_NONE
Definition: GPU_state.h:60
float GPU_line_width_get(void)
Definition: gpu_state.cc:248
eGPUBlend GPU_blend_get(void)
Definition: gpu_state.cc:218
void GPU_viewport_size_get_f(float coords[4])
Definition: gpu_state.cc:259
eGPUSamplerState
Definition: GPU_texture.h:25
void GPU_texture_bind_ex(GPUTexture *tex, eGPUSamplerState state, int unit, bool set_number)
struct GPUTexture GPUTexture
Definition: GPU_texture.h:17
void GPU_texture_bind(GPUTexture *tex, int unit)
Definition: gpu_texture.cc:466
struct GPUUniformBuf GPUUniformBuf
void GPU_uniformbuf_bind(GPUUniformBuf *ubo, int slot)
#define GPU_vertbuf_create_with_format(format)
struct GPUVertBuf GPUVertBuf
void GPU_vertbuf_data_alloc(GPUVertBuf *, uint v_len)
void * GPU_vertbuf_get_data(const GPUVertBuf *verts)
void GPU_vertbuf_data_resize(GPUVertBuf *, uint v_len)
void GPU_vertformat_clear(GPUVertFormat *)
@ GPU_COMP_F32
@ GPU_COMP_I32
@ GPU_COMP_U32
@ GPU_COMP_I16
@ GPU_COMP_U8
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
void UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset, unsigned char col[4])
Definition: resources.c:1081
void UI_GetThemeColor3fv(int colorid, float col[3])
Definition: resources.c:1165
void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3])
Definition: resources.c:1100
void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int offset, float col[4])
Definition: resources.c:1299
void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4])
Definition: resources.c:1259
void UI_GetThemeColor4fv(int colorid, float col[4])
Definition: resources.c:1173
void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4])
Definition: resources.c:1331
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
static Context * get()
Definition: gpu_context.cc:82
eGPUBuiltinShader builtin_shader_bound
virtual void end()=0
virtual uchar * begin()=0
eGPUBuiltinShader prev_builtin_shader
static float verts[][3]
struct @653::@656 attr_id
uint col
void immVertex2iv(uint attr_id, const int data[2])
GPUBatch * immBeginBatchAtMost(GPUPrimType prim_type, uint vertex_len)
void immVertex4f(uint attr_id, float x, float y, float z, float w)
static void immEndVertex()
void immUniform4f(const char *name, float x, float y, float z, float w)
void immUniformThemeColorAlpha(int color_id, float a)
void immEnd()
void immUniform2fv(const char *name, const float data[2])
void immThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
void immUnbindProgram()
void immAttr4fv(uint attr_id, const float data[4])
void immUniform3fv(const char *name, const float data[3])
void immAttr2fv(uint attr_id, const float data[2])
void immAttrSkip(uint attr_id)
void immAttr3ubv(uint attr_id, const uchar data[3])
GPUShader * immGetShader()
void immUniform2f(const char *name, float x, float y)
void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset)
void immUniformMatrix4fv(const char *name, const float data[4][4])
void immUniform3f(const char *name, float x, float y, float z)
void immUniformColor4f(float r, float g, float b, float a)
static bool vertex_count_makes_sense_for_primitive(uint vertex_len, GPUPrimType prim_type)
void immVertex2f(uint attr_id, float x, float y)
void immAttr1f(uint attr_id, float x)
void immUniformThemeColor(int color_id)
void immAttr2s(uint attr_id, short x, short y)
void immUniformThemeColorShade(int color_id, int offset)
void immBeginAtMost(GPUPrimType prim_type, uint vertex_len)
void immUniformColor3ub(uchar r, uchar g, uchar b)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
void immBindTexture(const char *name, GPUTexture *tex)
void immBindShader(GPUShader *shader)
void immVertex3f(uint attr_id, float x, float y, float z)
void immVertex2fv(uint attr_id, const float data[2])
void immAttr3ub(uint attr_id, uchar r, uchar g, uchar b)
static void wide_line_workaround_start(GPUPrimType prim_type)
void immVertex2s(uint attr_id, short x, short y)
void immUniform1i(const char *name, int x)
void immDeactivate()
void immAttr4ubv(uint attr_id, const uchar data[4])
void immUniformThemeColor3(int color_id)
GPUBatch * immBeginBatch(GPUPrimType prim_type, uint vertex_len)
void immAttr1u(uint attr_id, uint x)
void immVertex2i(uint attr_id, int x, int y)
static thread_local Immediate * imm
void immBindUniformBuf(const char *name, GPUUniformBuf *ubo)
void immUniform1f(const char *name, float x)
static void wide_line_workaround_end()
void immBindTextureSampler(const char *name, GPUTexture *tex, eGPUSamplerState state)
static void setAttrValueBit(uint attr_id)
GPUVertFormat * immVertexFormat()
void immActivate()
void immAttr4f(uint attr_id, float x, float y, float z, float w)
void immUniformColor4fv(const float rgba[4])
void immUniformThemeColorBlend(int color_id1, int color_id2, float fac)
void immUniformColor3f(float r, float g, float b)
void immAttr2i(uint attr_id, int x, int y)
void immUniformThemeColorBlendShade(int color_id1, int color_id2, float fac, int offset)
void immUniform4fv(const char *name, const float data[4])
void immAttr3fv(uint attr_id, const float data[3])
void immAttr2f(uint attr_id, float x, float y)
void immUniformColor3ubv(const uchar rgb[3])
void immVertex3fv(uint attr_id, const float data[3])
void immUniformColor4ub(uchar r, uchar g, uchar b, uchar a)
void immUniformColor3ubvAlpha(const uchar rgb[3], uchar alpha)
void immUniformColor3fvAlpha(const float rgb[3], float a)
void immUniformArray4fv(const char *name, const float *data, int count)
void immUniformColor4ubv(const uchar rgba[4])
void immAttr3f(uint attr_id, float x, float y, float z)
void immBegin(GPUPrimType prim_type, uint vertex_len)
void immUniformColor3fv(const float rgb[3])
void immAttr4ub(uint attr_id, uchar r, uchar g, uchar b, uchar a)
void VertexFormat_pack(GPUVertFormat *format)
int count
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
const int state
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
static unsigned a[3]
Definition: RandGen.cpp:78
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken rgba("rgba", pxr::TfToken::Immortal)
static const pxr::TfToken g("g", pxr::TfToken::Immortal)
static const pxr::TfToken rgb("rgb", pxr::TfToken::Immortal)
unsigned short uint16_t
Definition: stdint.h:79
signed int int32_t
Definition: stdint.h:77
unsigned char uint8_t
Definition: stdint.h:78
GPUVertAttr attrs[GPU_VERT_ATTR_MAX_LEN]