From e604ca021dd1078d9be8628e6ae87aebfa213a26 Mon Sep 17 00:00:00 2001 From: Rinthel Date: Fri, 2 Aug 2019 22:33:40 +0900 Subject: [PATCH] remove warning / add build option for osx --- scripts/bgfx.lua | 1 + src/renderer_vk.cpp | 45 ++++++++++++++++++++++----------------------- src/renderer_vk.h | 7 +++---- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/scripts/bgfx.lua b/scripts/bgfx.lua index 1043e8abb..69335c679 100644 --- a/scripts/bgfx.lua +++ b/scripts/bgfx.lua @@ -116,6 +116,7 @@ function bgfxProjectBase(_kind, _defines) } configuration { "osx" } + buildoptions { "-x objective-c++" } -- additional build option for osx linkoptions { "-framework Cocoa", "-framework QuartzCore", diff --git a/src/renderer_vk.cpp b/src/renderer_vk.cpp index 5b3389064..147e38633 100644 --- a/src/renderer_vk.cpp +++ b/src/renderer_vk.cpp @@ -10,9 +10,9 @@ #if BX_PLATFORM_OSX # import -# import -# import -# import +# import +# import +# import #endif namespace bgfx { namespace vk @@ -916,7 +916,7 @@ VK_IMPORT // "VK_LAYER_GOOGLE_threading", // "VK_LAYER_GOOGLE_unique_objects", // "VK_LAYER_LUNARG_device_limits", - "VK_LAYER_LUNARG_standard_validation", +// "VK_LAYER_LUNARG_standard_validation", // "VK_LAYER_LUNARG_image", // "VK_LAYER_LUNARG_mem_tracker", // "VK_LAYER_LUNARG_core_validation", @@ -924,7 +924,7 @@ VK_IMPORT // "VK_LAYER_LUNARG_parameter_validation", // "VK_LAYER_LUNARG_swapchain", // "VK_LAYER_LUNARG_vktrace", - "VK_LAYER_RENDERDOC_Capture", +// "VK_LAYER_RENDERDOC_Capture", #endif // BGFX_CONFIG_DEBUG /*not used*/ "" }; @@ -1891,13 +1891,13 @@ VK_IMPORT_DEVICE // { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS }, }; - VkDescriptorSetLayoutBinding dslb[] = - { -// { DslBinding::CombinedImageSampler, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, VK_SHADER_STAGE_ALL, NULL }, - { DslBinding::VertexUniformBuffer, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, NULL }, - { DslBinding::FragmentUniformBuffer, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, NULL }, -// { DslBinding::StorageBuffer, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, VK_SHADER_STAGE_ALL, NULL }, - }; +// VkDescriptorSetLayoutBinding dslb[] = +// { +// // { DslBinding::CombinedImageSampler, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, VK_SHADER_STAGE_ALL, NULL }, +// { DslBinding::VertexUniformBuffer, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_ALL, NULL }, +// { DslBinding::FragmentUniformBuffer, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, NULL }, +// // { DslBinding::StorageBuffer, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, VK_SHADER_STAGE_ALL, NULL }, +// }; VkDescriptorPoolCreateInfo dpci; dpci.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; @@ -3672,7 +3672,6 @@ VK_DESTROY // staging buffer VkBuffer stagingBuffer; VkDeviceMemory stagingMem; - VkBufferCreateInfo bci; bci.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; bci.pNext = NULL; bci.flags = 0; @@ -3688,13 +3687,11 @@ VK_DESTROY , &stagingBuffer )); - VkMemoryRequirements mr; vkGetBufferMemoryRequirements(device , stagingBuffer , &mr ); - VkMemoryAllocateInfo ma; ma.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; ma.pNext = NULL; ma.allocationSize = mr.size; @@ -3733,6 +3730,7 @@ VK_DESTROY void BufferVK::update(VkCommandBuffer _commandBuffer, uint32_t _offset, uint32_t _size, void* _data, bool _discard) { + BX_UNUSED(_commandBuffer, _discard); // void* dst; // VkDevice device = s_renderVK->m_device; // VK_CHECK(vkMapMemory(device, m_deviceMem, _offset, _size, 0, &dst) ); @@ -4018,7 +4016,7 @@ VK_DESTROY // fill binding description with uniform informations { - uint32_t bidx = 0; + uint16_t bidx = 0; if (m_size > 0) { m_bindings[bidx].stageFlags = VK_SHADER_STAGE_ALL; @@ -4206,6 +4204,8 @@ VK_DESTROY const bool renderTarget = 0 != (m_flags & BGFX_TEXTURE_RT_MASK); const bool blit = 0 != (m_flags & BGFX_TEXTURE_BLIT_DST); + BX_UNUSED(swizzle, writeOnly, computeWrite, renderTarget, blit); + BX_TRACE("Texture %3d: %s (requested: %s), %dx%d%s RT[%c], BO[%c], CW[%c]%s.", (int)(this - s_renderVK->m_textures), getName((TextureFormat::Enum)m_textureFormat), getName((TextureFormat::Enum)m_requestedFormat), ti.width, ti.height, @@ -4438,8 +4438,8 @@ VK_DESTROY region.imageExtent.height = m_height; region.imageExtent.depth = 1; - copyBufferToTexture(s_renderVK->m_commandPool, stagingBuffer, 1, ®ion);*/ - copyBufferToTexture(s_renderVK->m_commandPool, stagingBuffer, numSrd, bufferCopyInfo); + copyBufferToTexture(stagingBuffer, 1, ®ion);*/ + copyBufferToTexture(stagingBuffer, numSrd, bufferCopyInfo); } vkFreeMemory(device, stagingDeviceMem, &s_allocationCb); @@ -4508,8 +4508,9 @@ VK_DESTROY } } - void TextureVK::update(VkCommandPool commandPool, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) + void TextureVK::update(VkCommandPool _commandPool, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) { + BX_UNUSED(_commandPool, _side, _mip, _pitch); VkDevice device = s_renderVK->m_device; VkBuffer stagingBuffer = VK_NULL_HANDLE; @@ -4572,16 +4573,14 @@ VK_DESTROY region.imageExtent.height = _rect.m_height; region.imageExtent.depth = _depth; - copyBufferToTexture(s_renderVK->m_commandPool, stagingBuffer, 1, ®ion); + copyBufferToTexture(stagingBuffer, 1, ®ion); vkFreeMemory(device, stagingDeviceMem, &s_allocationCb); vkDestroy(stagingBuffer); } - void TextureVK::copyBufferToTexture(VkCommandPool commandPool, VkBuffer stagingBuffer, - uint32_t bufferImageCopyCount, VkBufferImageCopy* bufferImageCopy) + void TextureVK::copyBufferToTexture(VkBuffer stagingBuffer, uint32_t bufferImageCopyCount, VkBufferImageCopy* bufferImageCopy) { - VkDevice device = s_renderVK->m_device; VkCommandBuffer commandBuffer = s_renderVK->beginNewCommand(); // image Layout transition into destination optimal setImageMemoryBarrier(commandBuffer, m_textureImage, m_currentImageLayout, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, m_numMips, m_numLayers); diff --git a/src/renderer_vk.h b/src/renderer_vk.h index 0198c4625..2febc3a3f 100644 --- a/src/renderer_vk.h +++ b/src/renderer_vk.h @@ -390,8 +390,8 @@ VK_DESTROY , m_hash(0) , m_numUniforms(0) , m_numPredefined(0) - , m_numBindings(0) , m_numSamplers(0) + , m_numBindings(0) { } @@ -462,8 +462,7 @@ VK_DESTROY void destroy(); void update(VkCommandPool commandPool, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem); - void copyBufferToTexture(VkCommandPool commandPool, VkBuffer stagingBuffer, - uint32_t bufferImageCopyCount, VkBufferImageCopy* bufferImageCopy); + void copyBufferToTexture(VkBuffer stagingBuffer, uint32_t bufferImageCopyCount, VkBufferImageCopy* bufferImageCopy); void* m_directAccessPtr; uint64_t m_flags; @@ -477,11 +476,11 @@ VK_DESTROY uint8_t m_textureFormat; uint8_t m_numMips; - VkImageLayout m_currentImageLayout; VkImage m_textureImage; VkDeviceMemory m_textureDeviceMem; VkImageView m_textureImageView; VkSampler m_textureSampler; + VkImageLayout m_currentImageLayout; }; struct FrameBufferVK