0

Fix -Wc++11-narrowing: gpu/

Bug: 1216696
Change-Id: I07b360ad948e49b46ff9585e95fa35db6fe53f51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2975069
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#895781}
This commit is contained in:
Peter Kasting
2021-06-24 21:08:01 +00:00
committed by Chromium LUCI CQ
parent 87c7c994a1
commit ee9e7556ff
8 changed files with 22 additions and 13 deletions

@ -51,7 +51,8 @@ WGPUTexture ExternalVkImageDawnRepresentation::BeginAccess(
texture_descriptor.format = wgpu_format_;
texture_descriptor.usage = usage;
texture_descriptor.dimension = WGPUTextureDimension_2D;
texture_descriptor.size = {size().width(), size().height(), 1};
texture_descriptor.size = {static_cast<uint32_t>(size().width()),
static_cast<uint32_t>(size().height()), 1};
texture_descriptor.mipLevelCount = 1;
texture_descriptor.sampleCount = 1;

@ -297,10 +297,12 @@ TEST_F(ExternalVkImageFactoryTest, SkiaVulkanWrite_DawnRead) {
SkCanvas* dest_canvas = dest_surface->getCanvas();
// Color the top half blue, and the bottom half green
dest_canvas->drawRect(SkRect{0, 0, size.width(), size.height() / 2},
SkPaint(SkColors::kBlue));
dest_canvas->drawRect(
SkRect{0, size.height() / 2, size.width(), size.height()},
SkRect{0, 0, static_cast<SkScalar>(size.width()), size.height() / 2.0f},
SkPaint(SkColors::kBlue));
dest_canvas->drawRect(
SkRect{0, size.height() / 2.0f, static_cast<SkScalar>(size.width()),
static_cast<SkScalar>(size.height())},
SkPaint(SkColors::kGreen));
skia_representation->SetCleared();
@ -355,7 +357,8 @@ TEST_F(ExternalVkImageFactoryTest, SkiaVulkanWrite_DawnRead) {
dst_copy_view.layout.offset = 0;
dst_copy_view.layout.rowsPerImage = 0;
wgpu::Extent3D copy_extent = {size.width(), size.height(), 1};
wgpu::Extent3D copy_extent = {static_cast<uint32_t>(size.width()),
static_cast<uint32_t>(size.height()), 1};
encoder.CopyTextureToBuffer(&src_copy_view, &dst_copy_view, &copy_extent);
}

@ -116,7 +116,8 @@ class SharedImageRepresentationDawnIOSurface
texture_descriptor.format = wgpu_format_;
texture_descriptor.usage = usage;
texture_descriptor.dimension = WGPUTextureDimension_2D;
texture_descriptor.size = {size().width(), size().height(), 1};
texture_descriptor.size = {static_cast<uint32_t>(size().width()),
static_cast<uint32_t>(size().height()), 1};
texture_descriptor.mipLevelCount = 1;
texture_descriptor.sampleCount = 1;

@ -64,7 +64,8 @@ WGPUTexture SharedImageRepresentationDawnOzone::BeginAccess(
texture_descriptor.format = format_;
texture_descriptor.usage = usage;
texture_descriptor.dimension = WGPUTextureDimension_2D;
texture_descriptor.size = {pixmap_size.width(), pixmap_size.height(), 1};
texture_descriptor.size = {static_cast<uint32_t>(pixmap_size.width()),
static_cast<uint32_t>(pixmap_size.height()), 1};
texture_descriptor.mipLevelCount = 1;
texture_descriptor.sampleCount = 1;

@ -355,7 +355,8 @@ void ImageDecodeAcceleratorStub::ProcessCompletedDecode(
const GrBackendTexture plane_backend_texture(
plane_size.width(), plane_size.height(), GrMipMapped::kNo,
GrGLTextureInfo{GL_TEXTURE_EXTERNAL_OES, resource->texture,
is_nv12_chroma_plane ? GL_RG8_EXT : GL_R8_EXT});
static_cast<GrGLenum>(
is_nv12_chroma_plane ? GL_RG8_EXT : GL_R8_EXT)});
plane_sk_images[plane] = SkImage::MakeFromTexture(
shared_context_state->gr_context(), plane_backend_texture,
kTopLeft_GrSurfaceOrigin,

@ -163,8 +163,8 @@ class Simulator {
.parent = connection_->default_root(),
.x = 1,
.y = 1,
.width = window_width_,
.height = window_height_,
.width = static_cast<uint16_t>(window_width_),
.height = static_cast<uint16_t>(window_height_),
.background_pixel = black_pixel,
.border_pixel = black_pixel,
.event_mask = x11::EventMask::Exposure | x11::EventMask::KeyPress |

@ -154,7 +154,7 @@ bool VulkanImage::InitializeWithExternalMemoryAndModifiers(
VkImageDrmFormatModifierListCreateInfoEXT modifier_list = {
.sType = VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT,
.drmFormatModifierCount = modifiers.size(),
.drmFormatModifierCount = static_cast<uint32_t>(modifiers.size()),
.pDrmFormatModifiers = modifiers.data(),
};
@ -192,7 +192,8 @@ bool VulkanImage::InitializeWithExternalMemoryAndModifiers(
// TODO(penghuang): use VK_IMAGE_ASPECT_MEMORY_PLANE_i_BIT_EXT when the mesa
// can handle VK_IMAGE_ASPECT_MEMORY_PLANE_i_BIT_EXT.
const VkImageSubresource image_subresource = {
.aspectMask = VK_IMAGE_ASPECT_PLANE_0_BIT << i,
.aspectMask =
static_cast<VkImageAspectFlags>(VK_IMAGE_ASPECT_PLANE_0_BIT << i),
.mipLevel = 0,
.arrayLayer = 0,
};

@ -29,7 +29,8 @@ VkSemaphore ImportVkSemaphoreHandle(VkDevice vk_device,
const VkImportSemaphoreFdInfoKHR import = {
.sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR,
.semaphore = semaphore,
.flags = is_sync_fd ? VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR : 0,
.flags = is_sync_fd ? VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR
: VkSemaphoreImportFlags{0},
.handleType = handle_type,
.fd = fd.release(),
};