SWDEV-303204 - Disable texture/image Apis on some devices. (#2381)

Modify texture tests to pass on devices that don't support texture.
Add hipDeviceAttributeImageSupport to check image support in runtime

Change-Id: Ia89c494e651a6198a24448b59a91e046a9ebea38
This commit is contained in:
TomSang
2021-12-02 01:16:13 -05:00
committed by GitHub
orang tua 0d361c5621
melakukan 5c8af57480
10 mengubah file dengan 77 tambahan dan 6 penghapusan
+10 -1
Melihat File
@@ -40,10 +40,12 @@ std::vector<unsigned int> mip_vector = {8, 4, 2, 1};
__global__ void tex2DKernel(float* outputData, hipTextureObject_t textureObject, int width,
int height, float level) {
#ifndef __gfx90a__
#if !defined(__HIP_NO_IMAGE_SUPPORT) || !__HIP_NO_IMAGE_SUPPORT
int x = blockIdx.x * blockDim.x + threadIdx.x;
int y = blockIdx.y * blockDim.y + threadIdx.y;
outputData[y * width + x] = tex2DLod<float>(textureObject, x, y, level);
#endif
#endif
}
bool runMipMapTest(unsigned int width, unsigned int height, unsigned int mipmap_level) {
@@ -148,6 +150,7 @@ bool runMipMapTest(unsigned int width, unsigned int height, unsigned int mipmap_
hipDestroyTextureObject(textureObject);
hipFree(dData);
hipFreeArray(hipArray);
free(hData);
return testResult;
}
@@ -169,7 +172,13 @@ bool runTest(int argc, char** argv) {
int main(int argc, char** argv) {
bool testResult = true;
int imageSupport = 0;
hipDeviceGetAttribute(&imageSupport, hipDeviceAttributeImageSupport,
p_gpuDevice);
if (!imageSupport) {
printf("Texture is not support on the device\n");
passed();
}
#ifdef _WIN32
testResult = runTest(argc, argv);
#else