Files
UnrealEngineUWP/Engine/Shaders/Private/ScreenPixelShader.usf
Arciel Rekman 77f1a87106 Stereo mobile preview (UE-168931)
- Implemented for D3D11 and D3D12, as Mobile Multi View (MMV) fallback on both.

  High level summary / notable changes:
  - preview shader platforms will get the necessary properties from the desktop shader platforms used to display them
  - stereo render target manager will get informed which shader platform the engine is currently using
  - regularized somewhat what happens when the editor's preview platform changes (enabling/disabling and activating/deactivating). (Preview system is confusing because it's tri-state: preview platform can be set but not active, which is the same as it not being set). More code can be de-duplicated there.
  - Multiview will be considered disabled (for scene textures at least) if, despite ViewFamily requiring it, no View actually has it enabled.
  - Patched a bunch of shaders to account for texture array RTs used for MMV (and MMV fallback).


#rb Yuriy.ODonnell
#jira UE-168931
#review
#preflight 638a41d3976b1644cb68d21a

[CL 23377965 by Arciel Rekman in ue5-main branch]
2022-12-02 15:29:35 -05:00

71 lines
1.8 KiB
Plaintext

// Copyright Epic Games, Inc. All Rights Reserved.
/*=============================================================================
ScreenPixelShader.usf: Filter pixel shader source.
=============================================================================*/
#include "Common.ush"
#ifndef SCREEN_PS_FROM_SLICE0
#define SCREEN_PS_FROM_SLICE0 0
#endif
#if SCREEN_PS_FROM_SLICE0
Texture2DArray InTexture;
// if source is an array, we only need the first slice
#define TexOrArr2DSample(Tex, S, UV) Tex.Sample(S, float3(UV.x, UV.y, 0))
#define TexOrArr2DSampleLevel(Tex, S, UV, L) Tex.SampleLevel(S, float3(UV.x, UV.y, 0), L)
#else
Texture2D InTexture;
#define TexOrArr2DSample(Tex, S, UV) Texture2DSample(Tex, S, UV)
#define TexOrArr2DSampleLevel(Tex, S, UV, L) Texture2DSampleLevel(Tex, S, UV, L)
#endif
SamplerState InTextureSampler;
int MipLevel;
void Main(
FScreenVertexOutput Input,
out float4 OutColor : SV_Target0
)
{
OutColor = TexOrArr2DSample(InTexture, InTextureSampler, Input.UV);
}
void MainInvertAlpha(
FScreenVertexOutput Input,
out float4 OutColor : SV_Target0
)
{
OutColor = TexOrArr2DSample(InTexture, InTextureSampler, Input.UV);
OutColor.a = 1.f - OutColor.a;
}
void MainsRGBSource(
FScreenVertexOutput Input,
out float4 OutColor : SV_Target0
)
{
OutColor = TexOrArr2DSample(InTexture, InTextureSampler, Input.UV);
OutColor.rgb = pow( OutColor.rgb, 1.0f / 2.2f );
}
void MainMipLevel(
FScreenVertexOutput Input,
out float4 OutColor : SV_Target0
)
{
OutColor = TexOrArr2DSampleLevel(InTexture, InTextureSampler, Input.UV, MipLevel);
}
void MainsRGBSourceMipLevel(
FScreenVertexOutput Input,
out float4 OutColor : SV_Target0
)
{
OutColor = TexOrArr2DSampleLevel(InTexture, InTextureSampler, Input.UV, MipLevel);
OutColor.rgb = pow( OutColor.rgb, 1.0f / 2.2f );
}