/* This file is auto-generated; any change will not be preserved */
#pragma once

typedef struct _GskGpuColorizeInstance GskGpuColorizeInstance;

struct _GskGpuColorizeInstance {
  float rect[4];
  float color[4];
  float tex_rect[4];
  guint32 tex_id;
};

static inline void
gsk_gpu_colorize_setup_vao (gsize offset)
{
  glEnableVertexAttribArray (0);
  glVertexAttribDivisor (0, 1);
  glVertexAttribPointer (0,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuColorizeInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuColorizeInstance, rect)));
  glEnableVertexAttribArray (1);
  glVertexAttribDivisor (1, 1);
  glVertexAttribPointer (1,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuColorizeInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuColorizeInstance, color)));
  glEnableVertexAttribArray (2);
  glVertexAttribDivisor (2, 1);
  glVertexAttribPointer (2,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuColorizeInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuColorizeInstance, tex_rect)));
  glEnableVertexAttribArray (3);
  glVertexAttribDivisor (3, 1);
  glVertexAttribIPointer (3,
                          1,
                          GL_UNSIGNED_INT,
                          sizeof (GskGpuColorizeInstance),
                          GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuColorizeInstance, tex_id)));
}


static void
gsk_gpu_colorize_setup_attrib_locations (GLuint program)
{
  glBindAttribLocation (program, 0, "in_rect");
  glBindAttribLocation (program, 1, "in_color");
  glBindAttribLocation (program, 2, "in_tex_rect");
  glBindAttribLocation (program, 3, "in_tex_id");
}


#ifdef GDK_RENDERING_VULKAN

static const VkPipelineVertexInputStateCreateInfo gsk_gpu_colorize_info = {
  .sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
  .vertexBindingDescriptionCount = 1,
  .pVertexBindingDescriptions = (VkVertexInputBindingDescription[1]) {
      {
        .binding = 0,
        .stride = sizeof (GskGpuColorizeInstance),
        .inputRate = VK_VERTEX_INPUT_RATE_INSTANCE
      }
  },
  .vertexAttributeDescriptionCount = 4,
  .pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[4]) {
      {
        .location = 0,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuColorizeInstance, rect),
      },
      {
        .location = 1,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuColorizeInstance, color),
      },
      {
        .location = 2,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuColorizeInstance, tex_rect),
      },
      {
        .location = 3,
        .binding = 0,
        .format = VK_FORMAT_R32_UINT,
        .offset = G_STRUCT_OFFSET(GskGpuColorizeInstance, tex_id),
      },
  },
};

#endif

