Condition particles shaders at build time

...while also specifying 300 es in order to fix some of these shaders on
WebGL. If dynamic indexing is rejected in WebGL 1 and WebGL 2 with 100
es shaders, then the only option is to use 300 es shaders with WebGL 2.

Fixes: QTBUG-111227
Pick-to: 6.5
Change-Id: I506aa0a7aa6870b888c0f55ad97b99c3e26c31c0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Laszlo Agocs 2023-03-07 12:35:02 +01:00
parent 0a0f777821
commit 15662b6a1a
2 changed files with 118 additions and 44 deletions

View File

@ -69,26 +69,128 @@ qt_internal_add_resource(QuickParticlesPrivate "particles"
FILES
${particles_resource_files}
)
set(particles1_resource_files
"shaders_ng/imageparticle_colored.frag.qsb"
"shaders_ng/imageparticle_colored.vert.qsb"
"shaders_ng/imageparticle_coloredpoint.frag.qsb"
"shaders_ng/imageparticle_coloredpoint.vert.qsb"
"shaders_ng/imageparticle_deformed.frag.qsb"
"shaders_ng/imageparticle_deformed.vert.qsb"
"shaders_ng/imageparticle_simplepoint.frag.qsb"
"shaders_ng/imageparticle_simplepoint.vert.qsb"
"shaders_ng/imageparticle_sprite.frag.qsb"
"shaders_ng/imageparticle_sprite.vert.qsb"
"shaders_ng/imageparticle_tabled.frag.qsb"
"shaders_ng/imageparticle_tabled.vert.qsb"
)
qt_internal_add_resource(QuickParticlesPrivate "particles1"
qt_internal_add_shaders(QuickParticlesPrivate "particles_shaders1"
SILENT
BATCHABLE
PRECOMPILE
OPTIMIZED
GLSL
"150,120,100es,300es"
PREFIX
"/particles"
FILES
${particles1_resource_files}
"shaders_ng/imageparticle.vert"
"shaders_ng/imageparticle.frag"
OUTPUTS
"shaders_ng/imageparticle_simplepoint.vert.qsb"
"shaders_ng/imageparticle_simplepoint.frag.qsb"
DEFINES
POINT
)
qt_internal_add_shaders(QuickParticlesPrivate "particles_shaders2"
SILENT
BATCHABLE
PRECOMPILE
OPTIMIZED
GLSL
"150,120,100es,300es"
PREFIX
"/particles"
FILES
"shaders_ng/imageparticle.vert"
"shaders_ng/imageparticle.frag"
OUTPUTS
"shaders_ng/imageparticle_coloredpoint.vert.qsb"
"shaders_ng/imageparticle_coloredpoint.frag.qsb"
DEFINES
POINT
COLOR
)
qt_internal_add_shaders(QuickParticlesPrivate "particles_shaders3"
SILENT
BATCHABLE
PRECOMPILE
OPTIMIZED
GLSL
"150,120,100es,300es"
PREFIX
"/particles"
FILES
"shaders_ng/imageparticle.vert"
"shaders_ng/imageparticle.frag"
OUTPUTS
"shaders_ng/imageparticle_colored.vert.qsb"
"shaders_ng/imageparticle_colored.frag.qsb"
DEFINES
COLOR
)
qt_internal_add_shaders(QuickParticlesPrivate "particles_shaders4"
SILENT
BATCHABLE
PRECOMPILE
OPTIMIZED
GLSL
"150,120,100es,300es"
PREFIX
"/particles"
FILES
"shaders_ng/imageparticle.vert"
"shaders_ng/imageparticle.frag"
OUTPUTS
"shaders_ng/imageparticle_deformed.vert.qsb"
"shaders_ng/imageparticle_deformed.frag.qsb"
DEFINES
DEFORM
COLOR
)
qt_internal_add_shaders(QuickParticlesPrivate "particles_shaders5"
SILENT
BATCHABLE
PRECOMPILE
OPTIMIZED
GLSL
"150,120,100es,300es"
PREFIX
"/particles"
FILES
"shaders_ng/imageparticle.vert"
"shaders_ng/imageparticle.frag"
OUTPUTS
"shaders_ng/imageparticle_tabled.vert.qsb"
"shaders_ng/imageparticle_tabled.frag.qsb"
DEFINES
TABLE
DEFORM
COLOR
)
qt_internal_add_shaders(QuickParticlesPrivate "particles_shaders6"
SILENT
BATCHABLE
PRECOMPILE
OPTIMIZED
GLSL
"150,120,100es,300es"
PREFIX
"/particles"
FILES
"shaders_ng/imageparticle.vert"
"shaders_ng/imageparticle.frag"
OUTPUTS
"shaders_ng/imageparticle_sprite.vert.qsb"
"shaders_ng/imageparticle_sprite.frag.qsb"
DEFINES
SPRITE
TABLE
DEFORM
COLOR
ZORDER_LOC
8
)
qt_internal_extend_target(QuickParticlesPrivate CONDITION MSVC

View File

@ -1,28 +0,0 @@
:: Copyright (C) 2019 The Qt Company Ltd.
:: SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
:: For HLSL we invoke fxc.exe (-c argument) and store the resulting intermediate format
:: instead of HLSL source, so this needs to be run on Windows from a developer command prompt.
:: For SPIR-V the optimizer is requested (-O argument) which means spirv-opt must be
:: invokable (e.g. because it's in the PATH from the Vulkan SDK)
qsb -DPOINT -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_simplepoint.vert.qsb imageparticle.vert
qsb -DPOINT --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_simplepoint.frag.qsb imageparticle.frag
qsb -DPOINT -DCOLOR -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_coloredpoint.vert.qsb imageparticle.vert
qsb -DPOINT -DCOLOR --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_coloredpoint.frag.qsb imageparticle.frag
qsb -DCOLOR -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_colored.vert.qsb imageparticle.vert
qsb -DCOLOR --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_colored.frag.qsb imageparticle.frag
qsb -DDEFORM -DCOLOR -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_deformed.vert.qsb imageparticle.vert
qsb -DDEFORM -DCOLOR --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_deformed.frag.qsb imageparticle.frag
qsb -DTABLE -DDEFORM -DCOLOR -b --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_tabled.vert.qsb imageparticle.vert
qsb -DTABLE -DDEFORM -DCOLOR --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_tabled.frag.qsb imageparticle.frag
qsb -DSPRITE -DTABLE -DDEFORM -DCOLOR -b --zorder-loc 8 --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_sprite.vert.qsb imageparticle.vert
qsb -DSPRITE -DTABLE -DDEFORM -DCOLOR --glsl "150,120,100 es" --hlsl 50 --msl 12 -O -c -o imageparticle_sprite.frag.qsb imageparticle.frag