Fix more compilation warnings.
Add -Wconditional-uninitialized -Wc++11-narrowing. Bug: chromium:1064305 Change-Id: I1c1503cafaa2e58e990fc18998200af1f2c00d06 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19341 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
5b7292c8f8
commit
4fbd14badb
|
@ -97,6 +97,8 @@ config("dawn_internal") {
|
|||
"-Wcstring-format-directive",
|
||||
"-Wtautological-unsigned-zero-compare",
|
||||
"-Wreturn-std-move-in-c++11",
|
||||
"-Wconditional-uninitialized",
|
||||
"-Wc++11-narrowing",
|
||||
|
||||
# Turn on the following flag after removing the empty statement in
|
||||
# third_party/glm/glm/simd/common.h:106
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
|
||||
ResultOrError<std::string> ShaderModule::GetHLSLSource(PipelineLayout* layout) {
|
||||
std::unique_ptr<spirv_cross::CompilerHLSL> compiler_impl;
|
||||
spirv_cross::CompilerHLSL* compiler;
|
||||
spirv_cross::CompilerHLSL* compiler = nullptr;
|
||||
if (!GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
|
||||
// If these options are changed, the values in DawnSPIRVCrossHLSLFastFuzzer.cpp need to
|
||||
// be updated.
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
namespace dawn_native { namespace vulkan {
|
||||
|
||||
const char* VkResultAsString(::VkResult result) {
|
||||
// Convert to a uint32_t to silence and MSVC warning that the fake errors don't appear in
|
||||
// Convert to a int32_t to silence and MSVC warning that the fake errors don't appear in
|
||||
// the original VkResult enum.
|
||||
uint32_t code = static_cast<uint32_t>(result);
|
||||
int32_t code = static_cast<int32_t>(result);
|
||||
|
||||
switch (code) {
|
||||
case VK_SUCCESS:
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "utils/ComboRenderPipelineDescriptor.h"
|
||||
#include "utils/WGPUHelpers.h"
|
||||
|
||||
constexpr static unsigned int kRTSize = 8;
|
||||
constexpr static uint32_t kRTSize = 8;
|
||||
|
||||
class BindGroupTests : public DawnTest {
|
||||
protected:
|
||||
|
@ -218,7 +218,7 @@ TEST_P(BindGroupTests, ReusedUBO) {
|
|||
|
||||
RGBA8 filled(0, 255, 0, 255);
|
||||
RGBA8 notFilled(0, 0, 0, 0);
|
||||
int min = 1, max = kRTSize - 3;
|
||||
uint32_t min = 1, max = kRTSize - 3;
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
|
||||
|
@ -290,13 +290,13 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
|||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||
wgpu::TextureView textureView = texture.CreateView();
|
||||
|
||||
int width = kRTSize, height = kRTSize;
|
||||
int widthInBytes = width * sizeof(RGBA8);
|
||||
uint32_t width = kRTSize, height = kRTSize;
|
||||
uint32_t widthInBytes = width * sizeof(RGBA8);
|
||||
widthInBytes = (widthInBytes + 255) & ~255;
|
||||
int sizeInBytes = widthInBytes * height;
|
||||
int size = sizeInBytes / sizeof(RGBA8);
|
||||
uint32_t sizeInBytes = widthInBytes * height;
|
||||
uint32_t size = sizeInBytes / sizeof(RGBA8);
|
||||
std::vector<RGBA8> data = std::vector<RGBA8>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
for (uint32_t i = 0; i < size; i++) {
|
||||
data[i] = RGBA8(0, 255, 0, 255);
|
||||
}
|
||||
wgpu::Buffer stagingBuffer =
|
||||
|
@ -323,7 +323,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
|||
|
||||
RGBA8 filled(0, 255, 0, 255);
|
||||
RGBA8 notFilled(0, 0, 0, 0);
|
||||
int min = 1, max = kRTSize - 3;
|
||||
uint32_t min = 1, max = kRTSize - 3;
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
|
||||
|
@ -407,7 +407,7 @@ TEST_P(BindGroupTests, MultipleBindLayouts) {
|
|||
|
||||
RGBA8 filled(255, 255, 0, 255);
|
||||
RGBA8 notFilled(0, 0, 0, 0);
|
||||
int min = 1, max = kRTSize - 3;
|
||||
uint32_t min = 1, max = kRTSize - 3;
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
|
||||
|
@ -456,7 +456,7 @@ TEST_P(BindGroupTests, DrawTwiceInSamePipelineWithFourBindGroupSets) {
|
|||
|
||||
RGBA8 filled(255, 0, 0, 255);
|
||||
RGBA8 notFilled(0, 0, 0, 0);
|
||||
int min = 1, max = kRTSize - 3;
|
||||
uint32_t min = 1, max = kRTSize - 3;
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
|
||||
|
@ -498,7 +498,7 @@ TEST_P(BindGroupTests, SetBindGroupBeforePipeline) {
|
|||
// The result should be red.
|
||||
RGBA8 filled(255, 0, 0, 255);
|
||||
RGBA8 notFilled(0, 0, 0, 0);
|
||||
int min = 1, max = kRTSize - 3;
|
||||
uint32_t min = 1, max = kRTSize - 3;
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
|
||||
|
@ -559,7 +559,7 @@ TEST_P(BindGroupTests, SetDynamicBindGroupBeforePipeline) {
|
|||
// The result should be RGBAunorm(1, 0, 0, 0.5) + RGBAunorm(0, 1, 0, 0.5)
|
||||
RGBA8 filled(255, 255, 0, 255);
|
||||
RGBA8 notFilled(0, 0, 0, 0);
|
||||
int min = 1, max = kRTSize - 3;
|
||||
uint32_t min = 1, max = kRTSize - 3;
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
|
||||
|
@ -636,7 +636,7 @@ TEST_P(BindGroupTests, BindGroupsPersistAfterPipelineChange) {
|
|||
// The result should be RGBAunorm(1, 0, 0, 0.5) + RGBAunorm(0, 1, 0, 0.5)
|
||||
RGBA8 filled(255, 255, 0, 255);
|
||||
RGBA8 notFilled(0, 0, 0, 0);
|
||||
int min = 1, max = kRTSize - 3;
|
||||
uint32_t min = 1, max = kRTSize - 3;
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
|
||||
|
@ -741,7 +741,7 @@ TEST_P(BindGroupTests, DrawThenChangePipelineAndBindGroup) {
|
|||
|
||||
RGBA8 filled(255, 255, 255, 255);
|
||||
RGBA8 notFilled(0, 0, 0, 0);
|
||||
int min = 1, max = kRTSize - 3;
|
||||
uint32_t min = 1, max = kRTSize - 3;
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, max, min);
|
||||
EXPECT_PIXEL_RGBA8_EQ(filled, renderPass.color, min, max);
|
||||
|
|
|
@ -104,9 +104,9 @@ namespace {
|
|||
std::tuple<Pipeline, VertexBuffer, BindGroup, UniformData, RenderBundle>;
|
||||
|
||||
template <typename T>
|
||||
int AssignParam(T& lhs, T rhs) {
|
||||
unsigned int AssignParam(T& lhs, T rhs) {
|
||||
lhs = rhs;
|
||||
return 0;
|
||||
return 0u;
|
||||
}
|
||||
|
||||
// This helper function allows creating a DrawCallParam from a list of arguments
|
||||
|
|
|
@ -960,12 +960,12 @@ namespace dawn_native { namespace vulkan {
|
|||
allocationSizeA, memoryTypeIndexA, {});
|
||||
|
||||
// Draw a non-trivial picture
|
||||
int width = 640, height = 480, pixelSize = 4;
|
||||
uint32_t width = 640, height = 480, pixelSize = 4;
|
||||
uint32_t rowPitch = Align(width * pixelSize, kTextureRowPitchAlignment);
|
||||
uint32_t size = rowPitch * (height - 1) + width * pixelSize;
|
||||
unsigned char data[size];
|
||||
for (int row = 0; row < height; row++) {
|
||||
for (int col = 0; col < width; col++) {
|
||||
for (uint32_t row = 0; row < height; row++) {
|
||||
for (uint32_t col = 0; col < width; col++) {
|
||||
float normRow = static_cast<float>(row) / height;
|
||||
float normCol = static_cast<float>(col) / width;
|
||||
float dist = sqrt(normRow * normRow + normCol * normCol) * 3;
|
||||
|
|
Loading…
Reference in New Issue