mirror of
https://github.com/utmapp/angle.git
synced 2026-12-06 02:12:05 -10:00
Vulkan: Rename 'extents' param to 'glExtents'.
Merely a minor refactor to clean up the diff of a subsequent CL. In the follow up we will also distinguish the GL extents from the Vulkan extents/layerCount pair. Bug: angleproject:3189 Change-Id: Ibbb79bf2e6d3f798243b424bacbfb2e5538bfecf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1709755 Commit-Queue: Jamie Madill <[email protected]> Reviewed-by: Jonah Ryan-Davis <[email protected]>
This commit is contained in:
1 parent
592539fdee
commit
cedea1d91b
2 files changed
+52
-50
No files matched your search
@@ -1493,20 +1493,20 @@ void ImageHelper::initStagingBuffer(RendererVk *renderer,
|
||||
|
||||
angle::Result ImageHelper::init(Context *context,
|
||||
gl::TextureType textureType,
|
||||
const gl::Extents &extents,
|
||||
const gl::Extents &glExtents,
|
||||
const Format &format,
|
||||
GLint samples,
|
||||
VkImageUsageFlags usage,
|
||||
uint32_t mipLevels,
|
||||
uint32_t layerCount)
|
||||
{
|
||||
return initExternal(context, textureType, extents, format, samples, usage,
|
||||
return initExternal(context, textureType, glExtents, format, samples, usage,
|
||||
ImageLayout::Undefined, nullptr, mipLevels, layerCount);
|
||||
}
|
||||
|
||||
angle::Result ImageHelper::initExternal(Context *context,
|
||||
gl::TextureType textureType,
|
||||
const gl::Extents &extents,
|
||||
const gl::Extents &glExtents,
|
||||
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(extents, &mExtents);
|
||||
gl_vk::GetExtent(glExtents, &mExtents);
|
||||
mFormat = &format;
|
||||
mSamples = samples;
|
||||
mLayerCount = layerCount;
|
||||
@@ -1680,13 +1680,13 @@ void ImageHelper::destroy(VkDevice device)
|
||||
}
|
||||
|
||||
void ImageHelper::init2DWeakReference(VkImage handle,
|
||||
const gl::Extents &extents,
|
||||
const gl::Extents &glExtents,
|
||||
const Format &format,
|
||||
GLint samples)
|
||||
{
|
||||
ASSERT(!valid());
|
||||
|
||||
gl_vk::GetExtent(extents, &mExtents);
|
||||
gl_vk::GetExtent(glExtents, &mExtents);
|
||||
mFormat = &format;
|
||||
mSamples = samples;
|
||||
mCurrentLayout = ImageLayout::Undefined;
|
||||
@@ -1698,14 +1698,14 @@ void ImageHelper::init2DWeakReference(VkImage handle,
|
||||
|
||||
angle::Result ImageHelper::init2DStaging(Context *context,
|
||||
const MemoryProperties &memoryProperties,
|
||||
const gl::Extents &extents,
|
||||
const gl::Extents &glExtents,
|
||||
const Format &format,
|
||||
VkImageUsageFlags usage,
|
||||
uint32_t layerCount)
|
||||
{
|
||||
ASSERT(!valid());
|
||||
|
||||
gl_vk::GetExtent(extents, &mExtents);
|
||||
gl_vk::GetExtent(glExtents, &mExtents);
|
||||
mFormat = &format;
|
||||
mSamples = 1;
|
||||
mLayerCount = layerCount;
|
||||
@@ -1718,9 +1718,7 @@ angle::Result ImageHelper::init2DStaging(Context *context,
|
||||
imageInfo.flags = 0;
|
||||
imageInfo.imageType = VK_IMAGE_TYPE_2D;
|
||||
imageInfo.format = format.vkImageFormat;
|
||||
imageInfo.extent.width = static_cast<uint32_t>(extents.width);
|
||||
imageInfo.extent.height = static_cast<uint32_t>(extents.height);
|
||||
imageInfo.extent.depth = 1;
|
||||
imageInfo.extent = mExtents;
|
||||
imageInfo.mipLevels = 1;
|
||||
imageInfo.arrayLayers = mLayerCount;
|
||||
imageInfo.samples = gl_vk::GetSamples(mSamples);
|
||||
@@ -2066,7 +2064,7 @@ void ImageHelper::removeStagedUpdates(ContextVk *contextVk, const gl::ImageIndex
|
||||
|
||||
angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
|
||||
const gl::ImageIndex &index,
|
||||
const gl::Extents &extents,
|
||||
const gl::Extents &glExtents,
|
||||
const gl::Offset &offset,
|
||||
const gl::InternalFormat &formatInfo,
|
||||
const gl::PixelUnpackState &unpack,
|
||||
@@ -2075,12 +2073,14 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
|
||||
const vk::Format &vkFormat)
|
||||
{
|
||||
GLuint inputRowPitch = 0;
|
||||
ANGLE_VK_CHECK_MATH(contextVk, formatInfo.computeRowPitch(type, extents.width, unpack.alignment,
|
||||
unpack.rowLength, &inputRowPitch));
|
||||
ANGLE_VK_CHECK_MATH(contextVk,
|
||||
formatInfo.computeRowPitch(type, glExtents.width, unpack.alignment,
|
||||
unpack.rowLength, &inputRowPitch));
|
||||
|
||||
GLuint inputDepthPitch = 0;
|
||||
ANGLE_VK_CHECK_MATH(contextVk, formatInfo.computeDepthPitch(extents.height, unpack.imageHeight,
|
||||
inputRowPitch, &inputDepthPitch));
|
||||
ANGLE_VK_CHECK_MATH(
|
||||
contextVk, formatInfo.computeDepthPitch(glExtents.height, unpack.imageHeight, inputRowPitch,
|
||||
&inputDepthPitch));
|
||||
|
||||
bool applySkipImages = false;
|
||||
|
||||
@@ -2106,21 +2106,21 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
|
||||
GLuint totalSize;
|
||||
|
||||
ANGLE_VK_CHECK_MATH(contextVk, storageFormatInfo.computeCompressedImageSize(
|
||||
gl::Extents(extents.width, 1, 1), &rowPitch));
|
||||
gl::Extents(glExtents.width, 1, 1), &rowPitch));
|
||||
ANGLE_VK_CHECK_MATH(contextVk,
|
||||
storageFormatInfo.computeCompressedImageSize(
|
||||
gl::Extents(extents.width, extents.height, 1), &depthPitch));
|
||||
gl::Extents(glExtents.width, glExtents.height, 1), &depthPitch));
|
||||
|
||||
ANGLE_VK_CHECK_MATH(contextVk,
|
||||
storageFormatInfo.computeCompressedImageSize(extents, &totalSize));
|
||||
storageFormatInfo.computeCompressedImageSize(glExtents, &totalSize));
|
||||
|
||||
outputRowPitch = rowPitch;
|
||||
outputDepthPitch = depthPitch;
|
||||
|
||||
angle::CheckedNumeric<uint32_t> checkedRowLength =
|
||||
rx::CheckedRoundUp<uint32_t>(extents.width, storageFormatInfo.compressedBlockWidth);
|
||||
rx::CheckedRoundUp<uint32_t>(glExtents.width, storageFormatInfo.compressedBlockWidth);
|
||||
angle::CheckedNumeric<uint32_t> checkedImageHeight =
|
||||
rx::CheckedRoundUp<uint32_t>(extents.height, storageFormatInfo.compressedBlockHeight);
|
||||
rx::CheckedRoundUp<uint32_t>(glExtents.height, storageFormatInfo.compressedBlockHeight);
|
||||
|
||||
ANGLE_VK_CHECK_MATH(contextVk, checkedRowLength.IsValid());
|
||||
ANGLE_VK_CHECK_MATH(contextVk, checkedImageHeight.IsValid());
|
||||
@@ -2133,13 +2133,13 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
|
||||
{
|
||||
ASSERT(storageFormat.pixelBytes != 0);
|
||||
|
||||
outputRowPitch = storageFormat.pixelBytes * extents.width;
|
||||
outputDepthPitch = outputRowPitch * extents.height;
|
||||
outputRowPitch = storageFormat.pixelBytes * glExtents.width;
|
||||
outputDepthPitch = outputRowPitch * glExtents.height;
|
||||
|
||||
bufferRowLength = extents.width;
|
||||
bufferImageHeight = extents.height;
|
||||
bufferRowLength = glExtents.width;
|
||||
bufferImageHeight = glExtents.height;
|
||||
|
||||
allocationSize = outputDepthPitch * extents.depth;
|
||||
allocationSize = outputDepthPitch * glExtents.depth;
|
||||
|
||||
// Note: because the LoadImageFunctionInfo functions are limited to copying a single
|
||||
// component, we have to special case packed depth/stencil use and send the stencil as a
|
||||
@@ -2148,7 +2148,7 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
|
||||
formatInfo.depthBits > 0 && formatInfo.stencilBits > 0)
|
||||
{
|
||||
// Note: Stencil is always one byte
|
||||
stencilAllocationSize = extents.width * extents.height * extents.depth;
|
||||
stencilAllocationSize = glExtents.width * glExtents.height * glExtents.depth;
|
||||
allocationSize += stencilAllocationSize;
|
||||
}
|
||||
}
|
||||
@@ -2164,8 +2164,9 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
|
||||
|
||||
LoadImageFunctionInfo loadFunction = vkFormat.textureLoadFunctions(type);
|
||||
|
||||
loadFunction.loadFunction(extents.width, extents.height, extents.depth, source, inputRowPitch,
|
||||
inputDepthPitch, stagingPointer, outputRowPitch, outputDepthPitch);
|
||||
loadFunction.loadFunction(glExtents.width, glExtents.height, glExtents.depth, source,
|
||||
inputRowPitch, inputDepthPitch, stagingPointer, outputRowPitch,
|
||||
outputDepthPitch);
|
||||
|
||||
VkBufferImageCopy copy = {};
|
||||
VkImageAspectFlags aspectFlags = GetFormatAspectFlags(vkFormat.imageFormat());
|
||||
@@ -2178,7 +2179,7 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
|
||||
copy.imageSubresource.layerCount = index.getLayerCount();
|
||||
|
||||
gl_vk::GetOffset(offset, ©.imageOffset);
|
||||
gl_vk::GetExtent(extents, ©.imageExtent);
|
||||
gl_vk::GetExtent(glExtents, ©.imageExtent);
|
||||
|
||||
if (stencilAllocationSize > 0)
|
||||
{
|
||||
@@ -2186,15 +2187,16 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
|
||||
ASSERT((aspectFlags & VK_IMAGE_ASPECT_STENCIL_BIT) != 0);
|
||||
|
||||
// Skip over depth data.
|
||||
stagingPointer += outputDepthPitch * extents.depth;
|
||||
stagingOffset += outputDepthPitch * extents.depth;
|
||||
stagingPointer += outputDepthPitch * glExtents.depth;
|
||||
stagingOffset += outputDepthPitch * glExtents.depth;
|
||||
|
||||
// recompute pitch for stencil data
|
||||
outputRowPitch = extents.width;
|
||||
outputDepthPitch = outputRowPitch * extents.height;
|
||||
outputRowPitch = glExtents.width;
|
||||
outputDepthPitch = outputRowPitch * glExtents.height;
|
||||
|
||||
angle::LoadX24S8ToS8(extents.width, extents.height, extents.depth, source, inputRowPitch,
|
||||
inputDepthPitch, stagingPointer, outputRowPitch, outputDepthPitch);
|
||||
angle::LoadX24S8ToS8(glExtents.width, glExtents.height, glExtents.depth, source,
|
||||
inputRowPitch, inputDepthPitch, stagingPointer, outputRowPitch,
|
||||
outputDepthPitch);
|
||||
|
||||
VkBufferImageCopy stencilCopy = {};
|
||||
|
||||
@@ -2206,7 +2208,7 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
|
||||
stencilCopy.imageSubresource.layerCount = index.getLayerCount();
|
||||
|
||||
gl_vk::GetOffset(offset, &stencilCopy.imageOffset);
|
||||
gl_vk::GetExtent(extents, &stencilCopy.imageExtent);
|
||||
gl_vk::GetExtent(glExtents, &stencilCopy.imageExtent);
|
||||
stencilCopy.imageSubresource.aspectMask = VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||
mSubresourceUpdates.emplace_back(bufferHandle, stencilCopy);
|
||||
|
||||
@@ -2241,7 +2243,7 @@ angle::Result ImageHelper::stageSubresourceUpdate(ContextVk *contextVk,
|
||||
angle::Result ImageHelper::stageSubresourceUpdateAndGetData(ContextVk *contextVk,
|
||||
size_t allocationSize,
|
||||
const gl::ImageIndex &imageIndex,
|
||||
const gl::Extents &extents,
|
||||
const gl::Extents &glExtents,
|
||||
const gl::Offset &offset,
|
||||
uint8_t **destData)
|
||||
{
|
||||
@@ -2252,8 +2254,8 @@ angle::Result ImageHelper::stageSubresourceUpdateAndGetData(ContextVk *contextVk
|
||||
|
||||
VkBufferImageCopy copy = {};
|
||||
copy.bufferOffset = stagingOffset;
|
||||
copy.bufferRowLength = extents.width;
|
||||
copy.bufferImageHeight = extents.height;
|
||||
copy.bufferRowLength = glExtents.width;
|
||||
copy.bufferImageHeight = glExtents.height;
|
||||
copy.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
copy.imageSubresource.mipLevel = imageIndex.getLevelIndex();
|
||||
copy.imageSubresource.baseArrayLayer = imageIndex.hasLayer() ? imageIndex.getLayerIndex() : 0;
|
||||
@@ -2263,7 +2265,7 @@ angle::Result ImageHelper::stageSubresourceUpdateAndGetData(ContextVk *contextVk
|
||||
ASSERT(getAspectFlags() == VK_IMAGE_ASPECT_COLOR_BIT);
|
||||
|
||||
gl_vk::GetOffset(offset, ©.imageOffset);
|
||||
gl_vk::GetExtent(extents, ©.imageExtent);
|
||||
gl_vk::GetExtent(glExtents, ©.imageExtent);
|
||||
|
||||
mSubresourceUpdates.emplace_back(bufferHandle, copy);
|
||||
|
||||
@@ -2370,7 +2372,7 @@ angle::Result ImageHelper::stageSubresourceUpdateFromFramebuffer(
|
||||
void ImageHelper::stageSubresourceUpdateFromImage(vk::ImageHelper *image,
|
||||
const gl::ImageIndex &index,
|
||||
const gl::Offset &destOffset,
|
||||
const gl::Extents &extents)
|
||||
const gl::Extents &glExtents)
|
||||
{
|
||||
VkImageCopy copyToImage = {};
|
||||
copyToImage.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
@@ -2380,7 +2382,7 @@ void ImageHelper::stageSubresourceUpdateFromImage(vk::ImageHelper *image,
|
||||
copyToImage.dstSubresource.baseArrayLayer = index.hasLayer() ? index.getLayerIndex() : 0;
|
||||
copyToImage.dstSubresource.layerCount = index.getLayerCount();
|
||||
gl_vk::GetOffset(destOffset, ©ToImage.dstOffset);
|
||||
gl_vk::GetExtent(extents, ©ToImage.extent);
|
||||
gl_vk::GetExtent(glExtents, ©ToImage.extent);
|
||||
|
||||
mSubresourceUpdates.emplace_back(image, copyToImage);
|
||||
}
|
||||
|
||||
@@ -645,7 +645,7 @@ class ImageHelper final : public CommandGraphResource
|
||||
|
||||
angle::Result init(Context *context,
|
||||
gl::TextureType textureType,
|
||||
const gl::Extents &extents,
|
||||
const gl::Extents &glExtents,
|
||||
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 &extents,
|
||||
const gl::Extents &glExtents,
|
||||
const Format &format,
|
||||
GLint samples,
|
||||
VkImageUsageFlags usage,
|
||||
@@ -693,7 +693,7 @@ class ImageHelper final : public CommandGraphResource
|
||||
//
|
||||
angle::Result init2DStaging(Context *context,
|
||||
const MemoryProperties &memoryProperties,
|
||||
const gl::Extents &extent,
|
||||
const gl::Extents &glExtents,
|
||||
const Format &format,
|
||||
VkImageUsageFlags usage,
|
||||
uint32_t layerCount);
|
||||
@@ -711,7 +711,7 @@ class ImageHelper final : public CommandGraphResource
|
||||
void dumpResources(Serial serial, std::vector<GarbageObject> *garbageQueue);
|
||||
|
||||
void init2DWeakReference(VkImage handle,
|
||||
const gl::Extents &extents,
|
||||
const gl::Extents &glExtents,
|
||||
const Format &format,
|
||||
GLint samples);
|
||||
void resetImageWeakReference();
|
||||
@@ -760,7 +760,7 @@ class ImageHelper final : public CommandGraphResource
|
||||
|
||||
angle::Result stageSubresourceUpdate(ContextVk *contextVk,
|
||||
const gl::ImageIndex &index,
|
||||
const gl::Extents &extents,
|
||||
const gl::Extents &glExtents,
|
||||
const gl::Offset &offset,
|
||||
const gl::InternalFormat &formatInfo,
|
||||
const gl::PixelUnpackState &unpack,
|
||||
@@ -771,7 +771,7 @@ class ImageHelper final : public CommandGraphResource
|
||||
angle::Result stageSubresourceUpdateAndGetData(ContextVk *contextVk,
|
||||
size_t allocationSize,
|
||||
const gl::ImageIndex &imageIndex,
|
||||
const gl::Extents &extents,
|
||||
const gl::Extents &glExtents,
|
||||
const gl::Offset &offset,
|
||||
uint8_t **destData);
|
||||
|
||||
@@ -786,7 +786,7 @@ class ImageHelper final : public CommandGraphResource
|
||||
void stageSubresourceUpdateFromImage(vk::ImageHelper *image,
|
||||
const gl::ImageIndex &index,
|
||||
const gl::Offset &destOffset,
|
||||
const gl::Extents &extents);
|
||||
const gl::Extents &glExtents);
|
||||
|
||||
// Stage a clear operation to a clear value based on WebGL requirements.
|
||||
void stageSubresourceRobustClear(const gl::ImageIndex &index, const angle::Format &format);
|
||||
|
||||
Reference in new issue
Block a user