From 71885de27c973a73b7d020f5ebbe86e16b86d7e4 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 18 Mar 2019 18:19:26 -0400 Subject: First pass support for half on vk (#912) * Look at getting half to work on vk. * Alter half test so can always produce consistent test results. * First pass working half on vk. * Improve comments for vulkan extensions around half. * Upgraded vulkan headers to v1.1.103 https://github.com/KhronosGroup/Vulkan-Headers * * Add getFeatures on Render interface * Vulkan renderer determines at startup if it can support half * Parse render-features on render-test * Small changes to half-calc.slang test. * Structured buffer half access works as expected for Vk, but isn't for dx12, so disable for now. * Require the half feature for renderers for the half-structured-buffer.slang test. * * Added ToolReturnCode to be more rigerous about how a return code is passed back from a tool * Added support for a tool being able to pass back an 'ignored' result. * Used enum codes to indicate meanings * Made spawnAndWait return a ToolReturnCode * Ignore tests that don't have required render-feature * Fix macro line continuation usage. * Check dx12 has half support. * Checking for half on dx12 - if CheckFeatureSupport fails, don't fail renderer initialization. * Fix typo. --- tools/gfx/render-d3d12.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tools/gfx/render-d3d12.cpp') diff --git a/tools/gfx/render-d3d12.cpp b/tools/gfx/render-d3d12.cpp index 0b611a219..5483e7e4b 100644 --- a/tools/gfx/render-d3d12.cpp +++ b/tools/gfx/render-d3d12.cpp @@ -55,6 +55,7 @@ class D3D12Renderer : public Renderer public: // Renderer implementation virtual SlangResult initialize(const Desc& desc, void* inWindowHandle) override; + virtual const List& getFeatures() override { return m_features; } virtual void setClearColor(const float color[4]) override; virtual void clearFrame() override; virtual void presentFrame() override; @@ -571,6 +572,8 @@ protected: PFN_D3D12_SERIALIZE_ROOT_SIGNATURE m_D3D12SerializeRootSignature = nullptr; HWND m_hwnd = nullptr; + + List m_features; }; Renderer* createD3D12Renderer() @@ -1397,6 +1400,8 @@ Result D3D12Renderer::initialize(const Desc& desc, void* inWindowHandle) return SLANG_FAIL; } + + FlagCombiner combiner; // TODO: we should probably provide a command-line option // to override UseDebug of default rather than leave it @@ -1426,6 +1431,22 @@ Result D3D12Renderer::initialize(const Desc& desc, void* inWindowHandle) return SLANG_FAIL; } + // Find what features are supported + { + // Check this is how this is laid out... + SLANG_COMPILE_TIME_ASSERT(D3D_SHADER_MODEL_6_0 == 0x60); + + D3D12_FEATURE_DATA_SHADER_MODEL featureShaderMode; + featureShaderMode.HighestShaderModel = D3D_SHADER_MODEL(0x62); + + if (SLANG_SUCCEEDED(m_device->CheckFeatureSupport(D3D12_FEATURE_SHADER_MODEL, &featureShaderMode, sizeof(featureShaderMode))) && + featureShaderMode.HighestShaderModel >= 0x62) + { + // With sm_6_2 we have half + m_features.Add("half"); + } + } + m_numRenderFrames = 3; m_numRenderTargets = 2; -- cgit v1.2.3