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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user