29 const bool use_instancing)
35 GLuint divisor = (use_instancing) ? 1 : 0;
37 for (
uint a_idx = 0; a_idx < attr_len; a_idx++) {
40 if (
format->deinterleaved) {
41 offset += ((a_idx == 0) ? 0 :
format->attrs[a_idx - 1].size) * v_len;
52 for (
uint n_idx = 0; n_idx <
a->name_len; n_idx++) {
56 if (
input ==
nullptr ||
input->location == -1) {
60 enabled_attrib |= (1 <<
input->location);
62 if (
ELEM(
a->comp_len, 16, 12, 8)) {
65 for (
int i = 0; i <
a->comp_len / 4; i++) {
66 glEnableVertexAttribArray(
input->location + i);
67 glVertexAttribDivisor(
input->location + i, divisor);
68 glVertexAttribPointer(
69 input->location + i, 4,
type, GL_FALSE,
stride, (
const GLubyte *)pointer + i * 16);
73 glEnableVertexAttribArray(
input->location);
74 glVertexAttribDivisor(
input->location, divisor);
76 switch (
a->fetch_mode) {
79 glVertexAttribPointer(
input->location,
a->comp_len,
type, GL_FALSE,
stride, pointer);
82 glVertexAttribPointer(
input->location,
a->comp_len,
type, GL_TRUE,
stride, pointer);
91 return enabled_attrib;
97 const int base_instance)
102 glBindVertexArray(vao);
123 if (attr_mask &
mask) {
128 glEnableVertexAttribArray(
a);
129 glVertexAttribFormat(
a, 4, GL_FLOAT, GL_FALSE, 0);
130 glVertexAttribBinding(
a,
a);
146 glBindVertexArray(vao);
#define GPU_BATCH_INST_VBO_MAX_LEN
#define GPU_BATCH_VBO_MAX_LEN
_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 type
_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 stride
ATTR_WARN_UNUSED_RESULT const BMVert * v
static bool vertex_attrib_binding_support
const ShaderInput * attr_get(const char *name) const
uint16_t enabled_attr_mask_
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
ccl_global KernelShaderEvalInput * input
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
void update_bindings(const GLuint vao, const GPUBatch *batch, const ShaderInterface *interface, int base_instance)
static Context * unwrap(GPUContext *ctx)
static uint16_t vbo_bind(const ShaderInterface *interface, const GPUVertFormat *format, uint v_first, uint v_len, const bool use_instancing)
static GLenum to_gl(const GPUAttachmentType type)