From c0cb0f3760002de7a287767fc907e78a252b71ac Mon Sep 17 00:00:00 2001 From: MikhailGorobets Date: Mon, 27 Apr 2026 18:01:57 +0600 Subject: [PATCH 1/3] Add DrawMeshIndirectAttribs::pMtlAttribs for Metal mesh draw threadgroup sizes (API256017) --- Graphics/GraphicsEngine/interface/APIInfo.h | 2 +- Graphics/GraphicsEngine/interface/DeviceContext.h | 12 ++++++++++-- ReleaseHistory.md | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Graphics/GraphicsEngine/interface/APIInfo.h b/Graphics/GraphicsEngine/interface/APIInfo.h index 6aa6cd2a7..4731f7d9a 100644 --- a/Graphics/GraphicsEngine/interface/APIInfo.h +++ b/Graphics/GraphicsEngine/interface/APIInfo.h @@ -30,7 +30,7 @@ /// \file /// Diligent API information -#define DILIGENT_API_VERSION 256016 +#define DILIGENT_API_VERSION 256017 #include "../../../Primitives/interface/BasicTypes.h" diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h index 31b4e9543..515d004d4 100644 --- a/Graphics/GraphicsEngine/interface/DeviceContext.h +++ b/Graphics/GraphicsEngine/interface/DeviceContext.h @@ -714,6 +714,12 @@ struct DrawMeshIndirectAttribs /// When pCounterBuffer is not null, state transition mode for the count buffer. RESOURCE_STATE_TRANSITION_MODE CounterBufferStateTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE); + /// Metal-specific mesh draw command attributes. + /// + /// \remarks + /// This member is only used by Metal backend and is ignored by others. + const DrawMeshAttribsMtl* pMtlAttribs DEFAULT_INITIALIZER(nullptr); + #if DILIGENT_CPP_INTERFACE /// Initializes the structure members with default values constexpr DrawMeshIndirectAttribs() noexcept {} @@ -726,7 +732,8 @@ struct DrawMeshIndirectAttribs RESOURCE_STATE_TRANSITION_MODE _AttribsBufferStateTransitionMode = DrawMeshIndirectAttribs{}.AttribsBufferStateTransitionMode, IBuffer* _pCounterBuffer = DrawMeshIndirectAttribs{}.pCounterBuffer, Uint64 _CounterOffset = DrawMeshIndirectAttribs{}.CounterOffset, - RESOURCE_STATE_TRANSITION_MODE _CounterBufferStateTransitionMode = DrawMeshIndirectAttribs{}.CounterBufferStateTransitionMode) noexcept : + RESOURCE_STATE_TRANSITION_MODE _CounterBufferStateTransitionMode = DrawMeshIndirectAttribs{}.CounterBufferStateTransitionMode, + const DrawMeshAttribsMtl* _pMtlAttribs = DrawMeshIndirectAttribs{}.pMtlAttribs) noexcept : pAttribsBuffer {_pAttribsBuffer }, DrawArgsOffset {_DrawArgsOffset }, Flags {_Flags }, @@ -734,7 +741,8 @@ struct DrawMeshIndirectAttribs AttribsBufferStateTransitionMode{_AttribsBufferStateTransitionMode}, pCounterBuffer {_pCounterBuffer }, CounterOffset {_CounterOffset }, - CounterBufferStateTransitionMode{_CounterBufferStateTransitionMode} + CounterBufferStateTransitionMode{_CounterBufferStateTransitionMode}, + pMtlAttribs {_pMtlAttribs } {} #endif }; diff --git a/ReleaseHistory.md b/ReleaseHistory.md index 83dae9f90..f307ca23a 100644 --- a/ReleaseHistory.md +++ b/ReleaseHistory.md @@ -2,6 +2,8 @@ ## Current progress +* Added `DrawMeshIndirectAttribs::pMtlAttribs` member (API256017) + * `DrawMeshIndirectAttribs::pMtlAttribs` allows specifying Metal object and mesh thread group sizes for `IDeviceContext::DrawMeshIndirect()` * Added `DrawMeshAttribsMtl` struct and `DrawMeshAttribs::pMtlAttribs` member (API256016) * `DrawMeshAttribsMtl` allows specifying Metal object and mesh thread group sizes for `IDeviceContext::DrawMesh()` * Added `TextureUpdateOffsetAlignment` and `TextureUpdateStrideAlignment` members to `BufferProperties` struct (API256015) From a00a3b8533c1d53c6c5d5924de58434311c722fd Mon Sep 17 00:00:00 2001 From: MikhailGorobets Date: Mon, 27 Apr 2026 18:02:02 +0600 Subject: [PATCH 2/3] Tests: Add native MSL mesh shader tests --- .../src/MeshShaderTest.cpp | 323 ++++++++++++++++++ 1 file changed, 323 insertions(+) diff --git a/Tests/DiligentCoreAPITest/src/MeshShaderTest.cpp b/Tests/DiligentCoreAPITest/src/MeshShaderTest.cpp index 18f32aa5f..855c932c5 100644 --- a/Tests/DiligentCoreAPITest/src/MeshShaderTest.cpp +++ b/Tests/DiligentCoreAPITest/src/MeshShaderTest.cpp @@ -31,6 +31,7 @@ #include "gtest/gtest.h" #include "InlineShaders/MeshShaderTestHLSL.h" +#include "InlineShaders/MeshShaderTestMSL.h" namespace Diligent { @@ -576,4 +577,326 @@ TEST(MeshShaderTest, DrawTrisWithAmplificationShader) pSwapChain->Present(); } + +TEST(MeshShaderTest, DrawTriangle_MSL) +{ + auto* pEnv = GPUTestingEnvironment::GetInstance(); + auto* pDevice = pEnv->GetDevice(); + const auto& deviceInfo = pDevice->GetDeviceInfo(); + if (!deviceInfo.IsMetalDevice()) + { + GTEST_SKIP() << "MSL is only supported in Metal"; + } + if (!deviceInfo.Features.MeshShaders) + { + GTEST_SKIP() << "Mesh shader is not supported by this device"; + } + + GPUTestingEnvironment::ScopedReset EnvironmentAutoReset; + + auto* pSwapChain = pEnv->GetSwapChain(); + auto* pContext = pEnv->GetDeviceContext(); + + RefCntAutoPtr pTestingSwapChain(pSwapChain, IID_TestingSwapChain); + if (pTestingSwapChain) + { + pContext->Flush(); + pContext->InvalidateState(); + +#if METAL_SUPPORTED + MeshShaderDrawReferenceMtl(pSwapChain); +#else + LOG_ERROR_AND_THROW("Metal is not supported"); +#endif + + pTestingSwapChain->TakeSnapshot(); + } + + ITextureView* pRTVs[] = {pSwapChain->GetCurrentBackBufferRTV()}; + pContext->SetRenderTargets(1, pRTVs, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION); + + float ClearColor[] = {0.f, 0.f, 0.f, 0.f}; + pContext->ClearRenderTarget(pRTVs[0], ClearColor, RESOURCE_STATE_TRANSITION_MODE_TRANSITION); + + GraphicsPipelineStateCreateInfo PSOCreateInfo; + + auto& PSODesc = PSOCreateInfo.PSODesc; + auto& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; + + PSODesc.Name = "MSL mesh shader test"; + + PSODesc.PipelineType = PIPELINE_TYPE_MESH; + GraphicsPipeline.NumRenderTargets = 1; + GraphicsPipeline.RTVFormats[0] = pSwapChain->GetDesc().ColorBufferFormat; + GraphicsPipeline.PrimitiveTopology = PRIMITIVE_TOPOLOGY_UNDEFINED; + GraphicsPipeline.RasterizerDesc.CullMode = CULL_MODE_BACK; + GraphicsPipeline.RasterizerDesc.FillMode = FILL_MODE_SOLID; + GraphicsPipeline.RasterizerDesc.FrontCounterClockwise = False; + + GraphicsPipeline.DepthStencilDesc.DepthEnable = False; + + ShaderCreateInfo ShaderCI; + ShaderCI.SourceLanguage = SHADER_SOURCE_LANGUAGE_MSL; + + RefCntAutoPtr pMS; + { + ShaderCI.Desc = {"MSL mesh shader test - MS", SHADER_TYPE_MESH, true}; + ShaderCI.EntryPoint = "MSmain"; + ShaderCI.Source = MSL::MeshShaderTest.c_str(); + + pDevice->CreateShader(ShaderCI, &pMS); + ASSERT_NE(pMS, nullptr); + } + + RefCntAutoPtr pPS; + { + ShaderCI.Desc = {"MSL mesh shader test - PS", SHADER_TYPE_PIXEL, true}; + ShaderCI.EntryPoint = "PSmain"; + ShaderCI.Source = MSL::MeshShaderTest.c_str(); + + pDevice->CreateShader(ShaderCI, &pPS); + ASSERT_NE(pPS, nullptr); + } + + PSOCreateInfo.pMS = pMS; + PSOCreateInfo.pPS = pPS; + RefCntAutoPtr pPSO; + pDevice->CreateGraphicsPipelineState(PSOCreateInfo, &pPSO); + ASSERT_NE(pPSO, nullptr); + + pContext->SetPipelineState(pPSO); + + DrawMeshAttribsMtl mtlDrawAttrs{4, 1, 1}; + DrawMeshAttribs drawAttrs(1, DRAW_FLAG_VERIFY_ALL, &mtlDrawAttrs); + pContext->DrawMesh(drawAttrs); + + pSwapChain->Present(); +} + + +TEST(MeshShaderTest, DrawTriangleIndirect_MSL) +{ + auto* pEnv = GPUTestingEnvironment::GetInstance(); + auto* pDevice = pEnv->GetDevice(); + const auto& deviceInfo = pDevice->GetDeviceInfo(); + if (!deviceInfo.IsMetalDevice()) + { + GTEST_SKIP() << "MSL is only supported in Metal"; + } + if (!deviceInfo.Features.MeshShaders) + { + GTEST_SKIP() << "Mesh shader is not supported by this device"; + } + + GPUTestingEnvironment::ScopedReset EnvironmentAutoReset; + + auto* pSwapChain = pEnv->GetSwapChain(); + auto* pContext = pEnv->GetDeviceContext(); + + RefCntAutoPtr pTestingSwapChain(pSwapChain, IID_TestingSwapChain); + if (pTestingSwapChain) + { + pContext->Flush(); + pContext->InvalidateState(); + +#if METAL_SUPPORTED + MeshShaderIndirectDrawReferenceMtl(pSwapChain); +#else + LOG_ERROR_AND_THROW("Metal is not supported"); +#endif + + pTestingSwapChain->TakeSnapshot(); + } + + ITextureView* pRTVs[] = {pSwapChain->GetCurrentBackBufferRTV()}; + pContext->SetRenderTargets(1, pRTVs, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION); + + float ClearColor[] = {0.f, 0.f, 0.f, 0.f}; + pContext->ClearRenderTarget(pRTVs[0], ClearColor, RESOURCE_STATE_TRANSITION_MODE_TRANSITION); + + GraphicsPipelineStateCreateInfo PSOCreateInfo; + + auto& PSODesc = PSOCreateInfo.PSODesc; + auto& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; + + PSODesc.Name = "MSL mesh shader indirect test"; + + PSODesc.PipelineType = PIPELINE_TYPE_MESH; + GraphicsPipeline.NumRenderTargets = 1; + GraphicsPipeline.RTVFormats[0] = pSwapChain->GetDesc().ColorBufferFormat; + GraphicsPipeline.PrimitiveTopology = PRIMITIVE_TOPOLOGY_UNDEFINED; + GraphicsPipeline.RasterizerDesc.CullMode = CULL_MODE_BACK; + GraphicsPipeline.RasterizerDesc.FillMode = FILL_MODE_SOLID; + GraphicsPipeline.RasterizerDesc.FrontCounterClockwise = False; + + GraphicsPipeline.DepthStencilDesc.DepthEnable = False; + + ShaderCreateInfo ShaderCI; + ShaderCI.SourceLanguage = SHADER_SOURCE_LANGUAGE_MSL; + + RefCntAutoPtr pMS; + { + ShaderCI.Desc = {"MSL mesh shader indirect test - MS", SHADER_TYPE_MESH, true}; + ShaderCI.EntryPoint = "MSmain"; + ShaderCI.Source = MSL::MeshShaderTest.c_str(); + + pDevice->CreateShader(ShaderCI, &pMS); + ASSERT_NE(pMS, nullptr); + } + + RefCntAutoPtr pPS; + { + ShaderCI.Desc = {"MSL mesh shader indirect test - PS", SHADER_TYPE_PIXEL, true}; + ShaderCI.EntryPoint = "PSmain"; + ShaderCI.Source = MSL::MeshShaderTest.c_str(); + + pDevice->CreateShader(ShaderCI, &pPS); + ASSERT_NE(pPS, nullptr); + } + + PSOCreateInfo.pMS = pMS; + PSOCreateInfo.pPS = pPS; + RefCntAutoPtr pPSO; + pDevice->CreateGraphicsPipelineState(PSOCreateInfo, &pPSO); + ASSERT_NE(pPSO, nullptr); + + struct IndirectBuffData + { + Uint32 IndirectData[3] = {1, 1, 1}; + }; + IndirectBuffData Data; + + BufferDesc IndirectBufferDesc; + IndirectBufferDesc.Name = "MSL indirect mesh buffer"; + IndirectBufferDesc.Usage = USAGE_IMMUTABLE; + IndirectBufferDesc.Size = sizeof(Data); + IndirectBufferDesc.BindFlags = BIND_INDIRECT_DRAW_ARGS; + + BufferData InitData{&Data, sizeof(Data)}; + + RefCntAutoPtr pBuffer; + pDevice->CreateBuffer(IndirectBufferDesc, &InitData, &pBuffer); + ASSERT_NE(pBuffer, nullptr); + + pContext->SetPipelineState(pPSO); + + DrawMeshAttribsMtl mtlDrawAttrs{4, 1, 1}; + DrawMeshIndirectAttribs drawAttrs; + drawAttrs.pAttribsBuffer = pBuffer; + drawAttrs.Flags = DRAW_FLAG_VERIFY_ALL; + drawAttrs.AttribsBufferStateTransitionMode = RESOURCE_STATE_TRANSITION_MODE_TRANSITION; + drawAttrs.pMtlAttribs = &mtlDrawAttrs; + + pContext->DrawMeshIndirect(drawAttrs); + + pSwapChain->Present(); +} + + +TEST(MeshShaderTest, DrawTrisWithAmplificationShader_MSL) +{ + auto* pEnv = GPUTestingEnvironment::GetInstance(); + auto* pDevice = pEnv->GetDevice(); + const auto& deviceInfo = pDevice->GetDeviceInfo(); + if (!deviceInfo.IsMetalDevice()) + { + GTEST_SKIP() << "MSL is only supported in Metal"; + } + if (!deviceInfo.Features.MeshShaders) + { + GTEST_SKIP() << "Mesh shader is not supported by this device"; + } + + GPUTestingEnvironment::ScopedReset EnvironmentAutoReset; + + auto* pSwapChain = pEnv->GetSwapChain(); + auto* pContext = pEnv->GetDeviceContext(); + + RefCntAutoPtr pTestingSwapChain(pSwapChain, IID_TestingSwapChain); + if (pTestingSwapChain) + { + pContext->Flush(); + pContext->InvalidateState(); + +#if METAL_SUPPORTED + AmplificationShaderDrawReferenceMtl(pSwapChain); +#else + LOG_ERROR_AND_THROW("Metal is not supported"); +#endif + + pTestingSwapChain->TakeSnapshot(); + } + + ITextureView* pRTVs[] = {pSwapChain->GetCurrentBackBufferRTV()}; + pContext->SetRenderTargets(1, pRTVs, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION); + + float ClearColor[] = {0.f, 0.f, 0.f, 0.f}; + pContext->ClearRenderTarget(pRTVs[0], ClearColor, RESOURCE_STATE_TRANSITION_MODE_TRANSITION); + + GraphicsPipelineStateCreateInfo PSOCreateInfo; + + auto& PSODesc = PSOCreateInfo.PSODesc; + auto& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; + + PSODesc.Name = "MSL amplification shader test"; + + PSODesc.PipelineType = PIPELINE_TYPE_MESH; + GraphicsPipeline.NumRenderTargets = 1; + GraphicsPipeline.RTVFormats[0] = pSwapChain->GetDesc().ColorBufferFormat; + GraphicsPipeline.PrimitiveTopology = PRIMITIVE_TOPOLOGY_UNDEFINED; + GraphicsPipeline.RasterizerDesc.CullMode = CULL_MODE_BACK; + GraphicsPipeline.RasterizerDesc.FillMode = FILL_MODE_SOLID; + GraphicsPipeline.RasterizerDesc.FrontCounterClockwise = False; + + GraphicsPipeline.DepthStencilDesc.DepthEnable = False; + + ShaderCreateInfo ShaderCI; + ShaderCI.SourceLanguage = SHADER_SOURCE_LANGUAGE_MSL; + + RefCntAutoPtr pAS; + { + ShaderCI.Desc = {"MSL amplification shader test - AS", SHADER_TYPE_AMPLIFICATION, true}; + ShaderCI.EntryPoint = "OBJmain"; + ShaderCI.Source = MSL::AmplificationShaderTest.c_str(); + + pDevice->CreateShader(ShaderCI, &pAS); + ASSERT_NE(pAS, nullptr); + } + + RefCntAutoPtr pMS; + { + ShaderCI.Desc = {"MSL amplification shader test - MS", SHADER_TYPE_MESH, true}; + ShaderCI.EntryPoint = "AmpMSmain"; + ShaderCI.Source = MSL::AmplificationShaderTest.c_str(); + + pDevice->CreateShader(ShaderCI, &pMS); + ASSERT_NE(pMS, nullptr); + } + + RefCntAutoPtr pPS; + { + ShaderCI.Desc = {"MSL amplification shader test - PS", SHADER_TYPE_PIXEL, true}; + ShaderCI.EntryPoint = "AmpPSmain"; + ShaderCI.Source = MSL::AmplificationShaderTest.c_str(); + + pDevice->CreateShader(ShaderCI, &pPS); + ASSERT_NE(pPS, nullptr); + } + + PSOCreateInfo.pAS = pAS; + PSOCreateInfo.pMS = pMS; + PSOCreateInfo.pPS = pPS; + RefCntAutoPtr pPSO; + pDevice->CreateGraphicsPipelineState(PSOCreateInfo, &pPSO); + ASSERT_NE(pPSO, nullptr); + + pContext->SetPipelineState(pPSO); + + DrawMeshAttribsMtl mtlDrawAttrs{8, 1, 1, 1, 1, 1}; + DrawMeshAttribs drawAttrs(8, DRAW_FLAG_VERIFY_ALL, &mtlDrawAttrs); + pContext->DrawMesh(drawAttrs); + + pSwapChain->Present(); +} + } // namespace From be635836d7a0f70bc215a3408b91610abd2d57e4 Mon Sep 17 00:00:00 2001 From: assiduous Date: Mon, 27 Apr 2026 09:53:31 -0700 Subject: [PATCH 3/3] MeshShaderTest: don't use auto where unnecessary --- .../src/MeshShaderTest.cpp | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/Tests/DiligentCoreAPITest/src/MeshShaderTest.cpp b/Tests/DiligentCoreAPITest/src/MeshShaderTest.cpp index 855c932c5..d06273ce2 100644 --- a/Tests/DiligentCoreAPITest/src/MeshShaderTest.cpp +++ b/Tests/DiligentCoreAPITest/src/MeshShaderTest.cpp @@ -69,8 +69,8 @@ namespace TEST(MeshShaderTest, DrawTriangle) { - auto* pEnv = GPUTestingEnvironment::GetInstance(); - auto* pDevice = pEnv->GetDevice(); + GPUTestingEnvironment* pEnv = GPUTestingEnvironment::GetInstance(); + IRenderDevice* pDevice = pEnv->GetDevice(); if (!pDevice->GetDeviceInfo().Features.MeshShaders) { GTEST_SKIP() << "Mesh shader is not supported by this device"; @@ -78,8 +78,8 @@ TEST(MeshShaderTest, DrawTriangle) GPUTestingEnvironment::ScopedReset EnvironmentAutoReset; - auto* pSwapChain = pEnv->GetSwapChain(); - auto* pContext = pEnv->GetDeviceContext(); + ISwapChain* pSwapChain = pEnv->GetSwapChain(); + IDeviceContext* pContext = pEnv->GetDeviceContext(); RefCntAutoPtr pTestingSwapChain(pSwapChain, IID_TestingSwapChain); if (pTestingSwapChain) @@ -87,7 +87,7 @@ TEST(MeshShaderTest, DrawTriangle) pContext->Flush(); pContext->InvalidateState(); - auto deviceType = pDevice->GetDeviceInfo().Type; + const RENDER_DEVICE_TYPE deviceType = pDevice->GetDeviceInfo().Type; switch (deviceType) { #if D3D12_SUPPORTED @@ -124,8 +124,8 @@ TEST(MeshShaderTest, DrawTriangle) GraphicsPipelineStateCreateInfo PSOCreateInfo; - auto& PSODesc = PSOCreateInfo.PSODesc; - auto& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; + PipelineStateDesc& PSODesc = PSOCreateInfo.PSODesc; + GraphicsPipelineDesc& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; PSODesc.Name = "Mesh shader test"; @@ -182,8 +182,8 @@ TEST(MeshShaderTest, DrawTriangle) TEST(MeshShaderTest, DrawTriangleIndirect) { - auto* pEnv = GPUTestingEnvironment::GetInstance(); - auto* pDevice = pEnv->GetDevice(); + GPUTestingEnvironment* pEnv = GPUTestingEnvironment::GetInstance(); + IRenderDevice* pDevice = pEnv->GetDevice(); if (!pDevice->GetDeviceInfo().Features.MeshShaders) { GTEST_SKIP() << "Mesh shader is not supported by this device"; @@ -191,8 +191,8 @@ TEST(MeshShaderTest, DrawTriangleIndirect) GPUTestingEnvironment::ScopedReset EnvironmentAutoReset; - auto* pSwapChain = pEnv->GetSwapChain(); - auto* pContext = pEnv->GetDeviceContext(); + ISwapChain* pSwapChain = pEnv->GetSwapChain(); + IDeviceContext* pContext = pEnv->GetDeviceContext(); RefCntAutoPtr pTestingSwapChain(pSwapChain, IID_TestingSwapChain); if (pTestingSwapChain) @@ -200,7 +200,7 @@ TEST(MeshShaderTest, DrawTriangleIndirect) pContext->Flush(); pContext->InvalidateState(); - auto deviceType = pDevice->GetDeviceInfo().Type; + const RENDER_DEVICE_TYPE deviceType = pDevice->GetDeviceInfo().Type; switch (deviceType) { #if D3D12_SUPPORTED @@ -239,8 +239,8 @@ TEST(MeshShaderTest, DrawTriangleIndirect) GraphicsPipelineStateCreateInfo PSOCreateInfo; - auto& PSODesc = PSOCreateInfo.PSODesc; - auto& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; + PipelineStateDesc& PSODesc = PSOCreateInfo.PSODesc; + GraphicsPipelineDesc& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; PSODesc.Name = "Mesh shader test"; @@ -319,8 +319,8 @@ TEST(MeshShaderTest, DrawTriangleIndirect) TEST(MeshShaderTest, DrawTriangleIndirectCount) { - auto* pEnv = GPUTestingEnvironment::GetInstance(); - auto* pDevice = pEnv->GetDevice(); + GPUTestingEnvironment* pEnv = GPUTestingEnvironment::GetInstance(); + IRenderDevice* pDevice = pEnv->GetDevice(); if (!pDevice->GetDeviceInfo().Features.MeshShaders) { GTEST_SKIP() << "Mesh shader is not supported by this device"; @@ -332,8 +332,8 @@ TEST(MeshShaderTest, DrawTriangleIndirectCount) GPUTestingEnvironment::ScopedReset EnvironmentAutoReset; - auto* pSwapChain = pEnv->GetSwapChain(); - auto* pContext = pEnv->GetDeviceContext(); + ISwapChain* pSwapChain = pEnv->GetSwapChain(); + IDeviceContext* pContext = pEnv->GetDeviceContext(); RefCntAutoPtr pTestingSwapChain(pSwapChain, IID_TestingSwapChain); if (pTestingSwapChain) @@ -341,7 +341,7 @@ TEST(MeshShaderTest, DrawTriangleIndirectCount) pContext->Flush(); pContext->InvalidateState(); - auto deviceType = pDevice->GetDeviceInfo().Type; + const RENDER_DEVICE_TYPE deviceType = pDevice->GetDeviceInfo().Type; switch (deviceType) { #if D3D12_SUPPORTED @@ -374,8 +374,8 @@ TEST(MeshShaderTest, DrawTriangleIndirectCount) GraphicsPipelineStateCreateInfo PSOCreateInfo; - auto& PSODesc = PSOCreateInfo.PSODesc; - auto& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; + PipelineStateDesc& PSODesc = PSOCreateInfo.PSODesc; + GraphicsPipelineDesc& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; PSODesc.Name = "Mesh shader test"; @@ -458,8 +458,8 @@ TEST(MeshShaderTest, DrawTriangleIndirectCount) TEST(MeshShaderTest, DrawTrisWithAmplificationShader) { - auto* pEnv = GPUTestingEnvironment::GetInstance(); - auto* pDevice = pEnv->GetDevice(); + GPUTestingEnvironment* pEnv = GPUTestingEnvironment::GetInstance(); + IRenderDevice* pDevice = pEnv->GetDevice(); if (!pDevice->GetDeviceInfo().Features.MeshShaders) { GTEST_SKIP() << "Mesh shader is not supported by this device"; @@ -467,8 +467,8 @@ TEST(MeshShaderTest, DrawTrisWithAmplificationShader) GPUTestingEnvironment::ScopedReset EnvironmentAutoReset; - auto* pSwapChain = pEnv->GetSwapChain(); - auto* pContext = pEnv->GetDeviceContext(); + ISwapChain* pSwapChain = pEnv->GetSwapChain(); + IDeviceContext* pContext = pEnv->GetDeviceContext(); RefCntAutoPtr pTestingSwapChain(pSwapChain, IID_TestingSwapChain); if (pTestingSwapChain) @@ -476,7 +476,7 @@ TEST(MeshShaderTest, DrawTrisWithAmplificationShader) pContext->Flush(); pContext->InvalidateState(); - auto deviceType = pDevice->GetDeviceInfo().Type; + const RENDER_DEVICE_TYPE deviceType = pDevice->GetDeviceInfo().Type; switch (deviceType) { #if D3D12_SUPPORTED @@ -513,8 +513,8 @@ TEST(MeshShaderTest, DrawTrisWithAmplificationShader) GraphicsPipelineStateCreateInfo PSOCreateInfo; - auto& PSODesc = PSOCreateInfo.PSODesc; - auto& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; + PipelineStateDesc& PSODesc = PSOCreateInfo.PSODesc; + GraphicsPipelineDesc& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; PSODesc.Name = "Amplification shader test"; @@ -580,9 +580,9 @@ TEST(MeshShaderTest, DrawTrisWithAmplificationShader) TEST(MeshShaderTest, DrawTriangle_MSL) { - auto* pEnv = GPUTestingEnvironment::GetInstance(); - auto* pDevice = pEnv->GetDevice(); - const auto& deviceInfo = pDevice->GetDeviceInfo(); + GPUTestingEnvironment* pEnv = GPUTestingEnvironment::GetInstance(); + IRenderDevice* pDevice = pEnv->GetDevice(); + const RenderDeviceInfo& deviceInfo = pDevice->GetDeviceInfo(); if (!deviceInfo.IsMetalDevice()) { GTEST_SKIP() << "MSL is only supported in Metal"; @@ -594,8 +594,8 @@ TEST(MeshShaderTest, DrawTriangle_MSL) GPUTestingEnvironment::ScopedReset EnvironmentAutoReset; - auto* pSwapChain = pEnv->GetSwapChain(); - auto* pContext = pEnv->GetDeviceContext(); + ISwapChain* pSwapChain = pEnv->GetSwapChain(); + IDeviceContext* pContext = pEnv->GetDeviceContext(); RefCntAutoPtr pTestingSwapChain(pSwapChain, IID_TestingSwapChain); if (pTestingSwapChain) @@ -606,7 +606,7 @@ TEST(MeshShaderTest, DrawTriangle_MSL) #if METAL_SUPPORTED MeshShaderDrawReferenceMtl(pSwapChain); #else - LOG_ERROR_AND_THROW("Metal is not supported"); + UNEXPECTED("Metal is not supported. This test should've been skipped"); #endif pTestingSwapChain->TakeSnapshot(); @@ -620,8 +620,8 @@ TEST(MeshShaderTest, DrawTriangle_MSL) GraphicsPipelineStateCreateInfo PSOCreateInfo; - auto& PSODesc = PSOCreateInfo.PSODesc; - auto& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; + PipelineStateDesc& PSODesc = PSOCreateInfo.PSODesc; + GraphicsPipelineDesc& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; PSODesc.Name = "MSL mesh shader test"; @@ -676,9 +676,9 @@ TEST(MeshShaderTest, DrawTriangle_MSL) TEST(MeshShaderTest, DrawTriangleIndirect_MSL) { - auto* pEnv = GPUTestingEnvironment::GetInstance(); - auto* pDevice = pEnv->GetDevice(); - const auto& deviceInfo = pDevice->GetDeviceInfo(); + GPUTestingEnvironment* pEnv = GPUTestingEnvironment::GetInstance(); + IRenderDevice* pDevice = pEnv->GetDevice(); + const RenderDeviceInfo& deviceInfo = pDevice->GetDeviceInfo(); if (!deviceInfo.IsMetalDevice()) { GTEST_SKIP() << "MSL is only supported in Metal"; @@ -690,8 +690,8 @@ TEST(MeshShaderTest, DrawTriangleIndirect_MSL) GPUTestingEnvironment::ScopedReset EnvironmentAutoReset; - auto* pSwapChain = pEnv->GetSwapChain(); - auto* pContext = pEnv->GetDeviceContext(); + ISwapChain* pSwapChain = pEnv->GetSwapChain(); + IDeviceContext* pContext = pEnv->GetDeviceContext(); RefCntAutoPtr pTestingSwapChain(pSwapChain, IID_TestingSwapChain); if (pTestingSwapChain) @@ -702,7 +702,7 @@ TEST(MeshShaderTest, DrawTriangleIndirect_MSL) #if METAL_SUPPORTED MeshShaderIndirectDrawReferenceMtl(pSwapChain); #else - LOG_ERROR_AND_THROW("Metal is not supported"); + UNEXPECTED("Metal is not supported. This test should've been skipped"); #endif pTestingSwapChain->TakeSnapshot(); @@ -716,8 +716,8 @@ TEST(MeshShaderTest, DrawTriangleIndirect_MSL) GraphicsPipelineStateCreateInfo PSOCreateInfo; - auto& PSODesc = PSOCreateInfo.PSODesc; - auto& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; + PipelineStateDesc& PSODesc = PSOCreateInfo.PSODesc; + GraphicsPipelineDesc& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; PSODesc.Name = "MSL mesh shader indirect test"; @@ -795,9 +795,9 @@ TEST(MeshShaderTest, DrawTriangleIndirect_MSL) TEST(MeshShaderTest, DrawTrisWithAmplificationShader_MSL) { - auto* pEnv = GPUTestingEnvironment::GetInstance(); - auto* pDevice = pEnv->GetDevice(); - const auto& deviceInfo = pDevice->GetDeviceInfo(); + GPUTestingEnvironment* pEnv = GPUTestingEnvironment::GetInstance(); + IRenderDevice* pDevice = pEnv->GetDevice(); + const RenderDeviceInfo& deviceInfo = pDevice->GetDeviceInfo(); if (!deviceInfo.IsMetalDevice()) { GTEST_SKIP() << "MSL is only supported in Metal"; @@ -809,8 +809,8 @@ TEST(MeshShaderTest, DrawTrisWithAmplificationShader_MSL) GPUTestingEnvironment::ScopedReset EnvironmentAutoReset; - auto* pSwapChain = pEnv->GetSwapChain(); - auto* pContext = pEnv->GetDeviceContext(); + ISwapChain* pSwapChain = pEnv->GetSwapChain(); + IDeviceContext* pContext = pEnv->GetDeviceContext(); RefCntAutoPtr pTestingSwapChain(pSwapChain, IID_TestingSwapChain); if (pTestingSwapChain) @@ -821,7 +821,7 @@ TEST(MeshShaderTest, DrawTrisWithAmplificationShader_MSL) #if METAL_SUPPORTED AmplificationShaderDrawReferenceMtl(pSwapChain); #else - LOG_ERROR_AND_THROW("Metal is not supported"); + UNEXPECTED("Metal is not supported. This test should've been skipped"); #endif pTestingSwapChain->TakeSnapshot(); @@ -835,8 +835,8 @@ TEST(MeshShaderTest, DrawTrisWithAmplificationShader_MSL) GraphicsPipelineStateCreateInfo PSOCreateInfo; - auto& PSODesc = PSOCreateInfo.PSODesc; - auto& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; + PipelineStateDesc& PSODesc = PSOCreateInfo.PSODesc; + GraphicsPipelineDesc& GraphicsPipeline = PSOCreateInfo.GraphicsPipeline; PSODesc.Name = "MSL amplification shader test";