Grafik Komit

20 Melakukan

Penulis SHA1 Pesan Tanggal
Vladislav Sytchenko a81e7d63c6 Correctly check max 1D image buffer size
VDI reports the limits in pixels, but user provides the size in bytes.

Make sure both values are in pixels before doing comparisons.

Change-Id: I082c7175c9fa4383e0b0ee38ff8c047c26ff20b4
2020-04-09 21:37:43 -04:00
Vladislav Sytchenko 5f14ae1161 Take into an account the number of channels...
when querying the element size of an array.

Change-Id: Id57d3374b14d80a59230ec8286704f2fbabb0fae
2020-04-03 15:43:18 -04:00
Vladislav Sytchenko aea688b79c Add entry points for hipTexObject*() API
Even though the runtime and driver texture object API is one to one, the structs used by these APIs are not. See hipResourceDesc vs HIP_RESOURCE_DESC differences.

These differences are not trivial and most likely won't be able to handled by hipify, so we need new API entry points.

Change-Id: Id4bcb1ad0ae15378dbdb5a2ed07e5ea30f320082
2020-04-01 14:51:51 -04:00
Vladislav Sytchenko c1475f948e Replace hip::TextureObject with __hip_texture
This avoids the use of extra casts when obtaining a texture object handle.

Change-Id: I42df22bdad0ab9ac6c33cb8b282dee65fe7cfd6e
2020-03-26 14:45:20 -04:00
Vladislav Sytchenko 2028b6eb29 Headers need to export C symbols for texture API
This also adds declarations of all the missing texture APIs.

hipTexRefSet*() functions need to take a textureReference as a ptr for type erasure to work. Runtime has been modified to accomodate this.

This change only applies to VDI.

Change-Id: Icf43cc5bd44dfc2c39084b7fe56d5a793bf7319f
2020-03-26 14:45:20 -04:00
Vladislav Sytchenko 8ddeeb4551 Enable initial sRGB support
Instead of using the sampler field force_degamma to perform sRGB->linear conversion during pixel sampling, we use an appropriate image format instead. The overhead of this is having to create an image view when creating a texture object from an array.

Change-Id: I1ca368c312c1fd4b6f784a3a1b35b5eeb28070ff
2020-03-26 14:45:20 -04:00
Vladislav Sytchenko ea701777d8 Allow creating texture from unaligned user ptr
All we have to do is align the ptr to HW requirments an if it's not zero, then return the offset to the user.

We currently don't have anywhere to store this offset, so hipGetTextureAlignmentOffset() will still always return 0.

Change-Id: If31998127d99a2a3222a026d88249519d6102505
2020-03-26 12:43:17 -04:00
Vladislav Sytchenko e8fa3b2589 Program texture flags in a better way
Not sure what I was thinking when initially implementing this...

Change-Id: Ib82f0f5a86683c08823dd4b59c98259d27151822
2020-03-18 18:15:09 -04:00
Vladislav Sytchenko 2bad9e2821 Purge the use of ihip*impl() texture APIs
These are artifacts left from HIP-HCC and now are not needed by HIP-VDI.

Change-Id: Ib25a1081fe6146c8a89659395151e9d5bdaf7519
2020-03-18 18:15:01 -04:00
Vladislav Sytchenko 7385a032ae Correctly infer the texture read mode
Currently we extract the read mode from the ihip*impl() calls, which is not correct. We should be getting it from the texture itself directly.

Change-Id: Idf6449fefa395a887138a252e8ea937a6897e600
2020-03-18 18:14:45 -04:00
Vladislav Sytchenko c7407a3b57 Correct the definition of ...
hipBindTextureToMipmappedArray()

The texture reference needs to be passed as a constant pointer.

Change-Id: I6d31204c7f2325a5bc1e8b6e089fd9f8d21d1d78
2020-03-18 18:14:36 -04:00
Vladislav Sytchenko 3e460ab514 Correct the declaration of hipBindTexture2D()
The texture reference needs to be passed as a constant pointer.

Change-Id: Idde461f0f328ac87ce677b6bab3203161b514cbf
2020-03-18 18:08:23 -04:00
Vladislav Sytchenko 2d77399747 Correct the declaration of hipBindTextureToArray()
The texture reference needs to be passed as a constant pointer.

Change-Id: Iff171626536071fb2020cfff7132ec930577b1b9
2020-03-18 18:08:13 -04:00
Vladislav Sytchenko 7190fa518e Correct the declaration of hipBindTexture()
The texture reference needs to be passed as a constant pointer.

Change-Id: I36ca0bddaba30becfc2ce70dd9e5b7db66c57f27
2020-03-18 18:08:01 -04:00
Vladislav Sytchenko dbb8f96a8e Fix dangling pointer after hipUnbindTexture() call
Change-Id: Ic4b476c62ebfae31e94dd139b20b6aaaa52bb866
2020-03-06 14:10:56 -05:00
Vladislav Sytchenko ccc73a9fb4 hipBindTexture() should handle nullptr offset.
If a user passes a ptr that was allocated by hipMalloc(), the offset is guaranteed to be 0 and NULL may be passed as the offset parameter. We shouldn't return an error in this case.

Change-Id: I4a8d645121e5a17d5e2861a0629356a3599de9ee
2020-02-25 13:50:34 -05:00
Vladislav Sytchenko c22eb7808d HIP-VDI texture rework
The current texture implementation is based off the one for HIP-HCC. There's a lot of problems with it - only creating images from buffers, hard coding logic and ignoring user parameters. This leads to a whole lot of UB even with simple examples (as seen with RedShift's code).

This CL is aimed to bring the HIP-VDI texture implementation closer to what is described by Cuda.

hipMemcpyAtoA() - image to image copy.
hipMemcpyHtoA()/hipMemcpyDtoA() - buffer to image copy.
hipMemcpyAtoH()/hipMemcpyAtoD() - image to buffer copy.

hipArrayCreate()/hipArray3DCreate()/hipMallocArray()/hipMalloc3DArray() - creates 1D/2D/3D/1D Array/2D Array images.
hipCreateTextureObject() - creates sampler, (optional) creates 1D/2D image from buffer, (optional) creates image views.
hipBindTexture() - creates 1D image from buffer (should create a typed buffer, however this is not compatible with HIP-HCC).
hipBindTexture2D() - creates 2D image form buffer.
hipBindTextureToArray() - creates image view.
hipTexRefSetAddress() - creates 1D image from buffer (should create a typed buffer, however this is not compatible with HIP-HCC).
hipTexRefSetAddress2D() - creates 2D image from buffer.
hipTexRefSetArray() - creates image view.

There are still a lot of  TODOs in the code, here's a few important ones:
1. VDI doesn't support a lot of sampler flags.
2. VDI doesn't support device to image 2D/3D copy.
3. Mipmaps implementation is incomplete.
4. Image view implementation is incomplete.

Change-Id: Ia374ee27aa14f76451fee7667495036f4419a487
2020-02-24 15:23:45 -05:00
Christophe Paquot 9630e40beb Introducing hip::Device which wraps around amd::Context and deviceId
Change-Id: Ie35a6edb65c001b35eb9f5d2af26e765dc41c00e
2020-02-18 17:18:56 -05:00
Laurent Morichetti 2764aee583 Update copyright info for VDI files
Change-Id: Ib160fbf89ec89a5895321f73402a33b4d344a68f
2020-02-04 08:47:10 -08:00
Laurent Morichetti e604beeef4 Merge HIP/VDI branch 'amd-staging' into lmoriche/amd-master-next
Change-Id: Iabaab4e72815ba483a1330ec6a1130f2b86676f0
2020-01-29 15:02:13 -08:00