From ed512a48de74eab612d683651137ea3f7f506b87 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 22 Jul 2016 02:40:15 +0200 Subject: [PATCH] Remove glsl shader variants (and fix text rendering I forgot about) --- renderdoc/CMakeLists.txt | 23 +- renderdoc/data/embedded_files.h | 21 +- renderdoc/data/glsl/arraymscopy.comp | 65 --- renderdoc/data/glsl/blit.frag | 34 -- renderdoc/data/glsl/blit.vert | 43 -- renderdoc/data/glsl/checkerboard.frag | 51 --- renderdoc/data/glsl/debuguniforms.h | 149 ------- renderdoc/data/glsl/generic.frag | 35 -- renderdoc/data/glsl/generic.vert | 43 -- renderdoc/data/glsl/histogram.comp | 400 ------------------ renderdoc/data/glsl/mesh.comp | 83 ---- renderdoc/data/glsl/mesh.frag | 59 --- renderdoc/data/glsl/mesh.geom | 65 --- renderdoc/data/glsl/mesh.vert | 66 --- renderdoc/data/glsl/outline.frag | 71 ---- renderdoc/data/glsl/quadoverdraw.frag | 96 ----- renderdoc/data/glsl/texdisplay.frag | 177 -------- renderdoc/data/glsl/text.frag | 50 --- renderdoc/data/glsl/text.vert | 71 ---- renderdoc/data/glsl_shaders.cpp | 4 +- renderdoc/data/renderdoc.rc | 22 +- renderdoc/data/resource.h | 32 +- .../{glsl/texsample.h => spv/gl_texsample.h} | 0 renderdoc/data/spv/text.vert | 5 +- .../data/spv/{texsample.h => vk_texsample.h} | 0 renderdoc/driver/gl/gl_driver.cpp | 61 +-- renderdoc/driver/gl/gl_replay.cpp | 4 +- renderdoc/renderdoc.vcxproj | 21 +- renderdoc/renderdoc.vcxproj.filters | 66 +-- 29 files changed, 67 insertions(+), 1750 deletions(-) delete mode 100644 renderdoc/data/glsl/arraymscopy.comp delete mode 100644 renderdoc/data/glsl/blit.frag delete mode 100644 renderdoc/data/glsl/blit.vert delete mode 100644 renderdoc/data/glsl/checkerboard.frag delete mode 100644 renderdoc/data/glsl/debuguniforms.h delete mode 100644 renderdoc/data/glsl/generic.frag delete mode 100644 renderdoc/data/glsl/generic.vert delete mode 100644 renderdoc/data/glsl/histogram.comp delete mode 100644 renderdoc/data/glsl/mesh.comp delete mode 100644 renderdoc/data/glsl/mesh.frag delete mode 100644 renderdoc/data/glsl/mesh.geom delete mode 100644 renderdoc/data/glsl/mesh.vert delete mode 100644 renderdoc/data/glsl/outline.frag delete mode 100644 renderdoc/data/glsl/quadoverdraw.frag delete mode 100644 renderdoc/data/glsl/texdisplay.frag delete mode 100644 renderdoc/data/glsl/text.frag delete mode 100644 renderdoc/data/glsl/text.vert rename renderdoc/data/{glsl/texsample.h => spv/gl_texsample.h} (100%) rename renderdoc/data/spv/{texsample.h => vk_texsample.h} (100%) diff --git a/renderdoc/CMakeLists.txt b/renderdoc/CMakeLists.txt index f17b73073..1d8916d4e 100644 --- a/renderdoc/CMakeLists.txt +++ b/renderdoc/CMakeLists.txt @@ -79,8 +79,6 @@ set(sources core/resource_manager.cpp core/resource_manager.h core/socket_helpers.h - data/glsl/debuguniforms.h - data/glsl/texsample.h data/hlsl/debugcbuffers.h data/spv/debuguniforms.h data/spv/texsample.h @@ -195,24 +193,6 @@ target_compile_definitions(rdoc ${RDOC_DEFINITIONS}) target_include_directories(rdoc ${RDOC_INCLUDES}) set(data - data/glsl/arraymscopy.comp - data/glsl/blit.frag - data/glsl/blit.vert - data/glsl/checkerboard.frag - data/glsl/debuguniforms.h - data/glsl/generic.frag - data/glsl/generic.vert - data/glsl/histogram.comp - data/glsl/mesh.comp - data/glsl/mesh.frag - data/glsl/mesh.geom - data/glsl/mesh.vert - data/glsl/outline.frag - data/glsl/quadoverdraw.frag - data/glsl/texdisplay.frag - data/glsl/texsample.h - data/glsl/text.frag - data/glsl/text.vert data/spv/blit.vert data/spv/checkerboard.frag data/spv/debuguniforms.h @@ -228,7 +208,8 @@ set(data data/spv/quadresolve.frag data/spv/quadwrite.frag data/spv/texdisplay.frag - data/spv/texsample.h + data/spv/gl_texsample.h + data/spv/vk_texsample.h data/spv/text.frag data/spv/text.vert data/spv/array2ms.comp diff --git a/renderdoc/data/embedded_files.h b/renderdoc/data/embedded_files.h index 00a42d709..a58cef8f5 100644 --- a/renderdoc/data/embedded_files.h +++ b/renderdoc/data/embedded_files.h @@ -29,24 +29,6 @@ extern unsigned char CONCAT(data_, filename)[]; \ extern int CONCAT(CONCAT(data_, filename), _len); -DECLARE_EMBED(glsl_debuguniforms_h); -DECLARE_EMBED(glsl_texsample_h); -DECLARE_EMBED(glsl_blit_vert); -DECLARE_EMBED(glsl_blit_frag); -DECLARE_EMBED(glsl_texdisplay_frag); -DECLARE_EMBED(glsl_checkerboard_frag); -DECLARE_EMBED(glsl_histogram_comp); -DECLARE_EMBED(glsl_quadoverdraw_frag); -DECLARE_EMBED(glsl_arraymscopy_comp); -DECLARE_EMBED(glsl_mesh_vert); -DECLARE_EMBED(glsl_mesh_frag); -DECLARE_EMBED(glsl_mesh_geom); -DECLARE_EMBED(glsl_mesh_comp); -DECLARE_EMBED(glsl_generic_vert); -DECLARE_EMBED(glsl_generic_frag); -DECLARE_EMBED(glsl_text_frag); -DECLARE_EMBED(glsl_text_vert); -DECLARE_EMBED(glsl_outline_frag); DECLARE_EMBED(sourcecodepro_ttf); DECLARE_EMBED(spv_blit_vert); DECLARE_EMBED(spv_checkerboard_frag); @@ -62,7 +44,8 @@ DECLARE_EMBED(spv_minmaxresult_comp); DECLARE_EMBED(spv_histogram_comp); DECLARE_EMBED(spv_outline_frag); DECLARE_EMBED(spv_debuguniforms_h); -DECLARE_EMBED(spv_texsample_h); +DECLARE_EMBED(spv_gl_texsample_h); +DECLARE_EMBED(spv_vk_texsample_h); DECLARE_EMBED(spv_quadresolve_frag); DECLARE_EMBED(spv_quadwrite_frag); DECLARE_EMBED(spv_mesh_comp); diff --git a/renderdoc/data/glsl/arraymscopy.comp b/renderdoc/data/glsl/arraymscopy.comp deleted file mode 100644 index a1c78c10e..000000000 --- a/renderdoc/data/glsl/arraymscopy.comp +++ /dev/null @@ -1,65 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 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. - ******************************************************************************/ - -#extension GL_ARB_compute_shader : require - -layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in; - - -uniform int numMultiSamples; - - - -layout(binding = 0) uniform usampler2DMSArray srcMS; -layout(binding = 0) writeonly uniform uimage2DArray dstArray; - -void MS2Array() -{ - uvec3 id = gl_GlobalInvocationID; - - int slice = int(id.z / numMultiSamples); - int sampleIdx = int(id.z % numMultiSamples); - - uvec4 data = texelFetch(srcMS, ivec3(int(id.x), int(id.y), slice), sampleIdx); - - imageStore(dstArray, ivec3(int(id.x), int(id.y), int(id.z)), data); -} - - - - -layout(binding = 0) uniform usampler2DArray srcArray; -layout(binding = 0) writeonly uniform uimage2DMSArray dstMS; - -void Array2MS() -{ - uvec3 id = gl_GlobalInvocationID; - - int slice = int(id.z / numMultiSamples); - int sampleIdx = int(id.z % numMultiSamples); - - uvec4 data = texelFetch(srcArray, ivec3(int(id.x), int(id.y), int(id.z)), 0); - - imageStore(dstMS, ivec3(int(id.x), int(id.y), slice), sampleIdx, data); -} \ No newline at end of file diff --git a/renderdoc/data/glsl/blit.frag b/renderdoc/data/glsl/blit.frag deleted file mode 100644 index 6018674de..000000000 --- a/renderdoc/data/glsl/blit.frag +++ /dev/null @@ -1,34 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -#version 420 core - -layout (binding = 0) uniform sampler2D tex0; -layout (location = 0) out vec4 color_out; - -void main(void) -{ - color_out = texture(tex0, gl_FragCoord.xy/textureSize(tex0, 0)); -} diff --git a/renderdoc/data/glsl/blit.vert b/renderdoc/data/glsl/blit.vert deleted file mode 100644 index 124da8c46..000000000 --- a/renderdoc/data/glsl/blit.vert +++ /dev/null @@ -1,43 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -#version 420 core - -out gl_PerVertex -{ - vec4 gl_Position; - float gl_PointSize; - float gl_ClipDistance[]; -}; - -void main(void) -{ - const vec4 verts[4] = vec4[4](vec4(-1.0, -1.0, 0.5, 1.0), - vec4( 1.0, -1.0, 0.5, 1.0), - vec4(-1.0, 1.0, 0.5, 1.0), - vec4( 1.0, 1.0, 0.5, 1.0)); - - gl_Position = verts[gl_VertexID]; -} diff --git a/renderdoc/data/glsl/checkerboard.frag b/renderdoc/data/glsl/checkerboard.frag deleted file mode 100644 index e48396e67..000000000 --- a/renderdoc/data/glsl/checkerboard.frag +++ /dev/null @@ -1,51 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -#version 420 core - -layout (location = 0) out vec4 color_out; - -layout (binding = 0, std140) uniform checker -{ - vec4 lightCol; - vec4 darkCol; -}; - -void main(void) -{ - vec2 ab = mod(gl_FragCoord.xy, 128.0f.xx); - - if( - (ab.x < 64 && ab.y < 64) || - (ab.x > 64 && ab.y > 64) - ) - { - color_out = vec4(darkCol.rgb*darkCol.rgb, 1); - } - else - { - color_out = vec4(lightCol.rgb*lightCol.rgb, 1); - } -} diff --git a/renderdoc/data/glsl/debuguniforms.h b/renderdoc/data/glsl/debuguniforms.h deleted file mode 100644 index 125d37a85..000000000 --- a/renderdoc/data/glsl/debuguniforms.h +++ /dev/null @@ -1,149 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -// use some preprocessor hacks to compile the same header in both GLSL and C++ so we can define -// classes that represent a whole cbuffer -#if defined(__cplusplus) - -#include "common/common.h" -#include "maths/vec.h" - -#define uniform struct -#define vec2 Vec2f -#define vec3 Vec3f -#define vec4 Vec4f -#define uint uint32_t - -#define BINDING(b) - -#else - -// this has to happen above even any pre-processor definitions, -// so it's added in code -//#version 420 core - -#define BINDING(b) layout(binding = b, std140) - -#endif - -BINDING(0) uniform texdisplay -{ - vec2 Position; - float Scale; - float HDRMul; - - vec4 Channels; - - float RangeMinimum; - float InverseRangeSize; - float MipLevel; - int FlipY; - - vec3 TextureResolutionPS; - int OutputDisplayFormat; - - vec2 OutputRes; - int RawOutput; - float Slice; - - int SampleIdx; - int NumSamples; - vec2 Padding; -}; - -BINDING(0) uniform FontUniforms -{ - vec2 TextPosition; - float txtpadding; - float TextSize; - - vec2 CharacterSize; - vec2 FontScreenAspect; -}; - -BINDING(0) uniform HistogramCBufferData -{ - uint HistogramChannels; - float HistogramMin; - float HistogramMax; - uint HistogramFlags; - - float HistogramSlice; - int HistogramMip; - int HistogramSample; - int HistogramNumSamples; - - vec3 HistogramTextureResolution; - float Padding3; -}; - -// some constants available to both C++ and GLSL for configuring display -#define CUBEMAP_FACE_POS_X 0 -#define CUBEMAP_FACE_NEG_X 1 -#define CUBEMAP_FACE_POS_Y 2 -#define CUBEMAP_FACE_NEG_Y 3 -#define CUBEMAP_FACE_POS_Z 4 -#define CUBEMAP_FACE_NEG_Z 5 - -#define RESTYPE_TEX1D 0x1 -#define RESTYPE_TEX2D 0x2 -#define RESTYPE_TEX3D 0x3 -#define RESTYPE_TEXCUBE 0x4 -#define RESTYPE_TEX1DARRAY 0x5 -#define RESTYPE_TEX2DARRAY 0x6 -#define RESTYPE_TEXCUBEARRAY 0x7 -#define RESTYPE_TEXRECT 0x8 -#define RESTYPE_TEXBUFFER 0x9 -#define RESTYPE_TEX2DMS 0xA -#define RESTYPE_TEXTYPEMAX 0xA - -#define MESHDISPLAY_SOLID 0x1 -#define MESHDISPLAY_FACELIT 0x2 -#define MESHDISPLAY_SECONDARY 0x3 -#define MESHDISPLAY_SECONDARY_ALPHA 0x4 - -#define TEXDISPLAY_TYPEMASK 0xF -#define TEXDISPLAY_UINT_TEX 0x10 -#define TEXDISPLAY_SINT_TEX 0x20 -#define TEXDISPLAY_NANS 0x80 -#define TEXDISPLAY_CLIPPING 0x100 -#define TEXDISPLAY_GAMMA_CURVE 0x200 - -#ifndef FLT_EPSILON -#define FLT_EPSILON 1.192092896e-07f -#endif - -// histogram/minmax is calculated in blocks of NxN each with MxM tiles. -// e.g. a tile is 32x32 pixels, then this is arranged in blocks of 32x32 tiles. -// 1 compute thread = 1 tile, 1 compute group = 1 block -// -// NOTE because of this a block can cover more than the texture (think of a 1280x720 -// texture covered by 2x1 blocks) -// -// these values are in each dimension -#define HGRAM_PIXELS_PER_TILE 64 -#define HGRAM_TILES_PER_BLOCK 32 - -#define HGRAM_NUM_BUCKETS 256 diff --git a/renderdoc/data/glsl/generic.frag b/renderdoc/data/glsl/generic.frag deleted file mode 100644 index fad67fad8..000000000 --- a/renderdoc/data/glsl/generic.frag +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -#version 420 core - -layout (location = 0) out vec4 color_out; - -uniform vec4 RENDERDOC_GenericFS_Color; - -void main(void) -{ - color_out = RENDERDOC_GenericFS_Color; -} diff --git a/renderdoc/data/glsl/generic.vert b/renderdoc/data/glsl/generic.vert deleted file mode 100644 index f812d16ea..000000000 --- a/renderdoc/data/glsl/generic.vert +++ /dev/null @@ -1,43 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -#version 420 core - -layout (location = 0) in vec4 position; - -uniform vec4 RENDERDOC_GenericVS_Offset; -uniform vec4 RENDERDOC_GenericVS_Scale; - -out gl_PerVertex -{ - vec4 gl_Position; - float gl_PointSize; - float gl_ClipDistance[]; -}; - -void main(void) -{ - gl_Position = position*RENDERDOC_GenericVS_Scale + RENDERDOC_GenericVS_Offset; -} diff --git a/renderdoc/data/glsl/histogram.comp b/renderdoc/data/glsl/histogram.comp deleted file mode 100644 index 6a3e069b0..000000000 --- a/renderdoc/data/glsl/histogram.comp +++ /dev/null @@ -1,400 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 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. - ******************************************************************************/ - -// compute shaders that figure out the min/max values or histogram in a texture heirarchically -// note that we have to conditionally compile this shader for float/uint/sint as doing that -// dynamically produces a shader with too many temp registers unfortunately. - -#extension GL_ARB_compute_shader : require -#extension GL_ARB_shader_storage_buffer_object : require - -#if RENDERDOC_TileMinMaxCS - -layout(binding=0) writeonly buffer minmaxtiledest -{ -#if UINT_TEX - uvec4 tiles[]; -#elif SINT_TEX - ivec4 tiles[]; -#else - vec4 tiles[]; -#endif -} dest; - -layout (local_size_x = HGRAM_TILES_PER_BLOCK, local_size_y = HGRAM_TILES_PER_BLOCK) in; - -void main() -{ - uvec3 tid = gl_LocalInvocationID; - uvec3 gid = gl_WorkGroupID; - - int texType = SHADER_RESTYPE; - - uvec3 texDim = uvec3(HistogramTextureResolution); - - uint blocksX = uint(ceil(float(texDim.x)/float(HGRAM_PIXELS_PER_TILE*HGRAM_TILES_PER_BLOCK))); - - uvec2 topleft = (gid.xy*HGRAM_TILES_PER_BLOCK + tid.xy)*HGRAM_PIXELS_PER_TILE; - - uint outIdx = (tid.y*HGRAM_TILES_PER_BLOCK + tid.x) + (gid.y*blocksX + gid.x)*(HGRAM_TILES_PER_BLOCK*HGRAM_TILES_PER_BLOCK); - - int i=0; - -#if UINT_TEX - { - uvec4 minval = uvec4(0,0,0,0); - uvec4 maxval = uvec4(0,0,0,0); - - for(uint y=topleft.y; y < min(texDim.y, topleft.y + HGRAM_PIXELS_PER_TILE); y++) - { - for(uint x=topleft.x; x < min(texDim.x, topleft.x + HGRAM_PIXELS_PER_TILE); x++) - { - uvec4 data = SampleTextureUInt4(vec2(x, y), texType, false, - HistogramMip, HistogramSlice, HistogramSample); - - if(i == 0) - { - minval = maxval = data; - } - else - { - minval = min(minval, data); - maxval = max(maxval, data); - } - - i++; - } - } - - dest.tiles[outIdx*2+0] = minval; - dest.tiles[outIdx*2+1] = maxval; - } -#elif SINT_TEX - { - ivec4 minval = ivec4(0,0,0,0); - ivec4 maxval = ivec4(0,0,0,0); - - for(uint y=topleft.y; y < min(texDim.y, topleft.y + HGRAM_PIXELS_PER_TILE); y++) - { - for(uint x=topleft.x; x < min(texDim.x, topleft.x + HGRAM_PIXELS_PER_TILE); x++) - { - ivec4 data = SampleTextureSInt4(vec2(x, y), texType, false, - HistogramMip, HistogramSlice, HistogramSample); - - if(i == 0) - { - minval = maxval = data; - } - else - { - minval = min(minval, data); - maxval = max(maxval, data); - } - - i++; - } - } - - dest.tiles[outIdx*2+0] = minval; - dest.tiles[outIdx*2+1] = maxval; - } -#else - { - vec4 minval = vec4(0,0,0,0); - vec4 maxval = vec4(0,0,0,0); - - for(uint y=topleft.y; y < min(texDim.y, topleft.y + HGRAM_PIXELS_PER_TILE); y++) - { - for(uint x=topleft.x; x < min(texDim.x, topleft.x + HGRAM_PIXELS_PER_TILE); x++) - { - vec4 data = SampleTextureFloat4(vec2(x, y), texType, false, - HistogramMip, HistogramSlice, HistogramSample, HistogramNumSamples); - - if(i == 0) - { - minval = maxval = data; - } - else - { - minval = min(minval, data); - maxval = max(maxval, data); - } - - i++; - } - } - - dest.tiles[outIdx*2+0] = minval; - dest.tiles[outIdx*2+1] = maxval; - } -#endif -} - -#endif // #if RENDERDOC_TileMinMaxCS - - -#if RENDERDOC_ResultMinMaxCS - -layout(binding=0) writeonly buffer minmaxresultdest -{ -#if UINT_TEX - uvec4 result[2]; -#elif SINT_TEX - ivec4 result[2]; -#else - vec4 result[2]; -#endif -} dest; - -layout(binding=1) readonly buffer minmaxtilesrc -{ -#if UINT_TEX - uvec4 tiles[]; -#elif SINT_TEX - ivec4 tiles[]; -#else - vec4 tiles[]; -#endif -} src; - -layout (local_size_x = 1) in; - -void main() -{ - uvec3 texDim = uvec3(HistogramTextureResolution); - - uint blocksX = uint(ceil(float(texDim.x)/float(HGRAM_PIXELS_PER_TILE*HGRAM_TILES_PER_BLOCK))); - uint blocksY = uint(ceil(float(texDim.y)/float(HGRAM_PIXELS_PER_TILE*HGRAM_TILES_PER_BLOCK))); - -#if UINT_TEX - uvec4 minvalU = src.tiles[0]; - uvec4 maxvalU = src.tiles[1]; -#elif SINT_TEX - ivec4 minvalI = src.tiles[0]; - ivec4 maxvalI = src.tiles[1]; -#else - vec4 minvalF = src.tiles[0]; - vec4 maxvalF = src.tiles[1]; -#endif - - // i is the tile we're looking at - for(uint i=1; i < blocksX*blocksY*HGRAM_TILES_PER_BLOCK*HGRAM_TILES_PER_BLOCK; i++) - { - uint blockIdx = i/(HGRAM_TILES_PER_BLOCK*HGRAM_TILES_PER_BLOCK); - uint tileIdx = i%(HGRAM_TILES_PER_BLOCK*HGRAM_TILES_PER_BLOCK); - - // which block and tile is this in - uvec2 blockXY = uvec2(blockIdx % blocksX, blockIdx / blocksX); - uvec2 tileXY = uvec2(tileIdx % HGRAM_TILES_PER_BLOCK, tileIdx / HGRAM_TILES_PER_BLOCK); - - // if this is at least partially within the texture, include it. - if(blockXY.x*(HGRAM_TILES_PER_BLOCK*HGRAM_PIXELS_PER_TILE) + tileXY.x*HGRAM_PIXELS_PER_TILE < texDim.x && - blockXY.y*(HGRAM_TILES_PER_BLOCK*HGRAM_PIXELS_PER_TILE) + tileXY.y*HGRAM_PIXELS_PER_TILE < texDim.y) - { -#if UINT_TEX - minvalU = min(minvalU, src.tiles[i*2 + 0]); - maxvalU = max(maxvalU, src.tiles[i*2 + 1]); -#elif SINT_TEX - minvalI = min(minvalI, src.tiles[i*2 + 0]); - maxvalI = max(maxvalI, src.tiles[i*2 + 1]); -#else - minvalF = min(minvalF, src.tiles[i*2 + 0]); - maxvalF = max(maxvalF, src.tiles[i*2 + 1]); -#endif - } - } - -#if UINT_TEX - dest.result[0] = minvalU; - dest.result[1] = maxvalU; -#elif SINT_TEX - dest.result[0] = minvalI; - dest.result[1] = maxvalI; -#else - dest.result[0] = minvalF; - dest.result[1] = maxvalF; -#endif -} - -#endif // #if RENDERDOC_ResultMinMaxCS - -#if RENDERDOC_HistogramCS - -layout(binding=0) writeonly buffer minmaxresultdest -{ - uvec4 result[HGRAM_NUM_BUCKETS]; -} dest; - -layout (local_size_x = HGRAM_TILES_PER_BLOCK, local_size_y = HGRAM_TILES_PER_BLOCK) in; - -void main() -{ - uvec3 tid = gl_LocalInvocationID; - uvec3 gid = gl_WorkGroupID; - - int texType = SHADER_RESTYPE; - - uvec3 texDim = uvec3(HistogramTextureResolution); - - uint blocksX = uint(ceil(float(texDim.x)/float(HGRAM_PIXELS_PER_TILE*HGRAM_TILES_PER_BLOCK))); - - uvec2 topleft = (gid.xy*HGRAM_TILES_PER_BLOCK + tid.xy)*HGRAM_PIXELS_PER_TILE; - - int i=0; - - for(uint y=topleft.y; y < min(texDim.y, topleft.y + HGRAM_PIXELS_PER_TILE); y++) - { - for(uint x=topleft.x; x < min(texDim.x, topleft.x + HGRAM_PIXELS_PER_TILE); x++) - { - uint bucketIdx = HGRAM_NUM_BUCKETS+1; - -#if UINT_TEX - { - uvec4 data = SampleTextureUInt4(vec2(x, y), texType, false, - HistogramMip, HistogramSlice, HistogramSample); - - float divisor = 0.0f; - uint sum = 0; - if((HistogramChannels & 0x1) > 0) - { - sum += data.x; - divisor += 1.0f; - } - if((HistogramChannels & 0x2) > 0) - { - sum += data.y; - divisor += 1.0f; - } - if((HistogramChannels & 0x4) > 0) - { - sum += data.z; - divisor += 1.0f; - } - if((HistogramChannels & 0x8) > 0) - { - sum += data.w; - divisor += 1.0f; - } - - if(divisor > 0.0f) - { - float val = float(sum)/divisor; - - float normalisedVal = (val - HistogramMin)/(HistogramMax - HistogramMin); - - if(normalisedVal < 0.0f) - normalisedVal = 2.0f; - - bucketIdx = uint(floor(normalisedVal*HGRAM_NUM_BUCKETS)); - } - } -#elif SINT_TEX - { - ivec4 data = SampleTextureSInt4(vec2(x, y), texType, false, - HistogramMip, HistogramSlice, HistogramSample); - - float divisor = 0.0f; - int sum = 0; - if((HistogramChannels & 0x1) > 0) - { - sum += data.x; - divisor += 1.0f; - } - if((HistogramChannels & 0x2) > 0) - { - sum += data.y; - divisor += 1.0f; - } - if((HistogramChannels & 0x4) > 0) - { - sum += data.z; - divisor += 1.0f; - } - if((HistogramChannels & 0x8) > 0) - { - sum += data.w; - divisor += 1.0f; - } - - if(divisor > 0.0f) - { - float val = float(sum)/divisor; - - float normalisedVal = (val - HistogramMin)/(HistogramMax - HistogramMin); - - if(normalisedVal < 0.0f) - normalisedVal = 2.0f; - - bucketIdx = uint(floor(normalisedVal*HGRAM_NUM_BUCKETS)); - } - } -#else - { - vec4 data = SampleTextureFloat4(vec2(x, y), texType, false, - HistogramMip, HistogramSlice, HistogramSample, HistogramNumSamples); - - float divisor = 0.0f; - float sum = 0.0f; - if((HistogramChannels & 0x1) > 0) - { - sum += data.x; - divisor += 1.0f; - } - if((HistogramChannels & 0x2) > 0) - { - sum += data.y; - divisor += 1.0f; - } - if((HistogramChannels & 0x4) > 0) - { - sum += data.z; - divisor += 1.0f; - } - if((HistogramChannels & 0x8) > 0) - { - sum += data.w; - divisor += 1.0f; - } - - if(divisor > 0.0f) - { - float val = sum/divisor; - - float normalisedVal = (val - HistogramMin)/(HistogramMax - HistogramMin); - - if(normalisedVal < 0.0f) - normalisedVal = 2.0f; - - bucketIdx = uint(floor(normalisedVal*HGRAM_NUM_BUCKETS)); - } - } -#endif - - if(bucketIdx >= 0 && bucketIdx < HGRAM_NUM_BUCKETS) - atomicAdd(dest.result[bucketIdx].x, 1U); - } - } -} - -#endif //#if RENDERDOC_HistogramCS diff --git a/renderdoc/data/glsl/mesh.comp b/renderdoc/data/glsl/mesh.comp deleted file mode 100644 index e598fb508..000000000 --- a/renderdoc/data/glsl/mesh.comp +++ /dev/null @@ -1,83 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 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. - ******************************************************************************/ - -#version 420 core - -#extension GL_ARB_compute_shader : require -#extension GL_ARB_shader_storage_buffer_object : require - -layout(binding = 0) uniform atomic_uint pickresult_counter; -layout(binding = 0) writeonly buffer pickresult_buffer -{ - uvec4 results[]; -} pickresult; - -layout(binding = 1) readonly buffer vertex_data -{ - vec4 data[]; -} vb; - -layout(binding = 2) readonly buffer index_data -{ - uint data[]; -} ib; - - -uniform vec2 PickCoords; -uniform vec2 PickViewport; - -uniform mat4 PickMVP; - -uniform uint PickIdx; -uniform uint PickNumVerts; - -layout (local_size_x = 1024, local_size_y = 1) in; - -void main() -{ - uvec3 tid = gl_GlobalInvocationID; - - uint vertid = tid.x; - - if(vertid >= PickNumVerts) - return; - - uint idx = PickIdx != 0 ? ib.data[vertid] : vertid; - - vec4 pos = vb.data[idx]; - - vec4 wpos = PickMVP * pos; - - wpos.xyz /= wpos.www; - - vec2 scr = (wpos.xy*vec2(1.0f, -1.0f) + 1.0f) * 0.5f * PickViewport; - - // close to target co-ords? add to list - float len = length(scr - PickCoords); - if(len < 35.0f) - { - uint result_idx = atomicCounterIncrement(pickresult_counter); - pickresult.results[result_idx] = uvec4(vertid, idx, floatBitsToUint(len), floatBitsToUint(wpos.z)); - } -} \ No newline at end of file diff --git a/renderdoc/data/glsl/mesh.frag b/renderdoc/data/glsl/mesh.frag deleted file mode 100644 index 504b193bc..000000000 --- a/renderdoc/data/glsl/mesh.frag +++ /dev/null @@ -1,59 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 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. - ******************************************************************************/ - -in v2f -{ - vec4 secondary; - vec4 norm; -} IN; - -layout (location = 0) out vec4 color_out; - -uniform vec4 RENDERDOC_GenericFS_Color; - -uniform uint Mesh_DisplayFormat; - -void main(void) -{ - uint type = Mesh_DisplayFormat; - - if(type == MESHDISPLAY_SECONDARY) - { - color_out = vec4(IN.secondary.xyz, 1); - } - else if(type == MESHDISPLAY_SECONDARY_ALPHA) - { - color_out = vec4(IN.secondary.www, 1); - } - else if(type == MESHDISPLAY_FACELIT) - { - vec3 lightDir = normalize(vec3(0, -0.3f, -1)); - - color_out = vec4(RENDERDOC_GenericFS_Color.xyz*abs(dot(lightDir, IN.norm.xyz)), 1); - } - else //if(type == MESHDISPLAY_SOLID) - { - color_out = vec4(RENDERDOC_GenericFS_Color.xyz, 1); - } -} diff --git a/renderdoc/data/glsl/mesh.geom b/renderdoc/data/glsl/mesh.geom deleted file mode 100644 index 3591f38eb..000000000 --- a/renderdoc/data/glsl/mesh.geom +++ /dev/null @@ -1,65 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 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. - ******************************************************************************/ - -#version 420 core - -layout(triangles, invocations = 1) in; -layout(triangle_strip, max_vertices = 3) out; - -in v2f -{ - vec4 secondary; - vec4 norm; -} IN[]; - -out v2f -{ - vec4 secondary; - vec4 norm; -} OUT; - -uniform mat4 InvProj; - -out gl_PerVertex -{ - vec4 gl_Position; - float gl_PointSize; - float gl_ClipDistance[]; -}; - -void main() -{ - vec4 faceEdgeA = (InvProj * gl_in[1].gl_Position) - (InvProj * gl_in[0].gl_Position); - vec4 faceEdgeB = (InvProj * gl_in[2].gl_Position) - (InvProj * gl_in[0].gl_Position); - vec3 faceNormal = normalize( cross(faceEdgeA.xyz, faceEdgeB.xyz) ); - - for(int i=0; i < 3; i++) - { - gl_Position = gl_in[i].gl_Position; - OUT.secondary = IN[i].secondary; - OUT.norm = vec4(faceNormal.xyz, 1); - EmitVertex(); - } - EndPrimitive(); -} diff --git a/renderdoc/data/glsl/mesh.vert b/renderdoc/data/glsl/mesh.vert deleted file mode 100644 index 7215ad9e4..000000000 --- a/renderdoc/data/glsl/mesh.vert +++ /dev/null @@ -1,66 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -#version 420 core - -layout (location = 0) in vec4 position; -layout (location = 1) in vec4 secondary; - -uniform mat4 ModelViewProj; -uniform vec2 PointSpriteSize; -uniform uint HomogenousInput; - -out gl_PerVertex -{ - vec4 gl_Position; - float gl_PointSize; - float gl_ClipDistance[]; -}; - -out v2f -{ - vec4 secondary; - vec4 norm; -} OUT; - -void main(void) -{ - vec2 psprite[4] = - { - vec2(-1.0f, -1.0f), - vec2(-1.0f, 1.0f), - vec2( 1.0f, -1.0f), - vec2( 1.0f, 1.0f) - }; - - vec4 pos = position; - if(HomogenousInput == 0) - pos = vec4(position.xyz, 1); - - gl_Position = ModelViewProj * pos; - gl_Position.xy += PointSpriteSize.xy*0.01f*psprite[gl_VertexID%4]*gl_Position.w; - OUT.secondary = secondary; - OUT.norm = vec4(0, 0, 1, 1); -} diff --git a/renderdoc/data/glsl/outline.frag b/renderdoc/data/glsl/outline.frag deleted file mode 100644 index 00f386cb1..000000000 --- a/renderdoc/data/glsl/outline.frag +++ /dev/null @@ -1,71 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -#version 420 core - -layout (location = 0) out vec4 color_out; - -uniform vec4 RENDERDOC_Inner_Color; -uniform vec4 RENDERDOC_Border_Color; -uniform vec4 RENDERDOC_ViewRect; -uniform uint RENDERDOC_Scissor; - -void main(void) -{ - vec4 ret = RENDERDOC_Inner_Color; - - vec2 rectPos = gl_FragCoord.xy - RENDERDOC_ViewRect.xy; - vec2 rectSize = RENDERDOC_ViewRect.zw; - - vec2 ab = mod(rectPos.xy, 32.0f.xx); - - bool checkerVariant = ( - (ab.x < 16 && ab.y < 16) || - (ab.x > 16 && ab.y > 16) - ); - - if(RENDERDOC_Scissor == 0) - { - if(rectPos.x < 3.0f || rectPos.x > rectSize.x - 3.0f || - rectPos.y < 3.0f || rectPos.y > rectSize.y - 3.0f) - { - ret = RENDERDOC_Border_Color; - } - } - else - { - if(rectPos.x < 3.0f || rectPos.x > rectSize.x - 3.0f || - rectPos.y < 3.0f || rectPos.y > rectSize.y - 3.0f) - { - ret = checkerVariant ? vec4(1, 1, 1, 1) : vec4(0, 0, 0, 1); - } - else - { - ret = vec4(0, 0, 0, 0); - } - } - - color_out = ret; -} diff --git a/renderdoc/data/glsl/quadoverdraw.frag b/renderdoc/data/glsl/quadoverdraw.frag deleted file mode 100644 index 7dbc3fc43..000000000 --- a/renderdoc/data/glsl/quadoverdraw.frag +++ /dev/null @@ -1,96 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 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. - ******************************************************************************/ - -//////////////////////////////////////////////////////////////////////////////////////////// -// Below shaders courtesy of Stephen Hill (@self_shadow), converted to glsl trivially -// -// http://blog.selfshadow.com/2012/11/12/counting-quads/ -// https://github.com/selfshadow/demos/blob/master/QuadShading/QuadShading.fx -//////////////////////////////////////////////////////////////////////////////////////////// - -layout(binding = 0, r32ui) uniform coherent uimage2DArray overdrawImage; - - - -#ifdef RENDERDOC_QuadOverdrawPS - -layout(early_fragment_tests) in; - -void main() -{ - uint c0 = uint(gl_SampleMaskIn[0]); - - // Obtain coverage for all pixels in the quad, via 'message passing'*. - // (* For more details, see: - // "Shader Amortization using Pixel Quad Message Passing", Eric Penner, GPU Pro 2.) - uvec2 p = uvec2(uint(gl_FragCoord.x) & 1, uint(gl_FragCoord.y) & 1); - ivec2 sign = ivec2(p.x > 0 ? -1 : 1, p.y > 0 ? -1 : 1); - uint c1 = c0 + sign.x*int(dFdxFine(c0)); - uint c2 = c0 + sign.y*int(dFdyFine(c0)); - uint c3 = c2 + sign.x*int(dFdxFine(c2)); - - // Count the live pixels, minus 1 (zero indexing) - uint pixelCount = c0 + c1 + c2 + c3 - 1; - - ivec3 quad = ivec3(gl_FragCoord.xy*0.5, pixelCount); - imageAtomicAdd(overdrawImage, quad, 1); -} - -#endif // RENDERDOC_QuadOverdrawPS - - - - -#ifdef RENDERDOC_QOResolvePS - -#define NUM_RAMP_COLOURS 128 - -uniform vec4 overdrawRampColours[NUM_RAMP_COLOURS]; - -vec4 ToColour(uint v) -{ - return overdrawRampColours[min(v, uint(NUM_RAMP_COLOURS-1))]; -} - -layout (location = 0) out vec4 color_out; - -void main() -{ - ivec2 quad = ivec2(gl_FragCoord.xy*0.5f); - - uint overdraw = 0; - for(uint i = 0; i < 4; i++) - overdraw += imageLoad(overdrawImage, ivec3(quad, i)).x/(i + 1); - - color_out = ToColour(overdraw); -} - -#endif // RENDERDOC_QOResolvePS - -//////////////////////////////////////////////////////////////////////////////////////////// -// Above shaders courtesy of Stephen Hill (@self_shadow), converted to glsl trivially -// -// http://blog.selfshadow.com/2012/11/12/counting-quads/ -// https://github.com/selfshadow/demos/blob/master/QuadShading/QuadShading.fx -//////////////////////////////////////////////////////////////////////////////////////////// diff --git a/renderdoc/data/glsl/texdisplay.frag b/renderdoc/data/glsl/texdisplay.frag deleted file mode 100644 index 90f6b5f4a..000000000 --- a/renderdoc/data/glsl/texdisplay.frag +++ /dev/null @@ -1,177 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2015-2016 Baldur Karlsson - * Copyright (c) 2014 Crytek - * - * 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. - ******************************************************************************/ - -layout (location = 0) out vec4 color_out; - -float ConvertSRGBToLinear(float srgb) -{ - if (srgb <= 0.04045f) - return srgb / 12.92f; - else - return pow(( clamp(srgb, 0.0f, 1.0f) + 0.055f) / 1.055f, 2.4f); -} - -void main(void) -{ -#if UINT_TEX - bool uintTex = true; - bool sintTex = false; -#elif SINT_TEX - bool uintTex = false; - bool sintTex = true; -#else - bool uintTex = false; - bool sintTex = false; -#endif - - vec4 col; - uvec4 ucol; - ivec4 scol; - - // calc screen co-ords with origin top left, modified by Position - vec2 scr = vec2(gl_FragCoord.x, OutputRes.y - gl_FragCoord.y) - Position.xy; - - scr /= Scale; - - int texType = (OutputDisplayFormat & TEXDISPLAY_TYPEMASK); - - if(texType == RESTYPE_TEX1D || texType == RESTYPE_TEXBUFFER || texType == RESTYPE_TEX1DARRAY) - { - // by convention display 1D textures as 100 high - if(scr.x < 0.0f || scr.x > TextureResolutionPS.x || scr.y < 0.0f || scr.y > 100.0f) - discard; - } - else - { - if(scr.x < 0.0f || scr.y < 0.0f || - scr.x > TextureResolutionPS.x || scr.y > TextureResolutionPS.y) - discard; - } - - // sample the texture. -#if UINT_TEX - ucol = SampleTextureUInt4(scr, texType, FlipY == 0, int(MipLevel), Slice, SampleIdx); -#elif SINT_TEX - scol = SampleTextureSInt4(scr, texType, FlipY == 0, int(MipLevel), Slice, SampleIdx); -#else - col = SampleTextureFloat4(scr, texType, FlipY == 0, int(MipLevel), Slice, SampleIdx, NumSamples); -#endif - - if(RawOutput != 0) - { - if (uintTex) - color_out = uintBitsToFloat(ucol); - else if (sintTex) - color_out = intBitsToFloat(scol); - else - color_out = col; - return; - } - - // RGBM encoding - if(HDRMul > 0.0f) - { - if (uintTex) - col = vec4(ucol.rgb * ucol.a * uint(HDRMul), 1.0); - else if (sintTex) - col = vec4(scol.rgb * scol.a * int(HDRMul), 1.0); - else - col = vec4(col.rgb * col.a * HDRMul, 1.0); - } - - if (uintTex) - col = vec4(ucol); - else if (sintTex) - col = vec4(scol); - - vec4 pre_range_col = col; - - col = ((col - RangeMinimum)*InverseRangeSize); - - if(Channels.x < 0.5f) col.x = pre_range_col.x = 0.0f; - if(Channels.y < 0.5f) col.y = pre_range_col.y = 0.0f; - if(Channels.z < 0.5f) col.z = pre_range_col.z = 0.0f; - if(Channels.w < 0.5f) col.w = pre_range_col.w = 1.0f; - - // show nans, infs and negatives - if((OutputDisplayFormat & TEXDISPLAY_NANS) > 0) - { - if(isnan(pre_range_col.r) || isnan(pre_range_col.g) || isnan(pre_range_col.b) || isnan(pre_range_col.a)) - { - color_out = vec4(1, 0, 0, 1); - return; - } - - if(isinf(pre_range_col.r) || isinf(pre_range_col.g) || isinf(pre_range_col.b) || isinf(pre_range_col.a)) - { - color_out = vec4(0, 1, 0, 1); - return; - } - - if(pre_range_col.r < 0 || pre_range_col.g < 0 || pre_range_col.b < 0 || pre_range_col.a < 0) - { - color_out = vec4(0, 0, 1, 1); - return; - } - - col = vec4(dot(col.xyz, vec3(0.2126, 0.7152, 0.0722)).xxx, 1); - } - else if((OutputDisplayFormat & TEXDISPLAY_CLIPPING) > 0) - { - if(col.r < 0 || col.g < 0 || col.b < 0 || col.a < 0) - { - color_out = vec4(1, 0, 0, 1); - return; - } - - if(col.r > (1+FLT_EPSILON) || col.g > (1+FLT_EPSILON) || col.b > (1+FLT_EPSILON) || col.a > (1+FLT_EPSILON)) - { - color_out = vec4(0, 1, 0, 1); - return; - } - - col = vec4(dot(col.xyz, vec3(0.2126, 0.7152, 0.0722)).xxx, 1); - } - else - { - // if only one channel is selected - if(dot(Channels, 1.0f.xxxx) == 1.0f) - { - // if it's alpha, just move it into rgb - // otherwise, select the channel that's on and replicate it across all channels - if(Channels.a == 1) - col = vec4(col.aaa, 1); - else - col = vec4(dot(col.rgb, 1.0f.xxx).xxx, 1.0f); - } - } - - if((OutputDisplayFormat & TEXDISPLAY_GAMMA_CURVE) > 0) - { - col.rgb = vec3(ConvertSRGBToLinear(col.r), ConvertSRGBToLinear(col.g), ConvertSRGBToLinear(col.b)); - } - - color_out = col; -} \ No newline at end of file diff --git a/renderdoc/data/glsl/text.frag b/renderdoc/data/glsl/text.frag deleted file mode 100644 index 71ef958f3..000000000 --- a/renderdoc/data/glsl/text.frag +++ /dev/null @@ -1,50 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 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. - ******************************************************************************/ - -#version 420 core - -layout (binding = 0) uniform sampler2D tex0; -layout (location = 0) out vec4 color_out; - -in v2f -{ - vec4 tex; - vec2 glyphuv; -} IN; - -void main(void) -{ - float text = 0; - - if(IN.glyphuv.x >= 0.0f && IN.glyphuv.x <= 1.0f && - IN.glyphuv.y >= 0.0f && IN.glyphuv.y <= 1.0f) - { - vec2 uv; - uv.x = mix(IN.tex.x, IN.tex.z, IN.glyphuv.x); - uv.y = mix(IN.tex.y, IN.tex.w, IN.glyphuv.y); - text = texture(tex0, uv.xy).x; - } - - color_out = vec4(text.xxx, clamp(text + 0.5f, 0.0f, 1.0f)); -} diff --git a/renderdoc/data/glsl/text.vert b/renderdoc/data/glsl/text.vert deleted file mode 100644 index 1fe638ae7..000000000 --- a/renderdoc/data/glsl/text.vert +++ /dev/null @@ -1,71 +0,0 @@ -/****************************************************************************** - * The MIT License (MIT) - * - * Copyright (c) 2014-2016 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. - ******************************************************************************/ - -struct glyph -{ - vec4 posdata; - vec4 uvdata; -}; - -layout (binding = 1, std140) uniform glyphdata -{ - glyph glyphs[127-32]; -}; - -layout (binding = 2, std140) uniform stringdata -{ - uvec4 str[256]; -}; - -out v2f -{ - vec4 tex; - vec2 glyphuv; -} OUT; - -out gl_PerVertex -{ - vec4 gl_Position; - float gl_PointSize; - float gl_ClipDistance[]; -}; - -void main(void) -{ - const vec3 verts[4] = vec3[4](vec3( 0.0, 0.0, 0.5), - vec3( 1.0, 0.0, 0.5), - vec3( 0.0, 1.0, 0.5), - vec3( 1.0, 1.0, 0.5)); - - vec3 pos = verts[gl_VertexID]; - uint strindex = gl_InstanceID; - - vec2 charPos = vec2(strindex + pos.x + TextPosition.x, -pos.y - TextPosition.y); - - glyph G = glyphs[str[strindex].x]; - - gl_Position = vec4(charPos.xy*2.0f*TextSize*FontScreenAspect.xy + vec2(-1, 1), 1, 1); - OUT.glyphuv.xy = (pos.xy - G.posdata.xy) * G.posdata.zw; - OUT.tex = G.uvdata * CharacterSize.xyxy; -} diff --git a/renderdoc/data/glsl_shaders.cpp b/renderdoc/data/glsl_shaders.cpp index f0644bf51..b71c2c5f9 100644 --- a/renderdoc/data/glsl_shaders.cpp +++ b/renderdoc/data/glsl_shaders.cpp @@ -57,9 +57,9 @@ void GenerateGLSLShader(std::vector &sources, ShaderType type, if(shader.find("#include \"texsample.h\"") != string::npos) { if(type == eShaderVulkan) - sources[2] = GetEmbeddedResource(spv_texsample_h); + sources[2] = GetEmbeddedResource(spv_vk_texsample_h); else if(type == eShaderGLSL) - sources[2] = GetEmbeddedResource(glsl_texsample_h); + sources[2] = GetEmbeddedResource(spv_gl_texsample_h); else RDCERR("Unknown type! %d", type); } diff --git a/renderdoc/data/renderdoc.rc b/renderdoc/data/renderdoc.rc index 54cea2aba..8631c159f 100644 --- a/renderdoc/data/renderdoc.rc +++ b/renderdoc/data/renderdoc.rc @@ -110,25 +110,6 @@ RESOURCE_debugcbuffers_h TYPE_EMBED "hlsl/debugcbuffers.h" RESOURCE_multisample_hlsl TYPE_EMBED "hlsl/multisample.hlsl" RESOURCE_mesh_hlsl TYPE_EMBED "hlsl/mesh.hlsl" -RESOURCE_glsl_blit_vert TYPE_EMBED "glsl/blit.vert" -RESOURCE_glsl_blit_frag TYPE_EMBED "glsl/blit.frag" -RESOURCE_glsl_texdisplay_frag TYPE_EMBED "glsl/texdisplay.frag" -RESOURCE_glsl_checkerboard_frag TYPE_EMBED "glsl/checkerboard.frag" -RESOURCE_glsl_generic_vert TYPE_EMBED "glsl/generic.vert" -RESOURCE_glsl_generic_frag TYPE_EMBED "glsl/generic.frag" -RESOURCE_glsl_mesh_vert TYPE_EMBED "glsl/mesh.vert" -RESOURCE_glsl_debuguniforms_h TYPE_EMBED "glsl/debuguniforms.h" -RESOURCE_glsl_text_vert TYPE_EMBED "glsl/text.vert" -RESOURCE_glsl_text_frag TYPE_EMBED "glsl/text.frag" -RESOURCE_glsl_texsample_h TYPE_EMBED "glsl/texsample.h" -RESOURCE_glsl_histogram_comp TYPE_EMBED "glsl/histogram.comp" -RESOURCE_glsl_mesh_frag TYPE_EMBED "glsl/mesh.frag" -RESOURCE_glsl_mesh_geom TYPE_EMBED "glsl/mesh.geom" -RESOURCE_glsl_mesh_comp TYPE_EMBED "glsl/mesh.comp" -RESOURCE_glsl_arraymscopy_comp TYPE_EMBED "glsl/arraymscopy.comp" -RESOURCE_glsl_quadoverdraw_frag TYPE_EMBED "glsl/quadoverdraw.frag" -RESOURCE_glsl_outline_frag TYPE_EMBED "glsl/outline.frag" - RESOURCE_sourcecodepro_ttf TYPE_EMBED "sourcecodepro.ttf" RESOURCE_spv_blit_vert TYPE_EMBED "spv/blit.vert" @@ -145,7 +126,8 @@ RESOURCE_spv_minmaxresult_comp TYPE_EMBED "spv/minmaxresult.comp" RESOURCE_spv_histogram_comp TYPE_EMBED "spv/histogram.comp" RESOURCE_spv_outline_frag TYPE_EMBED "spv/outline.frag" RESOURCE_spv_debuguniforms_h TYPE_EMBED "spv/debuguniforms.h" -RESOURCE_spv_texsample_h TYPE_EMBED "spv/texsample.h" +RESOURCE_spv_gl_texsample_h TYPE_EMBED "spv/gl_texsample.h" +RESOURCE_spv_vk_texsample_h TYPE_EMBED "spv/vk_texsample.h" RESOURCE_spv_quadresolve_frag TYPE_EMBED "spv/quadresolve.frag" RESOURCE_spv_quadwrite_frag TYPE_EMBED "spv/quadwrite.frag" RESOURCE_spv_mesh_comp TYPE_EMBED "spv/mesh.comp" diff --git a/renderdoc/data/resource.h b/renderdoc/data/resource.h index f0918d051..9ab0259ab 100644 --- a/renderdoc/data/resource.h +++ b/renderdoc/data/resource.h @@ -12,25 +12,6 @@ #define RESOURCE_multisample_hlsl 106 #define RESOURCE_mesh_hlsl 107 -#define RESOURCE_glsl_blit_vert 201 -#define RESOURCE_glsl_blit_frag 202 -#define RESOURCE_glsl_texdisplay_frag 203 -#define RESOURCE_glsl_checkerboard_frag 204 -#define RESOURCE_glsl_generic_vert 205 -#define RESOURCE_glsl_generic_frag 206 -#define RESOURCE_glsl_mesh_vert 207 -#define RESOURCE_glsl_debuguniforms_h 208 -#define RESOURCE_glsl_text_vert 209 -#define RESOURCE_glsl_text_frag 210 -#define RESOURCE_glsl_texsample_h 211 -#define RESOURCE_glsl_histogram_comp 212 -#define RESOURCE_glsl_mesh_frag 213 -#define RESOURCE_glsl_mesh_geom 214 -#define RESOURCE_glsl_mesh_comp 215 -#define RESOURCE_glsl_arraymscopy_comp 216 -#define RESOURCE_glsl_quadoverdraw_frag 217 -#define RESOURCE_glsl_outline_frag 218 - #define RESOURCE_sourcecodepro_ttf 301 #define RESOURCE_spv_blit_vert 401 @@ -47,12 +28,13 @@ #define RESOURCE_spv_histogram_comp 414 #define RESOURCE_spv_outline_frag 415 #define RESOURCE_spv_debuguniforms_h 416 -#define RESOURCE_spv_texsample_h 417 -#define RESOURCE_spv_quadresolve_frag 418 -#define RESOURCE_spv_quadwrite_frag 419 -#define RESOURCE_spv_mesh_comp 420 -#define RESOURCE_spv_array2ms_comp 421 -#define RESOURCE_spv_ms2array_comp 422 +#define RESOURCE_spv_gl_texsample_h 417 +#define RESOURCE_spv_vk_texsample_h 418 +#define RESOURCE_spv_quadresolve_frag 419 +#define RESOURCE_spv_quadwrite_frag 420 +#define RESOURCE_spv_mesh_comp 421 +#define RESOURCE_spv_array2ms_comp 422 +#define RESOURCE_spv_ms2array_comp 423 #if !defined(STRINGIZE) #define STRINGIZE2(a) #a diff --git a/renderdoc/data/glsl/texsample.h b/renderdoc/data/spv/gl_texsample.h similarity index 100% rename from renderdoc/data/glsl/texsample.h rename to renderdoc/data/spv/gl_texsample.h diff --git a/renderdoc/data/spv/text.vert b/renderdoc/data/spv/text.vert index 106c42e06..d3a018249 100644 --- a/renderdoc/data/spv/text.vert +++ b/renderdoc/data/spv/text.vert @@ -42,11 +42,14 @@ void main(void) uint strindex = INSTANCE_ID; vec2 charPos = vec2(strindex + pos.x + general.TextPosition.x, pos.y + general.TextPosition.y); - FontGlyphData G = glyphs.data[ str.chars[strindex].x ]; gl_Position = vec4(charPos.xy*2.0f*general.TextSize*general.FontScreenAspect.xy + vec2(-1, -1), 1, 1); glyphuv.xy = (pos.xy - G.posdata.xy) * G.posdata.zw; tex = G.uvdata * general.CharacterSize.xyxy; + +#ifdef OPENGL + gl_Position.y = -gl_Position.y; +#endif } diff --git a/renderdoc/data/spv/texsample.h b/renderdoc/data/spv/vk_texsample.h similarity index 100% rename from renderdoc/data/spv/texsample.h rename to renderdoc/data/spv/vk_texsample.h diff --git a/renderdoc/driver/gl/gl_driver.cpp b/renderdoc/driver/gl/gl_driver.cpp index 11629f332..074d7ef30 100644 --- a/renderdoc/driver/gl/gl_driver.cpp +++ b/renderdoc/driver/gl/gl_driver.cpp @@ -26,7 +26,7 @@ #include "gl_driver.h" #include #include "common/common.h" -#include "data/glsl/debuguniforms.h" +#include "data/glsl_shaders.h" #include "driver/shaders/spirv/spirv_common.h" #include "jpeg-compressor/jpge.h" #include "maths/vec.h" @@ -34,6 +34,9 @@ #include "serialise/string_utils.h" #include "stb/stb_truetype.h" +#define OPENGL 1 +#include "data/spv/debuguniforms.h" + const int firstChar = int(' ') + 1; const int lastChar = 127; const int numChars = lastChar - firstChar; @@ -1153,7 +1156,7 @@ void WrappedOpenGL::ContextData::CreateDebugData(const GLHookSet &gl) gl.glGenBuffers(1, &GeneralUBO); gl.glBindBuffer(eGL_UNIFORM_BUFFER, GeneralUBO); - gl.glBufferData(eGL_UNIFORM_BUFFER, sizeof(FontUniforms), NULL, eGL_DYNAMIC_DRAW); + gl.glBufferData(eGL_UNIFORM_BUFFER, sizeof(FontUBOData), NULL, eGL_DYNAMIC_DRAW); gl.glGenBuffers(1, &StringUBO); gl.glBindBuffer(eGL_UNIFORM_BUFFER, StringUBO); @@ -1167,43 +1170,53 @@ void WrappedOpenGL::ContextData::CreateDebugData(const GLHookSet &gl) gl.glGetShaderiv && gl.glGetShaderInfoLog && gl.glDeleteShader && gl.glCreateProgram && gl.glAttachShader && gl.glLinkProgram && gl.glGetProgramiv && gl.glGetProgramInfoLog) { - string textvs = "#version 420 core\n\n"; - textvs += GetEmbeddedResource(glsl_debuguniforms_h); - textvs += GetEmbeddedResource(glsl_text_vert); - string textfs = GetEmbeddedResource(glsl_text_frag); + vector vs; + vector fs; - GLuint vs = gl.glCreateShader(eGL_VERTEX_SHADER); - GLuint fs = gl.glCreateShader(eGL_FRAGMENT_SHADER); + GenerateGLSLShader(vs, eShaderGLSL, "", GetEmbeddedResource(spv_text_vert), 420); + GenerateGLSLShader(fs, eShaderGLSL, "", GetEmbeddedResource(spv_text_frag), 420); - const char *src = textvs.c_str(); - gl.glShaderSource(vs, 1, &src, NULL); - src = textfs.c_str(); - gl.glShaderSource(fs, 1, &src, NULL); + vector vsc; + vsc.reserve(vs.size()); + vector fsc; + fsc.reserve(fs.size()); - gl.glCompileShader(vs); - gl.glCompileShader(fs); + for(size_t i = 0; i < vs.size(); i++) + vsc.push_back(vs[i].c_str()); + + for(size_t i = 0; i < fs.size(); i++) + fsc.push_back(fs[i].c_str()); + + GLuint vert = gl.glCreateShader(eGL_VERTEX_SHADER); + GLuint frag = gl.glCreateShader(eGL_FRAGMENT_SHADER); + + gl.glShaderSource(vert, (GLsizei)vs.size(), &vsc[0], NULL); + gl.glShaderSource(frag, (GLsizei)fs.size(), &fsc[0], NULL); + + gl.glCompileShader(vert); + gl.glCompileShader(frag); char buffer[1024] = {0}; GLint status = 0; - gl.glGetShaderiv(vs, eGL_COMPILE_STATUS, &status); + gl.glGetShaderiv(vert, eGL_COMPILE_STATUS, &status); if(status == 0) { - gl.glGetShaderInfoLog(vs, 1024, NULL, buffer); + gl.glGetShaderInfoLog(vert, 1024, NULL, buffer); RDCERR("Shader error: %s", buffer); } - gl.glGetShaderiv(fs, eGL_COMPILE_STATUS, &status); + gl.glGetShaderiv(frag, eGL_COMPILE_STATUS, &status); if(status == 0) { - gl.glGetShaderInfoLog(fs, 1024, NULL, buffer); + gl.glGetShaderInfoLog(frag, 1024, NULL, buffer); RDCERR("Shader error: %s", buffer); } Program = gl.glCreateProgram(); - gl.glAttachShader(Program, vs); - gl.glAttachShader(Program, fs); + gl.glAttachShader(Program, vert); + gl.glAttachShader(Program, frag); gl.glLinkProgram(Program); @@ -1214,8 +1227,8 @@ void WrappedOpenGL::ContextData::CreateDebugData(const GLHookSet &gl) RDCERR("Link error: %s", buffer); } - gl.glDeleteShader(vs); - gl.glDeleteShader(fs); + gl.glDeleteShader(vert); + gl.glDeleteShader(frag); } ready = true; @@ -1663,8 +1676,8 @@ void WrappedOpenGL::RenderOverlayStr(float x, float y, const char *text) { gl.glBindBufferBase(eGL_UNIFORM_BUFFER, 0, ctxdata.GeneralUBO); - FontUniforms *ubo = (FontUniforms *)gl.glMapBufferRange( - eGL_UNIFORM_BUFFER, 0, sizeof(FontUniforms), GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); + FontUBOData *ubo = (FontUBOData *)gl.glMapBufferRange( + eGL_UNIFORM_BUFFER, 0, sizeof(FontUBOData), GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); ubo->TextPosition.x = x; ubo->TextPosition.y = y; diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index d59f6d0a5..c0073247b 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -24,11 +24,13 @@ ******************************************************************************/ #include "gl_replay.h" -#include "data/glsl/debuguniforms.h" #include "serialise/string_utils.h" #include "gl_driver.h" #include "gl_resources.h" +#define OPENGL 1 +#include "data/spv/debuguniforms.h" + GLReplay::GLReplay() { m_pDriver = NULL; diff --git a/renderdoc/renderdoc.vcxproj b/renderdoc/renderdoc.vcxproj index 9d9f3fad3..e048cd4be 100644 --- a/renderdoc/renderdoc.vcxproj +++ b/renderdoc/renderdoc.vcxproj @@ -252,13 +252,12 @@ - - - + + @@ -379,22 +378,6 @@ - - - - - - - - - - - - - - - - diff --git a/renderdoc/renderdoc.vcxproj.filters b/renderdoc/renderdoc.vcxproj.filters index c337d32b9..2705302fb 100644 --- a/renderdoc/renderdoc.vcxproj.filters +++ b/renderdoc/renderdoc.vcxproj.filters @@ -34,9 +34,6 @@ {0ecdcd74-a30b-457e-8b22-92bd58405c56} - - {889cc549-e49b-430b-9e9b-5a42e7c26b03} - {7d6b0f22-1180-4767-b284-cc87f54ec012} @@ -156,9 +153,6 @@ Resources\hlsl - - Resources\glsl - OS\Win32 @@ -213,9 +207,6 @@ 3rdparty\stb - - Resources\glsl - Common\Strings @@ -237,9 +228,6 @@ Resources\spv - - Resources\spv - Common @@ -255,6 +243,12 @@ Resources + + Resources\spv + + + Resources\spv + @@ -442,57 +436,9 @@ Resources\hlsl - - Resources\glsl - - - Resources\glsl - - - Resources\glsl - - - Resources\glsl - - - Resources\glsl - - - Resources\glsl - - - Resources\glsl - - - Resources\glsl - - - Resources\glsl - - - Resources\glsl - - - Resources\glsl - - - Resources\glsl - - - Resources\glsl - - - Resources\glsl - Resources\hlsl - - Resources\glsl - - - Resources\glsl - Resources\spv