-
Notifications
You must be signed in to change notification settings - Fork 840
Virtual texturing fullscreen debug [Hold] #143
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
95224dc
Virtual texturing full screen debug (#6534)
robin-demoor bf8e0bb
Merge remote-tracking branch 'upstream/VirtualTexturing' into Virtual…
robin-demoor 8f747f4
Removed redundant shader variable set
robin-demoor 09e821b
Material leak fix
robin-demoor 8cb9580
Merge remote-tracking branch 'origin/VirtualTexturing' into VirtualTe…
robin-demoor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
com.unity.render-pipelines.high-definition/Runtime/Debug/DebugVTBlit.shader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
Shader "Hidden/DebugVTBlit" | ||
{ | ||
|
||
SubShader | ||
{ | ||
// No culling or depth | ||
Cull Off ZWrite Off ZTest Always | ||
|
||
Pass | ||
{ | ||
CGPROGRAM | ||
#pragma vertex vert | ||
#pragma fragment frag | ||
#pragma multi_compile_local __ USE_TEXARRAY | ||
|
||
#include "UnityCG.cginc" | ||
|
||
struct appdata | ||
{ | ||
float4 vertex : POSITION; | ||
float2 uv : TEXCOORD0; | ||
}; | ||
|
||
struct v2f | ||
{ | ||
float2 uv : TEXCOORD0; | ||
float4 vertex : SV_POSITION; | ||
}; | ||
|
||
v2f vert(appdata v) | ||
{ | ||
v2f o; | ||
o.vertex = UnityObjectToClipPos(v.vertex); | ||
o.uv = v.uv; | ||
return o; | ||
} | ||
|
||
#ifdef USE_TEXARRAY | ||
UNITY_DECLARE_TEX2DARRAY(_MainTex); | ||
#else | ||
sampler2D _MainTex; | ||
#endif | ||
|
||
fixed4 frag(v2f i) : SV_Target | ||
{ | ||
#ifdef USE_TEXARRAY | ||
fixed4 col = UNITY_SAMPLE_TEX2DARRAY(_MainTex,float3(i.uv,0.0f)); | ||
#else | ||
fixed4 col = tex2D(_MainTex, i.uv); | ||
#endif | ||
|
||
float4 swiz; | ||
swiz = col; | ||
swiz *= 255.0f; | ||
|
||
float tileX = swiz.x + fmod(swiz.y, 8.0f) * 256.0f; | ||
float tileY = floor(swiz.y / 8.0f) + fmod(swiz.z, 64.0f) * 32.0f; | ||
float level = floor((swiz.z) / 64.0f) + fmod(swiz.w, 4.0f) * 4.0f; | ||
float tex = floor(swiz.w / 4.0f); | ||
|
||
return float4(tileX,tileY,level,tex); | ||
} | ||
ENDCG | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
com.unity.render-pipelines.high-definition/Runtime/Debug/DebugVTBlit.shader.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey,
2 remark here.
Is there any reasons to keep this debug mode editor only? All our debug mode are available at runtime and it is useful for users to see it on device (like no PS4 screen for exampl)e.
Second, we don't inspect shader directly Shader.Find("Hidden/DebugVTBlit")); in HDRP we always put system shader in an hdrp resource asset \com.unity.render-pipelines.high-definition\Runtime\RenderPipeline\RenderPipelineResources.cs and then access it like this.
This is to not pollute other render pipeline with our thing (like URP).