Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libANGLE/renderer/metal/FrameBufferMtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void OverrideMTLClearColor(const mtl::TextureRef &texture,
sizeInBytes.ValueOrDie(), &tempBuffer));

gl::Rectangle region(0, 0, width, height);
uint32_t bytesPerRow = angleFormat.pixelBytes * width;
size_t bytesPerRow = static_cast<size_t>(angleFormat.pixelBytes) * width;
uint32_t destOffset = 0;
ANGLE_TRY(mtl::ReadTexturePerSliceBytesToBuffer(context, srcTexture, bytesPerRow, region,
mipNativeLevel, layerIndex, destOffset,
Expand Down
5 changes: 2 additions & 3 deletions src/libANGLE/renderer/vulkan/SurfaceVk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,8 @@ angle::Result LockSurfaceImpl(DisplayVk *displayVk,
{
const gl::InternalFormat &internalFormat =
gl::GetSizedInternalFormatInfo(image->getActualFormat().glInternalFormat);
GLuint rowStride = image->getActualFormat().pixelBytes * width;
VkDeviceSize bufferSize =
(static_cast<VkDeviceSize>(rowStride) * static_cast<VkDeviceSize>(height));
VkDeviceSize rowStride = static_cast<VkDeviceSize>(image->getActualFormat().pixelBytes) * width;
VkDeviceSize bufferSize = rowStride * static_cast<VkDeviceSize>(height);

if (!lockBufferHelper.valid() || (lockBufferHelper.getSize() != bufferSize))
{
Expand Down
12 changes: 6 additions & 6 deletions src/libANGLE/renderer/vulkan/TextureVk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3173,14 +3173,14 @@ angle::Result TextureVk::reinitImageAsRenderable(ContextVk *contextVk, const vk:
&dstData, dstFormat.id));

// Source and destination data is tightly packed
GLuint srcDataRowPitch = sourceBox.width * srcFormat.pixelBytes;
GLuint dstDataRowPitch = sourceBox.width * dstFormat.pixelBytes;
size_t srcDataRowPitch = static_cast<size_t>(sourceBox.width) * srcFormat.pixelBytes;
size_t dstDataRowPitch = static_cast<size_t>(sourceBox.width) * dstFormat.pixelBytes;

GLuint srcDataDepthPitch = srcDataRowPitch * sourceBox.height;
GLuint dstDataDepthPitch = dstDataRowPitch * sourceBox.height;
size_t srcDataDepthPitch = srcDataRowPitch * sourceBox.height;
size_t dstDataDepthPitch = dstDataRowPitch * sourceBox.height;

GLuint srcDataLayerPitch = srcDataDepthPitch * sourceBox.depth;
GLuint dstDataLayerPitch = dstDataDepthPitch * sourceBox.depth;
size_t srcDataLayerPitch = srcDataDepthPitch * sourceBox.depth;
size_t dstDataLayerPitch = dstDataDepthPitch * sourceBox.depth;

rx::PixelReadFunction pixelReadFunction = srcFormat.pixelReadFunction;
rx::PixelWriteFunction pixelWriteFunction = dstFormat.pixelWriteFunction;
Expand Down
6 changes: 3 additions & 3 deletions src/libANGLE/renderer/vulkan/UtilsVk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4284,10 +4284,10 @@ angle::Result UtilsVk::transCodeEtcToBc(ContextVk *contextVk,

ASSERT(dstImage->getType() != VK_IMAGE_TYPE_1D && dstImage->getType() != VK_IMAGE_TYPE_3D);

GLuint sliceTexels = (copyRegion->bufferRowLength / info.compressedBlockWidth) *
size_t sliceTexels = static_cast<size_t>(copyRegion->bufferRowLength / info.compressedBlockWidth) *
(copyRegion->bufferImageHeight / info.compressedBlockHeight);
GLuint sliceSize = sliceTexels * intendedFormat.pixelBytes;
GLuint texBufferSize = sliceSize * copyRegion->imageSubresource.layerCount;
size_t sliceSize = sliceTexels * intendedFormat.pixelBytes;
size_t texBufferSize = sliceSize * copyRegion->imageSubresource.layerCount;

// Make sure the texture buffer size not out of limit.
// Usually the limit is more than 128M.
Expand Down
4 changes: 3 additions & 1 deletion src/libANGLE/renderer/vulkan/vk_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11535,7 +11535,9 @@ angle::Result ImageHelper::readPixelsImpl(ContextVk *contextVk,

uint8_t *readPixelBuffer = nullptr;
VkDeviceSize stagingOffset = 0;
size_t allocationSize = readFormat->pixelBytes * area.width * area.height;
size_t allocationSize = static_cast<size_t>(readFormat->pixelBytes) *
static_cast<size_t>(area.width) *
static_cast<size_t>(area.height);

ANGLE_TRY(contextVk->initBufferForImageCopy(stagingBuffer, allocationSize,
MemoryCoherency::CachedPreferCoherent,
Expand Down