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

#define gsk_gpu_componenttransfer_n_textures 1

typedef struct _GskGpuComponenttransferInstance GskGpuComponenttransferInstance;

struct _GskGpuComponenttransferInstance {
  float params_r[4];
  float params_g[4];
  float params_b[4];
  float params_a[4];
  float table0[4];
  float table1[4];
  float table2[4];
  float table3[4];
  float table4[4];
  float table5[4];
  float table6[4];
  float table7[4];
  float rect[4];
  float tex_rect[4];
  float opacity;
};

static inline void
gsk_gpu_componenttransfer_setup_vao (gsize offset)
{
  glEnableVertexAttribArray (0);
  glVertexAttribDivisor (0, 1);
  glVertexAttribPointer (0,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, params_r)));
  glEnableVertexAttribArray (1);
  glVertexAttribDivisor (1, 1);
  glVertexAttribPointer (1,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, params_g)));
  glEnableVertexAttribArray (2);
  glVertexAttribDivisor (2, 1);
  glVertexAttribPointer (2,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, params_b)));
  glEnableVertexAttribArray (3);
  glVertexAttribDivisor (3, 1);
  glVertexAttribPointer (3,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, params_a)));
  glEnableVertexAttribArray (4);
  glVertexAttribDivisor (4, 1);
  glVertexAttribPointer (4,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table0)));
  glEnableVertexAttribArray (5);
  glVertexAttribDivisor (5, 1);
  glVertexAttribPointer (5,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table1)));
  glEnableVertexAttribArray (6);
  glVertexAttribDivisor (6, 1);
  glVertexAttribPointer (6,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table2)));
  glEnableVertexAttribArray (7);
  glVertexAttribDivisor (7, 1);
  glVertexAttribPointer (7,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table3)));
  glEnableVertexAttribArray (8);
  glVertexAttribDivisor (8, 1);
  glVertexAttribPointer (8,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table4)));
  glEnableVertexAttribArray (9);
  glVertexAttribDivisor (9, 1);
  glVertexAttribPointer (9,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table5)));
  glEnableVertexAttribArray (10);
  glVertexAttribDivisor (10, 1);
  glVertexAttribPointer (10,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table6)));
  glEnableVertexAttribArray (11);
  glVertexAttribDivisor (11, 1);
  glVertexAttribPointer (11,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table7)));
  glEnableVertexAttribArray (12);
  glVertexAttribDivisor (12, 1);
  glVertexAttribPointer (12,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, rect)));
  glEnableVertexAttribArray (13);
  glVertexAttribDivisor (13, 1);
  glVertexAttribPointer (13,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, tex_rect)));
  glEnableVertexAttribArray (14);
  glVertexAttribDivisor (14, 1);
  glVertexAttribPointer (14,
                         1,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuComponenttransferInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuComponenttransferInstance, opacity)));
}


static void
gsk_gpu_componenttransfer_setup_attrib_locations (GLuint program)
{
  glBindAttribLocation (program, 0, "in_params_r");
  glBindAttribLocation (program, 1, "in_params_g");
  glBindAttribLocation (program, 2, "in_params_b");
  glBindAttribLocation (program, 3, "in_params_a");
  glBindAttribLocation (program, 4, "in_table0");
  glBindAttribLocation (program, 5, "in_table1");
  glBindAttribLocation (program, 6, "in_table2");
  glBindAttribLocation (program, 7, "in_table3");
  glBindAttribLocation (program, 8, "in_table4");
  glBindAttribLocation (program, 9, "in_table5");
  glBindAttribLocation (program, 10, "in_table6");
  glBindAttribLocation (program, 11, "in_table7");
  glBindAttribLocation (program, 12, "in_rect");
  glBindAttribLocation (program, 13, "in_tex_rect");
  glBindAttribLocation (program, 14, "in_opacity");
}


#ifdef GDK_RENDERING_VULKAN

static const VkPipelineVertexInputStateCreateInfo gsk_gpu_componenttransfer_info = {
  .sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
  .vertexBindingDescriptionCount = 1,
  .pVertexBindingDescriptions = (VkVertexInputBindingDescription[1]) {
      {
        .binding = 0,
        .stride = sizeof (GskGpuComponenttransferInstance),
        .inputRate = VK_VERTEX_INPUT_RATE_INSTANCE
      }
  },
  .vertexAttributeDescriptionCount = 15,
  .pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[15]) {
      {
        .location = 0,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, params_r),
      },
      {
        .location = 1,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, params_g),
      },
      {
        .location = 2,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, params_b),
      },
      {
        .location = 3,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, params_a),
      },
      {
        .location = 4,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table0),
      },
      {
        .location = 5,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table1),
      },
      {
        .location = 6,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table2),
      },
      {
        .location = 7,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table3),
      },
      {
        .location = 8,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table4),
      },
      {
        .location = 9,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table5),
      },
      {
        .location = 10,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table6),
      },
      {
        .location = 11,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, table7),
      },
      {
        .location = 12,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, rect),
      },
      {
        .location = 13,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, tex_rect),
      },
      {
        .location = 14,
        .binding = 0,
        .format = VK_FORMAT_R32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuComponenttransferInstance, opacity),
      },
  },
};

#endif

