diff --git a/qrenderdoc/Code/QRDUtils.cpp b/qrenderdoc/Code/QRDUtils.cpp index 569da1ade5..e5cad515fe 100644 --- a/qrenderdoc/Code/QRDUtils.cpp +++ b/qrenderdoc/Code/QRDUtils.cpp @@ -1653,6 +1653,7 @@ QString D3DSemanticString(const SigParameter &sig) lit("SV_Barycentrics"), lit("SV_CullPrimitive"), lit("out indices"), + lit("SV_ViewID"), }; static_assert(arraydim() == ARRAY_COUNT(sysValues), diff --git a/qrenderdoc/Code/ScintillaSyntax.cpp b/qrenderdoc/Code/ScintillaSyntax.cpp index 42867a2e7d..ef1eebf55e 100644 --- a/qrenderdoc/Code/ScintillaSyntax.cpp +++ b/qrenderdoc/Code/ScintillaSyntax.cpp @@ -165,7 +165,7 @@ gl_CullDistance gl_FragCoord gl_FragDepth gl_FrontFacing gl_GlobalInvocationID g gl_in gl_InstanceID gl_InvocationID gl_Layer gl_LocalInvocationID gl_LocalInvocationIndex gl_MaxPatchVertices gl_NumWorkGroups gl_out gl_PatchVerticesIn gl_PerVertex gl_PointCoord gl_PointSize gl_Position gl_PrimitiveID gl_PrimitiveIDIn gl_SampleID gl_SampleMask gl_SampleMaskIn -gl_SamplePosition gl_TessCoord gl_TessLevelInner gl_TessLevelOuter gl_VertexID gl_ViewportIndex +gl_SamplePosition gl_TessCoord gl_TessLevelInner gl_TessLevelOuter gl_VertexID gl_ViewIndex gl_ViewportIndex gl_WorkGroupID gl_WorkGroupSize gl_MaxComputeWorkGroupCount gl_MaxComputeWorkGroupSize gl_MaxComputeUniformComponents diff --git a/renderdoc/api/replay/renderdoc_tostr.inl b/renderdoc/api/replay/renderdoc_tostr.inl index 53f32f6d38..911efa5f70 100644 --- a/renderdoc/api/replay/renderdoc_tostr.inl +++ b/renderdoc/api/replay/renderdoc_tostr.inl @@ -693,6 +693,7 @@ rdcstr DoStringise(const ShaderBuiltin &el) STRINGISE_ENUM_CLASS_NAMED(Barycentrics, "Barycentrics"); STRINGISE_ENUM_CLASS_NAMED(CullPrimitive, "Cull Primitive Output"); STRINGISE_ENUM_CLASS_NAMED(OutputIndices, "Output Indices"); + STRINGISE_ENUM_CLASS_NAMED(MultiViewIndex, "Multiview Index"); } END_ENUM_STRINGISE(); } diff --git a/renderdoc/api/replay/replay_enums.h b/renderdoc/api/replay/replay_enums.h index cca46d8a92..cf850b9897 100644 --- a/renderdoc/api/replay/replay_enums.h +++ b/renderdoc/api/replay/replay_enums.h @@ -1109,6 +1109,11 @@ to apply to multiple related things - see :data:`ClipDistance`, :data:`CullDista .. data:: OutputIndices An output containing the indices for a meshlet. + +.. data:: MultiViewIndex + + An input specifying the view being rendered to in multiview rendering. Only valid when multiview rendering is enabled. + )"); enum class ShaderBuiltin : uint32_t { @@ -1166,6 +1171,7 @@ enum class ShaderBuiltin : uint32_t Barycentrics, CullPrimitive, OutputIndices, + MultiViewIndex, Count, }; diff --git a/renderdoc/driver/gl/gl_shader_refl.cpp b/renderdoc/driver/gl/gl_shader_refl.cpp index e0da5b5d61..f8f31c660a 100644 --- a/renderdoc/driver/gl/gl_shader_refl.cpp +++ b/renderdoc/driver/gl/gl_shader_refl.cpp @@ -2278,6 +2278,8 @@ void MakeShaderReflection(GLenum shadType, GLuint sepProg, ShaderReflection &ref sig.systemValue = ShaderBuiltin::GSInstanceIndex; if(IS_BUILTIN("gl_Layer")) sig.systemValue = ShaderBuiltin::RTIndex; + if(IS_BUILTIN("gl_ViewID_OVR")) + sig.systemValue = ShaderBuiltin::MultiViewIndex; if(IS_BUILTIN("gl_ViewportIndex")) sig.systemValue = ShaderBuiltin::ViewportIndex; diff --git a/renderdoc/driver/shaders/spirv/spirv_common.cpp b/renderdoc/driver/shaders/spirv/spirv_common.cpp index bacf1def40..cb82d73100 100644 --- a/renderdoc/driver/shaders/spirv/spirv_common.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_common.cpp @@ -156,7 +156,7 @@ ShaderBuiltin MakeShaderBuiltin(ShaderStage stage, const rdcspv::BuiltIn el) case rdcspv::BuiltIn::BaseVertex: return ShaderBuiltin::BaseVertex; case rdcspv::BuiltIn::BaseInstance: return ShaderBuiltin::BaseInstance; case rdcspv::BuiltIn::DrawIndex: return ShaderBuiltin::DrawIndex; - case rdcspv::BuiltIn::ViewIndex: return ShaderBuiltin::ViewportIndex; + case rdcspv::BuiltIn::ViewIndex: return ShaderBuiltin::MultiViewIndex; case rdcspv::BuiltIn::FragStencilRefEXT: return ShaderBuiltin::StencilReference; case rdcspv::BuiltIn::NumWorkgroups: return ShaderBuiltin::DispatchSize; case rdcspv::BuiltIn::GlobalInvocationId: return ShaderBuiltin::DispatchThreadIndex; diff --git a/renderdoc/driver/vulkan/vk_postvs.cpp b/renderdoc/driver/vulkan/vk_postvs.cpp index f28ed98247..9c6c93713a 100644 --- a/renderdoc/driver/vulkan/vk_postvs.cpp +++ b/renderdoc/driver/vulkan/vk_postvs.cpp @@ -1123,6 +1123,10 @@ static void ConvertToMeshOutputCompute(const ShaderReflection &refl, { valueID = instIndexID; } + else if(builtin == ShaderBuiltin::MultiViewIndex) + { + valueID = viewID; + } else if(builtin == ShaderBuiltin::ViewportIndex) { valueID = viewID; diff --git a/renderdoc/driver/vulkan/vk_shader_feedback.cpp b/renderdoc/driver/vulkan/vk_shader_feedback.cpp index 0673838842..1503c066ca 100644 --- a/renderdoc/driver/vulkan/vk_shader_feedback.cpp +++ b/renderdoc/driver/vulkan/vk_shader_feedback.cpp @@ -791,7 +791,7 @@ void AnnotateShader(const ShaderReflection &refl, const SPIRVPatchData &patchDat // invalid and we just set 0. Valid for both Vertex and Pixel shaders if(editor.HasCapability(rdcspv::Capability::MultiView)) { - view = fetchOrAddGlobalInput("rdoc_viewIndex", ShaderBuiltin::ViewportIndex, + view = fetchOrAddGlobalInput("rdoc_viewIndex", ShaderBuiltin::MultiViewIndex, rdcspv::BuiltIn::ViewIndex, uint32Type, true); } else @@ -888,7 +888,7 @@ void AnnotateShader(const ShaderReflection &refl, const SPIRVPatchData &patchDat // invalid and we just set 0. Valid for both Vertex and Pixel shaders if(editor.HasCapability(rdcspv::Capability::MultiView)) { - view = fetchOrAddGlobalInput("rdoc_viewIndex", ShaderBuiltin::ViewportIndex, + view = fetchOrAddGlobalInput("rdoc_viewIndex", ShaderBuiltin::MultiViewIndex, rdcspv::BuiltIn::ViewIndex, uint32Type, true); } else diff --git a/renderdoc/driver/vulkan/vk_shaderdebug.cpp b/renderdoc/driver/vulkan/vk_shaderdebug.cpp index be6ab83ca6..d50610de1a 100644 --- a/renderdoc/driver/vulkan/vk_shaderdebug.cpp +++ b/renderdoc/driver/vulkan/vk_shaderdebug.cpp @@ -4013,6 +4013,7 @@ ShaderDebugTrace *VulkanReplay::DebugVertex(uint32_t eventId, uint32_t vertid, u builtins[ShaderBuiltin::VertexIndex] = ShaderVariable(rdcstr(), vertid + vertOffset, 0U, 0U, 0U); builtins[ShaderBuiltin::InstanceIndex] = ShaderVariable(rdcstr(), instid + instOffset, 0U, 0U, 0U); builtins[ShaderBuiltin::ViewportIndex] = ShaderVariable(rdcstr(), view, 0U, 0U, 0U); + builtins[ShaderBuiltin::MultiViewIndex] = ShaderVariable(rdcstr(), view, 0U, 0U, 0U); rdcarray &locations = apiWrapper->location_inputs; for(const VkVertexInputAttributeDescription2EXT &attr : state.vertexAttributes)