Commit c327370e by Jamie Madill Committed by Commit Bot

Vulkan: Pass VkExtent3D to TextureHelper::init.

Bug: angleproject:3189 Change-Id: I4b95240bb32fbc2b3d0c8f097e0552d0fe23417d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1713094 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com>
parent c68e7cbc
......@@ -96,7 +96,10 @@ angle::Result MemoryObjectVk::createImage(const gl::Context *context,
externalMemoryImageCreateInfo.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO;
externalMemoryImageCreateInfo.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT;
ANGLE_TRY(image->initExternal(contextVk, type, size, vkFormat, 1, imageUsageFlags,
VkExtent3D vkExtents;
gl_vk::GetExtent(size, &vkExtents);
ANGLE_TRY(image->initExternal(contextVk, type, vkExtents, vkFormat, 1, imageUsageFlags,
vk::ImageLayout::ExternalPreInitialized,
&externalMemoryImageCreateInfo, levels, 1));
......
......@@ -71,7 +71,7 @@ angle::Result RenderbufferVk::setStorageImpl(const gl::Context *context,
(textureFormat.redBits > 0 ? VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT : 0) |
(isDepthOrStencilFormat ? VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT : 0);
gl::Extents extents(static_cast<int>(width), static_cast<int>(height), 1);
VkExtent3D extents = {static_cast<uint32_t>(width), static_cast<uint32_t>(height), 1u};
ANGLE_TRY(
mImage->init(contextVk, gl::TextureType::_2D, extents, vkFormat, samples, usage, 1, 1));
......
......@@ -138,8 +138,8 @@ angle::Result OffscreenSurfaceVk::AttachmentImage::initialize(DisplayVk *display
const VkImageUsageFlags usage = isDepthOrStencilFormat ? kSurfaceVKDepthStencilImageUsageFlags
: kSurfaceVKColorImageUsageFlags;
gl::Extents extents(std::max(static_cast<int>(width), 1), std::max(static_cast<int>(height), 1),
1);
VkExtent3D extents = {std::max(static_cast<uint32_t>(width), 1u),
std::max(static_cast<uint32_t>(height), 1u), 1u};
ANGLE_TRY(image.init(displayVk, gl::TextureType::_2D, extents, vkFormat, samples, usage, 1, 1));
VkMemoryPropertyFlags flags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
......@@ -612,12 +612,15 @@ angle::Result WindowSurfaceVk::createSwapChain(vk::Context *context,
GLint samples = GetSampleCount(mState.config);
ANGLE_VK_CHECK(context, samples > 0, VK_ERROR_INITIALIZATION_FAILED);
VkExtent3D vkExtents;
gl_vk::GetExtent(extents, &vkExtents);
if (samples > 1)
{
const VkImageUsageFlags usage = kSurfaceVKColorImageUsageFlags;
ANGLE_TRY(mColorImageMS.init(context, gl::TextureType::_2D, extents, format, samples, usage,
1, 1));
ANGLE_TRY(mColorImageMS.init(context, gl::TextureType::_2D, vkExtents, format, samples,
usage, 1, 1));
ANGLE_TRY(mColorImageMS.initMemory(context, renderer->getMemoryProperties(),
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT));
......@@ -659,8 +662,8 @@ angle::Result WindowSurfaceVk::createSwapChain(vk::Context *context,
const VkImageUsageFlags dsUsage = kSurfaceVKDepthStencilImageUsageFlags;
ANGLE_TRY(mDepthStencilImage.init(context, gl::TextureType::_2D, extents, dsFormat, samples,
dsUsage, 1, 1));
ANGLE_TRY(mDepthStencilImage.init(context, gl::TextureType::_2D, vkExtents, dsFormat,
samples, dsUsage, 1, 1));
ANGLE_TRY(mDepthStencilImage.initMemory(context, renderer->getMemoryProperties(),
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT));
......
......@@ -1359,7 +1359,10 @@ angle::Result TextureVk::initImage(ContextVk *contextVk,
imageUsageFlags |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
}
ANGLE_TRY(mImage->init(contextVk, mState.getType(), extents, format, 1, imageUsageFlags,
VkExtent3D vkExtent;
gl_vk::GetExtent(extents, &vkExtent);
ANGLE_TRY(mImage->init(contextVk, mState.getType(), vkExtent, format, 1, imageUsageFlags,
levelCount,
mState.getType() == gl::TextureType::CubeMap ? gl::kCubeFaceCount : 1));
......
......@@ -122,8 +122,11 @@ angle::Result HardwareBufferImageSiblingVkAndroid::initImpl(DisplayVk *displayVk
externalMemoryImageCreateInfo.handleTypes =
VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID;
VkExtent3D vkExtents;
gl_vk::GetExtent(mSize, &vkExtents);
mImage = new vk::ImageHelper();
ANGLE_TRY(mImage->initExternal(displayVk, gl::TextureType::_2D, mSize, vkFormat, 1, usage,
ANGLE_TRY(mImage->initExternal(displayVk, gl::TextureType::_2D, vkExtents, vkFormat, 1, usage,
vk::ImageLayout::ExternalPreInitialized,
&externalMemoryImageCreateInfo, 1, 1));
......
......@@ -1493,20 +1493,20 @@ void ImageHelper::initStagingBuffer(RendererVk *renderer,
angle::Result ImageHelper::init(Context *context,
gl::TextureType textureType,
const gl::Extents &glExtents,
const VkExtent3D &extents,
const Format &format,
GLint samples,
VkImageUsageFlags usage,
uint32_t mipLevels,
uint32_t layerCount)
{
return initExternal(context, textureType, glExtents, format, samples, usage,
return initExternal(context, textureType, extents, format, samples, usage,
ImageLayout::Undefined, nullptr, mipLevels, layerCount);
}
angle::Result ImageHelper::initExternal(Context *context,
gl::TextureType textureType,
const gl::Extents &glExtents,
const VkExtent3D &extents,
const Format &format,
GLint samples,
VkImageUsageFlags usage,
......@@ -1523,7 +1523,7 @@ angle::Result ImageHelper::initExternal(Context *context,
ASSERT(textureType != gl::TextureType::Rectangle || layerCount == 1);
ASSERT(textureType != gl::TextureType::CubeMap || layerCount == gl::kCubeFaceCount);
gl_vk::GetExtent(glExtents, &mExtents);
mExtents = extents;
mFormat = &format;
mSamples = samples;
mLayerCount = layerCount;
......
......@@ -645,7 +645,7 @@ class ImageHelper final : public CommandGraphResource
angle::Result init(Context *context,
gl::TextureType textureType,
const gl::Extents &glExtents,
const VkExtent3D &extents,
const Format &format,
GLint samples,
VkImageUsageFlags usage,
......@@ -653,7 +653,7 @@ class ImageHelper final : public CommandGraphResource
uint32_t layerCount);
angle::Result initExternal(Context *context,
gl::TextureType textureType,
const gl::Extents &glExtents,
const VkExtent3D &extents,
const Format &format,
GLint samples,
VkImageUsageFlags usage,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment