Skip to content

Fix fullscreen debug pass with XR DX12 #2199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 13, 2020
Merged
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 @@ -271,11 +271,6 @@ PrefabInstance:
propertyPath: doBeforeTest.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
value: DebugViewController, Unity.RenderPipelines.HighDefinition-Tests.Runtime
objectReference: {fileID: 0}
- target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 3}
propertyPath: xrCompatible
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
--- !u!1 &1167715396
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,7 @@ MeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 0f769a963f31add41a59027ba7d0ad68, type: 2}
- {fileID: 2100000, guid: a7a5d577661996b4d8610da4b048f59f, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,6 @@ PrefabInstance:
propertyPath: doBeforeTest.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName
value: DebugViewController, Unity.RenderPipelines.HighDefinition-Tests.Runtime
objectReference: {fileID: 0}
- target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7,
type: 3}
propertyPath: xrCompatible
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
--- !u!1 &1167715396
Expand Down
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Remove a rendergraph debug option to clear resources on release from UI.
- added SV_PrimitiveID in the VaryingMesh structure for fulldebugscreenpass as well as primitiveID in FragInputs
- Changed which local frame is used for multi-bounce RTReflections.
- Move System Generated Values semantics out of VaryingsMesh structure.

## [10.0.0] - 2019-06-10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ public struct VaryingsMeshToPS
subscriptOptions : StructFieldOptions.Optional);
public static FieldDescriptor instanceID = new FieldDescriptor(VaryingsMeshToPS.name, "instanceID", "", ShaderValueType.Uint,
"CUSTOM_INSTANCE_ID", "UNITY_ANY_INSTANCING_ENABLED");
public static FieldDescriptor primitiveID = new FieldDescriptor(VaryingsMeshToPS.name, "primitiveID", "VARYINGS_NEED_PRIMITIVEID", ShaderValueType.Uint,
"SV_PrimitiveID", "defined(PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER) && defined(SHADER_STAGE_FRAGMENT) && (defined(VARYINGS_NEED_PRIMITIVEID) || (SHADERPASS == SHADERPASS_FULLSCREEN_DEBUG))", StructFieldOptions.Generated & StructFieldOptions.Optional);
public static FieldDescriptor cullFace = new FieldDescriptor(VaryingsMeshToPS.name, "cullFace", "VARYINGS_NEED_CULLFACE", "FRONT_FACE_TYPE",
"FRONT_FACE_SEMANTIC", "defined(SHADER_STAGE_FRAGMENT) && defined(VARYINGS_NEED_CULLFACE)", StructFieldOptions.Generated & StructFieldOptions.Optional);
}

public struct VaryingsMeshToDS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ static class HDStructs
HDStructFields.VaryingsMeshToPS.texCoord3,
HDStructFields.VaryingsMeshToPS.color,
HDStructFields.VaryingsMeshToPS.instanceID,
HDStructFields.VaryingsMeshToPS.primitiveID,
HDStructFields.VaryingsMeshToPS.cullFace,
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,6 @@ static class CoreFieldDependencies
new FieldDependency(HDStructFields.FragInputs.texCoord2, HDStructFields.VaryingsMeshToPS.texCoord2),
new FieldDependency(HDStructFields.FragInputs.texCoord3, HDStructFields.VaryingsMeshToPS.texCoord3),
new FieldDependency(HDStructFields.FragInputs.color, HDStructFields.VaryingsMeshToPS.color),
new FieldDependency(HDStructFields.FragInputs.primitiveID, HDStructFields.VaryingsMeshToPS.primitiveID),
new FieldDependency(HDStructFields.FragInputs.IsFrontFace, HDStructFields.VaryingsMeshToPS.cullFace),
};

public static DependencyCollection VertexDescription = new DependencyCollection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ FragInputs BuildFragInputs(VaryingsMeshToPS input)
$FragInputs.texCoord3: output.texCoord3 = input.texCoord3;
$FragInputs.color: output.color = input.color;

#if defined(PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER) && defined(SHADER_STAGE_FRAGMENT) && (defined(VARYINGS_NEED_PRIMITIVEID) || (SHADERPASS == SHADERPASS_FULLSCREEN_DEBUG))
output.primitiveID = input.primitiveID;
#endif

#if defined(VARYINGS_NEED_CULLFACE) && SHADER_STAGE_FRAGMENT
output.isFrontFace = IS_FRONT_VFACE(input.cullFace, true, false);
#endif

return output;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void Frag( PackedVaryingsToPS packedInput,
)
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput);
FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh);
FragInputs input = UnpackVaryingsToFragInputs(packedInput);
DecalSurfaceData surfaceData;
float clipValue = 1.0;
float angleFadeFactor = 1.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void Frag( PackedVaryingsToPS packedInput
)
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput);
FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh);
FragInputs input = UnpackVaryingsToFragInputs(packedInput);

// input.positionSS is SV_Position
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ PackedVaryingsToPS VertTesselation(VaryingsToDS input)
float4 Frag(PackedVaryingsToPS packedInput) : SV_Target
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput);
FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh);
FragInputs input = UnpackVaryingsToFragInputs(packedInput);

// input.positionSS is SV_Position
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void Frag(PackedVaryingsToPS packedInput,
#endif

UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput);
FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh);
FragInputs input = UnpackVaryingsToFragInputs(packedInput);

// We need to readapt the SS position as our screen space positions are for a low res buffer, but we try to access a full res buffer.
input.positionSS.xy = _OffScreenRendering > 0 ? (input.positionSS.xy * _OffScreenDownsampleFactor) : input.positionSS.xy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void Frag(PackedVaryingsToPS packedInput,
#endif

UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput);
FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh);
FragInputs input = UnpackVaryingsToFragInputs(packedInput);

// input.positionSS is SV_Position
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ PackedVaryingsToPS VertTesselation(VaryingsToDS input)
void Frag(PackedVaryingsToPS packedInput)
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput);
FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh);
FragInputs input = UnpackVaryingsToFragInputs(packedInput);

PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void Frag( PackedVaryingsToPS packedInput,
)
{
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput);
FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh);
FragInputs input = UnpackVaryingsToFragInputs(packedInput);

// input.positionSS is SV_Position
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ PackedVaryingsToPS Vert(AttributesMesh inputMesh)

float4 Frag(PackedVaryingsToPS packedInput) : SV_Target
{
FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh);
FragInputs input = UnpackVaryingsToFragInputs(packedInput);

// input.positionSS is SV_Position
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void Frag( PackedVaryingsToPS packedInput
#endif
)
{
FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh);
FragInputs input = UnpackVaryingsToFragInputs(packedInput);

// input.positionSS is SV_Position
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,7 @@ struct PackedVaryingsMeshToPS
float4 interpolators5 : TEXCOORD5;
#endif

// In order to compile on all HDRP target platform we need to respect the following order for semantic:
// - SV_RenderTargetArrayIndex // use for stereo instancing - Must be declare before SV_IsFrontFace
// - SV_PrimitiveID // Must be declare before SV_IsFrontFace and after SV_RenderTargetArrayIndex
// - SV_IsFrontFace

UNITY_VERTEX_INPUT_INSTANCE_ID

#ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER
#if (defined(VARYINGS_NEED_PRIMITIVEID) || (SHADERPASS == SHADERPASS_FULLSCREEN_DEBUG)) && SHADER_STAGE_FRAGMENT
uint primitiveID : SV_PrimitiveID;
#endif
#endif

#if defined(VARYINGS_NEED_CULLFACE) && SHADER_STAGE_FRAGMENT
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
#endif
};

// Functions to pack data to use as few interpolator as possible, the ShaderGraph should generate these functions
Expand Down Expand Up @@ -180,16 +165,6 @@ FragInputs UnpackVaryingsMeshToFragInputs(PackedVaryingsMeshToPS input)
output.color = input.interpolators5;
#endif

#ifdef PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER
#if (defined(VARYINGS_NEED_PRIMITIVEID) || (SHADERPASS == SHADERPASS_FULLSCREEN_DEBUG)) && SHADER_STAGE_FRAGMENT
output.primitiveID = input.primitiveID;
#endif
#endif

#if defined(VARYINGS_NEED_CULLFACE) && SHADER_STAGE_FRAGMENT
output.isFrontFace = IS_FRONT_VFACE(input.cullFace, true, false);
#endif

return output;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,23 @@ struct PackedVaryingsToPS
#ifdef VARYINGS_NEED_PASS
PackedVaryingsPassToPS vpass;
#endif

PackedVaryingsMeshToPS vmesh;

// SGVs must be packed after all non-SGVs have been packed.
// If there are several SGVs, they are packed in the order of HLSL declaration.

UNITY_VERTEX_OUTPUT_STEREO

#if defined(PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER) && SHADER_STAGE_FRAGMENT
#if (defined(VARYINGS_NEED_PRIMITIVEID) || (SHADERPASS == SHADERPASS_FULLSCREEN_DEBUG))
uint primitiveID : SV_PrimitiveID;
#endif
#endif

#if defined(VARYINGS_NEED_CULLFACE) && SHADER_STAGE_FRAGMENT
FRONT_FACE_TYPE cullFace : FRONT_FACE_SEMANTIC;
#endif
};

PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input)
Expand All @@ -28,6 +42,23 @@ PackedVaryingsToPS PackVaryingsToPS(VaryingsToPS input)
return output;
}

FragInputs UnpackVaryingsToFragInputs(PackedVaryingsToPS packed)
{
FragInputs input = UnpackVaryingsMeshToFragInputs(packed.vmesh);

#if defined(PLATFORM_SUPPORTS_PRIMITIVE_ID_IN_PIXEL_SHADER) && SHADER_STAGE_FRAGMENT
#if (defined(VARYINGS_NEED_PRIMITIVEID) || (SHADERPASS == SHADERPASS_FULLSCREEN_DEBUG))
input.primitiveID = packed.primitiveID;
#endif
#endif

#if defined(VARYINGS_NEED_CULLFACE) && SHADER_STAGE_FRAGMENT
input.isFrontFace = IS_FRONT_VFACE(packed.cullFace, true, false);
#endif

return input;
}

#ifdef TESSELLATION_ON


Expand Down