-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #476 Depth Downsampling needed a special shader to handle MSAA. SSAO_HS_ps shader was needing a special shader to handle MSAA due to gBuf_normals being MSAA. Rather than adding a special variant via ifdef, just disable explicit_resolve since the explicit MSAA surface is not needed in the sample. Reworked SSAO compositor to be applied in two stages, so that MSAA can be handled properly
- Loading branch information
1 parent
b262400
commit 93c3add
Showing
6 changed files
with
229 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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 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
17 changes: 17 additions & 0 deletions
17
Samples/Media/2.0/scripts/materials/Common/GLSL/DepthDownscaleMax_Subsample0_ps.glsl
This file contains 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,17 @@ | ||
#version ogre_glsl_ver_330 | ||
|
||
vulkan_layout( ogre_t0 ) uniform texture2DMS depthTexture; | ||
|
||
in vec4 gl_FragCoord; | ||
//out float gl_FragDepth; | ||
|
||
void main() | ||
{ | ||
float fDepth0 = texelFetch( depthTexture, ivec2(gl_FragCoord.xy * 2.0), 0 ).x; | ||
float fDepth1 = texelFetch( depthTexture, ivec2(gl_FragCoord.xy * 2.0) + ivec2( 0, 1 ), 0 ).x; | ||
float fDepth2 = texelFetch( depthTexture, ivec2(gl_FragCoord.xy * 2.0) + ivec2( 1, 0 ), 0 ).x; | ||
float fDepth3 = texelFetch( depthTexture, ivec2(gl_FragCoord.xy * 2.0) + ivec2( 1, 1 ), 0 ).x; | ||
|
||
//gl_FragDepth = texelFetch( depthTexture, ivec2(gl_FragCoord.xy * 2.0), 0 ).x; | ||
gl_FragDepth = max( max( fDepth0, fDepth1 ), max( fDepth2, fDepth3 ) ); | ||
} |
21 changes: 21 additions & 0 deletions
21
Samples/Media/2.0/scripts/materials/Common/HLSL/DepthDownscaleMax_Subsample0_ps.hlsl
This file contains 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,21 @@ | ||
struct PS_INPUT | ||
{ | ||
float2 uv0 : TEXCOORD0; | ||
}; | ||
|
||
Texture2DMS<float> depthTexture : register(t0); | ||
|
||
float main | ||
( | ||
PS_INPUT inPs, | ||
float4 gl_FragCoord : SV_Position | ||
) : SV_Depth | ||
{ | ||
float fDepth0 = depthTexture.Load( int2(gl_FragCoord.xy * 2.0), 0 ).x; | ||
float fDepth1 = depthTexture.Load( int2(gl_FragCoord.xy * 2.0) + int2( 0, 1 ), 0 ).x; | ||
float fDepth2 = depthTexture.Load( int2(gl_FragCoord.xy * 2.0) + int2( 1, 0 ), 0 ).x; | ||
float fDepth3 = depthTexture.Load( int2(gl_FragCoord.xy * 2.0) + int2( 1, 1 ), 0 ).x; | ||
|
||
//return depthTexture.Load( int2(gl_FragCoord.xy * 2.0), 0 ) ).x; | ||
return max( max( fDepth0, fDepth1 ), max( fDepth2, fDepth3 ) ); | ||
} |
33 changes: 33 additions & 0 deletions
33
Samples/Media/2.0/scripts/materials/Common/Metal/DepthDownscaleMax_Subsample0_ps.metal
This file contains 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,33 @@ | ||
#include <metal_stdlib> | ||
using namespace metal; | ||
|
||
struct PS_INPUT | ||
{ | ||
float2 uv0; | ||
}; | ||
|
||
struct PS_OUTPUT | ||
{ | ||
float depth [[depth(any)]]; | ||
}; | ||
|
||
fragment PS_OUTPUT main_metal | ||
( | ||
PS_INPUT inPs [[stage_in]], | ||
|
||
depth2d_ms<float, access::read> depthTexture [[texture(0)]], | ||
|
||
float4 gl_FragCoord [[position]] | ||
) | ||
{ | ||
uint2 iFragCoord = (uint2)(gl_FragCoord.xy * 2.0); | ||
float fDepth0 = depthTexture.read( iFragCoord, 0 ); | ||
float fDepth1 = depthTexture.read( iFragCoord + uint2( 0, 1 ), 0 ); | ||
float fDepth2 = depthTexture.read( iFragCoord + uint2( 1, 0 ), 0 ); | ||
float fDepth3 = depthTexture.read( iFragCoord + uint2( 1, 1 ), 0 ); | ||
|
||
PS_OUTPUT outPs; | ||
//outPs.depth =depthTexture.read( uint2(gl_FragCoord.xy * 2.0) ).x; | ||
outPs.depth = max( max( fDepth0, fDepth1 ), max( fDepth2, fDepth3 ) ); | ||
return outPs; | ||
} |
This file contains 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