зеркало из https://github.com/AvaloniaUI/angle.git
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 <syoussefi@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
9288dcf6b6
Коммит
886698bc3f
|
@ -86,7 +86,7 @@ struct FeaturesVk : FeatureSetBase
|
||||||
// Whether texture copies on cube map targets should be done on GPU. This is a workaround for
|
// 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
|
// Intel drivers on windows that have an issue with creating single-layer views on cube map
|
||||||
// textures.
|
// textures.
|
||||||
Feature forceCpuPathForCubeMapCopy = {
|
Feature forceCPUPathForCubeMapCopy = {
|
||||||
"force_cpu_path_for_cube_map_copy", FeatureCategory::VulkanWorkarounds,
|
"force_cpu_path_for_cube_map_copy", FeatureCategory::VulkanWorkarounds,
|
||||||
"Some Intel Windows drivers have an issue with creating single-layer "
|
"Some Intel Windows drivers have an issue with creating single-layer "
|
||||||
"views on cube map textures",
|
"views on cube map textures",
|
||||||
|
|
|
@ -1198,7 +1198,7 @@ void RendererVk::initFeatures(const ExtensionNameList &deviceExtensionNames)
|
||||||
mFeatures.extraCopyBufferRegion.enabled = IsIntel(mPhysicalDeviceProperties.vendorID);
|
mFeatures.extraCopyBufferRegion.enabled = IsIntel(mPhysicalDeviceProperties.vendorID);
|
||||||
|
|
||||||
// http://anglebug.com/3055
|
// http://anglebug.com/3055
|
||||||
mFeatures.forceCpuPathForCubeMapCopy.enabled = IsIntel(mPhysicalDeviceProperties.vendorID);
|
mFeatures.forceCPUPathForCubeMapCopy.enabled = IsIntel(mPhysicalDeviceProperties.vendorID);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
angle::PlatformMethods *platform = ANGLEPlatformCurrent();
|
angle::PlatformMethods *platform = ANGLEPlatformCurrent();
|
||||||
|
|
|
@ -61,15 +61,15 @@ bool CanCopyWithDraw(RendererVk *renderer,
|
||||||
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT);
|
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
|
// 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)
|
bool HasBothDepthAndStencilAspects(VkImageAspectFlags aspectFlags)
|
||||||
|
@ -435,10 +435,10 @@ angle::Result TextureVk::copySubImageImpl(const gl::Context *context,
|
||||||
&colorReadRT->getImage());
|
&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 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.
|
// Layer count can only be 1 as the source is a framebuffer.
|
||||||
ASSERT(offsetImageIndex.getLayerCount() == 1);
|
ASSERT(offsetImageIndex.getLayerCount() == 1);
|
||||||
|
@ -486,10 +486,10 @@ angle::Result TextureVk::copySubTextureImpl(ContextVk *contextVk,
|
||||||
sourceLevel, 0, sourceArea, &source->getImage());
|
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 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,
|
return copySubImageImplWithDraw(contextVk, offsetImageIndex, destOffset, destVkFormat,
|
||||||
sourceLevel, sourceArea, false, unpackFlipY,
|
sourceLevel, sourceArea, false, unpackFlipY,
|
||||||
|
@ -881,12 +881,12 @@ uint32_t TextureVk::getNativeImageLayer(uint32_t frontendLayer) const
|
||||||
return mImageLayerOffset + frontendLayer;
|
return mImageLayerOffset + frontendLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureVk::releaseAndDeleteImage(ContextVk *context)
|
void TextureVk::releaseAndDeleteImage(ContextVk *contextVk)
|
||||||
{
|
{
|
||||||
if (mImage)
|
if (mImage)
|
||||||
{
|
{
|
||||||
releaseImage(context);
|
releaseImage(contextVk);
|
||||||
releaseStagingBuffer(context);
|
releaseStagingBuffer(contextVk);
|
||||||
SafeDelete(mImage);
|
SafeDelete(mImage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1208,7 +1208,7 @@ angle::Result TextureVk::init3DRenderTargets(ContextVk *contextVk)
|
||||||
if (!m3DRenderTargets.empty())
|
if (!m3DRenderTargets.empty())
|
||||||
return angle::Result::Continue;
|
return angle::Result::Continue;
|
||||||
|
|
||||||
uint32_t layerCount = GetRenderTargetLayerCount(mImage);
|
uint32_t layerCount = GetRenderTargetLayerCount(*mImage);
|
||||||
|
|
||||||
mLayerFetchImageView.resize(layerCount);
|
mLayerFetchImageView.resize(layerCount);
|
||||||
m3DRenderTargets.resize(layerCount);
|
m3DRenderTargets.resize(layerCount);
|
||||||
|
@ -1629,11 +1629,11 @@ void TextureVk::releaseImageViews(ContextVk *contextVk)
|
||||||
mLayerFetchImageView.clear();
|
mLayerFetchImageView.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureVk::releaseStagingBuffer(ContextVk *context)
|
void TextureVk::releaseStagingBuffer(ContextVk *contextVk)
|
||||||
{
|
{
|
||||||
if (mImage)
|
if (mImage)
|
||||||
{
|
{
|
||||||
mImage->releaseStagingBuffer(context);
|
mImage->releaseStagingBuffer(contextVk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ class TextureVk : public TextureImpl
|
||||||
uint32_t imageLevelOffset,
|
uint32_t imageLevelOffset,
|
||||||
uint32_t imageLayerOffset,
|
uint32_t imageLayerOffset,
|
||||||
bool selfOwned);
|
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,
|
angle::Result redefineImage(const gl::Context *context,
|
||||||
const gl::ImageIndex &index,
|
const gl::ImageIndex &index,
|
||||||
|
@ -286,9 +286,9 @@ class TextureVk : public TextureImpl
|
||||||
const vk::Format &format,
|
const vk::Format &format,
|
||||||
const gl::Extents &extents,
|
const gl::Extents &extents,
|
||||||
const uint32_t levelCount);
|
const uint32_t levelCount);
|
||||||
void releaseImage(ContextVk *context);
|
void releaseImage(ContextVk *contextVk);
|
||||||
void releaseImageViews(ContextVk *contextVk);
|
void releaseImageViews(ContextVk *contextVk);
|
||||||
void releaseStagingBuffer(ContextVk *context);
|
void releaseStagingBuffer(ContextVk *contextVk);
|
||||||
uint32_t getLevelCount() const;
|
uint32_t getLevelCount() const;
|
||||||
angle::Result initImageViews(ContextVk *contextVk,
|
angle::Result initImageViews(ContextVk *contextVk,
|
||||||
const vk::Format &format,
|
const vk::Format &format,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче