Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,13 @@ public void ProcessRenderer(int i)

var materialIndex = rendererData.materialIndex[materialsOffset + matIndex];
var packedMaterialData = rendererData.packedMaterialData[materialIndex];
#if UNITY_6000_0_76 || UNITY_6000_0_77 || UNITY_6000_0_78 || UNITY_6000_0_79 || UNITY_6000_0_80 || UNITY_6000_1_OR_NEWER || UNITY_6000_2_OR_NEWER || UNITY_6000_3_OR_NEWER
// isIndirectSupported was removed from GPUDrivenPackedMaterialData in 6000.0.76f1 and newer.
// Default to true as workaround for local development; proper fix requires engine API update in Graphics repo.
supportsIndirect &= true;
#else
supportsIndirect &= packedMaterialData.isIndirectSupported;
#endif
}

var rangeKey = new RangeKey
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#ifndef _UNIFIEDRAYTRACING_TRACERAYANDQUERYHIT_HLSL_
#define _UNIFIEDRAYTRACING_TRACERAYANDQUERYHIT_HLSL_

#define UNIFIED_RT_PAYLOAD UnifiedRT::Hit
#ifndef UNIFIED_RT_RAYGEN_FUNC
#define UNIFIED_RT_RAYGEN_FUNC RayGenExecute
#endif
#define UNIFIED_RT_CLOSESTHIT_FUNC ClosestHitExecute
#include "Packages/com.unity.render-pipelines.core/Runtime/UnifiedRayTracing/TraceRay.hlsl"

void ClosestHitExecute(UnifiedRT::HitContext hitContext, inout UnifiedRT::Hit payload)
{
payload.instanceID = hitContext.InstanceID();
payload.primitiveIndex = hitContext.PrimitiveIndex();
payload.uvBarycentrics = hitContext.UvBarycentrics();
payload.hitDistance = hitContext.RayTCurrent();
payload.isFrontFace = hitContext.IsFrontFace();
}

namespace UnifiedRT
{

Hit TraceRayClosestHit(DispatchInfo dispatchInfo, RayTracingAccelStruct accelStruct, uint instanceMask, Ray ray, uint rayFlags)
{
Hit payload= (Hit)0;
payload.instanceID = -1;

TraceRay(dispatchInfo, accelStruct, instanceMask, ray, rayFlags | kRayFlagForceOpaque, payload);

return payload;
}

bool TraceRayAnyHit(DispatchInfo dispatchInfo, RayTracingAccelStruct accelStruct, uint instanceMask, Ray ray, uint rayFlags)
{
Hit payLoadShadow = (Hit)0;
payLoadShadow.instanceID = -1;

TraceRay(dispatchInfo, accelStruct, instanceMask, ray, rayFlags | kRayFlagForceOpaque | kRayFlagAcceptFirstHitAndEndSearch, payLoadShadow);

return payLoadShadow.IsValid();
}

} // namespace UnifiedRT

#endif // _UNIFIEDRAYTRACING_TRACERAYANDQUERYHIT_HLSL_

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,25 @@ public void TestStripUnusedPass_XR(Shader shader)

helper = new TestHelper(shader, ShaderFeatures.None);
helper.data.stripUnusedXRVariants = false;
helper.data.passName = ShaderScriptableStripper.kPassNameXRMotionVectors;
helper.IsFalse(helper.stripper.StripUnusedPass_XRMotionVectors(ref helper.data));
helper.IsFalse(helper.stripper.StripUnusedPass(ref helper.data));
helper.data.passName = ShaderScriptableStripper.kPassNameMotionVectors;
TestHelper.s_EnabledKeywords = new System.Collections.Generic.List<string>() { "APPLICATION_SPACE_WARP_MOTION" };
helper.IsFalse(helper.stripper.StripInvalidVariants_MotionVectors(ref helper.data));
helper.IsFalse(helper.stripper.StripInvalidVariants(ref helper.data));

helper = new TestHelper(shader, ShaderFeatures.None);
helper.data.stripUnusedXRVariants = true;
helper.data.passName = ShaderScriptableStripper.kPassNameXRMotionVectors;
helper.IsTrue(helper.stripper.StripUnusedPass_XRMotionVectors(ref helper.data));
helper.IsTrue(helper.stripper.StripUnusedPass(ref helper.data));
helper.data.passName = ShaderScriptableStripper.kPassNameMotionVectors;
TestHelper.s_EnabledKeywords = new System.Collections.Generic.List<string>() { "APPLICATION_SPACE_WARP_MOTION" };
helper.IsTrue(helper.stripper.StripInvalidVariants_MotionVectors(ref helper.data));
helper.IsTrue(helper.stripper.StripInvalidVariants(ref helper.data));

// Test with keyword disabled should not strip even if XR variants stripping is enabled
helper = new TestHelper(shader, ShaderFeatures.None);
helper.data.stripUnusedXRVariants = true;
helper.data.passName = ShaderScriptableStripper.kPassNameMotionVectors;
TestHelper.s_EnabledKeywords = new System.Collections.Generic.List<string>() { };
helper.IsFalse(helper.stripper.StripInvalidVariants_MotionVectors(ref helper.data));
helper.IsFalse(helper.stripper.StripInvalidVariants(ref helper.data));
}

public void TestStripUnusedPass_ShadowCaster(Shader shader)
Expand Down