mirror of
https://github.com/hedge-dev/UnleashedRecomp
synced 2026-06-08 12:28:15 -04:00
Implement MSAA properly for Vulkan.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
*.hlsl.*.h
|
||||
@@ -0,0 +1,5 @@
|
||||
void main(in uint vertexId : SV_VertexID, out float4 position : SV_Position, out float2 texCoord : TEXCOORD)
|
||||
{
|
||||
texCoord = float2((vertexId << 1) & 2, vertexId & 2);
|
||||
position = float4(texCoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
struct PushConstants
|
||||
{
|
||||
uint ResourceDescriptorIndex;
|
||||
};
|
||||
|
||||
[[vk::push_constant]] ConstantBuffer<PushConstants> g_PushConstants : register(b3, space4);
|
||||
|
||||
Texture2DMS<float, SAMPLE_COUNT> g_Texture2DMSDescriptorHeap[] : register(t0, space0);
|
||||
|
||||
float main(in float4 position : SV_Position) : SV_Depth
|
||||
{
|
||||
float result = g_Texture2DMSDescriptorHeap[g_PushConstants.ResourceDescriptorIndex].Load(int2(position.xy), 0);
|
||||
|
||||
[unroll] for (int i = 1; i < SAMPLE_COUNT; i++)
|
||||
result = max(result, g_Texture2DMSDescriptorHeap[g_PushConstants.ResourceDescriptorIndex].Load(int2(position.xy), i));
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
#define SAMPLE_COUNT 2
|
||||
#include "resolve_msaa_depth.hlsli"
|
||||
@@ -0,0 +1,2 @@
|
||||
#define SAMPLE_COUNT 4
|
||||
#include "resolve_msaa_depth.hlsli"
|
||||
@@ -0,0 +1,2 @@
|
||||
#define SAMPLE_COUNT 8
|
||||
#include "resolve_msaa_depth.hlsli"
|
||||
Reference in New Issue
Block a user