44e0440a9c
Change-Id: I5d88438d2bf6d20d2ebde8e6ae0cbd1d27630045
54 wiersze
2.0 KiB
C++
54 wiersze
2.0 KiB
C++
/*
|
|
Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved.
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
The above copyright notice and this permission notice shall be included in
|
|
all copies or substantial portions of the Software.
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANNTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
THE SOFTWARE.
|
|
*/
|
|
|
|
#include <hip_test_common.hh>
|
|
|
|
#define R 8 // rows, height
|
|
#define C 8 // columns, width
|
|
|
|
|
|
TEST_CASE("Unit_hipGetChannelDesc_CreateAndGet") {
|
|
hipChannelFormatDesc chan_test, chan_desc;
|
|
hipArray *hipArray;
|
|
|
|
#if HT_AMD
|
|
int imageSupport{};
|
|
HIP_CHECK(hipDeviceGetAttribute(&imageSupport,
|
|
hipDeviceAttributeImageSupport, 0));
|
|
if (!imageSupport) {
|
|
INFO("Texture is not supported on the device. Test is skipped");
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
chan_desc = hipCreateChannelDesc(32, 0, 0, 0, hipChannelFormatKindSigned);
|
|
HIP_CHECK(hipMallocArray(&hipArray, &chan_desc, C, R, 0));
|
|
HIP_CHECK(hipGetChannelDesc(&chan_test, hipArray));
|
|
|
|
if ((chan_test.x != 32) || (chan_test.y != 0)
|
|
|| (chan_test.z != 0) || (chan_test.f != 0)) {
|
|
INFO("Mismatch observed : " << chan_test.x << chan_test.y
|
|
<< chan_test.z << chan_test.f);
|
|
REQUIRE(false);
|
|
}
|
|
|
|
|
|
HIP_CHECK(hipFreeArray(hipArray));
|
|
}
|