Improved fragment id shader code

- Deleted WriteClearValues and replace with QueryPostModValues
- Add support for earlier GLSL versions and fix logic for creating primitive id program
- Changed to only run per fragment queries on events with multiple fragments
This commit is contained in:
Bruce He
2023-01-05 14:37:55 +00:00
committed by Baldur Karlsson
parent f6102a48a4
commit c0b931eb15
9 changed files with 388 additions and 151 deletions
+1
View File
@@ -66,6 +66,7 @@ DECLARE_EMBED(glsl_gles_texsample_h);
DECLARE_EMBED(glsl_pixelhistory_mscopy_comp);
DECLARE_EMBED(glsl_pixelhistory_mscopy_depth_comp);
DECLARE_EMBED(glsl_pixelhistory_primid_frag);
DECLARE_EMBED(glsl_pixelhistory_primid_legacy_frag);
DECLARE_EMBED(glsl_shaderdebug_sample_vert);
DECLARE_EMBED(glsl_texremap_frag);
DECLARE_EMBED(glsl_discard_frag);
+1 -1
View File
@@ -28,5 +28,5 @@ IO_LOCATION(0) out vec4 color_out;
void main(void)
{
color_out = intBitsToFloat(gl_PrimitiveID).xxxx;
color_out = vec4(intBitsToFloat(gl_PrimitiveID));
}
@@ -0,0 +1,32 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2020-2022 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"
IO_LOCATION(0) out vec4 color_out;
void main(void)
{
color_out = vec4(float(gl_PrimitiveID));
}
+1
View File
@@ -156,6 +156,7 @@ RESOURCE_glsl_histogram_comp TYPE_EMBED "glsl/histogram.comp"
RESOURCE_glsl_pixelhistory_mscopy_comp TYPE_EMBED "glsl/pixelhistory_mscopy.comp"
RESOURCE_glsl_pixelhistory_mscopy_depth_comp TYPE_EMBED "glsl/pixelhistory_mscopy_depth.comp"
RESOURCE_glsl_pixelhistory_primid_frag TYPE_EMBED "glsl/pixelhistory_primid.frag"
RESOURCE_glsl_pixelhistory_primid_legacy_frag TYPE_EMBED "glsl/pixelhistory_primid_legacy.frag"
RESOURCE_glsl_glsl_ubos_h TYPE_EMBED "glsl/glsl_ubos.h"
RESOURCE_glsl_gl_texsample_h TYPE_EMBED "glsl/gl_texsample.h"
RESOURCE_glsl_vk_texsample_h TYPE_EMBED "glsl/vk_texsample.h"
+1
View File
@@ -65,6 +65,7 @@
#define RESOURCE_glsl_vk_depthms2buffer_comp 448
#define RESOURCE_glsl_vk_buffer2ms_comp 449
#define RESOURCE_glsl_vk_depthbuf2ms_frag 450
#define RESOURCE_glsl_pixelhistory_primid_legacy_frag 451
// Next default values for new objects
//