Skip to content

Commit 97cdf33

Browse files
committed
Update bgfx.
1 parent c32f6eb commit 97cdf33

File tree

6 files changed

+151
-132
lines changed

6 files changed

+151
-132
lines changed

bin/shaderc.exe

124 KB
Binary file not shown.

code/bgfx/src/config.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,23 @@
6363
? 1 : 0)
6464
# endif // BGFX_CONFIG_RENDERER_NVN
6565

66+
# ifndef BGFX_CONFIG_RENDERER_OPENGL_MIN_VERSION
67+
# define BGFX_CONFIG_RENDERER_OPENGL_MIN_VERSION 1
68+
# endif // BGFX_CONFIG_RENDERER_OPENGL_MIN_VERSION
69+
6670
# ifndef BGFX_CONFIG_RENDERER_OPENGL
6771
# define BGFX_CONFIG_RENDERER_OPENGL (0 \
6872
|| BX_PLATFORM_BSD \
6973
|| BX_PLATFORM_LINUX \
7074
|| BX_PLATFORM_OSX \
7175
|| BX_PLATFORM_WINDOWS \
72-
? 1 : 0)
76+
? BGFX_CONFIG_RENDERER_OPENGL_MIN_VERSION : 0)
7377
# endif // BGFX_CONFIG_RENDERER_OPENGL
7478

79+
# ifndef BGFX_CONFIG_RENDERER_OPENGLES_MIN_VERSION
80+
# define BGFX_CONFIG_RENDERER_OPENGLES_MIN_VERSION 1
81+
# endif // BGFX_CONFIG_RENDERER_OPENGLES_MIN_VERSION
82+
7583
# ifndef BGFX_CONFIG_RENDERER_OPENGLES
7684
# define BGFX_CONFIG_RENDERER_OPENGLES (0 \
7785
|| BX_PLATFORM_ANDROID \
@@ -80,7 +88,7 @@
8088
|| BX_PLATFORM_RPI \
8189
|| BX_PLATFORM_STEAMLINK \
8290
|| BX_PLATFORM_NX \
83-
? 1 : 0)
91+
? BGFX_CONFIG_RENDERER_OPENGLES_MIN_VERSION : 0)
8492
# endif // BGFX_CONFIG_RENDERER_OPENGLES
8593

8694
# ifndef BGFX_CONFIG_RENDERER_VULKAN

code/bgfx/src/renderer_mtl.mm

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3069,10 +3069,15 @@ void writeString(bx::WriterI* _writer, const char* _str)
30693069
void SwapChainMtl::resize(FrameBufferMtl &_frameBuffer, uint32_t _width, uint32_t _height, uint32_t _flags)
30703070
{
30713071
const int32_t sampleCount = s_msaa[(_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT];
3072-
3073-
#if BX_PLATFORM_OSX > 101300
3074-
m_metalLayer.displaySyncEnabled = 0 != (_flags&BGFX_RESET_VSYNC);
3075-
#endif // BX_PLATFORM_OSX > 101300
3072+
3073+
#if BX_PLATFORM_OSX
3074+
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
3075+
if (@available(macOS 10.13, *))
3076+
{
3077+
m_metalLayer.displaySyncEnabled = 0 != (_flags&BGFX_RESET_VSYNC);
3078+
}
3079+
#endif // __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
3080+
#endif // BX_PLATFORM_OSX
30763081

30773082
m_metalLayer.drawableSize = CGSizeMake(_width, _height);
30783083
m_metalLayer.pixelFormat = (_flags & BGFX_RESET_SRGB_BACKBUFFER)

code/bgfx/src/renderer_vk.cpp

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,9 +1377,18 @@ VK_IMPORT_INSTANCE
13771377
g_caps.deviceId = uint16_t(m_deviceProperties.deviceID);
13781378

13791379
g_caps.supported |= ( 0
1380-
| BGFX_CAPS_TEXTURE_BLIT
1380+
| BGFX_CAPS_ALPHA_TO_COVERAGE
1381+
| BGFX_CAPS_BLEND_INDEPENDENT
1382+
| BGFX_CAPS_COMPUTE
13811383
| BGFX_CAPS_DRAW_INDIRECT
1384+
| BGFX_CAPS_FRAGMENT_DEPTH
13821385
| BGFX_CAPS_INSTANCING
1386+
| BGFX_CAPS_TEXTURE_3D
1387+
| BGFX_CAPS_TEXTURE_BLIT
1388+
| BGFX_CAPS_TEXTURE_COMPARE_ALL
1389+
| BGFX_CAPS_VERTEX_ATTRIB_HALF
1390+
| BGFX_CAPS_VERTEX_ATTRIB_UINT10
1391+
| BGFX_CAPS_VERTEX_ID
13831392
);
13841393
g_caps.limits.maxTextureSize = m_deviceProperties.limits.maxImageDimension2D;
13851394
g_caps.limits.maxFBAttachments = bx::min(uint8_t(m_deviceProperties.limits.maxFragmentOutputAttachments), uint8_t(BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS) );
@@ -2301,20 +2310,17 @@ VK_IMPORT_DEVICE
23012310
pi.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
23022311
pi.pNext = NULL;
23032312
pi.waitSemaphoreCount = 0;
2304-
pi.pWaitSemaphores = NULL; //&m_presentDone[0];
2313+
pi.pWaitSemaphores = NULL;
23052314
pi.swapchainCount = 1;
23062315
pi.pSwapchains = &m_swapchain;
23072316
pi.pImageIndices = &m_backBufferColorIdx;
23082317
pi.pResults = NULL;
23092318
VkResult result = vkQueuePresentKHR(m_queueGraphics, &pi);
2310-
if (VK_ERROR_OUT_OF_DATE_KHR == result || VK_SUBOPTIMAL_KHR == result)
2319+
if (VK_ERROR_OUT_OF_DATE_KHR == result
2320+
|| VK_SUBOPTIMAL_KHR == result)
23112321
{
23122322
m_needToRefreshSwapchain = true;
23132323
}
2314-
else
2315-
{
2316-
VK_CHECK(result);
2317-
}
23182324
}
23192325
}
23202326

@@ -2613,13 +2619,14 @@ VK_IMPORT_DEVICE
26132619
uint32_t samplerFlags = (uint32_t)(texture.m_flags & BGFX_SAMPLER_BITS_MASK);
26142620
VkSampler sampler = getSampler(samplerFlags, 1);
26152621

2622+
const uint32_t size = bx::strideAlign(program.m_vsh->m_size, align);
26162623
uint32_t bufferOffset = scratchBuffer.m_pos;
26172624
VkDescriptorBufferInfo bufferInfo;
26182625
bufferInfo.buffer = scratchBuffer.m_buffer;
26192626
bufferInfo.offset = 0;
2620-
bufferInfo.range = bx::strideAlign(program.m_vsh->m_size, align);
2627+
bufferInfo.range = size;
26212628
bx::memCopy(&scratchBuffer.m_data[scratchBuffer.m_pos], m_vsScratch, program.m_vsh->m_size);
2622-
scratchBuffer.m_pos += bufferInfo.range;
2629+
scratchBuffer.m_pos += size;
26232630

26242631
VkWriteDescriptorSet wds[3];
26252632
wds[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
@@ -5461,7 +5468,7 @@ VK_DESTROY
54615468
void* directAccessPtr = NULL;
54625469
VK_CHECK(vkBindBufferMemory(device, stagingBuffer, stagingDeviceMem, 0));
54635470
VK_CHECK(vkMapMemory(device, stagingDeviceMem, 0, ma.allocationSize, 0, (void**)&directAccessPtr));
5464-
bx::memCopy(directAccessPtr, _mem->data, bci.size);
5471+
bx::memCopy(directAccessPtr, _mem->data, size_t(bci.size));
54655472
vkUnmapMemory(device, stagingDeviceMem);
54665473

54675474
const uint32_t bpp = bimg::getBitsPerPixel(bimg::TextureFormat::Enum(m_textureFormat) );
@@ -5710,7 +5717,7 @@ VK_DESTROY
57105717
uint8_t primIndex = uint8_t(primType >> BGFX_STATE_PT_SHIFT);
57115718
PrimInfo prim = s_primInfo[primIndex];
57125719

5713-
bool wasCompute = false;
5720+
bool wasCompute = false;
57145721
bool viewHasScissor = false;
57155722
bool restoreScissor = false;
57165723
Rect viewScissorRect;
@@ -5726,22 +5733,21 @@ VK_DESTROY
57265733
uint32_t statsKeyType[2] = {};
57275734

57285735
VkSemaphore renderWait = m_presentDone[m_backBufferColorIdx];
5729-
VkResult result = vkAcquireNextImageKHR(m_device
5730-
, m_swapchain
5731-
, UINT64_MAX
5732-
, renderWait
5733-
, VK_NULL_HANDLE
5734-
, &m_backBufferColorIdx
5735-
);
5736-
if (VK_ERROR_OUT_OF_DATE_KHR == result || VK_SUBOPTIMAL_KHR == result)
5736+
VkResult result = vkAcquireNextImageKHR(
5737+
m_device
5738+
, m_swapchain
5739+
, UINT64_MAX
5740+
, renderWait
5741+
, VK_NULL_HANDLE
5742+
, &m_backBufferColorIdx
5743+
);
5744+
5745+
if (VK_ERROR_OUT_OF_DATE_KHR == result
5746+
|| VK_SUBOPTIMAL_KHR == result)
57375747
{
57385748
m_needToRefreshSwapchain = true;
57395749
return;
57405750
}
5741-
else
5742-
{
5743-
VK_CHECK(result);
5744-
}
57455751

57465752
// const uint64_t f0 = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_FACTOR, BGFX_STATE_BLEND_FACTOR);
57475753
// const uint64_t f1 = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_INV_FACTOR, BGFX_STATE_BLEND_INV_FACTOR);

0 commit comments

Comments
 (0)