31 const bool use_instancing)
33 uint16_t enabled_attrib = 0;
37 GLuint divisor = (use_instancing) ? 1 : 0;
39 for (
uint a_idx = 0; a_idx < attr_len; a_idx++) {
42 if (
format->deinterleaved) {
43 offset += ((a_idx == 0) ? 0 :
format->attrs[a_idx - 1].size) * v_len;
51 const GLvoid *pointer = (
const GLubyte *)intptr_t(offset + v_first * stride);
58 if (
input ==
nullptr ||
input->location == -1) {
62 enabled_attrib |= (1 <<
input->location);
68 glEnableVertexAttribArray(
input->location +
i);
69 glVertexAttribDivisor(
input->location +
i, divisor);
70 glVertexAttribPointer(
71 input->location +
i, 4, type, GL_FALSE, stride, (
const GLubyte *)pointer +
i * 16);
75 glEnableVertexAttribArray(
input->location);
76 glVertexAttribDivisor(
input->location, divisor);
81 glVertexAttribPointer(
input->location, a->
comp_len, type, GL_TRUE, stride, pointer);
84 glVertexAttribIPointer(
input->location, a->
comp_len, type, stride, pointer);
90 return enabled_attrib;
96 const int base_instance)
99 uint16_t attr_mask =
interface->enabled_attr_mask_;
101 glBindVertexArray(vao);
120 if (
batch->resource_id_buf) {
122 int component_len = 1;
123 if (
input ==
nullptr) {
130 glEnableVertexAttribArray(
input->location);
131 glVertexAttribDivisor(
input->location, 1);
132 glVertexAttribIPointer(
134 attr_mask &= ~(1 <<
input->location);
138 if (attr_mask != 0) {
139 for (uint16_t
mask = 1, a = 0; a < 16; a++,
mask <<= 1) {
140 if (attr_mask &
mask) {
145 glEnableVertexAttribArray(a);
146 glVertexAttribFormat(a, 4, GL_FLOAT, GL_FALSE, 0);
147 glVertexAttribBinding(a, a);