-Fixed texture driver API sample
-Added hipTexRefSetAddress and hipTexRefSetAddress2D APIs
Esse commit está contido em:
@@ -2173,7 +2173,7 @@ hipError_t ihipBindTextureImpl(int dim,
|
||||
enum hipTextureReadMode readMode,
|
||||
size_t *offset,
|
||||
const void *devPtr,
|
||||
const struct hipChannelFormatDesc& desc,
|
||||
const struct hipChannelFormatDesc* desc,
|
||||
size_t size,
|
||||
textureReference* tex);
|
||||
|
||||
@@ -2197,7 +2197,7 @@ hipError_t hipBindTexture(size_t *offset,
|
||||
const struct hipChannelFormatDesc& desc,
|
||||
size_t size = UINT_MAX)
|
||||
{
|
||||
return ihipBindTextureImpl(dim, readMode, offset, devPtr, desc, size, &tex);
|
||||
return ihipBindTextureImpl(dim, readMode, offset, devPtr, &desc, size, &tex);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2218,7 +2218,7 @@ hipError_t hipBindTexture(size_t *offset,
|
||||
const void *devPtr,
|
||||
size_t size = UINT_MAX)
|
||||
{
|
||||
return ihipBindTextureImpl(dim, readMode, offset, devPtr, tex.channelDesc, size, &tex);
|
||||
return ihipBindTextureImpl(dim, readMode, offset, devPtr, &(tex.channelDesc), size, &tex);
|
||||
}
|
||||
|
||||
// C API
|
||||
@@ -2234,7 +2234,7 @@ hipError_t ihipBindTexture2DImpl(int dim,
|
||||
enum hipTextureReadMode readMode,
|
||||
size_t *offset,
|
||||
const void *devPtr,
|
||||
const struct hipChannelFormatDesc& desc,
|
||||
const struct hipChannelFormatDesc* desc,
|
||||
size_t width,
|
||||
size_t height,
|
||||
textureReference* tex);
|
||||
@@ -2247,7 +2247,7 @@ hipError_t hipBindTexture2D(size_t *offset,
|
||||
size_t height,
|
||||
size_t pitch)
|
||||
{
|
||||
return ihipBindTexture2DImpl(dim, readMode, offset, devPtr, tex.channelDesc, width, height, &tex);
|
||||
return ihipBindTexture2DImpl(dim, readMode, offset, devPtr, &(tex.channelDesc), width, height, &tex);
|
||||
}
|
||||
|
||||
template <class T, int dim, enum hipTextureReadMode readMode>
|
||||
@@ -2259,7 +2259,7 @@ hipError_t hipBindTexture2D(size_t *offset,
|
||||
size_t height,
|
||||
size_t pitch)
|
||||
{
|
||||
return ihipBindTexture2DImpl(dim, readMode, offset, devPtr, desc, width, height, &tex);
|
||||
return ihipBindTexture2DImpl(dim, readMode, offset, devPtr, &desc, width, height, &tex);
|
||||
}
|
||||
|
||||
//C API
|
||||
@@ -2349,6 +2349,10 @@ hipError_t hipTexRefSetFlags ( textureReference* tex, unsigned int flags );
|
||||
|
||||
hipError_t hipTexRefSetFormat (textureReference* tex, hipArray_Format fmt, int NumPackedComponents );
|
||||
|
||||
hipError_t hipTexRefSetAddress( size_t* offset, textureReference* tex, hipDeviceptr_t devPtr, size_t size );
|
||||
|
||||
hipError_t hipTexRefSetAddress2D( textureReference* tex, const HIP_ARRAY_DESCRIPTOR* desc, hipDeviceptr_t devPtr, size_t pitch );
|
||||
|
||||
// doxygen end Texture
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -30,7 +30,7 @@ THE SOFTWARE.
|
||||
#define fileName "tex2dKernel.code"
|
||||
|
||||
texture<float, 2, hipReadModeElementType> tex;
|
||||
bool testResult = true;
|
||||
bool testResult = false;
|
||||
|
||||
#define HIP_CHECK(cmd) \
|
||||
{\
|
||||
@@ -38,7 +38,7 @@ bool testResult = true;
|
||||
if(status != hipSuccess) {std::cout<<"error: #"<<status<<" ("<< hipGetErrorString(status) << ") at line:"<<__LINE__<<": "<<#cmd<<std::endl;abort();}\
|
||||
}
|
||||
|
||||
void runTest(int argc, char **argv)
|
||||
bool runTest(int argc, char **argv)
|
||||
{
|
||||
unsigned int width = 256;
|
||||
unsigned int height = 256;
|
||||
@@ -142,11 +142,12 @@ void runTest(int argc, char **argv)
|
||||
}
|
||||
hipFree(dData);
|
||||
hipFreeArray(array);
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv){
|
||||
hipInit(0);
|
||||
runTest(argc, argv);
|
||||
testResult = runTest(argc, argv);
|
||||
printf("%s ...\n", testResult ? "PASSED" : "FAILED");
|
||||
exit(testResult ? EXIT_SUCCESS : EXIT_FAILURE);
|
||||
return 0;
|
||||
|
||||
+38
-6
@@ -383,7 +383,7 @@ hipError_t ihipBindTextureImpl(int dim,
|
||||
enum hipTextureReadMode readMode,
|
||||
size_t *offset,
|
||||
const void *devPtr,
|
||||
const struct hipChannelFormatDesc& desc,
|
||||
const struct hipChannelFormatDesc* desc,
|
||||
size_t size, textureReference* tex )
|
||||
{
|
||||
hipError_t hip_status = hipSuccess;
|
||||
@@ -415,7 +415,11 @@ hipError_t ihipBindTextureImpl(int dim,
|
||||
|
||||
hsa_ext_image_channel_order_t channelOrder;
|
||||
hsa_ext_image_channel_type_t channelType;
|
||||
getChannelOrderAndType(desc, readMode, channelOrder, channelType);
|
||||
if(NULL == desc) {
|
||||
getDrvChannelOrderAndType(tex->format, tex->numChannels, channelOrder, channelType);
|
||||
} else {
|
||||
getChannelOrderAndType(*desc, readMode, channelOrder, channelType);
|
||||
}
|
||||
imageDescriptor.format.channel_order = channelOrder;
|
||||
imageDescriptor.format.channel_type = channelType;
|
||||
|
||||
@@ -445,7 +449,7 @@ hipError_t hipBindTexture(size_t* offset,
|
||||
hipError_t hip_status = hipSuccess;
|
||||
// TODO: hipReadModeElementType is default.
|
||||
hip_status = ihipBindTextureImpl(hipTextureType1D, hipReadModeElementType,
|
||||
offset, devPtr, *desc, size, tex);
|
||||
offset, devPtr, desc, size, tex);
|
||||
return ihipLogStatus(hip_status);
|
||||
}
|
||||
|
||||
@@ -453,7 +457,7 @@ hipError_t ihipBindTexture2DImpl(int dim,
|
||||
enum hipTextureReadMode readMode,
|
||||
size_t *offset,
|
||||
const void *devPtr,
|
||||
const struct hipChannelFormatDesc& desc,
|
||||
const struct hipChannelFormatDesc* desc,
|
||||
size_t width,
|
||||
size_t height,
|
||||
textureReference* tex)
|
||||
@@ -487,7 +491,12 @@ hipError_t ihipBindTexture2DImpl(int dim,
|
||||
|
||||
hsa_ext_image_channel_order_t channelOrder;
|
||||
hsa_ext_image_channel_type_t channelType;
|
||||
getChannelOrderAndType(desc, readMode, channelOrder, channelType);
|
||||
|
||||
if(NULL == desc) {
|
||||
getDrvChannelOrderAndType(tex->format, tex->numChannels, channelOrder, channelType);
|
||||
} else {
|
||||
getChannelOrderAndType(*desc, readMode, channelOrder, channelType);
|
||||
}
|
||||
imageDescriptor.format.channel_order = channelOrder;
|
||||
imageDescriptor.format.channel_type = channelType;
|
||||
|
||||
@@ -518,7 +527,7 @@ hipError_t hipBindTexture2D(size_t* offset,
|
||||
HIP_INIT_API(offset, tex, devPtr, desc, width, height, pitch);
|
||||
hipError_t hip_status = hipSuccess;
|
||||
hip_status = ihipBindTexture2DImpl(hipTextureType2D, hipReadModeElementType,
|
||||
offset, devPtr, *desc, width, height, tex);
|
||||
offset, devPtr, desc, width, height, tex);
|
||||
return ihipLogStatus(hip_status);
|
||||
}
|
||||
|
||||
@@ -737,3 +746,26 @@ hipError_t hipTexRefSetArray ( textureReference* tex, hipArray_const_t array, u
|
||||
array, array->desc,tex );
|
||||
return ihipLogStatus(hip_status);
|
||||
}
|
||||
|
||||
|
||||
hipError_t hipTexRefSetAddress( size_t* offset, textureReference* tex, hipDeviceptr_t devPtr, size_t size )
|
||||
{
|
||||
HIP_INIT_API(offset, tex, devPtr, size);
|
||||
hipError_t hip_status = hipSuccess;
|
||||
//hipChannelFormatDesc desc;
|
||||
// TODO: hipReadModeElementType is default.
|
||||
hip_status = ihipBindTextureImpl(hipTextureType1D, hipReadModeElementType,
|
||||
offset, devPtr, NULL, size, tex);
|
||||
return ihipLogStatus(hip_status);
|
||||
}
|
||||
|
||||
hipError_t hipTexRefSetAddress2D( textureReference* tex, const HIP_ARRAY_DESCRIPTOR* desc, hipDeviceptr_t devPtr, size_t pitch )
|
||||
{
|
||||
HIP_INIT_API(tex, desc, devPtr, pitch);
|
||||
size_t offset;
|
||||
hipError_t hip_status = hipSuccess;
|
||||
// TODO: hipReadModeElementType is default.
|
||||
hip_status = ihipBindTexture2DImpl(hipTextureType2D, hipReadModeElementType,
|
||||
&offset, devPtr, NULL, desc->width, desc->height, tex);
|
||||
return ihipLogStatus(hip_status);
|
||||
}
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário