//
// fb/DistributedFrameBuffer_ispc.h
// (Header automatically generated by the ispc compiler.)
// DO NOT EDIT THIS FILE.
//

#pragma once
#include <stdint.h>



#ifdef __cplusplus
namespace ispc { /* namespace */
#endif // __cplusplus


/* Portable alignment macro that works across different compilers and standards */
#if defined(__cplusplus) && __cplusplus >= 201103L
/* C++11 or newer - use alignas keyword */
#define __ISPC_ALIGN__(x) alignas(x)
#elif defined(__GNUC__) || defined(__clang__)
/* GCC or Clang - use __attribute__ */
#define __ISPC_ALIGN__(x) __attribute__((aligned(x)))
#elif defined(_MSC_VER)
/* Microsoft Visual C++ - use __declspec */
#define __ISPC_ALIGN__(x) __declspec(align(x))
#else
/* Unknown compiler/standard - alignment not supported */
#define __ISPC_ALIGN__(x)
#warning "Alignment not supported on this compiler"
#endif // defined(__cplusplus) && __cplusplus >= 201103L
#ifndef __ISPC_ALIGNED_STRUCT__
#if defined(__clang__) || !defined(_MSC_VER) || _MSC_VER > 1943
// Clang, GCC, ICC, Visual Studio
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Older Visual Studio
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif // defined(__clang__) || !defined(_MSC_VER) || _MSC_VER > 1943
#endif // __ISPC_ALIGNED_STRUCT__

#ifndef __ISPC_STRUCT_vec2i__
#define __ISPC_STRUCT_vec2i__
struct vec2i {
    int32_t x;
    int32_t y;
};
#endif

#ifndef __ISPC_STRUCT_box2i__
#define __ISPC_STRUCT_box2i__
struct box2i {
    struct vec2i lower;
    struct vec2i upper;
};
#endif

#ifndef __ISPC_STRUCT_vec2f__
#define __ISPC_STRUCT_vec2f__
struct vec2f {
    float x;
    float y;
};
#endif

#ifndef __ISPC_STRUCT_VaryingTile__
#define __ISPC_STRUCT_VaryingTile__
__ISPC_ALIGNED_STRUCT__(16) VaryingTile {
    struct box2i region;
    struct vec2i fbSize;
    struct vec2f rcp_fbSize;
    int32_t generation;
    int32_t children;
    int32_t sortOrder;
    int32_t accumID;
    float pad[4];
    __ISPC_ALIGN__(16)     float r[1024][4];
    __ISPC_ALIGN__(16)     float g[1024][4];
    __ISPC_ALIGN__(16)     float b[1024][4];
    __ISPC_ALIGN__(16)     float a[1024][4];
    __ISPC_ALIGN__(16)     float z[1024][4];
    __ISPC_ALIGN__(16)     float nx[1024][4];
    __ISPC_ALIGN__(16)     float ny[1024][4];
    __ISPC_ALIGN__(16)     float nz[1024][4];
    __ISPC_ALIGN__(16)     float ar[1024][4];
    __ISPC_ALIGN__(16)     float ag[1024][4];
    __ISPC_ALIGN__(16)     float ab[1024][4];
    __ISPC_ALIGN__(16)     uint32_t pid[1024][4];
    __ISPC_ALIGN__(16)     uint32_t gid[1024][4];
    __ISPC_ALIGN__(16)     uint32_t iid[1024][4];
};
#endif


///////////////////////////////////////////////////////////////////////////
// Functions exported from ispc code
///////////////////////////////////////////////////////////////////////////
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
extern "C" {
#endif // __cplusplus
    extern void DFB_accumulateAuxTile(const struct VaryingTile * tile, void * _final, struct VaryingTile * accum);
    extern float DFB_accumulateTile(const struct VaryingTile * tile, struct VaryingTile * final, struct VaryingTile * accum, struct VaryingTile * variance, bool doAccumulation, bool hasVarianceBuffer);
    extern void DFB_accumulateTileSimple(const struct VaryingTile * tile, struct VaryingTile * accum, struct VaryingTile * variance);
    extern float DFB_computeErrorForTile(const int32_t * const size_, const struct VaryingTile * accum, const struct VaryingTile * variance, const float accumID);
    extern void DFB_sortAndBlendFragments(struct VaryingTile *  * tileArray, int32_t numTiles);
    extern void DFB_writeTile(const struct VaryingTile * tile, void * _color);
    extern void DFB_zComposite(const struct VaryingTile * delta, struct VaryingTile * current);
#if defined(__cplusplus) && (! defined(__ISPC_NO_EXTERN_C) || !__ISPC_NO_EXTERN_C )
} /* end extern C */
#endif // __cplusplus


/* Portable alignment macro that works across different compilers and standards */
#if defined(__cplusplus) && __cplusplus >= 201103L
/* C++11 or newer - use alignas keyword */
#define __ISPC_ALIGN__(x) alignas(x)
#elif defined(__GNUC__) || defined(__clang__)
/* GCC or Clang - use __attribute__ */
#define __ISPC_ALIGN__(x) __attribute__((aligned(x)))
#elif defined(_MSC_VER)
/* Microsoft Visual C++ - use __declspec */
#define __ISPC_ALIGN__(x) __declspec(align(x))
#else
/* Unknown compiler/standard - alignment not supported */
#define __ISPC_ALIGN__(x)
#warning "Alignment not supported on this compiler"
#endif // defined(__cplusplus) && __cplusplus >= 201103L
#ifndef __ISPC_ALIGNED_STRUCT__
#if defined(__clang__) || !defined(_MSC_VER) || _MSC_VER > 1943
// Clang, GCC, ICC, Visual Studio
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Older Visual Studio
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif // defined(__clang__) || !defined(_MSC_VER) || _MSC_VER > 1943
#endif // __ISPC_ALIGNED_STRUCT__

#ifndef __ISPC_STRUCT_VaryingTile__
#define __ISPC_STRUCT_VaryingTile__
__ISPC_ALIGNED_STRUCT__(32) VaryingTile {
    struct box2i region;
    struct vec2i fbSize;
    struct vec2f rcp_fbSize;
    int32_t generation;
    int32_t children;
    int32_t sortOrder;
    int32_t accumID;
    float pad[4];
    __ISPC_ALIGN__(32)     float r[512][8];
    __ISPC_ALIGN__(32)     float g[512][8];
    __ISPC_ALIGN__(32)     float b[512][8];
    __ISPC_ALIGN__(32)     float a[512][8];
    __ISPC_ALIGN__(32)     float z[512][8];
    __ISPC_ALIGN__(32)     float nx[512][8];
    __ISPC_ALIGN__(32)     float ny[512][8];
    __ISPC_ALIGN__(32)     float nz[512][8];
    __ISPC_ALIGN__(32)     float ar[512][8];
    __ISPC_ALIGN__(32)     float ag[512][8];
    __ISPC_ALIGN__(32)     float ab[512][8];
    __ISPC_ALIGN__(32)     uint32_t pid[512][8];
    __ISPC_ALIGN__(32)     uint32_t gid[512][8];
    __ISPC_ALIGN__(32)     uint32_t iid[512][8];
};
#endif


/* Portable alignment macro that works across different compilers and standards */
#if defined(__cplusplus) && __cplusplus >= 201103L
/* C++11 or newer - use alignas keyword */
#define __ISPC_ALIGN__(x) alignas(x)
#elif defined(__GNUC__) || defined(__clang__)
/* GCC or Clang - use __attribute__ */
#define __ISPC_ALIGN__(x) __attribute__((aligned(x)))
#elif defined(_MSC_VER)
/* Microsoft Visual C++ - use __declspec */
#define __ISPC_ALIGN__(x) __declspec(align(x))
#else
/* Unknown compiler/standard - alignment not supported */
#define __ISPC_ALIGN__(x)
#warning "Alignment not supported on this compiler"
#endif // defined(__cplusplus) && __cplusplus >= 201103L
#ifndef __ISPC_ALIGNED_STRUCT__
#if defined(__clang__) || !defined(_MSC_VER) || _MSC_VER > 1943
// Clang, GCC, ICC, Visual Studio
#define __ISPC_ALIGNED_STRUCT__(s) struct __ISPC_ALIGN__(s)
#else
// Older Visual Studio
#define __ISPC_ALIGNED_STRUCT__(s) __ISPC_ALIGN__(s) struct
#endif // defined(__clang__) || !defined(_MSC_VER) || _MSC_VER > 1943
#endif // __ISPC_ALIGNED_STRUCT__

#ifndef __ISPC_STRUCT_VaryingTile__
#define __ISPC_STRUCT_VaryingTile__
__ISPC_ALIGNED_STRUCT__(64) VaryingTile {
    struct box2i region;
    struct vec2i fbSize;
    struct vec2f rcp_fbSize;
    int32_t generation;
    int32_t children;
    int32_t sortOrder;
    int32_t accumID;
    float pad[4];
    __ISPC_ALIGN__(64)     float r[256][16];
    __ISPC_ALIGN__(64)     float g[256][16];
    __ISPC_ALIGN__(64)     float b[256][16];
    __ISPC_ALIGN__(64)     float a[256][16];
    __ISPC_ALIGN__(64)     float z[256][16];
    __ISPC_ALIGN__(64)     float nx[256][16];
    __ISPC_ALIGN__(64)     float ny[256][16];
    __ISPC_ALIGN__(64)     float nz[256][16];
    __ISPC_ALIGN__(64)     float ar[256][16];
    __ISPC_ALIGN__(64)     float ag[256][16];
    __ISPC_ALIGN__(64)     float ab[256][16];
    __ISPC_ALIGN__(64)     uint32_t pid[256][16];
    __ISPC_ALIGN__(64)     uint32_t gid[256][16];
    __ISPC_ALIGN__(64)     uint32_t iid[256][16];
};
#endif



#ifdef __cplusplus
} /* namespace */
#endif // __cplusplus
