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 DXVK profiles to express Vulkan requirements #2826

Merged
merged 1 commit into from
Aug 30, 2022

Conversation

christophe-lunarg
Copy link
Contributor

I created a Vulkan profiles JSON file to express DXVK minimum requirements for each D3D level. This JSON files are defined by Vulkan Profiles schemas avaiable here and can be used as part of the Vulkan SDK Profiles Toolset. (PDF, Presentation)

I based myself on https://github.com/doitsujin/dxvk/wiki/Driver-support but it would certainly be necessary to validate that my interpretation is correct.

This Vulkan profiles JSON file could help users of the project to track new requirements. For the case of IHVs, it will allows them to prioritize implementing new features and for ISVs it will help them to figure out the ecosystem of devices where the project versions could run.

Further use of this file could be to express future requirements by adding "roadmap" profiles or "optimal" profiles to express the requirement for the best level of performance with DXVK.

Finally, having these information baked into this file allows some level of automation to the users of the projects and make sure that each revision of the project comes the corresponding explicit set of Vulkan requirements.

I am creating this PR first for the purpose of discussion and evaluate whether you could be interested by such features.

@christophe-lunarg
Copy link
Contributor Author

I also created a file for DXVK 1.10.3 which could be useful to express the different is term of requirements with master. Maybe this could be part of a 1.10.4 release?

{
    "$schema": "https://schema.khronos.org/vulkan/profiles-0.8.0-106.json#",
    "capabilities": {
        "vulkan10requirements": {
            "features": {
                "VkPhysicalDeviceFeatures": {
                    "robustBufferAccess": true
                }
            }
        },
        "vulkan11requirements": {
            "extensions": {
                "VK_KHR_16bit_storage": 1,
                "VK_KHR_bind_memory2": 1,
                "VK_KHR_dedicated_allocation": 1,
                "VK_KHR_descriptor_update_template": 1,
                "VK_KHR_device_group": 1,
                "VK_KHR_device_group_creation": 1,
                "VK_KHR_external_fence": 1,
                "VK_KHR_external_fence_capabilities": 1,
                "VK_KHR_external_memory": 1,
                "VK_KHR_external_memory_capabilities": 1,
                "VK_KHR_external_semaphore": 1,
                "VK_KHR_external_semaphore_capabilities": 1,
                "VK_KHR_get_memory_requirements2": 1,
                "VK_KHR_get_physical_device_properties2": 1,
                "VK_KHR_maintenance1": 1,
                "VK_KHR_maintenance2": 1,
                "VK_KHR_maintenance3": 1,
                "VK_KHR_multiview": 1,
                "VK_KHR_relaxed_block_layout": 1,
                "VK_KHR_sampler_ycbcr_conversion": 1,
                "VK_KHR_shader_draw_parameters": 1,
                "VK_KHR_storage_buffer_storage_class": 1,
                "VK_KHR_variable_pointers": 1
            },
            "features": {
                "VkPhysicalDeviceMultiviewFeatures": {
                    "multiview": true
                }
            },
            "properties": {
                "VkPhysicalDeviceMultiviewProperties": {
                    "maxMultiviewViewCount": 6,
                    "maxMultiviewInstanceIndex": 134217727
                }
            }
        },
        "level9": {
            "extensions": {
                "VK_EXT_transform_feedback": 1
            },
            "features": {
                "VkPhysicalDeviceFeatures": {
                	"geometryShader": true,
                    "robustBufferAccess": true,
                    "shaderStorageImageWriteWithoutFormat": true,
                    "depthClamp": true,
                    "depthBiasClamp": true,
                    "fillModeNonSolid": true,
                    "pipelineStatisticsQuery": true,
                    "sampleRateShading": true,
                    "shaderClipDistance": true,
                    "shaderCullDistance": true,
                    "textureCompressionBC": true,
                    "occlusionQueryPrecise": true,
                    "independentBlend": true,
                    "multiViewport": true,
                    "fullDrawIndexUint32": true,
                    "shaderImageGatherExtended": true
                },
                "VkPhysicalDeviceShaderDrawParametersFeatures": {
                    "shaderDrawParameters": true
                },
                "VkPhysicalDeviceTransformFeedbackFeaturesEXT": {
                    "transformFeedback": true,
                    "geometryStreams": true
                }
            }
        },
        "level10_1": {
            "features": {
                "VkPhysicalDeviceFeatures": {
                    "dualSrcBlend": true,
                    "imageCubeArray": true
                }
            }
        },
        "level11_0": {
            "features": {
                "VkPhysicalDeviceFeatures": {
                    "drawIndirectFirstInstance": true,
                    "fragmentStoresAndAtomics": true,
                    "multiDrawIndirect": true,
                    "tessellationShader": true
                }
            }
        },
        "level11_1": {
            "features": {
                "VkPhysicalDeviceFeatures": {
                    "logicOp": true,
                    "variableMultisampleRate": true,
                    "vertexPipelineStoresAndAtomics": true
                }
            }
        }
    },
    "profiles": {
        "VP_DXVK_level9_baseline": {
            "version": 1,
            "api-version": "1.1.106",
            "label": "DXVK minimum requirements profile",
            "description": "DXVK minimum requirements",
            "contributors": {
                "Christophe Riccio": {
                    "company": "LunarG",
                    "email": "christophe@lunarg.com",
                    "contact": true
                }
            },
            "history": [
                {
                    "revision": 1,
                    "date": "2021-12-08",
                    "author": "Christophe Riccio",
                    "comment": "Initial revision"
                }
            ],
            "capabilities": [
                "vulkan10requirements",
                "vulkan11requirements",
                "level9"
            ]
        },
        "VP_DXVK_level10_1_baseline": {
            "version": 1,
            "api-version": "1.1.106",
            "label": "DXVK feature level 10.1 profile",
            "description": "DXVK requirements for feature level 10.1",
            "contributors": {
                "Christophe Riccio": {
                    "company": "LunarG",
                    "email": "christophe@lunarg.com",
                    "contact": true
                }
            },
            "history": [
                {
                    "revision": 1,
                    "date": "2022-03-09",
                    "author": "Christophe Riccio",
                    "comment": "Initial revision"
                }
            ],
            "capabilities": [
                "vulkan10requirements",
                "vulkan11requirements",
                "level9",
                "level10_1"
            ]
        },
        "VP_DXVK_level11_0_baseline": {
            "version": 1,
            "api-version": "1.1.106",
            "label": "DXVK feature level 11.0 profile",
            "description": "DXVK requirements for feature level 11.0",
            "contributors": {
                "Christophe Riccio": {
                    "company": "LunarG",
                    "email": "christophe@lunarg.com",
                    "contact": true
                }
            },
            "history": [
                {
                    "revision": 1,
                    "date": "2022-03-09",
                    "author": "Christophe Riccio",
                    "comment": "Initial revision"
                }
            ],
            "capabilities": [
                "vulkan10requirements",
                "vulkan11requirements",
                "level9",
                "level10_1",
                "level11_0"
            ]
        },
        "VP_DXVK_level11_1_baseline": {
            "version": 1,
            "api-version": "1.1.106",
            "label": "DXVK feature level 11.1 profile",
            "description": "DXVK requirements for feature level 11.1",
            "contributors": {
                "Christophe Riccio": {
                    "company": "LunarG",
                    "email": "christophe@lunarg.com",
                    "contact": true
                }
            },
            "history": [
                {
                    "revision": 1,
                    "date": "2022-03-09",
                    "author": "Christophe Riccio",
                    "comment": "Initial revision"
                }
            ],
            "capabilities": [
                "vulkan10requirements",
                "vulkan11requirements",
                "level9",
                "level10_1",
                "level11_0",
                "level11_1"
            ]
        }
    }
}

},
"features": {
"VkPhysicalDeviceFeatures": {
"geometryShader": true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

indentation

@misyltoad
Copy link
Collaborator

Looks like samplerMirrorClampToEdge is missing and maybe more.

I would check against the GetDeviceFeatures functions instead.

@misyltoad
Copy link
Collaborator

I am also not super sure how one would express optional features with this.

eg. in your profile shaderDemoteToHelperInvocation is marked as true, but it is not actually required, we only use that if it is supported.

VP_DXVK_baseline.json Outdated Show resolved Hide resolved
VP_DXVK_baseline.json Outdated Show resolved Hide resolved
@doitsujin
Copy link
Owner

If this is useful for people then sure, why not. Seems easy enough for us to maintain.

See Josh's concerns about the extension lists though, since we really don't need any of the promoted extensions unless we explicitly enable the corresponding device features.

I also created a file for DXVK 1.10.3 which could be useful to express the different is term of requirements with master. Maybe this could be part of a 1.10.4 release?

We don't plan to make another 1.x release.

@christophe-lunarg
Copy link
Contributor Author

I am looking at the GetDeviceFeatures function to figure out the actual requirements

@christophe-lunarg
Copy link
Contributor Author

Note that if you are interested into that, we have a Python script that convert the JSON file into .cpp/.h code. This could be used for you initialization code and to ensure that the JSON files always match the source.

@misyltoad
Copy link
Collaborator

Note that if you are interested into that, we have a Python script that convert the JSON file into .cpp/.h code. This could be used for you initialization code and to ensure that the JSON files always match the source.

How would we encode optional features with this?

@christophe-lunarg
Copy link
Contributor Author

I am editing the level9 profile to give you an idea and pushing it when it's done... (in few minutes)

@christophe-lunarg
Copy link
Contributor Author

christophe-lunarg commented Aug 16, 2022

I updated VP_DXVK_level9_baseline and added VP_DXVK_level9_optional but I must admit that it's far from ideal.

VP_DXVK_level9_baseline could used trivially with the Vulkan Profiles Library using:

    const VpProfileProperties profile = {`VP_DXVK_level9_baseline, 1};

    VkDeviceCreateInfo info = {};
    info.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
    info.pNext = nullptr;
    info.queueCreateInfoCount = 1;
    info.pQueueCreateInfos = &scaffold->queueCreateInfo;
    info.enabledExtensionCount = 0;
    info.ppEnabledExtensionNames = nullptr;
    info.pEnabledFeatures = nullptr;

    VpDeviceCreateInfo profileInfo = {};
    profileInfo.pCreateInfo = &info;
    profileInfo.pProfile = &profile;

    VkDevice device = VK_NULL_HANDLE;
    VkResult res = vpCreateDevice(scaffold->physicalDevice, &profileInfo, nullptr, &device);

But sadly, doing the same with VP_DXVK_level9_optional would not result in the same behavior as in the project code. I am guessing that using the reflexion API of the Vulkan Profiles Library, it should be possible to end up with the same behavior but that would be pretty cumbersome...

I think ideally, we need something like:

        "VP_DXVK_level9_baseline": {
            "version": 1,
            "api-version": "1.3.204",
            "label": "DXVK D3D9 Baseline profile",
            "description": "DXVK for D3D9 minimum requirements",
            "contributors": {
                "Christophe Riccio": {
                    "company": "LunarG",
                    "email": "christophe@lunarg.com",
                    "contact": true
                }
            },
            "history": [
                {
                    "revision": 1,
                    "date": "2022-08-10",
                    "author": "Christophe Riccio",
                    "comment": "Initial revision"
                }
            ],
            "capabilities": [
                "vulkan10requirements",
                "vulkan11requirements",
                "vulkan12requirements",
                "vulkan13requirements",
                "level9"
            ],
            "optionals": [
                "level9_optional"
            ]
        },

@christophe-lunarg
Copy link
Contributor Author

I could only find GetDeviceFeatures in D3D9 and D3D11 directories. How does it work with D3D10?

@doitsujin
Copy link
Owner

doitsujin commented Aug 16, 2022

D3D10 is identical to D3D11 FL10_0 or FL10_1 respectively. Our implementation is just a thin wrapper around D3D11.

@christophe-lunarg
Copy link
Contributor Author

I separated D3D9 and D3D11 (and 10 then) into two different profiles files has there are not necessarilly requiring the same features. Let me know what you think.

@misyltoad
Copy link
Collaborator

I would personally prefer if this was one json rather than two, I don't see why we need two.

@christophe-lunarg
Copy link
Contributor Author

Ok, I'll make only one.

@doitsujin
Copy link
Owner

doitsujin commented Aug 17, 2022

I think the whole D3D11 feature level stuff could also be stripped down. Feature levels below 11_0 have next to no practical relevance nowadays, and I'm thinking we could have something like this as profiles:

  • D3D9 baseline
  • D3D9 optimal
  • maybe D3D10 FL10_1 baseline for the handful of D3D10 apps out there (it's really not many)
  • D3D11 FL11_0 baseline
  • D3D11 FL11_1 baseline
  • D3D11 FL11_1 optimal (all hardware that DXVK can currently run on supports this on Windows)

@christophe-lunarg
Copy link
Contributor Author

christophe-lunarg commented Aug 22, 2022

Thanks for all the feedback!

I merged back the profiles in a single file. The D3D9 and D3D11 sections remain separated in a way because the requirements expressed in the code actually diverge.

I also followed the profiles suggested by @doitsujin but note that I originally followed the project source which effectively expressed fine grain granularity of feature levels down to feature level 9. But if it's what makes sense to you, I am fine with it!

Any more feedback ?

@christophe-lunarg christophe-lunarg changed the title Add DXVK baseline profile to express Vulkan min requirements Add DXVK baseline profile to express Vulkan requirements Aug 22, 2022
@christophe-lunarg christophe-lunarg changed the title Add DXVK baseline profile to express Vulkan requirements Add DXVK profiles to express Vulkan requirements Aug 22, 2022
"description": "DXVK for D3D9 minimum requirements",
"contributors": {
"Philip Rebohle": {
"company": "DXVK"
Copy link
Owner

Choose a reason for hiding this comment

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

This should really say Valve for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll update tomorrow, thanks.

@doitsujin
Copy link
Owner

doitsujin commented Aug 22, 2022

Just a nit.

One question: I'm currently implementing missing bits to support Feature Level 12_0, and we will require certain device properties (rather than just device features) to have specific values in order to expose that. Can the profiles express this?

As an example, we'd want residencyStandard2DBlockShape to be VK_TRUE but residencyAlignedMipSize to be VK_FALSE.

@christophe-lunarg
Copy link
Contributor Author

Just a nit.

One question: I'm currently implementing missing bits to support Feature Level 12_0, and we will require certain device properties (rather than just device features) to have specific values in order to expose that. Can the profiles express this?

As an example, we'd want residencyStandard2DBlockShape to be VK_TRUE but residencyAlignedMipSize to be VK_FALSE.

Yes all properties are supported but also formats if that's useful to you. I'll create tomorrow a capability JSON block for level12 without the corresponding profile just to show you.

@misyltoad
Copy link
Collaborator

shaderDemoteToHelperInvocation is listed as optional but this is required for Vulkan 1.3 which we use.

@christophe-lunarg
Copy link
Contributor Author

Regarding shaderDemoteToHelperInvocation
I would suggest to replace:

enabled.vk13.shaderDemoteToHelperInvocation                   = supported.vk13.shaderDemoteToHelperInvocation;

By:

enabled.vk13.shaderDemoteToHelperInvocation = VK_TRUE;

To match the Vulkan 1.3 requirement.

I updated the profiles file accordingly.

@christophe-lunarg
Copy link
Contributor Author

@doitsujin such for d3d11_level12_0 in the JSON file to find the VkPhysicalDeviceSparseProperties example.

The block is never referenced in a profile so it can remain here as WIP doc without affecting the definision of the DXVK profiles / requirements.

@christophe-lunarg
Copy link
Contributor Author

@Joshua-Ashton, @doitsujin Anything missing to approve this PR?

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.

4 participants