Commit Graph
149 Commits
Author SHA1 Message Date
baldurk 38afb7c8ad Fix handling of S8 multisampled textures. Closes #2883 2023-03-14 16:32:06 +00:00
Orson Baines d7042643ce Address Pixel History PR feedback
- change mscopy compute shader to use same as vulkan
- default to sample 0 when average value is selected
2023-02-14 10:07:07 +00:00
Orson Baines d87f505a26 OpenGL Pixel History Multisampling support
- Read pixel value from the selected sample
- Support the average value for multisampled textures
- Mark events that fail sample mask
2023-02-14 10:07:07 +00:00
baldurk d47e79ae07 Update copyright years to 2023 2023-02-01 12:23:32 +00:00
Orson Baines 5b5d2aa191 Improve GL Pixel History per PR feedback
- Blit fragments and read back results in batch
- Modify per fragment callbacks to reduce number of full replays
- Use defines in the primitiveId shader to toggle between float/int
  output
2023-01-05 14:37:55 +00:00
Bruce He c0b931eb15 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
2023-01-05 14:37:55 +00:00
baldurk ea4aa16455 Force custom display shaders VS explicit output location. Closes #2757
* This works around an obtuse GL requirement that explicit locations on one side
  will cause a break in compatibility with the other side, even if dropping the
  location would work otherwise.
2022-10-20 12:50:00 +01:00
baldurk fc39299da8 Don't require GL_OVR_multiview2 when GL_OVR_multiview is enough
* This is also all we check for in code.
2022-06-16 15:53:50 +01:00
Remi Palandri acde46de57 move ms/compute shader system to single descriptorset 2022-05-03 12:33:46 +01:00
baldurk cd10efb693 Fix some abstraction defines for custom shaders 2022-03-30 13:05:46 +01:00
Remi Palandri 79aee1df43 full implementation of compute msaa-to-buffer 2022-03-09 12:10:47 +00:00
baldurk fcdea67879 Update copyright years to 2022 2022-02-17 17:38:32 +00:00
baldurk 4bf2e00ba5 Switch custom prefixes from defines to static constants 2022-02-01 01:07:25 +00:00
baldurk 3ac4bd0ebd Refactor custom shaders to abstract binding differences. Closes #2458
* Newly written shaders and any updated shaders can now use pre-defined macros
  to abstract away binding differences between APIs, so custom shaders will be
  more portable in particular shaders written in HLSL for D3D or GLSL on OpenGL
  won't break on vulkan because they refer to incorrect binds.
2022-01-31 19:14:08 +00:00
baldurk 39d31e880d Handle vertex picking in world space for post-projection data
* Previously the vertex picking was always being done in NDC space, but now for
  perspective projections we unproject into world space and raycast there for
  more reliable results with unsual projections.
2021-10-28 11:24:46 +01:00
baldurk 1ed4b561e6 Fix discard patterns to work correctly with multisampled UINT textures 2021-05-27 14:18:05 +01:00
baldurk 20d8ae2dcf Fix display of 3D texture slices when linear sampling
* When displaying mip 0 of a texture at less than 100% zoom we linear sampling,
  but we don't want to linear sample across slices. Adding a half pixel offset
  in z ensures we sample precisely on the slice itself.
2021-01-20 17:15:34 +00:00
baldurk 0c410d40ef Fix issue showing whole pass in mesh viewer with inverse view height
* In particular this was breaking if not all draws in the pass used an inverse
  view (unlikely in practice, but comes up in our tests).
2021-01-19 17:20:15 +00:00
baldurk 026da176bb Update copyright years to 2021 2021-01-13 13:56:10 +00:00
baldurk 2bfa2c0ced Move histogram/minmax shaders into vulkan shader cache
* This lets us cache all shaders instead of having some be regenerated outside
  the cache and looked up into it.
2020-09-04 16:39:42 +01:00
baldurk 9858f516d0 Set default precision specifiers earlier in GLES shader 2020-08-07 12:46:17 +01:00
baldurk 02a54be6ad When replaying resource discards fill with explicit pattern. Closes #284
* This helps catches cases where a discarded image is accidentally used and in
  many cases may still have valid data. Particularly on Vulkan this is relevant
  for DONT_CARE renderpass load and store ops.
2020-07-13 17:29:11 +01:00
Aliya Pazylbekova 0fd3d65a6f Vk Pixel History: support other depth formats MSAA
- Separate the pixel history copy pixel shader into two separate
  shaders, one for colour copy and one for depth
- Allocate and update descriptor sets on demand
- Add another compute shader for pixel history depth copy
2020-05-26 21:19:55 +01:00
baldurk e31ebd0f55 Work around presumed QC driver bug storing to array slices 2020-05-14 20:33:20 +01:00
Aliya Pazylbekova 41b911d1d0 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.
2020-05-06 19:35:25 +01:00
Aliya Pazylbekova 2cb546686b Vk Pixel History: multi sampled colour
Colour only, depth/stencil copy not supported.
This means that we only report pre-mod and post-mod colour values for
events. Since stencil copy is not supported, number of fragments is
not reported, and shader output is not queried.
2020-04-29 18:48:37 +01:00
baldurk 745b65b3d2 Fix sampling from cube textures 2020-04-27 17:03:12 +01:00
baldurk 18713f644e Implement OpImageQueryLod by faking derivatives on sample quad 2020-04-23 19:14:09 +01:00
baldurk 7d0d492a66 Add missing copyright statement in shader 2020-04-10 16:58:52 +01:00
Aliya Pazylbekova 8d2ad78f05 Vk Pixel History: refactoring, per fragment depth
- Refactor to use common funcs
- Add per fragment depth data
- Rename pixelhistory.frag to pixelhistory_primid.frag
- Fix how some per fragment pipelines are created

For per fragment data we create 3 pipelines
1) Post modification pipeline
changes the stencil state and scissors around the target pixel
2) Shader output pipeline
in addition to above, disables rasterization discard, depth bounds test,
culling and turns off blending
3) Primitive ID pipe
in addition to above, disables depth test and depth write, and changes
the fragment shader to only output primitive ID
2020-03-20 16:16:12 +00:00
Aliya Pazylbekova 83623af8d8 Vk Pixel History: per fragment data
- For now only per fragment primitive ID, and colour values, not depth
information.
2020-03-20 16:16:12 +00:00
baldurk cb94a28768 Create GLES shaders as version 300 if replaying on GL ES 3.0. Refs #1770 2020-03-11 18:00:53 +00:00
baldurk 2916c0f9f7 Update copyright years to 2020 2020-01-06 16:20:45 +00:00
baldurk e9bb5a8219 Initialise color when doing manual resolve on GL 2019-12-18 19:09:18 +00:00
baldurk ff08748238 Ensure all files have trailing new-lines and enforce with clang warning 2019-12-02 20:28:05 +00:00
baldurk 11c39377b1 Handle range adaption in texture remapping
* This can be used in saving overlays, stencil, etc
2019-11-27 11:05:24 +00:00
baldurk edc8fb6bd6 Be more precise with texture remapping to handle integer textures 2019-11-26 17:38:26 +00:00
Gert Wollny 44e7bbe439 gl: Handle the use of (u)intBitsToFloat by using a separate define
The shader code is preprocessed with glslang that doesn't use the driver
capabilities to define macros indicating the availability of extensions,
instead it uses its own set of supported extensions, and in this case
it supports ARB_gpu_shader5. As a result the generated shader code would
make use of the (u)intBitsToFloat conversion functions based on the define
GL_ARB_gpu_shader5 also if the driver doesn't support this extension.

Hence an additional define is added to indicate whether bit casting
functions are available, and the extension is only enabled/required when
the driver actually supports it.

Closes: #1586

v2: - Fix ws
    - reword commit message

v3: - check for ARB_shader_bit_encoding and ARB_gpu_shader5 in shader creation code
    - don't enable GL_ARB_gpu_shader5 unconditionally in the OpenGL shader
    - reword commit message

v4: Use an additional define HAS_BIT_CONVERSION to make sure gslang correctly
    parses the shader code (Baldurk).

v6: - Add HAS_BIT_CONVERSION also with the GLES code path (Baldur)
    - split patch
    - reword commit message(s) (Baldur)

v7: fix ws

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>

lala
2019-11-11 14:50:46 +00:00
tabi.katalin 4037927834 Fix histogram shader compilation for GLES
These are not supported in GLES and causes shader compile errors when replaying a capture: 
- OpenGL does not allow swizzles on scalar expressions
- implicit cast from "int" to "float"
- implicit cast from "int" to "uint"
Scalar swizzling can be replaced by vec4 and constant types can be explicitly specified.
2019-10-24 18:02:10 +01:00
baldurk 8ce2ea2202 Improve calculation of histogram
* The histogram shouldn't be calculated as channel-wise averages, but instead by
  'stacking' the channels (each channel contributes 1 to the appropriate
  bucket).
* Degenerate channels (where min==max) are excluded and listed only as a single
  spike, to avoid blowing out the automatic y-axis.
2019-10-10 16:48:42 +01:00
baldurk 2d473c39e7 Keep format in GL shaders for R/W images 2019-09-23 13:45:29 +01:00
Dominic Filion Guay 57c60cdfb8 Fixed issue with MSAA textures on Oculus Quest. 2019-09-18 19:28:42 +01:00
baldurk 07158ad24c Fix support for triangle fans on GL/Vulkan 2019-08-20 15:33:12 +01:00
baldurk 7715188d0d GLES 3.1 can't handle MSAA array textures, only 3.2 can 2019-06-28 11:01:19 +01:00
baldurk a5c909ec0c Don't try to use MSAA array textures on MoltenVK 2019-06-21 12:51:52 +01:00
baldurk 28cde37849 Add support for generating SPIR-V shaders for OpenGL
* Only a couple of these are needed - ones we might link with user shaders in a
  program
2019-06-07 18:44:13 +01:00
baldurk afb7fa3771 Add handling for MSAA Array textures on GL/GLSL shaders. Closes #1333 2019-04-01 14:21:52 +01:00
tabi.katalin 2507532623 Fix GLES shader compile errors
Detected two shader compile errors while replaying GLES apps:
1. „#extension directive must occur before any non-preprocessor token” -  Fix the order of precisions and extensions in the shader code.
2. „extension 'GL_OES_texture_cube_map_array' is not supported”  - Do not add extensions if they are actually not supported. TEXTURE_CUBE_MAP_ARRAY was added to GLES 3.2 so   GL_OES_texture_cube_map_array and GL_EXT_texture_cube_map_array are no longer used.
2019-02-25 11:30:25 +00:00
baldurk 180b6f7cdc Remove use of shading_language_420pack and explicit_attrib_location
* On GL we can manually set these bindings when needed, and then we don't
  require those extensions.
2019-02-13 18:50:53 +00:00
baldurk 11819ed3be Refactor and clean up internal shaders to be better organised
* Split up old uber-cbuffers used for unrelated shaders into shader-specific
  cbuffers (DebugPixelCBufferData -> TexDisplayPSCBuffer / CheckerboardCBuffer /
  MeshPixelCBuffer).
* Split up HLSL files so not everything is lumped into 'debugdisplay.hlsl' but
  has separate files as appropriate.
* Use #include in GLSL and HLSL to better organise shader code together rather
  than relying on lumping files together on the C++ side.
* Renamed files like 'debugcbuffers.h' to 'hlsl_cbuffers.h'.
* Trimmed out some extensions/cruft that isn't needed in the GLSL side since we
  no longer use separable shaders.
* Combine some shaders like Outline/Checkerboard that were similar into central
  place.
2019-02-13 18:50:53 +00:00