Post

Replies

Boosts

Views

Activity

Reply to Metal CSM Shadows GPU Culling+Indirect+Vertex Amplification - empty some Shadow Cascades
hi, thank you for reply Keep the view mapping offsets, and write output.layer = 0 in the vertex shader. Keep output.layer = ampID, and pass view mappings with zero offsets, or pass nil for the view mappings. If your host code doesn't pass view mapping offsets, please post your setVertexAmplificationCount call and render pass setup, and I'll take another look. I forgot about posting configuration for MTLPipelineState, MTLRenderPassDescriptor and setup for drawing, i'm using metal-cpp: //MTLPipelineState::setMaxVertexAmplificationCount(4): mtlPSODesc->setMaxVertexAmplificationCount(desc.viewInstanceCount); // 4 MTLRenderPassDescriptor configuration: mtlRenderPassDescriptor->setRenderTargetArrayLength(renderTargetArrayLength); //4 Setup for drawing: MTLRenderCommandEncoder::setVertexAmplificationCount: const MTLVertexAmplificationViewMapping VertexAmplificationViewMappings[] = { { 0u, 0u }, // amplification_id 0 -> Viewport 0, RT Array Layer 0 { 0u, 1u }, // amplification_id 1 -> Viewport 0, RT Array Layer 1 { 0u, 2u }, // amplification_id 2 -> Viewport 0, RT Array Layer 2 { 0u, 3u } // amplification_id 3 -> Viewport 0, RT Array Layer 3 }; for (const auto& vertexAmplificationViewMapping : VertexAmplificationViewMappings) { mtlRenderToTexture.vertexAmplifications.push_back(vertexAmplificationViewMapping); } mtlCurRenderCommandEncoder->setVertexAmplificationCount(mtlRenderToTexture.vertexAmplifications.size(), mtlRenderToTexture.vertexAmplifications.data()); Keep the view mapping offsets, and write output.layer = 0 in the vertex shader. It has been fixed problem! I can remove at all the output declaration uint layer [[render_target_array_index]]; Also, HLSL shader doesn't use code for writing SV_RenderTargetArrayIndex index for Direct3D12/Vulkan. Thank you for you answer!
3w
Reply to Metal cpp compile errors
I think I have problem with my CMake files, because If I use defination within header files, I have no errors: #pragma clang diagnostic ignored "-Wgnu-anonymous-struct" #pragma clang diagnostic ignored "-Wdtor-name" #pragma clang diagnostic ignored "-Wold-style-cast" .... #include <Metal/Metal.hpp> ...
Topic: Graphics & Games SubTopic: General Tags:
Dec ’24
Reply to Metal cpp compile errors
Hi! thank you for your responce, new CMake: `target_compile_features(${MODULE_NAME} PRIVATE cxx_std_20) target_compile_options(${MODULE_NAME} PRIVATE "-Wno-error=gnu-anonymous-struct" "-Wno-error=dtor-name" "-Wno-error=old-style-cast" "-Wno-gnu" ... "-Wno-error=deprecated-declarations" )` Anonymous types declared in an anonymous union are an extension: MTLAccelerationStructure.hpp: union { struct { float x; float y; float z; }; ISO C++ requires the name after '::' to be found in the same scope as the name before '::' NSSharedPtr.hpp template <class _Class> _NS_INLINE NS::SharedPtr<_Class>::~SharedPtr() __attribute__((no_sanitize("undefined")))
Topic: Graphics & Games SubTopic: General Tags:
Nov ’24
Reply to Metal CSM Shadows GPU Culling+Indirect+Vertex Amplification - empty some Shadow Cascades
hi, thank you for reply Keep the view mapping offsets, and write output.layer = 0 in the vertex shader. Keep output.layer = ampID, and pass view mappings with zero offsets, or pass nil for the view mappings. If your host code doesn't pass view mapping offsets, please post your setVertexAmplificationCount call and render pass setup, and I'll take another look. I forgot about posting configuration for MTLPipelineState, MTLRenderPassDescriptor and setup for drawing, i'm using metal-cpp: //MTLPipelineState::setMaxVertexAmplificationCount(4): mtlPSODesc->setMaxVertexAmplificationCount(desc.viewInstanceCount); // 4 MTLRenderPassDescriptor configuration: mtlRenderPassDescriptor->setRenderTargetArrayLength(renderTargetArrayLength); //4 Setup for drawing: MTLRenderCommandEncoder::setVertexAmplificationCount: const MTLVertexAmplificationViewMapping VertexAmplificationViewMappings[] = { { 0u, 0u }, // amplification_id 0 -> Viewport 0, RT Array Layer 0 { 0u, 1u }, // amplification_id 1 -> Viewport 0, RT Array Layer 1 { 0u, 2u }, // amplification_id 2 -> Viewport 0, RT Array Layer 2 { 0u, 3u } // amplification_id 3 -> Viewport 0, RT Array Layer 3 }; for (const auto& vertexAmplificationViewMapping : VertexAmplificationViewMappings) { mtlRenderToTexture.vertexAmplifications.push_back(vertexAmplificationViewMapping); } mtlCurRenderCommandEncoder->setVertexAmplificationCount(mtlRenderToTexture.vertexAmplifications.size(), mtlRenderToTexture.vertexAmplifications.data()); Keep the view mapping offsets, and write output.layer = 0 in the vertex shader. It has been fixed problem! I can remove at all the output declaration uint layer [[render_target_array_index]]; Also, HLSL shader doesn't use code for writing SV_RenderTargetArrayIndex index for Direct3D12/Vulkan. Thank you for you answer!
Replies
Boosts
Views
Activity
3w
Reply to Metal cpp compile errors
I think I have problem with my CMake files, because If I use defination within header files, I have no errors: #pragma clang diagnostic ignored "-Wgnu-anonymous-struct" #pragma clang diagnostic ignored "-Wdtor-name" #pragma clang diagnostic ignored "-Wold-style-cast" .... #include <Metal/Metal.hpp> ...
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to Metal cpp compile errors
Hi! thank you for your responce, new CMake: `target_compile_features(${MODULE_NAME} PRIVATE cxx_std_20) target_compile_options(${MODULE_NAME} PRIVATE "-Wno-error=gnu-anonymous-struct" "-Wno-error=dtor-name" "-Wno-error=old-style-cast" "-Wno-gnu" ... "-Wno-error=deprecated-declarations" )` Anonymous types declared in an anonymous union are an extension: MTLAccelerationStructure.hpp: union { struct { float x; float y; float z; }; ISO C++ requires the name after '::' to be found in the same scope as the name before '::' NSSharedPtr.hpp template <class _Class> _NS_INLINE NS::SharedPtr<_Class>::~SharedPtr() __attribute__((no_sanitize("undefined")))
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Nov ’24