Fixed compilation issues when using libstdc++

Bug:dawn:229
Change-Id: I18ce6330bc4597db4f2c4548698b38ab2c826203
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11620
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Mathieu-Andre Chiasson 2019-09-25 19:32:01 +00:00 committed by Commit Bot service account
parent 6ac5a9250d
commit 09cc2b92c7
6 changed files with 17 additions and 9 deletions

View File

@ -117,20 +117,18 @@ namespace dawn_native {
private: private:
// Vulkan backend use uint32_t as dynamic offsets type, it is not correct. // Vulkan backend use uint32_t as dynamic offsets type, it is not correct.
// Vulkan should use VkDeviceSize. Dawn vulkan backend has to handle this. // Vulkan should use VkDeviceSize. Dawn vulkan backend has to handle this.
template <typename T> static void SetDynamicOffsets(uint32_t* data,
static void SetDynamicOffsets(T* data,
uint32_t dynamicOffsetCount, uint32_t dynamicOffsetCount,
uint64_t* dynamicOffsets) { uint64_t* dynamicOffsets) {
for (uint32_t i = 0; i < dynamicOffsetCount; ++i) { for (uint32_t i = 0; i < dynamicOffsetCount; ++i) {
ASSERT(dynamicOffsets[i] <= std::numeric_limits<T>::max()); ASSERT(dynamicOffsets[i] <= std::numeric_limits<uint32_t>::max());
data[i] = static_cast<T>(dynamicOffsets[i]); data[i] = static_cast<uint32_t>(dynamicOffsets[i]);
} }
} }
template <> static void SetDynamicOffsets(uint64_t* data,
static void SetDynamicOffsets<uint64_t>(uint64_t* data, uint32_t dynamicOffsetCount,
uint32_t dynamicOffsetCount, uint64_t* dynamicOffsets) {
uint64_t* dynamicOffsets) {
memcpy(data, dynamicOffsets, sizeof(uint64_t) * dynamicOffsetCount); memcpy(data, dynamicOffsets, sizeof(uint64_t) * dynamicOffsetCount);
} }
}; };

View File

@ -16,6 +16,8 @@
#define DAWNNATIVE_BUDDYALLOCATOR_H_ #define DAWNNATIVE_BUDDYALLOCATOR_H_
#include <cstddef> #include <cstddef>
#include <cstdint>
#include <limits>
#include <vector> #include <vector>
namespace dawn_native { namespace dawn_native {
@ -108,4 +110,4 @@ namespace dawn_native {
} // namespace dawn_native } // namespace dawn_native
#endif // DAWNNATIVE_BUDDYALLOCATOR_H_ #endif // DAWNNATIVE_BUDDYALLOCATOR_H_

View File

@ -17,6 +17,8 @@
#include "dawn_native/Device.h" #include "dawn_native/Device.h"
#include "dawn_native/ErrorScope.h" #include "dawn_native/ErrorScope.h"
#include <limits>
namespace dawn_native { namespace dawn_native {
ErrorScopeTracker::ErrorScopeTracker(DeviceBase* device) : mDevice(device) { ErrorScopeTracker::ErrorScopeTracker(DeviceBase* device) : mDevice(device) {

View File

@ -16,6 +16,8 @@
#include "dawn_wire/client/Client.h" #include "dawn_wire/client/Client.h"
#include "dawn_wire/client/Device.h" #include "dawn_wire/client/Device.h"
#include <limits>
namespace dawn_wire { namespace client { namespace dawn_wire { namespace client {
bool Client::DoDeviceUncapturedErrorCallback(DawnErrorType errorType, const char* message) { bool Client::DoDeviceUncapturedErrorCallback(DawnErrorType errorType, const char* message) {

View File

@ -16,6 +16,8 @@
#include "dawn_wire/WireClient.h" #include "dawn_wire/WireClient.h"
#include "dawn_wire/client/Client.h" #include "dawn_wire/client/Client.h"
#include <cstring>
namespace dawn_wire { namespace client { namespace dawn_wire { namespace client {
class InlineMemoryTransferService : public MemoryTransferService { class InlineMemoryTransferService : public MemoryTransferService {

View File

@ -16,6 +16,8 @@
#include "dawn_wire/WireServer.h" #include "dawn_wire/WireServer.h"
#include "dawn_wire/server/Server.h" #include "dawn_wire/server/Server.h"
#include <cstring>
namespace dawn_wire { namespace server { namespace dawn_wire { namespace server {
class InlineMemoryTransferService : public MemoryTransferService { class InlineMemoryTransferService : public MemoryTransferService {