qt5base-lts/tests
Laszlo Agocs 04cdde30d6 rhi: Enable exposing separate image and sampler objects from the shader
Adds the following in a QShader/QShaderDescription:

- a list of separate images
- a list of separate samplers
- a list of "combined_sampler_uniform_name" -> [
  separate_texture_binding, separate_sampler_binding ] mappings
  (relevant for GLSL only)

On the QShader (and qsb/QShaderBaker) level not having separate image
(texture) and sampler objects exposed in the reflection info is not
entirely future proof. Right now we benefit strongly from the fact
that Vulkan/SPIR-V supports both combined and separate
images/samplers, while for HLSL and MSL SPIRV-Cross translates
combined image samplers to separate texture and sampler objects, but
it is not given that relying on combined image samplers will always be
possible in the long run; it is mostly a legacy OpenGL thing that just
happens to be supported in Vulkan/SPIR-V due to some benefits with
certain implementations/hw, but is not something present in any newer
APIs.

In addition, before this patch, attempting to run a shader with
separate textures and samplers through qsb will just fail for GLSL,
even though SPIRV-Cross does have the ability to generate a "fake"
combined sampler for each separate texture+sampler combination. Take
this into use. This also involves generating and exposing a
combined_name->[separate_texture_binding,separate_sampler_binding]
mapping table for GLSL, not unlike we have the native binding map for
HLSL and MSL. A user (such as, the GL backend of QRhi) would then use
this table to recognize what user-provided texture+sampler binding
point numbers correspond to which auto-generated sampler2Ds in the GL
program.

Take the following example:

layout(binding = 1) uniform texture2D sepTex;
layout(binding = 2) uniform sampler sepSampler;
layout(binding = 3) uniform sampler sepSampler2;

Inn the reflection info (QShaderDescription) this (assuming a
corresponding qtshadertools patch in place) now gives one entry in
separateImages() and two in separateSamplers().  Assuming sepTex is
used both with sepSampler and sepSampler2, the GLSL output and mapping
table from QShaderBaker will have two auto-generated sampler2Ds (and
no 'texture2D' or 'sampler').

One immediate benefit is that it is now possible to create a shader
that relies only on separate images and samplers, feed it into qsb,
generate all the possible targets, and then also feed the SPIR-V
binary into a tool or library such as Tint (e.g. to generate WGSL)
that canot deal with combined image samplers.

Change-Id: I9b19847ea5854837b45d3a23edc788c48502aa15
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-01-03 14:57:01 +01:00
..
auto rhi: Enable exposing separate image and sampler objects from the shader 2022-01-03 14:57:01 +01:00
baseline Never handle scrollbars styled with box or border changes as transient 2021-11-29 16:02:28 +01:00
benchmarks Fix the benchmark for QList::removeAll() 2021-12-09 03:45:08 +01:00
global
libfuzzer Tests: Use REQUIRED COMPONENTS in find_package(Qt6...) 2021-12-13 14:16:26 +00:00
manual wasm: add rasterwindow manual test 2021-12-15 18:06:11 +02:00
shared QtBase: replace windows.h with qt_windows.h 2021-11-23 12:53:46 +08:00
testserver Network self-test: make it work with docker/containers 2020-11-17 19:56:06 +01:00
CMakeLists.txt CMake: Refactor optimization flag handling and add optimize_full 2020-10-06 10:07:05 +02:00
README

This directory contains autotests and benchmarks based on Qt Test. In order
to run the autotests reliably, you need to configure a desktop to match the
test environment that these tests are written for.

Linux X11:

   * The user must be logged in to an active desktop; you can't run the
     autotests without a valid DISPLAY that allows X11 connections.

   * The tests are run against a KDE3 or KDE4 desktop.

   * Window manager uses "click to focus", and not "focus follows mouse". Many
     tests move the mouse cursor around and expect this to not affect focus
     and activation.

   * Disable "click to activate", i.e., when a window is opened, the window
     manager should automatically activate it (give it input focus) and not
     wait for the user to click the window.