From bf4268a3963ba5a559a73c8ca442988c3a0dd445 Mon Sep 17 00:00:00 2001 From: Austin Kinross Date: Tue, 17 Sep 2019 13:33:56 -0700 Subject: [PATCH] Fix misc VS2019 bool conversion warnings BUG=angleproject:3921 Change-Id: I06de5131f98b27c2556ed60dd7228c9cfa154802 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1811858 Commit-Queue: Jamie Madill Reviewed-by: Jamie Madill --- src/compiler/translator/ShaderVars.cpp | 2 +- src/libANGLE/Display.cpp | 3 ++- src/libANGLE/VertexArray.cpp | 3 ++- src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp | 4 ++-- src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp | 4 ++-- .../d3d/d3d11/converged/CompositorNativeWindow11.cpp | 8 ++++---- src/libANGLE/renderer/vulkan/ContextVk.cpp | 2 +- src/libANGLE/renderer/vulkan/ProgramVk.cpp | 2 +- src/libANGLE/renderer/vulkan/vk_caps_utils.cpp | 3 ++- src/libANGLE/renderer/vulkan/vk_wrapper.h | 2 +- 10 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/compiler/translator/ShaderVars.cpp b/src/compiler/translator/ShaderVars.cpp index ac22cb09e..3cebc70d1 100644 --- a/src/compiler/translator/ShaderVars.cpp +++ b/src/compiler/translator/ShaderVars.cpp @@ -101,7 +101,7 @@ ShaderVariable &ShaderVariable::operator=(const ShaderVariable &other) offset = other.offset; readonly = other.readonly; writeonly = other.writeonly; - writeonly = other.index; + index = other.index; interpolation = other.interpolation; isInvariant = other.isInvariant; return *this; diff --git a/src/libANGLE/Display.cpp b/src/libANGLE/Display.cpp index 84449c1ab..ba8f982e6 100644 --- a/src/libANGLE/Display.cpp +++ b/src/libANGLE/Display.cpp @@ -924,7 +924,8 @@ Error Display::createContext(const Config *configuration, if (usesProgramCacheControl) { bool programCacheControlEnabled = - mAttributeMap.get(EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE, GL_FALSE); + (mAttributeMap.get(EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE, GL_FALSE) == + GL_TRUE); // A program cache size of zero indicates it should be disabled. if (!programCacheControlEnabled || mMemoryProgramCache.maxSize() == 0) { diff --git a/src/libANGLE/VertexArray.cpp b/src/libANGLE/VertexArray.cpp index 6a83e6cdd..3422a04d4 100644 --- a/src/libANGLE/VertexArray.cpp +++ b/src/libANGLE/VertexArray.cpp @@ -315,7 +315,8 @@ bool VertexArray::bindVertexBufferImpl(const Context *context, mCachedTransformFeedbackConflictedBindingsMask.set( bindingIndex, boundBuffer->isBoundForTransformFeedbackAndOtherUse()); mState.mClientMemoryAttribsMask &= ~binding->getBoundAttributesMask(); - updateCachedMappedArrayBuffers(boundBuffer->isMapped(), binding->getBoundAttributesMask()); + updateCachedMappedArrayBuffers((boundBuffer->isMapped() == GL_TRUE), + binding->getBoundAttributesMask()); } else { diff --git a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp index ca3fcef34..6bb17ac08 100644 --- a/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp @@ -2227,8 +2227,8 @@ angle::Result Renderer11::copyImageInternal(const gl::Context *context, { TextureHelper11 tex; ANGLE_TRY(resolveMultisampledTexture(context, sourceRenderTarget, - colorAttachment->getDepthSize(), - colorAttachment->getStencilSize(), &tex)); + colorAttachment->getDepthSize() > 0, + colorAttachment->getStencilSize() > 0, &tex)); D3D11_SHADER_RESOURCE_VIEW_DESC viewDesc; viewDesc.Format = sourceRenderTarget->getFormatSet().srvFormat; diff --git a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp index f85edee7f..3cc4ab425 100644 --- a/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp @@ -391,7 +391,7 @@ angle::Result TextureStorage11::getSRVForImage(const gl::Context *context, const d3d11::SharedSRV **outSRV) { // TODO(Xinghua.cao@intel.com): Add solution to handle swizzle required. - ImageKey key(imageUnit.level, imageUnit.layered, imageUnit.layer, imageUnit.access, + ImageKey key(imageUnit.level, (imageUnit.layered == GL_TRUE), imageUnit.layer, imageUnit.access, imageUnit.format); ANGLE_TRY(getCachedOrCreateSRVForImage(context, key, outSRV)); return angle::Result::Continue; @@ -423,7 +423,7 @@ angle::Result TextureStorage11::getUAVForImage(const gl::Context *context, const d3d11::SharedUAV **outUAV) { // TODO(Xinghua.cao@intel.com): Add solution to handle swizzle required. - ImageKey key(imageUnit.level, imageUnit.layered, imageUnit.layer, imageUnit.access, + ImageKey key(imageUnit.level, (imageUnit.layered == GL_TRUE), imageUnit.layer, imageUnit.access, imageUnit.format); ANGLE_TRY(getCachedOrCreateUAVForImage(context, key, outUAV)); return angle::Result::Continue; diff --git a/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.cpp b/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.cpp index 826b20d08..496f7c49a 100644 --- a/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.cpp @@ -341,7 +341,7 @@ bool RoHelper::SupportedWindowsRelease() if (FAILED(hr)) { - return isSupported; + return !!isSupported; } Microsoft::WRL::ComPtr api; @@ -351,19 +351,19 @@ bool RoHelper::SupportedWindowsRelease() if (FAILED(hr)) { - return isSupported; + return !!isSupported; } hr = GetStringReference(L"Windows.Foundation.UniversalApiContract", &contractName, &contractNameHeader); if (FAILED(hr)) { - return isSupported; + return !!isSupported; } api->IsApiContractPresentByMajor(contractName, 6, &isSupported); - return isSupported; + return !!isSupported; } HRESULT RoHelper::GetStringReference(PCWSTR source, HSTRING *act, HSTRING_HEADER *header) diff --git a/src/libANGLE/renderer/vulkan/ContextVk.cpp b/src/libANGLE/renderer/vulkan/ContextVk.cpp index 9938d259b..8746bc48f 100644 --- a/src/libANGLE/renderer/vulkan/ContextVk.cpp +++ b/src/libANGLE/renderer/vulkan/ContextVk.cpp @@ -1901,7 +1901,7 @@ angle::Result ContextVk::syncState(const gl::Context *context, // No additional work is needed here. We will update the pipeline desc later. invalidateDefaultAttributes( context->getStateCache().getActiveDefaultAttribsMask()); - bool useVertexBuffer = (mProgram->getState().getMaxActiveAttribLocation()); + bool useVertexBuffer = (mProgram->getState().getMaxActiveAttribLocation() > 0); mNonIndexedDirtyBitsMask.set(DIRTY_BIT_VERTEX_BUFFERS, useVertexBuffer); mIndexedDirtyBitsMask.set(DIRTY_BIT_VERTEX_BUFFERS, useVertexBuffer); mCurrentGraphicsPipeline = nullptr; diff --git a/src/libANGLE/renderer/vulkan/ProgramVk.cpp b/src/libANGLE/renderer/vulkan/ProgramVk.cpp index 970c53309..849bf160a 100644 --- a/src/libANGLE/renderer/vulkan/ProgramVk.cpp +++ b/src/libANGLE/renderer/vulkan/ProgramVk.cpp @@ -1465,7 +1465,7 @@ angle::Result ProgramVk::updateImagesDescriptorSet(ContextVk *contextVk, const vk::ImageView *imageView = nullptr; ANGLE_TRY(textureVk->getLayerLevelStorageImageView( - contextVk, binding.layered, binding.layer, binding.level, &imageView)); + contextVk, (binding.layered == GL_TRUE), binding.layer, binding.level, &imageView)); // Note: binding.access is unused because it is implied by the shader. diff --git a/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp b/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp index 57b854f4c..81af7f0da 100644 --- a/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp +++ b/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp @@ -88,7 +88,8 @@ void RendererVk::ensureCapsInitialized() const mNativeExtensions.instancedArraysEXT = mMaxVertexAttribDivisor > 1; // Only expose robust buffer access if the physical device supports it. - mNativeExtensions.robustBufferAccessBehavior = mPhysicalDeviceFeatures.robustBufferAccess; + mNativeExtensions.robustBufferAccessBehavior = + (mPhysicalDeviceFeatures.robustBufferAccess == VK_TRUE); mNativeExtensions.eglSync = true; diff --git a/src/libANGLE/renderer/vulkan/vk_wrapper.h b/src/libANGLE/renderer/vulkan/vk_wrapper.h index 829b8f77f..00b0cc5e3 100644 --- a/src/libANGLE/renderer/vulkan/vk_wrapper.h +++ b/src/libANGLE/renderer/vulkan/vk_wrapper.h @@ -189,7 +189,7 @@ class CommandBuffer : public WrappedObject static bool SupportsQueries(const VkPhysicalDeviceFeatures &features) { - return features.inheritedQueries; + return (features.inheritedQueries == VK_TRUE); } // Vulkan command buffers are executed as secondary command buffers within a primary command