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

@@ -110,7 +110,7 @@ namespace backend {
const auto& layoutInfo = layout->GetBindingInfo();
for (size_t i = start, j = 0; i < start + count; ++i, ++j) {
nxt::BufferUsageBit requiredBit;
nxt::BufferUsageBit requiredBit = nxt::BufferUsageBit::None;
switch (layoutInfo.types[i]) {
case nxt::BindingType::UniformBuffer:
requiredBit = nxt::BufferUsageBit::Uniform;

View File

@@ -71,7 +71,7 @@ namespace backend {
bool ComputeTextureCopyBufferSize(CommandBufferBuilder*, const TextureCopyLocation& location, uint32_t* bufferSize) {
// TODO(cwallez@chromium.org): check for overflows
uint32_t pixelSize = TextureFormatPixelSize(location.texture->GetFormat());
uint32_t pixelSize = static_cast<uint32_t>(TextureFormatPixelSize(location.texture->GetFormat()));
*bufferSize = location.width * location.height * location.depth * pixelSize;
return true;

View File

@@ -488,8 +488,7 @@ namespace backend {
break;
default:
ASSERT(false);
return false;
UNREACHABLE();
}
auto buffer = group->GetBindingAsBufferView(i)->GetBuffer();
@@ -535,13 +534,13 @@ namespace backend {
}
void CommandBufferStateTracker::UnsetPipeline() {
constexpr ValidationAspects pipelineDependentAspectsInverse =
~(1 << VALIDATION_ASPECT_RENDER_PIPELINE |
1 << VALIDATION_ASPECT_COMPUTE_PIPELINE |
1 << VALIDATION_ASPECT_BIND_GROUPS |
1 << VALIDATION_ASPECT_VERTEX_BUFFERS |
1 << VALIDATION_ASPECT_INDEX_BUFFER);
aspects &= pipelineDependentAspectsInverse;
constexpr ValidationAspects pipelineDependentAspects =
1 << VALIDATION_ASPECT_RENDER_PIPELINE |
1 << VALIDATION_ASPECT_COMPUTE_PIPELINE |
1 << VALIDATION_ASPECT_BIND_GROUPS |
1 << VALIDATION_ASPECT_VERTEX_BUFFERS |
1 << VALIDATION_ASPECT_INDEX_BUFFER;
aspects &= ~pipelineDependentAspects;
bindgroups.fill(nullptr);
}
}

View File

@@ -28,7 +28,7 @@ namespace backend {
}
uint32_t RenderPassBase::GetAttachmentCount() const {
return attachments.size();
return static_cast<uint32_t>(attachments.size());
}
const RenderPassBase::AttachmentInfo& RenderPassBase::GetAttachmentInfo(uint32_t attachment) const {
@@ -37,7 +37,7 @@ namespace backend {
}
uint32_t RenderPassBase::GetSubpassCount() const {
return subpasses.size();
return static_cast<uint32_t>(subpasses.size());
}
const RenderPassBase::SubpassInfo& RenderPassBase::GetSubpassInfo(uint32_t subpass) const {

View File

@@ -273,7 +273,8 @@ namespace d3d12 {
D3D12_RECT scissorRect = { 0, 0, static_cast<long>(width), static_cast<long>(height) };
commandList->RSSetViewports(1, &viewport);
commandList->RSSetScissorRects(1, &scissorRect);
commandList->OMSetRenderTargets(1, &device->GetCurrentRenderTargetDescriptor(), FALSE, nullptr);
D3D12_CPU_DESCRIPTOR_HANDLE rtv = device->GetCurrentRenderTargetDescriptor();
commandList->OMSetRenderTargets(1, &rtv, FALSE, nullptr);
}
break;
@@ -381,7 +382,7 @@ namespace d3d12 {
case Command::EndRenderPass:
{
EndRenderPassCmd* cmd = commands.NextCommand<EndRenderPassCmd>();
commands.NextCommand<EndRenderPassCmd>();
}
break;
@@ -426,13 +427,13 @@ namespace d3d12 {
case Command::SetPushConstants:
{
SetPushConstantsCmd* cmd = commands.NextCommand<SetPushConstantsCmd>();
commands.NextCommand<SetPushConstantsCmd>();
}
break;
case Command::SetStencilReference:
{
SetStencilReferenceCmd* cmd = commands.NextCommand<SetStencilReferenceCmd>();
commands.NextCommand<SetStencilReferenceCmd>();
}
break;

View File

@@ -200,10 +200,10 @@ namespace d3d12 {
pendingCommands.open = false;
lists[0] = pendingCommands.commandList.Get();
std::copy(commandLists.begin(), commandLists.end(), lists.begin() + 1);
commandQueue->ExecuteCommandLists(commandLists.size() + 1, lists.data());
commandQueue->ExecuteCommandLists(static_cast<UINT>(commandLists.size() + 1), lists.data());
} else {
std::vector<ID3D12CommandList*> lists(commandLists);
commandQueue->ExecuteCommandLists(commandLists.size(), lists.data());
commandQueue->ExecuteCommandLists(static_cast<UINT>(commandLists.size()), lists.data());
}
}

View File

@@ -14,6 +14,8 @@
#include "backend/d3d12/InputStateD3D12.h"
#include "common/BitSetIterator.h"
namespace backend {
namespace d3d12 {
@@ -48,8 +50,8 @@ namespace d3d12 {
const auto& attributesSetMask = GetAttributesSetMask();
size_t count = 0;
for (size_t i = 0; i < attributesSetMask.size(); ++i) {
unsigned int count = 0;
for (auto i : IterateBitSet(attributesSetMask)) {
if (!attributesSetMask[i]) {
continue;
}
@@ -60,7 +62,7 @@ namespace d3d12 {
// If the HLSL semantic is TEXCOORDN the SemanticName should be "TEXCOORD" and the SemanticIndex N
inputElementDescriptor.SemanticName = "TEXCOORD";
inputElementDescriptor.SemanticIndex = i;
inputElementDescriptor.SemanticIndex = static_cast<uint32_t>(i);
inputElementDescriptor.Format = VertexFormatType(attribute.format);
inputElementDescriptor.InputSlot = attribute.bindingSlot;

View File

@@ -89,8 +89,8 @@ namespace d3d12 {
resourceDescriptor.Alignment = 0;
resourceDescriptor.Width = GetWidth();
resourceDescriptor.Height = GetHeight();
resourceDescriptor.DepthOrArraySize = GetDepth();
resourceDescriptor.MipLevels = GetNumMipLevels();
resourceDescriptor.DepthOrArraySize = static_cast<UINT16>(GetDepth());
resourceDescriptor.MipLevels = static_cast<UINT16>(GetNumMipLevels());
resourceDescriptor.Format = D3D12TextureFormat(GetFormat());
resourceDescriptor.SampleDesc.Count = 1;
resourceDescriptor.SampleDesc.Quality = 0;

View File

@@ -243,10 +243,10 @@ namespace opengl {
case Command::SetBindGroup:
{
SetBindGroupCmd* cmd = commands.NextCommand<SetBindGroupCmd>();
size_t index = cmd->index;
size_t groupIndex = cmd->index;
BindGroup* group = ToBackend(cmd->group.Get());
const auto& indices = ToBackend(lastPipeline->GetLayout())->GetBindingIndexInfo()[index];
const auto& indices = ToBackend(lastPipeline->GetLayout())->GetBindingIndexInfo()[groupIndex];
const auto& layout = group->GetLayout()->GetBindingInfo();
// TODO(cwallez@chromium.org): iterate over the layout bitmask instead
@@ -260,18 +260,18 @@ namespace opengl {
{
BufferView* view = ToBackend(group->GetBindingAsBufferView(binding));
GLuint buffer = ToBackend(view->GetBuffer())->GetHandle();
GLuint index = indices[binding];
GLuint uboIndex = indices[binding];
glBindBufferRange(GL_UNIFORM_BUFFER, index, buffer, view->GetOffset(), view->GetSize());
glBindBufferRange(GL_UNIFORM_BUFFER, uboIndex, buffer, view->GetOffset(), view->GetSize());
}
break;
case nxt::BindingType::Sampler:
{
GLuint sampler = ToBackend(group->GetBindingAsSampler(binding))->GetHandle();
GLuint index = indices[binding];
GLuint samplerIndex = indices[binding];
for (auto unit : lastPipeline->GetTextureUnitsForSampler(index)) {
for (auto unit : lastPipeline->GetTextureUnitsForSampler(samplerIndex)) {
glBindSampler(unit, sampler);
}
}
@@ -283,9 +283,9 @@ namespace opengl {
Texture* texture = ToBackend(view->GetTexture());
GLuint handle = texture->GetHandle();
GLenum target = texture->GetGLTarget();
GLuint index = indices[binding];
GLuint textureIndex = indices[binding];
for (auto unit : lastPipeline->GetTextureUnitsForTexture(index)) {
for (auto unit : lastPipeline->GetTextureUnitsForTexture(textureIndex)) {
glActiveTexture(GL_TEXTURE0 + unit);
glBindTexture(target, handle);
}
@@ -296,9 +296,9 @@ namespace opengl {
{
BufferView* view = ToBackend(group->GetBindingAsBufferView(binding));
GLuint buffer = ToBackend(view->GetBuffer())->GetHandle();
GLuint index = indices[binding];
GLuint ssboIndex = indices[binding];
glBindBufferRange(GL_SHADER_STORAGE_BUFFER, index, buffer, view->GetOffset(), view->GetSize());
glBindBufferRange(GL_SHADER_STORAGE_BUFFER, ssboIndex, buffer, view->GetOffset(), view->GetSize());
}
break;
}