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
Tá an tiomantas seo le fáil i:
tiomanta ag
Tao Sang
tuismitheoir
b961d4a970
tiomantas
f03c11491b
@@ -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
|
||||
|
||||
@@ -540,7 +540,8 @@ class Image : public Memory {
|
||||
uint baseMipLevel_; //!< The base mip level for a view
|
||||
|
||||
protected:
|
||||
Image(const Format& format, Image& parent, uint baseMipLevel = 0, cl_mem_flags flags = 0);
|
||||
Image(const Format& format, Image& parent, uint baseMipLevel = 0, cl_mem_flags flags = 0,
|
||||
bool isMipmapView = false);
|
||||
|
||||
///! Initializes the device memory array which is nested
|
||||
// after'Image' object in memory layout.
|
||||
@@ -596,7 +597,8 @@ class Image : public Memory {
|
||||
const Format& format, //!< The new format for a view
|
||||
device::VirtualDevice* vDev, //!< Virtual device object
|
||||
uint baseMipLevel = 0, //!< Base mip level for a view
|
||||
cl_mem_flags flags = 0 //!< Memory allocation flags
|
||||
cl_mem_flags flags = 0, //!< Memory allocation flags
|
||||
bool createMipmapView = false //!< To create mipmap view based on this image
|
||||
);
|
||||
|
||||
//! Returns the impl for this image.
|
||||
|
||||
Tagairt in Eagrán Nua
Cuir bac ar úsáideoir