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 41DEFINE_SPIRV_ImageQuerySize_2d(image2d_t) 42DEFINE_SPIRV_ImageQuerySize_2d(image2d_depth_t) 43DEFINE_SPIRV_ImageQuerySizeLod_2d(image2d_t) 44DEFINE_SPIRV_ImageQuerySizeLod_2d(image2d_depth_t) 45DEFINE_SPIRV_ImageQuerySize_2darray(image2d_array_t) 46DEFINE_SPIRV_ImageQuerySize_2darray(image2d_array_depth_t) 47DEFINE_SPIRV_ImageQuerySizeLod_2darray(image2d_array_t) 48DEFINE_SPIRV_ImageQuerySizeLod_2darray(image2d_array_depth_t) 49