Mercurial > games > semicongine
changeset 1452:8125d5b0c68c
add: some support for 16-bit data access in shaders, and a check
author | sam <sam@basx.dev> |
---|---|
date | Sun, 16 Mar 2025 22:08:10 +0700 |
parents | e88f4e544f76 |
children | 60a709362440 |
files | semicongine/rendering.nim semicongine/rendering/shaders.nim |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/semicongine/rendering.nim Wed Mar 12 22:18:38 2025 +0700 +++ b/semicongine/rendering.nim Sun Mar 16 22:08:10 2025 +0700 @@ -158,6 +158,14 @@ let enabledFeatures = VkPhysicalDeviceFeatures( fillModeNonSolid: true, depthClamp: true, wideLines: true, largePoints: true ) + + var vk16bitExt = VkPhysicalDevice16BitStorageFeatures( + sType: VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES, + storageBuffer16BitAccess: true, + uniformAndStorageBuffer16BitAccess: true, + storagePushConstant16: false, + storageInputOutput16: false, + ) var createDeviceInfo = VkDeviceCreateInfo( sType: VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, queueCreateInfoCount: 1, @@ -167,6 +175,7 @@ enabledExtensionCount: uint32(deviceExtensions.len), ppEnabledExtensionNames: deviceExtensionsC, pEnabledFeatures: addr(enabledFeatures), + pNext: addr(vk16bitExt), ) checkVkResult vkCreateDevice( physicalDevice = result.physicalDevice,
--- a/semicongine/rendering/shaders.nim Wed Mar 12 22:18:38 2025 +0700 +++ b/semicongine/rendering/shaders.nim Sun Mar 16 22:08:10 2025 +0700 @@ -349,6 +349,9 @@ for constFieldName, constFieldValue in fieldPairs(value): assert typeof(constFieldValue) is SupportedGPUType, "push constant field '" & constFieldName & "' is not a SupportedGPUType" + assert not ( + typeof(constFieldValue) is uint16 or typeof(constFieldValue) is int16 + ), "16-bit members are not supported for push constants" pushConstants.add " " & glslType(constFieldValue) & " " & constFieldName & ";" pushConstants.add "} " & fieldname & ";" else: