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

typedef struct _GskGpuBoxshadowInstance GskGpuBoxshadowInstance;

struct _GskGpuBoxshadowInstance {
  float outline[12];
  float bounds[4];
  float color[4];
  float shadow_offset[2];
  float shadow_spread;
  float blur_radius;
};

static inline void
gsk_gpu_boxshadow_setup_vao (gsize offset)
{
  glEnableVertexAttribArray (0);
  glVertexAttribDivisor (0, 1);
  glVertexAttribPointer (0,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuBoxshadowInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuBoxshadowInstance, outline)));
  glEnableVertexAttribArray (1);
  glVertexAttribDivisor (1, 1);
  glVertexAttribPointer (1,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuBoxshadowInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuBoxshadowInstance, outline) + sizeof (float) * 4));
  glEnableVertexAttribArray (2);
  glVertexAttribDivisor (2, 1);
  glVertexAttribPointer (2,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuBoxshadowInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuBoxshadowInstance, outline) + sizeof (float) * 8));
  glEnableVertexAttribArray (3);
  glVertexAttribDivisor (3, 1);
  glVertexAttribPointer (3,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuBoxshadowInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuBoxshadowInstance, bounds)));
  glEnableVertexAttribArray (4);
  glVertexAttribDivisor (4, 1);
  glVertexAttribPointer (4,
                         4,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuBoxshadowInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuBoxshadowInstance, color)));
  glEnableVertexAttribArray (5);
  glVertexAttribDivisor (5, 1);
  glVertexAttribPointer (5,
                         2,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuBoxshadowInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuBoxshadowInstance, shadow_offset)));
  glEnableVertexAttribArray (6);
  glVertexAttribDivisor (6, 1);
  glVertexAttribPointer (6,
                         1,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuBoxshadowInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuBoxshadowInstance, shadow_spread)));
  glEnableVertexAttribArray (7);
  glVertexAttribDivisor (7, 1);
  glVertexAttribPointer (7,
                         1,
                         GL_FLOAT,
                         GL_FALSE,
                         sizeof (GskGpuBoxshadowInstance),
                         GSIZE_TO_POINTER (offset + G_STRUCT_OFFSET(GskGpuBoxshadowInstance, blur_radius)));
}


static void
gsk_gpu_boxshadow_setup_attrib_locations (GLuint program)
{
  glBindAttribLocation (program, 0, "in_outline");
  glBindAttribLocation (program, 3, "in_bounds");
  glBindAttribLocation (program, 4, "in_color");
  glBindAttribLocation (program, 5, "in_shadow_offset");
  glBindAttribLocation (program, 6, "in_shadow_spread");
  glBindAttribLocation (program, 7, "in_blur_radius");
}


#ifdef GDK_RENDERING_VULKAN

static const VkPipelineVertexInputStateCreateInfo gsk_gpu_boxshadow_info = {
  .sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,
  .vertexBindingDescriptionCount = 1,
  .pVertexBindingDescriptions = (VkVertexInputBindingDescription[1]) {
      {
        .binding = 0,
        .stride = sizeof (GskGpuBoxshadowInstance),
        .inputRate = VK_VERTEX_INPUT_RATE_INSTANCE
      }
  },
  .vertexAttributeDescriptionCount = 8,
  .pVertexAttributeDescriptions = (VkVertexInputAttributeDescription[8]) {
      {
        .location = 0,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuBoxshadowInstance, outline),
      },
      {
        .location = 1,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuBoxshadowInstance, outline) + sizeof (float) * 4,
      },
      {
        .location = 2,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuBoxshadowInstance, outline) + sizeof (float) * 8,
      },
      {
        .location = 3,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuBoxshadowInstance, bounds),
      },
      {
        .location = 4,
        .binding = 0,
        .format = VK_FORMAT_R32G32B32A32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuBoxshadowInstance, color),
      },
      {
        .location = 5,
        .binding = 0,
        .format = VK_FORMAT_R32G32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuBoxshadowInstance, shadow_offset),
      },
      {
        .location = 6,
        .binding = 0,
        .format = VK_FORMAT_R32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuBoxshadowInstance, shadow_spread),
      },
      {
        .location = 7,
        .binding = 0,
        .format = VK_FORMAT_R32_SFLOAT,
        .offset = G_STRUCT_OFFSET(GskGpuBoxshadowInstance, blur_radius),
      },
  },
};

#endif

