Fix all Windows warnings

This commit is contained in:
Corentin Wallez
2017-07-10 21:44:06 -04:00
committed by Corentin Wallez
parent 8fca4a21b7
commit 83e779d8f2
22 changed files with 99 additions and 96 deletions

View File

@@ -28,9 +28,9 @@ using nxt::VertexFormat;
// The predetermined values are "K * gl_VertexID + componentIndex" for vertex-indexed buffers, and
// "K * gl_InstanceID + componentIndex" for instance-indexed buffers.
constexpr static int kRTSize = 400;
constexpr static int kRTCellOffset = 50;
constexpr static int kRTCellSize = 100;
constexpr static unsigned int kRTSize = 400;
constexpr static unsigned int kRTCellOffset = 50;
constexpr static unsigned int kRTCellSize = 100;
class InputStateTest : public NXTTest {
protected:
@@ -175,7 +175,7 @@ class InputStateTest : public NXTTest {
template<typename T>
nxt::Buffer MakeVertexBuffer(std::vector<T> data) {
return utils::CreateFrozenBufferFromData(device, data.data(), data.size() * sizeof(T), nxt::BufferUsageBit::Vertex);
return utils::CreateFrozenBufferFromData(device, data.data(), static_cast<uint32_t>(data.size() * sizeof(T)), nxt::BufferUsageBit::Vertex);
}
struct DrawVertexBuffer {
@@ -183,8 +183,8 @@ class InputStateTest : public NXTTest {
nxt::Buffer* buffer;
};
void DoTestDraw(const nxt::Pipeline& pipeline, unsigned int triangles, unsigned int instances, std::vector<DrawVertexBuffer> vertexBuffers) {
EXPECT_LE(triangles, 4);
EXPECT_LE(instances, 4);
EXPECT_LE(triangles, 4u);
EXPECT_LE(instances, 4u);
nxt::CommandBufferBuilder builder = device.CreateCommandBufferBuilder();
@@ -207,10 +207,10 @@ class InputStateTest : public NXTTest {
// Check that the center of each triangle is pure green, so that if a single vertex shader
// instance fails, linear interpolation makes the pixel check fail.
for (size_t triangle = 0; triangle < 4; triangle++) {
for (size_t instance = 0; instance < 4; instance++) {
int x = kRTCellOffset + kRTCellSize * triangle;
int y = kRTCellOffset + kRTCellSize * instance;
for (unsigned int triangle = 0; triangle < 4; triangle++) {
for (unsigned int instance = 0; instance < 4; instance++) {
unsigned int x = kRTCellOffset + kRTCellSize * triangle;
unsigned int y = kRTCellOffset + kRTCellSize * instance;
if (triangle < triangles && instance < instances) {
EXPECT_PIXEL_RGBA8_EQ(RGBA8(0, 255, 0, 255), renderTarget, x, y);
} else {

View File

@@ -160,9 +160,11 @@ TEST(CommandAllocator, MultipleIterations) {
uint32_t myFirst = 42;
uint32_t myCount = 16;
CommandDraw* draw = allocator.Allocate<CommandDraw>(CommandType::Draw);
draw->first = myFirst;
draw->count = myCount;
{
CommandDraw* draw = allocator.Allocate<CommandDraw>(CommandType::Draw);
draw->first = myFirst;
draw->count = myCount;
}
{
CommandIterator iterator(std::move(allocator));
@@ -235,7 +237,7 @@ TEST(CommandAllocator, ManySmallCommands) {
// Stay under max representable uint16_t
const int kCommandCount = 50000;
int count = 0;
uint16_t count = 0;
for (int i = 0; i < kCommandCount; i++) {
CommandSmall* small = allocator.Allocate<CommandSmall>(CommandType::Small);
small->data = count ++;

View File

@@ -63,7 +63,7 @@ TEST(Math, Align) {
char* aligned = Align(unaligned, kTestAlignment);
ASSERT_GE(aligned - unaligned, 0);
ASSERT_LT(aligned - unaligned, kTestAlignment);
ASSERT_LT(static_cast<size_t>(aligned - unaligned), kTestAlignment);
ASSERT_EQ(reinterpret_cast<intptr_t>(aligned) & (kTestAlignment -1), 0);
}
}

View File

@@ -51,7 +51,7 @@ void ValidationTest::TearDown() {
ASSERT_TRUE(expectation.gotStatus) << "Didn't get a status for " << name;
ASSERT_NE(NXT_BUILDER_ERROR_STATUS_UNKNOWN, expectation.gotStatus) << "Got unknown status for " << name;
ASSERT_NE(NXT_BUILDER_ERROR_STATUS_UNKNOWN, expectation.status) << "Got unknown status for " << name;
bool wasSuccess = expectation.status == NXT_BUILDER_ERROR_STATUS_SUCCESS;
ASSERT_EQ(expectation.expectSuccess, wasSuccess)