Fix compilation on MSVC

- Fix a warning on 32bit for converting uint64_t to size_t for the
 buffer mapped range.
 - Fix a macro redifinition caused by including glfw3.h before windows.h

 Bug:

Change-Id: I3897af55679d943b1dfc34b93bba7bd25d8fb7d6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15320
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-01-21 15:25:25 +00:00 committed by Commit Bot service account
parent f2ed2482a4
commit 3003aa622b
2 changed files with 6 additions and 4 deletions

View File

@ -229,7 +229,7 @@ namespace dawn_native { namespace d3d12 {
}
MaybeError Buffer::MapAtCreationImpl(uint8_t** mappedPointer) {
mWrittenMappedRange = {0, GetSize()};
mWrittenMappedRange = {0, static_cast<size_t>(GetSize())};
DAWN_TRY(CheckHRESULT(GetD3D12Resource()->Map(0, &mWrittenMappedRange,
reinterpret_cast<void**>(mappedPointer)),
"D3D12 map at creation"));
@ -238,7 +238,7 @@ namespace dawn_native { namespace d3d12 {
MaybeError Buffer::MapReadAsyncImpl(uint32_t serial) {
mWrittenMappedRange = {};
D3D12_RANGE readRange = {0, GetSize()};
D3D12_RANGE readRange = {0, static_cast<size_t>(GetSize())};
char* data = nullptr;
DAWN_TRY(
CheckHRESULT(GetD3D12Resource()->Map(0, &readRange, reinterpret_cast<void**>(&data)),
@ -251,7 +251,7 @@ namespace dawn_native { namespace d3d12 {
}
MaybeError Buffer::MapWriteAsyncImpl(uint32_t serial) {
mWrittenMappedRange = {0, GetSize()};
mWrittenMappedRange = {0, static_cast<size_t>(GetSize())};
char* data = nullptr;
DAWN_TRY(CheckHRESULT(
GetD3D12Resource()->Map(0, &mWrittenMappedRange, reinterpret_cast<void**>(&data)),

View File

@ -19,14 +19,16 @@
#include "utils/GLFWUtils.h"
#include <gtest/gtest.h>
#include "GLFW/glfw3.h"
#include <cstdlib>
// Include windows.h before GLFW so GLFW's APIENTRY macro doesn't conflict with windows.h's.
#if defined(DAWN_PLATFORM_WINDOWS)
# include "common/windows_with_undefs.h"
#endif // defined(DAWN_PLATFORM_WINDOWS)
#include "GLFW/glfw3.h"
#if defined(DAWN_USE_X11)
# include "common/xlib_with_undefs.h"
#endif // defined(DAWN_USE_X11)