Fixes for compilation on Windows for x86

This commit is contained in:
2022-03-02 21:06:21 +01:00
parent e52cf67447
commit 20075e0fbd
2 changed files with 21 additions and 1 deletions
@@ -1042,7 +1042,7 @@ void GPUContextVulkan::BindIB(GPUBuffer* indexBuffer)
void GPUContextVulkan::BindSampler(int32 slot, GPUSampler* sampler) void GPUContextVulkan::BindSampler(int32 slot, GPUSampler* sampler)
{ {
ASSERT(slot >= GPU_STATIC_SAMPLERS_COUNT && slot < GPU_MAX_SAMPLER_BINDED); ASSERT(slot >= GPU_STATIC_SAMPLERS_COUNT && slot < GPU_MAX_SAMPLER_BINDED);
const auto handle = sampler ? ((GPUSamplerVulkan*)sampler)->Sampler : nullptr; const auto handle = sampler ? ((GPUSamplerVulkan*)sampler)->Sampler : VK_NULL_HANDLE;
_samplerHandles[slot] = handle; _samplerHandles[slot] = handle;
} }
@@ -25,7 +25,11 @@ public:
static void MemoryBarrier(); static void MemoryBarrier();
static int64 InterlockedExchange(int64 volatile* dst, int64 exchange) static int64 InterlockedExchange(int64 volatile* dst, int64 exchange)
{ {
#if WIN64
return _InterlockedExchange64(dst, exchange); return _InterlockedExchange64(dst, exchange);
#else
return _interlockedexchange64(dst, exchange);
#endif
} }
static int32 InterlockedCompareExchange(int32 volatile* dst, int32 exchange, int32 comperand) static int32 InterlockedCompareExchange(int32 volatile* dst, int32 exchange, int32 comperand)
{ {
@@ -37,15 +41,27 @@ public:
} }
static int64 InterlockedIncrement(int64 volatile* dst) static int64 InterlockedIncrement(int64 volatile* dst)
{ {
#if WIN64
return _InterlockedExchangeAdd64(dst, 1) + 1; return _InterlockedExchangeAdd64(dst, 1) + 1;
#else
return _interlockedexchange64(dst, 1) + 1;
#endif
} }
static int64 InterlockedDecrement(int64 volatile* dst) static int64 InterlockedDecrement(int64 volatile* dst)
{ {
#if WIN64
return _InterlockedExchangeAdd64(dst, -1) - 1; return _InterlockedExchangeAdd64(dst, -1) - 1;
#else
return _interlockedexchangeadd64(dst, -1) - 1;
#endif
} }
static int64 InterlockedAdd(int64 volatile* dst, int64 value) static int64 InterlockedAdd(int64 volatile* dst, int64 value)
{ {
#if WIN64
return _InterlockedExchangeAdd64(dst, value); return _InterlockedExchangeAdd64(dst, value);
#else
return _interlockedexchangeadd64(dst, value);
#endif
} }
static int32 AtomicRead(int32 volatile* dst) static int32 AtomicRead(int32 volatile* dst)
{ {
@@ -61,7 +77,11 @@ public:
} }
static void AtomicStore(int64 volatile* dst, int64 value) static void AtomicStore(int64 volatile* dst, int64 value)
{ {
#if WIN64
_InterlockedExchange64(dst, value); _InterlockedExchange64(dst, value);
#else
_interlockedexchange64(dst, value);
#endif
} }
static void Prefetch(void const* ptr); static void Prefetch(void const* ptr);
static void* Allocate(uint64 size, uint64 alignment); static void* Allocate(uint64 size, uint64 alignment);