SWDEV-368553 – Add missing mipmap Apis

Add missing mipmap Apis’ implementation.
Fix some bugs of mimpmap apis.
Use hipmipmappedArray to differentiate cuda
and driver apis on Nvidia.
Change-Id: I6079d9f3b2ddf4e42b9a6f7f3902322cfca02cfd
Этот коммит содержится в:
taosang2
2023-06-01 18:31:48 -04:00
коммит произвёл Tao Sang
родитель b961d4a970
Коммит f03c11491b
5 изменённых файлов: 115 добавлений и 43 удалений
+5 -4
Просмотреть файл
@@ -567,14 +567,15 @@ void Pipe::initDeviceMemory() {
#define GETMIPDIM(dim, mip) (((dim >> mip) > 0) ? (dim >> mip) : 1)
Image::Image(const Format& format, Image& parent, uint baseMipLevel, cl_mem_flags flags)
Image::Image(const Format& format, Image& parent, uint baseMipLevel, cl_mem_flags flags,
bool isMipmapView)
: Memory(parent, flags, 0,
parent.getWidth() * parent.getHeight() * parent.getDepth() * format.getElementSize()),
impl_(format, Coord3D(parent.getWidth() * parent.getImageFormat().getElementSize() /
format.getElementSize(),
parent.getHeight(), parent.getDepth()),
parent.getRowPitch(), parent.getSlicePitch(), parent.getBytePitch()),
mipLevels_(1),
mipLevels_(isMipmapView ? parent.getMipLevels() : 1),
baseMipLevel_(baseMipLevel) {
if (baseMipLevel > 0) {
impl_.region_.c[0] = GETMIPDIM(parent.getWidth(), baseMipLevel) *
@@ -1191,10 +1192,10 @@ bool Image::Format::isSupported(const Context& context, cl_mem_object_type image
// ================================================================================================
Image* Image::createView(const Context& context, const Format& format, device::VirtualDevice* vDev,
uint baseMipLevel, cl_mem_flags flags) {
uint baseMipLevel, cl_mem_flags flags, bool createMipmapView) {
// Find the image dimensions and create a corresponding object
Image* view = new (context) Image(format, *this, baseMipLevel, flags);
Image* view = new (context) Image(format, *this, baseMipLevel, flags, createMipmapView);
if (view != nullptr) {
// Set GPU virtual device for this view