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

typedef struct _GskGpuLineargradientInstance GskGpuLineargradientInstance;

struct _GskGpuLineargradientInstance {
  float rect[4];
  float startend[4];
  float color0[4];
  float color1[4];
  float color2[4];
  float color3[4];
  float color4[4];
  float color5[4];
  float color6[4];
  float offsets0[4];
  float offsets1[3];
};

static inline void
gsk_gpu_lineargradient_setup_vao (gsize offset)
{
  glEnableVertexAttribArray (0);
  glVertexAttribDivisor (0, 1);
  glVertexAttribPointer (0,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuLineargradientInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuLineargradientInstance, rect)));
  glEnableVertexAttribArray (1);
  glVertexAttribDivisor (1, 1);
  glVertexAttribPointer (1,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuLineargradientInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuLineargradientInstance, startend)));
  glEnableVertexAttribArray (2);
  glVertexAttribDivisor (2, 1);
  glVertexAttribPointer (2,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuLineargradientInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuLineargradientInstance, color0)));
  glEnableVertexAttribArray (3);
  glVertexAttribDivisor (3, 1);
  glVertexAttribPointer (3,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuLineargradientInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuLineargradientInstance, color1)));
  glEnableVertexAttribArray (4);
  glVertexAttribDivisor (4, 1);
  glVertexAttribPointer (4,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuLineargradientInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuLineargradientInstance, color2)));
  glEnableVertexAttribArray (5);
  glVertexAttribDivisor (5, 1);
  glVertexAttribPointer (5,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuLineargradientInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuLineargradientInstance, color3)));
  glEnableVertexAttribArray (6);
  glVertexAttribDivisor (6, 1);
  glVertexAttribPointer (6,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuLineargradientInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuLineargradientInstance, color4)));
  glEnableVertexAttribArray (7);
  glVertexAttribDivisor (7, 1);
  glVertexAttribPointer (7,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuLineargradientInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuLineargradientInstance, color5)));
  glEnableVertexAttribArray (8);
  glVertexAttribDivisor (8, 1);
  glVertexAttribPointer (8,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuLineargradientInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuLineargradientInstance, color6)));
  glEnableVertexAttribArray (9);
  glVertexAttribDivisor (9, 1);
  glVertexAttribPointer (9,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuLineargradientInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuLineargradientInstance, offsets0)));
  glEnableVertexAttribArray (10);
  glVertexAttribDivisor (10, 1);
  glVertexAttribPointer (10,
                         3,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuLineargradientInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuLineargradientInstance, offsets1)));
}


static void
gsk_gpu_lineargradient_setup_attrib_locations (GLuint program)
{
  glBindAttribLocation (program, 0, "in_rect");
  glBindAttribLocation (program, 1, "in_startend");
  glBindAttribLocation (program, 2, "in_color0");
  glBindAttribLocation (program, 3, "in_color1");
  glBindAttribLocation (program, 4, "in_color2");
  glBindAttribLocation (program, 5, "in_color3");
  glBindAttribLocation (program, 6, "in_color4");
  glBindAttribLocation (program, 7, "in_color5");
  glBindAttribLocation (program, 8, "in_color6");
  glBindAttribLocation (program, 9, "in_offsets0");
  glBindAttribLocation (program, 10, "in_offsets1");
}


#ifdef GDK_RENDERING_VULKAN

static const VkPipelineVertexInputStateCreateInfo gsk_gpu_lineargradient_info = {
  .sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
  .vertexBindingDescriptionCount = 1,
  .pVertexBindingDescriptions = (VkVertexInputBindingDescription[1]) {
      {
        .binding = 0,
        .stride = sizeof (GskGpuLineargradientInstance),
        .inputRate = VK_VERTEX_INPUT_RATE_INSTANCE
      }
  },
  .vertexAttributeDescriptionCount = 11,
  .pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[11]) {
      {
        .location = 0,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuLineargradientInstance, rect),
      },
      {
        .location = 1,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuLineargradientInstance, startend),
      },
      {
        .location = 2,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuLineargradientInstance, color0),
      },
      {
        .location = 3,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuLineargradientInstance, color1),
      },
      {
        .location = 4,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuLineargradientInstance, color2),
      },
      {
        .location = 5,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuLineargradientInstance, color3),
      },
      {
        .location = 6,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuLineargradientInstance, color4),
      },
      {
        .location = 7,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuLineargradientInstance, color5),
      },
      {
        .location = 8,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuLineargradientInstance, color6),
      },
      {
        .location = 9,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuLineargradientInstance, offsets0),
      },
      {
        .location = 10,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuLineargradientInstance, offsets1),
      },
  },
};

#endif

