Fix some type narrowing warnings and typos.

This commit is contained in:
Unknown W. Brackets 2017-03-19 07:44:02 -07:00
parent ef26ee267d
commit a1f59deafe
7 changed files with 12 additions and 15 deletions

View File

@ -143,8 +143,8 @@ size_t VulkanDeviceAllocator::Allocate(const VkMemoryRequirements &reqs, VkDevic
return ALLOCATE_FAILED;
}
size_t align = reqs.alignment <= SLAB_GRAIN_SIZE ? 1 : (reqs.alignment >> SLAB_GRAIN_SHIFT);
size_t blocks = (reqs.size + SLAB_GRAIN_SIZE - 1) >> SLAB_GRAIN_SHIFT;
size_t align = reqs.alignment <= SLAB_GRAIN_SIZE ? 1 : (size_t)(reqs.alignment >> SLAB_GRAIN_SHIFT);
size_t blocks = (size_t)((reqs.size + SLAB_GRAIN_SIZE - 1) >> SLAB_GRAIN_SHIFT);
const size_t numSlabs = slabs_.size();
for (size_t i = 0; i < numSlabs; ++i) {
@ -298,7 +298,7 @@ void VulkanDeviceAllocator::ExecuteFree(FreeInfo *userdata) {
delete userdata;
}
bool VulkanDeviceAllocator::AllocateSlab(size_t minBytes) {
bool VulkanDeviceAllocator::AllocateSlab(VkDeviceSize minBytes) {
assert(!destroyed_);
if (!slabs_.empty() && minSlabSize_ < maxSlabSize_) {
// We're allocating an additional slab, so rachet up its size.
@ -325,7 +325,7 @@ bool VulkanDeviceAllocator::AllocateSlab(size_t minBytes) {
slabs_.resize(slabs_.size() + 1);
Slab &slab = slabs_[slabs_.size() - 1];
slab.deviceMemory = deviceMemory;
slab.usage.resize(alloc.allocationSize >> SLAB_GRAIN_SHIFT);
slab.usage.resize((size_t)(alloc.allocationSize >> SLAB_GRAIN_SHIFT));
return true;
}

View File

@ -188,7 +188,7 @@ private:
freeInfo->allocator->ExecuteFree(freeInfo);
}
bool AllocateSlab(size_t minBytes);
bool AllocateSlab(VkDeviceSize minBytes);
bool AllocateFromSlab(Slab &slab, size_t &start, size_t blocks);
void Decimate();
void ExecuteFree(FreeInfo *userdata);

View File

@ -469,10 +469,8 @@ static ConfigSetting graphicsSettings[] = {
ReportedConfigSetting("AutoFrameSkip", &g_Config.bAutoFrameSkip, false, true, true),
ConfigSetting("FrameRate", &g_Config.iFpsLimit, 0, true, true),
ConfigSetting("FrameSkipUnthrottle", &g_Config.bFrameSkipUnthrottle, &DefaultFrameskipUnthrottle, true, false),
#ifdef _WIN32
#if defined(USING_WIN_UI)
ConfigSetting("RestartRequired", &g_Config.bRestartRequired, false, false),
#endif
#endif
ReportedConfigSetting("ForceMaxEmulatedFPS", &g_Config.iForceMaxEmulatedFPS, 60, true, true),

View File

@ -160,7 +160,7 @@ size_t RamCachingFileLoader::ReadFromCache(s64 pos, size_t bytes, void *data) {
std::lock_guard<std::mutex> guard(blocksMutex_);
for (s64 i = cacheStartPos; i <= cacheEndPos; ++i) {
if (blocks_[i] == 0) {
if (blocks_[(size_t)i] == 0) {
return readSize;
}
@ -186,7 +186,7 @@ void RamCachingFileLoader::SaveIntoCache(s64 pos, size_t bytes, Flags flags) {
{
std::lock_guard<std::mutex> guard(blocksMutex_);
for (s64 i = cacheStartPos; i <= cacheEndPos; ++i) {
if (blocks_[i] == 0) {
if (blocks_[(size_t)i] == 0) {
++blocksToRead;
if (blocksToRead >= MAX_BLOCKS_PER_READ) {
break;
@ -208,8 +208,8 @@ void RamCachingFileLoader::SaveIntoCache(s64 pos, size_t bytes, Flags flags) {
// In case they were simultaneously read.
u32 blocksRead = 0;
for (size_t i = 0; i < blocksActuallyRead; ++i) {
if (blocks_[cacheStartPos + i] == 0) {
blocks_[cacheStartPos + i] = 1;
if (blocks_[(size_t)cacheStartPos + i] == 0) {
blocks_[(size_t)cacheStartPos + i] = 1;
++blocksRead;
}
}

View File

@ -119,7 +119,7 @@ static const Builtin replacements[] = {
static const char *cbufferDecl = R"(
cbuffer data : register(b0) {
float2 u_texelDelta;
float2 u_pixelDelta;
float2 u_pixelDelta;
float4 u_time;
};
)";

View File

@ -117,7 +117,7 @@ bool GenerateFragmentShaderHLSL(const ShaderID &id, char *buffer, ShaderLanguage
if (enableAlphaTest) {
if (lang == HLSL_D3D11) {
WRITE(p, "int roundAndScaleTo255i(float x) { return uint(floor(x * 255.0f + 0.5f)); }\n");
WRITE(p, "int roundAndScaleTo255i(float x) { return int(floor(x * 255.0f + 0.5f)); }\n");
} else {
// D3D11 level 9 gets to take this path.
WRITE(p, "float roundAndScaleTo255f(float x) { return floor(x * 255.0f + 0.5f); }\n");

View File

@ -8,7 +8,6 @@
#include "Core/Reporting.h"
#include "Core/Util/AudioFormat.h"
#include "Windows/W32Util/Misc.h"
#include "Common/OSVersion.h"
#include "dsoundstream.h"
@ -477,4 +476,4 @@ WindowsAudioBackend *CreateAudioBackend(AudioBackendType type) {
} else {
return new DSoundAudioBackend();
}
}
}