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

Add a project for Vulkan port. #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

vlj
Copy link

@vlj vlj commented Jun 13, 2016

Here is the current state of my Vulkan port. It's based the master branch from may hence the conflicts.
The classic TressFX algorithm is implemented as well as the Shortcut version (but not the deterministic variant). The skinned version is not implemented.
It follows the DX11 interface as much as possible. SRV are replaced with ImageView and d3d context with command Buffer and extra parameters were added to switch between constant buffers (to avoid synchronisation). Since the command buffer creation is left to the user it's possible to run simulation and rendering on separate command buffers and submit them on different queue.
Calling multiple time Asset load/processing is likely not safe since there is no lifetime tracking. I think the API should be extended to free some resources like Mesh or render target without having to release the TressFx object.
I initially write the TressFX algorithm with a single renderpass but I finally use separate passes because I wasn't sure buffer were properly flushed without an explicit barrier. It didn't change performance as far as I can tell so I opted for the safest path.

Performance wise the rendering part is as fast as DX11 code on a HD 7750 and on a geforce card. The simulation is slower : it takes 3ms instead of 1ms on the hd 7750 and even more on the geforce, I will switch to storage buffer instead of image buffer in the compute shader to see if it solves the performance.

Compatibility wise the algorithm works as expected on radeon card. Congrats for the state of your vulkan implementation ! On geforce card using uniform buffer inside a compute shader is hanging the gpu so I had to use storage buffer to store constant data. It didn't change performance on radeon.
There is also a small bug where some random pixels are not drawn, I wonder if it's not an issue with stencil op.

I wrote a very basic viewer using a custom framework here : https://github.com/vlj/YAGF it's the "TressFX.Vulkan" project.

I wrote a small script in python that replaces include and transform spv file into a single precompiled .h file. I still have to figure out how to integrate amd_tressfx_vulkan properly with premake.

@vlj vlj mentioned this pull request Jun 15, 2016
@vlj
Copy link
Author

vlj commented Jun 18, 2016

I updated the PR.
Now it's synced with master and uses premake build script.

I also fixed several bug from previous version : shortcut algorithm doesn't have random black point anymore, tangent computation is now split in a separate compute shader.
Also performance are now even with the DX11 version. It's sub ms in both case.

The PR can be reviewed now I think.

@jstewart-amd
Copy link
Contributor

Thanks, @vlj. We will review this shortly.

@hey-o
Copy link

hey-o commented Aug 19, 2016

Any updates?

@Anteru
Copy link

Anteru commented Aug 19, 2016

I haven't got around to review it yet. Hope is to do get some time next week.

@@ -167,10 +184,18 @@ struct TressFX_HairBlob

struct TressFX_SceneMesh
{
#ifndef VULKAN
Copy link

Choose a reason for hiding this comment

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

Please change this to something like

#if AMD_TRESSFX_VULKAN
#elif AMD_TRESSFX_DIRECT3D11
#else
    #error
#endif

VkResult vr;
// Create the screen quad vertex buffer(use StandardVertex for simplicity)
const StandardVertex screenQuad[6] = {
{XMFLOAT3(-1.0f, -1.0f, 0.0f), XMFLOAT3(0.0f, 0.0f, 0.0f),
Copy link

@Anteru Anteru Aug 29, 2016

Choose a reason for hiding this comment

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

Seems like it would be easier to create a screen-covering triangle: https://anteru.net/blog/2012/03/03/1862/ Doesn't need any buffers to start with!

@Anteru
Copy link

Anteru commented Aug 29, 2016

First of all: Thanks for the contribution! I've looked at the code (haven't actually run or profiled the thing yet) and found a couple of issues - could you please take a look at them?

@vlj
Copy link
Author

vlj commented Jan 1, 2017

Sorry for the delay, I updated the PR following some of your comments. I will break some functions into smaller part later but in the meantime you can have a look at the code.

By the way TressFX currently relies on DirectX11.h for some types, namely UINT and the XMMATRIX/XMVECTOR... however directxmath is available with an open source licence here : https://github.com/Microsoft/DirectXMath
It looks like it's portable which means that including directxmath instead of directx11.h would make tressFX more portable.

@vlj vlj force-pushed the vulkan branch 3 times, most recently from 68d9d2d to 84ff715 Compare January 12, 2017 21:23
* Merge PPLL buffer/image memory allocation if possible.
* Merge thickness, index and triangle index memory allocation.
* Use provided color/depth stencil format for renderpasses.
* Remove fullscreen quad.
* Various code rewriting.
* Add debug marker.
* Stylistic styles.
@Broken1334
Copy link

Any progress?

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.

5 participants