Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Geometry shaders #1815

Open
wants to merge 134 commits into
base: geometry-shaders
Choose a base branch
from
Open

Conversation

js6i
Copy link
Collaborator

@js6i js6i commented Jan 10, 2023

Works in some cases.

@@ -304,7 +304,7 @@ if [ ! "$SPIRV_CROSS_ROOT" = "" ]; then
rm -rf ${REPO_NAME}
ln -sfn ${SPIRV_CROSS_ROOT} ${REPO_NAME}
else
REPO_URL="https://github.com/KhronosGroup/${REPO_NAME}.git"
REPO_URL="https://github.com/js6i/${REPO_NAME}.git"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe return KhronosGroup?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the time being He needs to pull from his fork of SPIRV-CROSS a lot of GS work is done there too.

@jakubnavratil
Copy link

Just asking if someone tryied this, does this solve Rocket League nameplates missing bug? Or possibly in future ...

@italomandara
Copy link
Contributor

italomandara commented Mar 10, 2023

Just asking if someone tryied this, does this solve Rocket League nameplates missing bug? Or possibly in future ...

Yes among many other things, like unlocking the entire UE4 game library and much more.

@jakubnavratil
Copy link

Just asking if someone tryied this, does this solve Rocket League nameplates missing bug? Or possibly in future ...

Yes among many other things, like unlocking the entire UE4 game library and much more.

Thats great to hear. I can't imagine how much work this takes, I'm not really into graphical programming, but I hope this can be resolved this year. I will certainly try this on my Air when I have time. Thanks!

@SuddenDeathMP
Copy link

Just asking if someone tryied this, does this solve Rocket League nameplates missing bug? Or possibly in future ...

Yes among many other things, like unlocking the entire UE4 game library and much more.

Did you actually tried to lunch any UE4 game with this branch?

@italomandara
Copy link
Contributor

Just asking if someone tryied this, does this solve Rocket League nameplates missing bug? Or possibly in future ...

Yes among many other things, like unlocking the entire UE4 game library and much more.

Did you actually tried to lunch any UE4 game with this branch?

I did some tests, nothing works yet, this is a work in progress.

italomandara and others added 11 commits April 4, 2023 10:28
…explicit-lod-workaround

Allow to disable Explicit LOD Workaround for Apple silicon.
- Fix memory leak when waiting on timeline semaphores.
- For correctness, set VkPhysicalDeviceLimits::lineWidthGranularity to 1.
- Update MoltenVK to version 1.2.4.
- Update Whats_New.md document with recent changes.
…hore-mem-leak

Several simple maintenance fixes.
- Add MVK_XCODE_14_3 macro to compile for iOS/tvOS 16.4 and above.
- Add support for BC compression on iOS/tvOS 16.4 and above where supported.
- Consolidate MVKPixelFormats::modifyMTLFormatCapabilities(mtlDev)
  and centralize querying MTLDevice format methods for all platforms.
of whitespace in MVKPixelFormats::modifyMTLFormatCapabilities().
…-compression

Support BC compression on iOS/tvOS, where available.
…ated MTLBuffer.

- MVKDevice track VkBuffers marked with VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT.
- Add SPIRVToMSLConversionResultInfo::usesPhysicalStorageBufferAddressesCapability
  to detect and track shaders that use PhysicalStorageBufferAddresses capability,
  and track such shader stages within pipeline.
- MVKResourcesCommandEncoderState encode usage of VkBuffers marked with
  VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT when pipeline uses
  PhysicalStorageBufferAddresses capability.
- Rename MVKResourcesCommandEncoderState::encodeArgumentBufferResourceUsage()
  to encodeResourceUsage().
- MVKDevice move some functions to public scope and remove friend classes.
- MVKDeviceMemory ensure _vkMemAllocFlags is always initialized (unrelated).
- Rename MVKFoundation template method contains() to mvkContains() (unrelated).
Ensure shaders using PhysicalStorageBufferAddresses encode the associated MTLBuffer.
- MVKRenderSubpass add separate getDepthFormat() & getStencilFormat(),
  and isDepthAttachmentUsed() & isStencilAttachmentUsed() and use
  instead of testing pixel format for depth and stencil components.
- Add MVKRenderingAttachmentIterator class to consistently iterate,
  and take actions, on the attachments in VkRenderingInfo to create
  synthetic MVKRenderPass and extract image views and clear colors.
- Remove mvkCreateRenderPass() and mvkCreateFramebuffer() in favor
  of additional constructors, and remove mvkGetDepthStencilFormat() in
  favor of retrieving formats for separate depth and stencil attachments.
- MVKRenderpass constructors reorganize order of adding attachments and
  subpasses, and connecting the two.
- Renmame MVKRenderPassAttachment to MVKAttachmentDescription.
- MVKPipeline reorganize member variables to minimize gaps in content
  and remove unnecessary _isRasterizingDepthStencil member var (unrelated).
@IsaacMarovitz
Copy link

Any updates on this PR? :)

- MVKPipeline validate depth & stencil formats before setting frag shader depth
  and stencil builtins, and before setting formats in MTLRenderPipelineDescriptor.
- MVKCmdClearAttachments always set depth/stencil format if subpass includes
  a depth or stencil attachment, even if they are not being cleared.
- MVKRenderingAttachmentIterator add synthetic attachment if depth or stencil
  attachment is not provided, but image format supports both depth and stencil.
…ess-older-os-fix

Disable pipeline cache compression prior to macOS 10.15 and iOS/tvOS 13.0
- Also rename kMVKCachedColorAttachmentCount to kMVKMaxColorAttachmentCount and
  kMVKCachedViewportScissorCount to kMVKMaxViewportScissorCount and (unrelated)
…ate-depth-stencil

Support separate depth and stencil attachments during dynamic rendering
The VK_MVK_moltenvk extension has never been brought inside Vulkan, and
the functions have never been supported by the Vulkan Loader and Layers.
Most of the functionality has long been replaced by the official
VK_metal_objects extension.

- Remove VK_MVK_moltenvk as an advertised extension.
- Refactor vk_mvk_moltenvk.h header file into separate headers files:
    - mvk_config.h - Valid public config functions
    - mvk_private_api.h - Valid development debugging functions used with care
    - mvk_deprecated_api.h - Formally deprecated functions.
- Retain skeleton vk_mvk_moltenvk.h header file for legacy compatibility only.
- Update documentation and header comments to explain changes.
- MVKInstance reorganize list of entry points for visual clarity (unrelated).
- Fixes to deprecation documentation (unrelated).
- mvkStringsAreEqual() add small performance optimization (unrelated).
…VK_moltenvk-extension

Deprecate the obsolete and non-standard VK_MVK_moltenvk extension.
- Set Metal depth store action to MTLStoreActionDontCare when
  depth attachment exists, but depth component has been swizzled away.
…err-depth-swizzle

Avoid Metal validation warning when depth component swizzled away
- Reinstate VK_MVK_moltenvk extension, but log warning message when it is enabled.
- Add vkGetMoltenVKConfiguration2MVK() and vkSetMoltenVKConfiguration2MVK()
  to set config without passing a dummy VkInstance, and deprecate
  vkGetMoltenVKConfigurationMVK() and vkSetMoltenVKConfigurationMVK().
…extn

Reinstate VK_MVK_moltenvk extension and add simplified config functions.
billhollings and others added 4 commits July 19, 2023 15:30
When compiling tessellation vertex shaders, MVKGraphicsPipeline
pass array of MVKMTLFunction instead of MTLFunctions to retain
MTLFunctions for duration of processing.
…-regression

Fix bad access regression to prematurely-deallocated MTLFunction.
This allows rebuilding without an internet connection and avoids random
build failures on flaky connections.
Don't fetch a submodule if the commit is already known
…devices.

The [MTLDevice sampleTimestamps:gpuTimestamp:] function turns out to be
synchronized with other queue activities, and can block GPU execution
if it is called between MTLCommandBuffer submissions. On non-Apple-Silicon
devices, it was called before and after every vkQueueSubmit() submission,
to track the correlation between GPU and CPU timestamps, and was delaying
the start of GPU work on the next submission (on Apple Silicon, both
CPU & GPU timestamps are specified in nanoseconds, and the call was bypassed).

Move timestamp correlation from vkQueueSubmit() to
vkGetPhysicalDeviceProperties(), where it is used to update
VkPhysicalDeviceLimits::timestampPeriod on non-Apple-Silicon devices.

Delegate MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties2*)
to MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties*), plus
minimize wasted effort if pNext is empty (unrelated).

Move the declaration of several MVKPhysicalDevice member structs to
potentially reduce member spacing (unrelated).
Xcode simulator always requires 256B buffer alignment, even when running
on Apple Silicon. Previously, it was assumed that Apple Silicon would use
it's native 16B buffer alignment.
…c-delay

Fix sync delay between calls to vkQueueSubmit() on non-Apple-Silicon devices.
…lign

Ensure Xcode simulator always uses 256B buffer alignment.
- In MoltenVK Xcode projects, set iOS & tvOS deployment targets to 12.0,
  to avoid warnings while building MoltenVK.
- Add DYLD_LIBRARY_PATH to runcts script, to ensure Vulkan and MoltenVK
  libraries are found during CTS runs.
- Update Whats_New.md and MoltenVK_Runtime_UserGuide.md documents.
Update dependency libraries to match Vulkan SDK 1.3.261.
- Guard against Intel returning zero values for CPU & GPU timestamps.
- Apply lowpass filter on timestampPeriod updates, to avoid wild temporary
  changes, particularly at startup before GPU has been really exercised.
…stampPeriod

Fix VkPhysicalDeviceLimits::timestampPeriod calculations on Intel GPU.
In the rare case where vertex attribute buffers are bound to MVKCommandEncoder,
are not used by first pipeline, but are used by a subsequent pipeline, and no
other bindings are changed, the MVKResourcesCommandEncoderState will not appear
to be dirty to the second pipeline, and the buffer will not be bound to Metal.

When reverting a binding to dirty if it is not used by a pipeline, also revert
the enclosing MVKResourcesCommandEncoderState to dirty state.

Update MoltenVK to version 1.2.6 (unrelated).
…x-attr-buff

Fix rare case where vertex attribute buffers are not bound to Metal.
@alphavector
Copy link

I built libMoltenVK.dylib with @js6i's latest changes and I get the error DX11 feature level 10.0 is required to run the engine.

> xcodebuild -version
Xcode 15.0
Build version 15A240d
> sw_vers
ProductName: macOS
ProductVersion: 14.0
BuildVersion: 23A339

I also replaced MACOSX_DEPLOYMENT_TARGET

diff --git a/ExternalDependencies.xcodeproj/project.pbxproj b/ExternalDependencies.xcodeproj/project.pbxproj
index f92a13b8..6496f6ed 100644
--- a/ExternalDependencies.xcodeproj/project.pbxproj
+++ b/ExternalDependencies.xcodeproj/project.pbxproj
@@ -5407,7 +5407,7 @@
 				GCC_WARN_UNUSED_VARIABLE = NO;
 				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
 				MACH_O_TYPE = staticlib;
-				MACOSX_DEPLOYMENT_TARGET = 10.11;
+				MACOSX_DEPLOYMENT_TARGET = 10.14;
 				SKIP_INSTALL = YES;
 				TVOS_DEPLOYMENT_TARGET = 9.0;
 			};
@@ -5456,7 +5456,7 @@
 				GCC_WARN_UNUSED_VARIABLE = NO;
 				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
 				MACH_O_TYPE = staticlib;
-				MACOSX_DEPLOYMENT_TARGET = 10.11;
+				MACOSX_DEPLOYMENT_TARGET = 10.14;
 				SKIP_INSTALL = YES;
 				TVOS_DEPLOYMENT_TARGET = 9.0;
 				VALIDATE_PRODUCT = YES;
diff --git a/MoltenVK/MoltenVK.xcodeproj/project.pbxproj b/MoltenVK/MoltenVK.xcodeproj/project.pbxproj
index 650a8219..b50158d6 100644
--- a/MoltenVK/MoltenVK.xcodeproj/project.pbxproj
+++ b/MoltenVK/MoltenVK.xcodeproj/project.pbxproj
@@ -1594,7 +1594,7 @@
 				);
 				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
 				MACH_O_TYPE = staticlib;
-				MACOSX_DEPLOYMENT_TARGET = 10.11;
+				MACOSX_DEPLOYMENT_TARGET = 10.14;
 				MTL_ENABLE_DEBUG_INFO = YES;
 				MVK_SKIP_DYLIB = "";
 				"MVK_SKIP_DYLIB[sdk=appletvsimulator*]" = YES;
@@ -1664,7 +1664,7 @@
 				);
 				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
 				MACH_O_TYPE = staticlib;
-				MACOSX_DEPLOYMENT_TARGET = 10.11;
+				MACOSX_DEPLOYMENT_TARGET = 10.14;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				MVK_SKIP_DYLIB = "";
 				"MVK_SKIP_DYLIB[sdk=appletvsimulator*]" = YES;
diff --git a/MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj/project.pbxproj b/MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj/project.pbxproj
index 924a8987..9ddbf11b 100644
--- a/MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj/project.pbxproj
+++ b/MoltenVKShaderConverter/MoltenVKShaderConverter.xcodeproj/project.pbxproj
@@ -632,7 +632,7 @@
 				);
 				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
 				MACH_O_TYPE = staticlib;
-				MACOSX_DEPLOYMENT_TARGET = 10.11;
+				MACOSX_DEPLOYMENT_TARGET = 10.14;
 				PRODUCT_NAME = MoltenVKShaderConverter;
 				SKIP_INSTALL = YES;
 				TVOS_DEPLOYMENT_TARGET = 9.0;
@@ -691,7 +691,7 @@
 				);
 				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
 				MACH_O_TYPE = staticlib;
-				MACOSX_DEPLOYMENT_TARGET = 10.11;
+				MACOSX_DEPLOYMENT_TARGET = 10.14;
 				PRODUCT_NAME = MoltenVKShaderConverter;
 				SKIP_INSTALL = YES;
 				TVOS_DEPLOYMENT_TARGET = 9.0;

Build of the latest release version works

@js6i
Copy link
Collaborator Author

js6i commented Sep 19, 2023

I built libMoltenVK.dylib with @js6i's latest changes and I get the error DX11 feature level 10.0 is required to run the engine.

It's probably missing shaderCullDistance and, if you're running wined3d, pipelineStatisticsQuery features, didn't you apply a hack adding those on top of release to make it work?

@alphavector
Copy link

alphavector commented Sep 20, 2023

I'm using dxvk. I don't think I can to apply any hacks, I'm a regular user who just follows this MR :D. I looked at the game launch logs with version 1.2.3, which I built myself with hacks to properly display shaders instead of black textures and my game runs fine

And used your changes + merged the main branch

I tried to compare the logs, but it's not obvious to me what the difference is and what went wrong

@alphavector
Copy link

I can help with the debug if needed
Or it's worth waiting until this mr is fully ready and it's too early to test anything yet

@stossy11
Copy link

Any News on this pr as if I try to build it I get this error when trying to fetch the dependency "SPIRV-Cross"

fatal: reference is not a tree: 7a1e3e7586b9b10a6286cad912940b7a501e93ea

@italomandara
Copy link
Contributor

Any News on this pr as if I try to build it I get this error when trying to fetch the dependency "SPIRV-Cross"

fatal: reference is not a tree: 7a1e3e7586b9b10a6286cad912940b7a501e93ea

That's because you don't have access to this repo REPO_URL="https://github.com/js6i/${REPO_NAME}.git"
you could do a git remote add

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet