From 886698bc3fddf45fb1e1987b1fa0e2d506eb52a8 Mon Sep 17 00:00:00 2001 From: Jamie Madill Date: Tue, 27 Aug 2019 16:48:07 -0400 Subject: [PATCH] Vulkan: Style cleanups to TextureVk. Pass params by const & and use "CPU instead of "Cpu" naming. Also prefer "ContextVk *contextVk" to "ContextVk *context". Bug: angleproject:2464 Change-Id: I887de5b2e5494d14f0e9c7db269eb63744f2a3cf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1771499 Reviewed-by: Shahbaz Youssefi Commit-Queue: Jamie Madill --- include/platform/FeaturesVk.h | 2 +- src/libANGLE/renderer/vulkan/RendererVk.cpp | 2 +- src/libANGLE/renderer/vulkan/TextureVk.cpp | 28 ++++++++++----------- src/libANGLE/renderer/vulkan/TextureVk.h | 6 ++--- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/platform/FeaturesVk.h b/include/platform/FeaturesVk.h index 4fd61ae91..614a86f09 100644 --- a/include/platform/FeaturesVk.h +++ b/include/platform/FeaturesVk.h @@ -86,7 +86,7 @@ struct FeaturesVk : FeatureSetBase // Whether texture copies on cube map targets should be done on GPU. This is a workaround for // Intel drivers on windows that have an issue with creating single-layer views on cube map // textures. - Feature forceCpuPathForCubeMapCopy = { + Feature forceCPUPathForCubeMapCopy = { "force_cpu_path_for_cube_map_copy", FeatureCategory::VulkanWorkarounds, "Some Intel Windows drivers have an issue with creating single-layer " "views on cube map textures", diff --git a/src/libANGLE/renderer/vulkan/RendererVk.cpp b/src/libANGLE/renderer/vulkan/RendererVk.cpp index dbdc2d518..21473ab9e 100644 --- a/src/libANGLE/renderer/vulkan/RendererVk.cpp +++ b/src/libANGLE/renderer/vulkan/RendererVk.cpp @@ -1198,7 +1198,7 @@ void RendererVk::initFeatures(const ExtensionNameList &deviceExtensionNames) mFeatures.extraCopyBufferRegion.enabled = IsIntel(mPhysicalDeviceProperties.vendorID); // http://anglebug.com/3055 - mFeatures.forceCpuPathForCubeMapCopy.enabled = IsIntel(mPhysicalDeviceProperties.vendorID); + mFeatures.forceCPUPathForCubeMapCopy.enabled = IsIntel(mPhysicalDeviceProperties.vendorID); #endif angle::PlatformMethods *platform = ANGLEPlatformCurrent(); diff --git a/src/libANGLE/renderer/vulkan/TextureVk.cpp b/src/libANGLE/renderer/vulkan/TextureVk.cpp index 35f3ad190..66b18ad25 100644 --- a/src/libANGLE/renderer/vulkan/TextureVk.cpp +++ b/src/libANGLE/renderer/vulkan/TextureVk.cpp @@ -61,15 +61,15 @@ bool CanCopyWithDraw(RendererVk *renderer, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT); } -bool ForceCpuPathForCopy(RendererVk *renderer, vk::ImageHelper *image) +bool ForceCPUPathForCopy(RendererVk *renderer, const vk::ImageHelper &image) { - return image->getLayerCount() > 1 && renderer->getFeatures().forceCpuPathForCubeMapCopy.enabled; + return image.getLayerCount() > 1 && renderer->getFeatures().forceCPUPathForCubeMapCopy.enabled; } -uint32_t GetRenderTargetLayerCount(vk::ImageHelper *image) +uint32_t GetRenderTargetLayerCount(const vk::ImageHelper &image) { // Depth > 1 means this is a 3D texture and depth is our layer count - return image->getExtents().depth > 1 ? image->getExtents().depth : image->getLayerCount(); + return image.getExtents().depth > 1 ? image.getExtents().depth : image.getLayerCount(); } bool HasBothDepthAndStencilAspects(VkImageAspectFlags aspectFlags) @@ -435,10 +435,10 @@ angle::Result TextureVk::copySubImageImpl(const gl::Context *context, &colorReadRT->getImage()); } - bool forceCpuPath = ForceCpuPathForCopy(renderer, mImage); + bool forceCPUPath = ForceCPUPathForCopy(renderer, *mImage); // If it's possible to perform the copy with a draw call, do that. - if (CanCopyWithDraw(renderer, srcFormat, destFormat) && !forceCpuPath) + if (CanCopyWithDraw(renderer, srcFormat, destFormat) && !forceCPUPath) { // Layer count can only be 1 as the source is a framebuffer. ASSERT(offsetImageIndex.getLayerCount() == 1); @@ -486,10 +486,10 @@ angle::Result TextureVk::copySubTextureImpl(ContextVk *contextVk, sourceLevel, 0, sourceArea, &source->getImage()); } - bool forceCpuPath = ForceCpuPathForCopy(renderer, mImage); + bool forceCPUPath = ForceCPUPathForCopy(renderer, *mImage); // If it's possible to perform the copy with a draw call, do that. - if (CanCopyWithDraw(renderer, sourceVkFormat, destVkFormat) && !forceCpuPath) + if (CanCopyWithDraw(renderer, sourceVkFormat, destVkFormat) && !forceCPUPath) { return copySubImageImplWithDraw(contextVk, offsetImageIndex, destOffset, destVkFormat, sourceLevel, sourceArea, false, unpackFlipY, @@ -881,12 +881,12 @@ uint32_t TextureVk::getNativeImageLayer(uint32_t frontendLayer) const return mImageLayerOffset + frontendLayer; } -void TextureVk::releaseAndDeleteImage(ContextVk *context) +void TextureVk::releaseAndDeleteImage(ContextVk *contextVk) { if (mImage) { - releaseImage(context); - releaseStagingBuffer(context); + releaseImage(contextVk); + releaseStagingBuffer(contextVk); SafeDelete(mImage); } } @@ -1208,7 +1208,7 @@ angle::Result TextureVk::init3DRenderTargets(ContextVk *contextVk) if (!m3DRenderTargets.empty()) return angle::Result::Continue; - uint32_t layerCount = GetRenderTargetLayerCount(mImage); + uint32_t layerCount = GetRenderTargetLayerCount(*mImage); mLayerFetchImageView.resize(layerCount); m3DRenderTargets.resize(layerCount); @@ -1629,11 +1629,11 @@ void TextureVk::releaseImageViews(ContextVk *contextVk) mLayerFetchImageView.clear(); } -void TextureVk::releaseStagingBuffer(ContextVk *context) +void TextureVk::releaseStagingBuffer(ContextVk *contextVk) { if (mImage) { - mImage->releaseStagingBuffer(context); + mImage->releaseStagingBuffer(contextVk); } } diff --git a/src/libANGLE/renderer/vulkan/TextureVk.h b/src/libANGLE/renderer/vulkan/TextureVk.h index 16dd6a97a..931ec6866 100644 --- a/src/libANGLE/renderer/vulkan/TextureVk.h +++ b/src/libANGLE/renderer/vulkan/TextureVk.h @@ -201,7 +201,7 @@ class TextureVk : public TextureImpl uint32_t imageLevelOffset, uint32_t imageLayerOffset, bool selfOwned); - void updateImageHelper(ContextVk *context, const vk::Format &internalFormat); + void updateImageHelper(ContextVk *contextVk, const vk::Format &internalFormat); angle::Result redefineImage(const gl::Context *context, const gl::ImageIndex &index, @@ -286,9 +286,9 @@ class TextureVk : public TextureImpl const vk::Format &format, const gl::Extents &extents, const uint32_t levelCount); - void releaseImage(ContextVk *context); + void releaseImage(ContextVk *contextVk); void releaseImageViews(ContextVk *contextVk); - void releaseStagingBuffer(ContextVk *context); + void releaseStagingBuffer(ContextVk *contextVk); uint32_t getLevelCount() const; angle::Result initImageViews(ContextVk *contextVk, const vk::Format &format,