mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-19 04:56:32 +00:00
Vk Pixel History: MSAA depth/stencil copy, shader out
Use a separate compute shader module for MSAA copy, and output directly into the destination buffer instead of creating staging resources. Support case where there is no depth stencil attachment to get post mod values in per fragment reporting. Previously used the original framebuffer that might not have had depth/stencil view, so couldn't count the fragments. Now use the sub image. To get the post mod color, we need to blend with the premod color, so we use vkCmdCopyImage to copy from the original image.
This commit is contained in:
committed by
Baldur Karlsson
parent
8a4f0a111d
commit
41b911d1d0
@@ -63,6 +63,7 @@ DECLARE_EMBED(glsl_ms2array_comp);
|
||||
DECLARE_EMBED(glsl_deptharr2ms_frag);
|
||||
DECLARE_EMBED(glsl_depthms2arr_frag);
|
||||
DECLARE_EMBED(glsl_gles_texsample_h);
|
||||
DECLARE_EMBED(glsl_pixelhistory_mscopy_comp);
|
||||
DECLARE_EMBED(glsl_pixelhistory_primid_frag);
|
||||
DECLARE_EMBED(glsl_shaderdebug_sample_vert);
|
||||
DECLARE_EMBED(glsl_texremap_frag);
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/******************************************************************************
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Baldur Karlsson
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include "glsl_globals.h"
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0) uniform PRECISION usampler2DMSArray srcMS0;
|
||||
layout(binding = 1) uniform PRECISION usampler2DMSArray srcMS1;
|
||||
|
||||
layout(binding = 2, std140) writeonly buffer pixelhistorydest
|
||||
{
|
||||
uvec4 result[];
|
||||
}
|
||||
dest;
|
||||
|
||||
layout(push_constant) uniform multisamplePush
|
||||
{
|
||||
int depthCopy;
|
||||
int currentSample;
|
||||
int x;
|
||||
int y;
|
||||
int dstOffset;
|
||||
}
|
||||
mscopy;
|
||||
|
||||
#define depthCopy (mscopy.depthCopy)
|
||||
#define currentSample (mscopy.currentSample)
|
||||
#define x (mscopy.x)
|
||||
#define y (mscopy.y)
|
||||
#define dstOffset (mscopy.dstOffset)
|
||||
|
||||
void main()
|
||||
{
|
||||
if(depthCopy == 0)
|
||||
{
|
||||
uvec4 data = texelFetch(srcMS0, ivec3(x, y, 0), currentSample);
|
||||
dest.result[dstOffset] = data;
|
||||
}
|
||||
else if(depthCopy == 1)
|
||||
{
|
||||
uint depth = texelFetch(srcMS0, ivec3(x, y, 0), currentSample).r;
|
||||
uint stencil = texelFetch(srcMS1, ivec3(x, y, 0), currentSample).r;
|
||||
dest.result[dstOffset] = uvec4(depth, stencil, 0, 0);
|
||||
}
|
||||
}
|
||||
@@ -128,6 +128,7 @@ RESOURCE_glsl_mesh_frag TYPE_EMBED "glsl/mesh.frag"
|
||||
RESOURCE_glsl_minmaxtile_comp TYPE_EMBED "glsl/minmaxtile.comp"
|
||||
RESOURCE_glsl_minmaxresult_comp TYPE_EMBED "glsl/minmaxresult.comp"
|
||||
RESOURCE_glsl_histogram_comp TYPE_EMBED "glsl/histogram.comp"
|
||||
RESOURCE_glsl_pixelhistory_mscopy_comp TYPE_EMBED "glsl/pixelhistory_mscopy.comp"
|
||||
RESOURCE_glsl_pixelhistory_primid_frag TYPE_EMBED "glsl/pixelhistory_primid.frag"
|
||||
RESOURCE_glsl_glsl_ubos_h TYPE_EMBED "glsl/glsl_ubos.h"
|
||||
RESOURCE_glsl_gl_texsample_h TYPE_EMBED "glsl/gl_texsample.h"
|
||||
|
||||
@@ -48,8 +48,9 @@
|
||||
#define RESOURCE_glsl_gltext_frag 430
|
||||
#define RESOURCE_glsl_glsl_globals_h 440
|
||||
#define RESOURCE_glsl_texremap_frag 441
|
||||
#define RESOURCE_glsl_pixelhistory_primid_frag 442
|
||||
#define RESOURCE_glsl_shaderdebug_sample_vert 443
|
||||
#define RESOURCE_glsl_pixelhistory_mscopy_comp 442
|
||||
#define RESOURCE_glsl_pixelhistory_primid_frag 443
|
||||
#define RESOURCE_glsl_shaderdebug_sample_vert 444
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user