@@ -1728,6 +1728,7 @@ VK_IMPORT_INSTANCE
17281728 | BGFX_CAPS_TEXTURE_BLIT
17291729 | BGFX_CAPS_TEXTURE_COMPARE_ALL
17301730 | (m_deviceFeatures.imageCubeArray ? BGFX_CAPS_TEXTURE_CUBE_ARRAY : 0 )
1731+ | BGFX_CAPS_TEXTURE_EXTERNAL
17311732 | BGFX_CAPS_TEXTURE_READ_BACK
17321733 | BGFX_CAPS_VERTEX_ATTRIB_HALF
17331734 | BGFX_CAPS_VERTEX_ATTRIB_UINT10
@@ -1742,7 +1743,10 @@ VK_IMPORT_INSTANCE
17421743 | (s_extension[Extension::KHR_fragment_shading_rate ].m_supported ? BGFX_CAPS_VARIABLE_RATE_SHADING : 0 )
17431744 ;
17441745
1745- m_variableRateShadingSupported = s_extension[Extension::KHR_fragment_shading_rate].m_supported ;
1746+ m_variableRateShadingSupported = true
1747+ && s_extension[Extension::KHR_fragment_shading_rate].m_supported
1748+ && NULL != vkCmdSetFragmentShadingRateKHR
1749+ ;
17461750
17471751 const uint32_t maxAttachments = bx::min<uint32_t >(
17481752 m_deviceProperties.limits .maxFragmentOutputAttachments
@@ -1899,6 +1903,12 @@ VK_IMPORT_INSTANCE
18991903 }
19001904 }
19011905
1906+ if (NULL != g_platformData.context )
1907+ {
1908+ m_device =
1909+ m_externalDevice = (VkDevice)g_platformData.context ;
1910+ }
1911+ else
19021912 {
19031913 uint32_t numEnabledLayers = 0 ;
19041914 const char * enabledLayer[Layer::Count];
@@ -2327,7 +2337,16 @@ VK_IMPORT_DEVICE
23272337 vkDestroy (m_descriptorPool[ii]);
23282338 }
23292339
2330- vkDestroyDevice (m_device, m_allocatorCb);
2340+ if (NULL != m_externalDevice)
2341+ {
2342+ m_externalDevice = NULL ;
2343+ m_device = NULL ;
2344+ }
2345+ else
2346+ {
2347+ vkDestroyDevice (m_device, m_allocatorCb);
2348+ m_device = NULL ;
2349+ }
23312350
23322351 if (VK_NULL_HANDLE != m_debugReportCallback)
23332352 {
@@ -4703,6 +4722,7 @@ VK_IMPORT_DEVICE
47034722 VkCommandBuffer m_commandBuffer;
47044723
47054724 VkDevice m_device;
4725+ VkDevice m_externalDevice;
47064726 uint32_t m_globalQueueFamily;
47074727 VkQueue m_globalQueue;
47084728 VkDescriptorPool m_descriptorPool[BGFX_CONFIG_MAX_FRAME_LATENCY];
@@ -6774,10 +6794,6 @@ VK_DESTROY
67746794 s_renderVK->recycleMemory (stagingBuffer.m_deviceMem );
67756795 }
67766796 }
6777- else
6778- {
6779- setState (_commandBuffer, m_sampledLayout);
6780- }
67816797
67826798 bx::free (g_allocator, bufferCopyInfo);
67836799
@@ -8714,7 +8730,7 @@ VK_DESTROY
87148730
87158731 for (TextureHandle th : m_external)
87168732 {
8717- s_renderVK->m_textures [th.idx ].setState (m_activeCommandBuffer, VK_IMAGE_LAYOUT_UNDEFINED );
8733+ s_renderVK->m_textures [th.idx ].setState (m_activeCommandBuffer, VK_IMAGE_LAYOUT_GENERAL );
87188734 }
87198735
87208736 setMemoryBarrier (
0 commit comments