Revert "Add external memory parameter to size computations"
This CL is essentially a revert of:
https://swiftshader-review.googlesource.com/c/SwiftShader/+/56388
which is no longer necessary. Whichever solution we choose for
the IOSurface alignment issue, this will not be required.
Bug: chromium:1232377
Change-Id: I032b716a68a80fbfbec95358e7e0925fca273871
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/56869
Tested-by: Alexis Hétu <sugoi@google.com>
Commit-Queue: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
diff --git a/src/Vulkan/VkDeviceMemory.hpp b/src/Vulkan/VkDeviceMemory.hpp
index 91dcc92..8a66056 100644
--- a/src/Vulkan/VkDeviceMemory.hpp
+++ b/src/Vulkan/VkDeviceMemory.hpp
@@ -57,7 +57,6 @@
// Internal implementation class for external memory. Platform-specific.
class ExternalBase;
- bool hasExternalMemory() const { return external; }
bool hasExternalImageProperties() const;
int externalImageRowPitchBytes(VkImageAspectFlagBits aspect) const;
VkDeviceSize externalImageMemoryOffset(VkImageAspectFlagBits aspect) const;
diff --git a/src/Vulkan/VkFormat.cpp b/src/Vulkan/VkFormat.cpp
index 216658b..48340ab 100644
--- a/src/Vulkan/VkFormat.cpp
+++ b/src/Vulkan/VkFormat.cpp
@@ -1703,7 +1703,7 @@
return 0;
}
-int Format::pitchB(int width, int border, bool external) const
+int Format::pitchB(int width, int border) const
{
// Render targets require 2x2 quads
width = sw::align<2>(width + 2 * border);
@@ -1779,7 +1779,7 @@
}
}
-int Format::sliceBUnpadded(int width, int height, int border, bool external) const
+int Format::sliceBUnpadded(int width, int height, int border) const
{
// Render targets require 2x2 quads
height = sw::align<2>(height + 2 * border);
@@ -1812,7 +1812,7 @@
case VK_FORMAT_ASTC_4x4_SRGB_BLOCK:
case VK_FORMAT_ASTC_5x4_UNORM_BLOCK:
case VK_FORMAT_ASTC_5x4_SRGB_BLOCK:
- return pitchB(width, border, external) * ((height + 3) / 4); // Pitch computed per 4 rows
+ return pitchB(width, border) * ((height + 3) / 4); // Pitch computed per 4 rows
case VK_FORMAT_ASTC_5x5_UNORM_BLOCK:
case VK_FORMAT_ASTC_5x5_SRGB_BLOCK:
case VK_FORMAT_ASTC_6x5_UNORM_BLOCK:
@@ -1821,39 +1821,39 @@
case VK_FORMAT_ASTC_8x5_SRGB_BLOCK:
case VK_FORMAT_ASTC_10x5_UNORM_BLOCK:
case VK_FORMAT_ASTC_10x5_SRGB_BLOCK:
- return pitchB(width, border, external) * ((height + 4) / 5); // Pitch computed per 5 rows
+ return pitchB(width, border) * ((height + 4) / 5); // Pitch computed per 5 rows
case VK_FORMAT_ASTC_6x6_UNORM_BLOCK:
case VK_FORMAT_ASTC_6x6_SRGB_BLOCK:
case VK_FORMAT_ASTC_8x6_UNORM_BLOCK:
case VK_FORMAT_ASTC_8x6_SRGB_BLOCK:
case VK_FORMAT_ASTC_10x6_UNORM_BLOCK:
case VK_FORMAT_ASTC_10x6_SRGB_BLOCK:
- return pitchB(width, border, external) * ((height + 5) / 6); // Pitch computed per 6 rows
+ return pitchB(width, border) * ((height + 5) / 6); // Pitch computed per 6 rows
case VK_FORMAT_ASTC_8x8_UNORM_BLOCK:
case VK_FORMAT_ASTC_8x8_SRGB_BLOCK:
case VK_FORMAT_ASTC_10x8_UNORM_BLOCK:
case VK_FORMAT_ASTC_10x8_SRGB_BLOCK:
- return pitchB(width, border, external) * ((height + 7) / 8); // Pitch computed per 8 rows
+ return pitchB(width, border) * ((height + 7) / 8); // Pitch computed per 8 rows
case VK_FORMAT_ASTC_10x10_UNORM_BLOCK:
case VK_FORMAT_ASTC_10x10_SRGB_BLOCK:
case VK_FORMAT_ASTC_12x10_UNORM_BLOCK:
case VK_FORMAT_ASTC_12x10_SRGB_BLOCK:
- return pitchB(width, border, external) * ((height + 9) / 10); // Pitch computed per 10 rows
+ return pitchB(width, border) * ((height + 9) / 10); // Pitch computed per 10 rows
case VK_FORMAT_ASTC_12x12_UNORM_BLOCK:
case VK_FORMAT_ASTC_12x12_SRGB_BLOCK:
- return pitchB(width, border, external) * ((height + 11) / 12); // Pitch computed per 12 rows
+ return pitchB(width, border) * ((height + 11) / 12); // Pitch computed per 12 rows
case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:
case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:
// "Images in this format must be defined with a width and height that is a multiple of two."
- return pitchB(width, border, external) * (height + height / 2); // U and V planes are 1/4 size of Y plane.
+ return pitchB(width, border) * (height + height / 2); // U and V planes are 1/4 size of Y plane.
default:
- return pitchB(width, border, external) * height; // Pitch computed per row
+ return pitchB(width, border) * height; // Pitch computed per row
}
}
-int Format::sliceB(int width, int height, int border, bool external) const
+int Format::sliceB(int width, int height, int border) const
{
- return sw::align<16>(sliceBUnpadded(width, height, border, external) + 15);
+ return sw::align<16>(sliceBUnpadded(width, height, border) + 15);
}
sw::float4 Format::getScale() const
diff --git a/src/Vulkan/VkFormat.hpp b/src/Vulkan/VkFormat.hpp
index f9010cb..dd26314 100644
--- a/src/Vulkan/VkFormat.hpp
+++ b/src/Vulkan/VkFormat.hpp
@@ -55,8 +55,8 @@
bool isUnsignedComponent(int component) const;
int bytes() const;
- int pitchB(int width, int border, bool external) const;
- int sliceB(int width, int height, int border, bool external) const;
+ int pitchB(int width, int border) const;
+ int sliceB(int width, int height, int border) const;
sw::float4 getScale() const;
@@ -74,7 +74,7 @@
private:
VkFormat compatibleFormat() const;
- int sliceBUnpadded(int width, int height, int border, bool external) const;
+ int sliceBUnpadded(int width, int height, int border) const;
VkFormat format = VK_FORMAT_UNDEFINED;
};
diff --git a/src/Vulkan/VkImage.cpp b/src/Vulkan/VkImage.cpp
index a29cd1e..534281f 100644
--- a/src/Vulkan/VkImage.cpp
+++ b/src/Vulkan/VkImage.cpp
@@ -807,7 +807,7 @@
return extentInBlocks.width * usedFormat.bytesPerBlock();
}
- return usedFormat.pitchB(mipLevelExtent.width, borderSize(), deviceMemory && deviceMemory->hasExternalMemory());
+ return usedFormat.pitchB(mipLevelExtent.width, borderSize());
}
int Image::slicePitchBytes(VkImageAspectFlagBits aspect, uint32_t mipLevel) const
@@ -824,7 +824,7 @@
return extentInBlocks.height * extentInBlocks.width * usedFormat.bytesPerBlock();
}
- return usedFormat.sliceB(mipLevelExtent.width, mipLevelExtent.height, borderSize(), deviceMemory && deviceMemory->hasExternalMemory());
+ return usedFormat.sliceB(mipLevelExtent.width, mipLevelExtent.height, borderSize());
}
Format Image::getFormat(VkImageAspectFlagBits aspect) const