Home | History | Annotate | Download | only in src
      1 #include "../inc/spirv.h"
      2 
      3 __attribute__((overloadable, always_inline)) int  __spirv_ImageQuerySize(image1d_buffer_t img) {
      4   return get_image_width(img);
      5 }
      6 
      7 __attribute__((overloadable, always_inline)) int  __spirv_ImageQuerySizeLod(image1d_t img, int lod) {
      8   return get_image_width(img) >> lod;
      9 }
     10 __attribute__((overloadable, always_inline)) int2  __spirv_ImageQuerySize(image1d_array_t img) {
     11   return (int2)(get_image_width(img), get_image_array_size(img));
     12 }
     13 __attribute__((overloadable, always_inline)) int2  __spirv_ImageQuerySizeLod(image1d_array_t img, int lod) {
     14   return (int2)(get_image_width(img) >> lod, get_image_array_size(img) >> lod);
     15 }
     16 
     17 #define DEFINE_SPIRV_ImageQuerySizeLod_2d(ImgTy) \
     18 __attribute__((overloadable, always_inline)) int2 __spirv_ImageQuerySizeLod(ImgTy img, int lod) { \
     19   return get_image_dim(img) >> lod; \
     20 }
     21 
     22 #define DEFINE_SPIRV_ImageQuerySizeLod_2darray(ImgTy) \
     23 __attribute__((overloadable, always_inline)) int3 __spirv_ImageQuerySizeLod(ImgTy img, int lod) { \
     24   return (int3)(get_image_dim(img) >> lod, get_image_array_size(img) >> lod); \
     25 }
     26 
     27 #define DEFINE_SPIRV_ImageQuerySize_2d(ImgTy) \
     28 __attribute__((overloadable, always_inline)) int2 __spirv_ImageQuerySize(ImgTy img) { \
     29   return get_image_dim(img); \
     30 }
     31 
     32 #define DEFINE_SPIRV_ImageQuerySize_2darray(ImgTy) \
     33 __attribute__((overloadable, always_inline)) int3 __spirv_ImageQuerySize(ImgTy img) { \
     34   return (int3)(get_image_dim(img), get_image_array_size(img)); \
     35 }
     36 
     37 __attribute__((overloadable, always_inline)) int3 __spirv_ImageQuerySizeLod(image3d_t img, int lod) {
     38   return get_image_dim(img).xyz >> lod;
     39 }
     40 
     41 DEFINE_SPIRV_ImageQuerySize_2d(image2d_t)
     42 DEFINE_SPIRV_ImageQuerySize_2d(image2d_depth_t)
     43 DEFINE_SPIRV_ImageQuerySizeLod_2d(image2d_t)
     44 DEFINE_SPIRV_ImageQuerySizeLod_2d(image2d_depth_t)
     45 DEFINE_SPIRV_ImageQuerySize_2darray(image2d_array_t)
     46 DEFINE_SPIRV_ImageQuerySize_2darray(image2d_array_depth_t)
     47 DEFINE_SPIRV_ImageQuerySizeLod_2darray(image2d_array_t)
     48 DEFINE_SPIRV_ImageQuerySizeLod_2darray(image2d_array_depth_t)
     49