Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 53acdb0868260fcd4a5ab1daac45903c7bfddb40
Author: Antoine C <[email protected]>
Date:   Mon Sep 2 19:54:07 2024 +0100

    Fix segfault on waveform resize

commit 0ff4510e863e84ddee860de6ff2206c694797646
Author: m0dB <[email protected]>
Date:   Mon Sep 23 16:33:50 2024 +0200

    ported waveformrendererrgb to rendergraph, hurray!

commit ffeeb394647ee565f3ddcf65cdaf9b5354ed4438
Author: m0dB <[email protected]>
Date:   Mon Sep 23 16:32:53 2024 +0200

    moved vertexupdaters

commit eb4ecf0733e3472c0e7c502cf575d5a5f8f32f93
Author: m0dB <[email protected]>
Date:   Mon Sep 23 16:24:18 2024 +0200

    moved rendergraph::OpenGLNode to derived

commit f81c1fd3913423557d3b59010b7f09c1e67d7ad0
Author: m0dB <[email protected]>
Date:   Mon Sep 23 16:22:57 2024 +0200

    fix typo

commit e7dbe44c656d25cf578e0d2ee93dd3092fc0b0c1
Author: m0dB <[email protected]>
Date:   Mon Sep 23 15:38:05 2024 +0200

    moved opengl node as baseclass for waveform renderers to derived class, so i can start porting some to geometrynode

commit 661db80ccdd12e32880068337649184678f81109
Author: m0dB <[email protected]>
Date:   Mon Sep 23 15:23:08 2024 +0200

    improved/added asserts

commit e092c22d33b2c9988a622ca4391ccf769194841c
Author: m0dB <[email protected]>
Date:   Mon Sep 23 01:44:47 2024 +0200

    updated READMEs

commit e93773cd6c5a49facd8eb96185e7f14a67a4113e
Author: m0dB <[email protected]>
Date:   Mon Sep 23 01:37:01 2024 +0200

    avoid adding entire src dir to include paths

commit de22d837f3f4b9dc4a0b820c255e2859718faf99
Author: m0dB <[email protected]>
Date:   Mon Sep 23 01:36:19 2024 +0200

    use qshader to load qsb files for opengl Qt >= 6.6

commit 95c3ee220b5ed152b922ee8c05dc2b2debc34af2
Author: m0dB <[email protected]>
Date:   Sun Sep 22 21:50:24 2024 +0200

    use string literal

commit cca51c1bd52974fc0fb99a3c85be7a31f02b025c
Author: m0dB <[email protected]>
Date:   Sun Sep 22 21:43:21 2024 +0200

    added some DEBUG_ASSERTs and some vector.reserve calls

commit bedb98e980f9639e3b571d0769e4d000b4391a68
Author: m0dB <[email protected]>
Date:   Sun Sep 22 20:35:01 2024 +0200

    use a generic Material::compare

commit 508b2c11185ac8a4e270e3b538f5bff0b79c3a39
Author: m0dB <[email protected]>
Date:   Sun Sep 22 19:06:27 2024 +0200

    added comment to explain return value of remove node functions

commit d5905c0d2101a8b848e83fcd39b62c554bcd805f
Author: m0dB <[email protected]>
Date:   Sun Sep 22 18:57:19 2024 +0200

    removed backend:: namespace, minor changes based on reviews

commit 5ff89267762b166b082eecb1357e7ec97c7d204b
Author: m0dB <[email protected]>
Date:   Sun Sep 22 13:18:47 2024 +0200

    removed accidental commit

commit d8d002f055532e3dfc038a9b7366d77cebd2b590
Author: m0dB <[email protected]>
Date:   Sun Sep 22 14:30:12 2024 +0200

    Update src/rendergraph/common/rendergraph/attribute.h

    simplify attribute constructor.

    Co-authored-by: Swiftb0y <[email protected]>

commit a686ad74f506c447d3164d2a4dc0efdf3c991175
Author: m0dB <[email protected]>
Date:   Sun Sep 22 13:20:07 2024 +0200

    Update src/rendergraph/opengl/backend/shadercache.h

    direct conversion from unique_ptr to shader_ptr

    Co-authored-by: Swiftb0y <[email protected]>

commit dda19a1810b45279da3312b91170360dd13342a1
Author: m0dB <[email protected]>
Date:   Sun Sep 22 13:15:42 2024 +0200

    Update res/shaders/rendergraph/unicolor.frag

    Co-authored-by: Swiftb0y <[email protected]>

commit 4dee2d07f4e9eb26e77054c52ef50913f83ee1ab
Author: m0dB <[email protected]>
Date:   Sun Sep 22 12:49:28 2024 +0200

    Update src/rendergraph/common/rendergraph/material/rgbamaterial.cpp

    Co-authored-by: Daniel Schürmann <[email protected]>

commit 26e74114d3f5531dd6549ad4c2493edc81944d81
Author: m0dB <[email protected]>
Date:   Sun Sep 22 12:49:06 2024 +0200

    Update src/rendergraph/common/rendergraph/material/patternmaterial.h

    un-name unused argument

    Co-authored-by: Swiftb0y <[email protected]>

commit eb1275b2ef8c2ffac0aa0a6cd498f12e4852f16f
Author: m0dB <[email protected]>
Date:   Thu Sep 19 19:13:52 2024 +0200

    reorganized the code, with a public common API that is derived from the opengl or the scenegraph backend.

commit d9460f7b87cd350445b6062e8ab6ef3b70a29096
Author: m0dB <[email protected]>
Date:   Thu Sep 19 12:57:46 2024 +0200

    remove nodebase, use encapsulation for scenegraph Node

commit dd479e565dff43866f5316959498b44b9d1208d7
Author: m0dB <[email protected]>
Date:   Thu Sep 19 01:58:57 2024 +0200

    cleanup and moved common rendergraph files to common/rendergraph

commit af0a728305400108b18f1163a39cfa5d8cb28771
Author: m0dB <[email protected]>
Date:   Thu Sep 19 00:42:46 2024 +0200

    removed pimpl from rendergraph scenegraph

commit 7adb1849d6676c21afc491a2a9dc57e2234c7a95
Author: m0dB <[email protected]>
Date:   Sun Sep 1 20:51:08 2024 +0200

    removed pimpl from rendergraph opengl

commit 0845c5e9bd9ada2d5b1aaa1f2950b88bde583edd
Author: m0dB <[email protected]>
Date:   Sat Aug 31 22:43:26 2024 +0200

    draw marks with rendergraph

commit 9ba6491b7b02407ff651261a99af78683b5eca7a
Author: m0dB <[email protected]>
Date:   Sat Aug 31 17:04:21 2024 +0200

    digitsrenderer with rendergraph

commit c8036085f42a9f5b4db1f966aaf86a10b6427dbd
Author: m0dB <[email protected]>
Date:   Sat Aug 31 16:24:15 2024 +0200

    keep track of material that modified the shader uniforms, fix scenegraph

commit 28d199a200263451e36a5bb27838bca0c1a6345f
Author: m0dB <[email protected]>
Date:   Sat Aug 31 15:23:32 2024 +0200

    reuse materialshaders

commit cde4ae43028ff9e0a4e6fc659eb51517bc70e6f5
Author: m0dB <[email protected]>
Date:   Sat Aug 31 13:49:14 2024 +0200

    draw playpos with rendergraph

commit adbd999d34d1165c75c742f6caa1f26935dcaaac
Author: m0dB <[email protected]>
Date:   Sat Aug 31 12:41:29 2024 +0200

    towards digits renderer as node

commit b0ad3f17009e59ef948fad3d7cca032110d811cf
Author: m0dB <[email protected]>
Date:   Sat Aug 31 12:18:42 2024 +0200

    make linked list handling part of rendergraph::Node

commit 296befb120e0dd523becf1f09d5d2671b9b1b443
Author: m0dB <[email protected]>
Date:   Sat Aug 31 03:58:14 2024 +0200

    mark range with dynamic nodes

commit 12740262486977927664566e3f04121020619a1b
Author: m0dB <[email protected]>
Date:   Sat Aug 31 01:48:10 2024 +0200

    fix teardown order

commit 13ccdedb54f42d92e7bb238c5bfb032c1b70f940
Author: m0dB <[email protected]>
Date:   Sat Aug 31 01:25:58 2024 +0200

    node iterator, fixed examples

commit 4ca7faef894521b033694f69e0beb8387316aa55
Author: m0dB <[email protected]>
Date:   Fri Aug 30 23:28:11 2024 +0200

    preroll/postroll using rendergraph

commit a6de4517363ced860647ca7c010ca703d517b6c5
Author: m0dB <[email protected]>
Date:   Tue Aug 27 11:31:01 2024 +0200

    waveformrenderbeat with rendergraph, various fixes, use same shaders and material for mixxx and rendergraph examples

commit 8d2d88331741a9666ca4a07aab93eb1c859d3c49
Author: m0dB <[email protected]>
Date:   Fri Aug 23 20:46:13 2024 +0200

    using rendergraph for allshader waveforms, with rendergraph::GeometryNode for end of track
  • Loading branch information
acolombier committed Sep 23, 2024
1 parent f864163 commit 5ec00bf
Show file tree
Hide file tree
Showing 170 changed files with 4,485 additions and 625 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3809,6 +3809,11 @@ if(VINYLCONTROL)
target_link_libraries(mixxx-lib PRIVATE mixxx-xwax)
endif()

# rendergraph
add_subdirectory(src/rendergraph/opengl)
add_subdirectory(res/shaders/rendergraph)
target_link_libraries(mixxx-lib PUBLIC rendergraph_gl)

# WavPack audio file support
find_package(wavpack)
default_option(WAVPACK "WavPack audio file support" "wavpack_FOUND")
Expand Down
4 changes: 4 additions & 0 deletions res/mixxx.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,9 @@
<file>shaders/passthrough.vert</file>
<file>shaders/rgbsignal.frag</file>
<file>shaders/stackedsignal.frag</file>
<file>shaders/rendergraph/endoftrack.frag.gl</file>
<file>shaders/rendergraph/endoftrack.vert.gl</file>
<file>shaders/rendergraph/texture.frag.gl</file>
<file>shaders/rendergraph/texture.vert.gl</file>
</qresource>
</RCC>
47 changes: 47 additions & 0 deletions res/shaders/rendergraph/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
set(shaders
endoftrack.frag
endoftrack.vert
pattern.frag
pattern.vert
rgb.frag
rgb.vert
rgba.frag
rgba.vert
texture.frag
texture.vert
unicolor.frag
unicolor.vert
)

qt6_add_shaders(rendergraph_sg "shaders-qsb"
BATCHABLE
PRECOMPILE
OPTIMIZED
PREFIX
/shaders/rendergraph
FILES
${shaders}
)

if(USE_QSHADER_FOR_GL)
message(STATUS "Adding qsb shaders to rendergraph_gl")
qt6_add_shaders(rendergraph_gl "shaders-qsb"
BATCHABLE
PRECOMPILE
OPTIMIZED
PREFIX
/shaders/rendergraph
FILES
${shaders}
)
else()
message(STATUS "Adding gl shaders to rendergraph_gl")
include(generated_shaders_gl.cmake)

qt_add_resources(rendergraph_gl "shaders-gl"
PREFIX
/shaders/rendergraph
FILES
${generated_shaders_gl}
)
endif()
10 changes: 10 additions & 0 deletions res/shaders/rendergraph/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
The CMakeLists.txt in this folder generates qsb shader bundles from the spirv shaders.

The qsb files can be used by QML / Qt scene graph QSGShader. Since Qt >= 6.6 we can load the qsb files and extract the glsl shaders
programmatically with QShader and use the with QOpenGLShader. For Qt < 6.6 the files have to generated manually with the script:

generate_shaders_gl.pl

(Make sure qsb and spirv commands are in your path. E.g:
export PATH=$PATH:~/VulkanSDK/1.3.283.0/macOS/bin:~/Qt/6.7.2/macos/bin
)
17 changes: 17 additions & 0 deletions res/shaders/rendergraph/endoftrack.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#version 440

layout(location = 0) in float vGradient;
layout(location = 0) out vec4 fragColor;

layout(std140, binding = 0) uniform buf {
vec4 color;
}
ubuf;

void main() {
float minAlpha = 0.5 * ubuf.color.w;
float maxAlpha = 0.83 * ubuf.color.w;
float alpha = mix(minAlpha, maxAlpha, max(0.0, vGradient));
// premultiple alpha
fragColor = vec4(ubuf.color.xyz * alpha, alpha);
}
19 changes: 19 additions & 0 deletions res/shaders/rendergraph/endoftrack.frag.gl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#version 120
//// GENERATED - EDITS WILL BE OVERWRITTEN

struct buf
{
vec4 color;
};

uniform buf ubuf;

varying float vGradient;

void main()
{
float minAlpha = 0.5 * ubuf.color.w;
float maxAlpha = 0.829999983310699462890625 * ubuf.color.w;
float alpha = mix(minAlpha, maxAlpha, max(0.0, vGradient));
gl_FragData[0] = vec4(ubuf.color.xyz * alpha, alpha);
}
10 changes: 10 additions & 0 deletions res/shaders/rendergraph/endoftrack.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#version 440

layout(location = 0) in vec4 position;
layout(location = 1) in float gradient;
layout(location = 0) out float vGradient;

void main() {
vGradient = gradient;
gl_Position = position;
}
12 changes: 12 additions & 0 deletions res/shaders/rendergraph/endoftrack.vert.gl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#version 120
//// GENERATED - EDITS WILL BE OVERWRITTEN

varying float vGradient;
attribute float gradient;
attribute vec4 position;

void main()
{
vGradient = gradient;
gl_Position = position;
}
68 changes: 68 additions & 0 deletions res/shaders/rendergraph/generate_shaders_gl.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/usr/bin/perl

my @files = (glob("*.vert"),glob("*.frag"));

open(GENERATED,">generated_shaders_gl.cmake");
print(GENERATED "set(generated_shaders_gl\n");
for $file (@files)
{
system("qsb","--glsl","120",$file,"-o","/tmp/$$-$file.qsb");
open(INFILE,"qsb --dump /tmp/$$-$file.qsb|");
open(OUTFILE,">$file.gl");
$ok = 0;
$comment_added = 0;
print "Generating $file.gl from $file\n";
while (<INFILE>)
{
if ($in_shader_block == 2)
{
if (m/^\*\*/)
{
$in_shader_block = 0;
$ok = 1;
}
else
{
if (!$comment_added)
{
if (!m/^#/)
{
print(OUTFILE "//// GENERATED - EDITS WILL BE OVERWRITTEN\n");
$comment_added = 1;
}
}
print OUTFILE "$_";
}
}
elsif ($in_shader_block == 1)
{
chomp($_);
if ($_ eq "Contents:")
{
$in_shader_block = 2;
}
}
else
{
chomp($_);
if ($_ eq "Shader 1: GLSL 120 [Standard]")
{
$in_shader_block = 1;
}
}
}
close INFILE;
close OUTFILE;
if($ok)
{
print(GENERATED " $file.gl\n");
}
else
{
print STDERR "Failed to generated $file.gl";
unlink("$file.gl")
}
unlink("/tmp/$$-$file.qsb");
}
print(GENERATED ")\n");
close GENERATED;
14 changes: 14 additions & 0 deletions res/shaders/rendergraph/generated_shaders_gl.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set(generated_shaders_gl
endoftrack.vert.gl
pattern.vert.gl
rgb.vert.gl
rgba.vert.gl
texture.vert.gl
unicolor.vert.gl
endoftrack.frag.gl
pattern.frag.gl
rgb.frag.gl
rgba.frag.gl
texture.frag.gl
unicolor.frag.gl
)
9 changes: 9 additions & 0 deletions res/shaders/rendergraph/pattern.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#version 440

layout(binding = 1) uniform sampler2D texture1;
layout(location = 0) in vec2 vTexcoord;
layout(location = 0) out vec4 fragColor;

void main() {
fragColor = texture(texture1, fract(vTexcoord));
}
11 changes: 11 additions & 0 deletions res/shaders/rendergraph/pattern.frag.gl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#version 120
//// GENERATED - EDITS WILL BE OVERWRITTEN

uniform sampler2D texture1;

varying vec2 vTexcoord;

void main()
{
gl_FragData[0] = texture2D(texture1, fract(vTexcoord));
}
15 changes: 15 additions & 0 deletions res/shaders/rendergraph/pattern.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#version 440

layout(std140, binding = 0) uniform buf {
mat4 matrix;
}
ubuf;

layout(location = 0) in vec4 position;
layout(location = 1) in vec2 texcoord;
layout(location = 0) out vec2 vTexcoord;

void main() {
vTexcoord = texcoord;
gl_Position = ubuf.matrix * position;
}
19 changes: 19 additions & 0 deletions res/shaders/rendergraph/pattern.vert.gl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#version 120
//// GENERATED - EDITS WILL BE OVERWRITTEN

struct buf
{
mat4 matrix;
};

uniform buf ubuf;

varying vec2 vTexcoord;
attribute vec2 texcoord;
attribute vec4 position;

void main()
{
vTexcoord = texcoord;
gl_Position = ubuf.matrix * position;
}
8 changes: 8 additions & 0 deletions res/shaders/rendergraph/rgb.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#version 440

layout(location = 0) in vec3 vColor;
layout(location = 0) out vec4 fragColor;

void main() {
fragColor = vec4(vColor, 1.0);
}
9 changes: 9 additions & 0 deletions res/shaders/rendergraph/rgb.frag.gl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#version 120
//// GENERATED - EDITS WILL BE OVERWRITTEN

varying vec3 vColor;

void main()
{
gl_FragData[0] = vec4(vColor, 1.0);
}
15 changes: 15 additions & 0 deletions res/shaders/rendergraph/rgb.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#version 440

layout(std140, binding = 0) uniform buf {
mat4 matrix;
}
ubuf;

layout(location = 0) in vec4 position;
layout(location = 1) in vec3 color;
layout(location = 0) out vec3 vColor;

void main() {
vColor = color;
gl_Position = ubuf.matrix * position;
}
19 changes: 19 additions & 0 deletions res/shaders/rendergraph/rgb.vert.gl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#version 120
//// GENERATED - EDITS WILL BE OVERWRITTEN

struct buf
{
mat4 matrix;
};

uniform buf ubuf;

varying vec3 vColor;
attribute vec3 color;
attribute vec4 position;

void main()
{
vColor = color;
gl_Position = ubuf.matrix * position;
}
8 changes: 8 additions & 0 deletions res/shaders/rendergraph/rgba.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#version 440

layout(location = 0) in vec4 vColor;
layout(location = 0) out vec4 fragColor;

void main() {
fragColor = vec4(vColor.xyz * vColor.w, vColor.w); // premultiple alpha
}
9 changes: 9 additions & 0 deletions res/shaders/rendergraph/rgba.frag.gl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#version 120
//// GENERATED - EDITS WILL BE OVERWRITTEN

varying vec4 vColor;

void main()
{
gl_FragData[0] = vec4(vColor.xyz * vColor.w, vColor.w);
}
15 changes: 15 additions & 0 deletions res/shaders/rendergraph/rgba.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#version 440

layout(std140, binding = 0) uniform buf {
mat4 matrix;
}
ubuf;

layout(location = 0) in vec4 position;
layout(location = 1) in vec4 color;
layout(location = 0) out vec4 vColor;

void main() {
vColor = color;
gl_Position = ubuf.matrix * position;
}
19 changes: 19 additions & 0 deletions res/shaders/rendergraph/rgba.vert.gl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#version 120
//// GENERATED - EDITS WILL BE OVERWRITTEN

struct buf
{
mat4 matrix;
};

uniform buf ubuf;

varying vec4 vColor;
attribute vec4 color;
attribute vec4 position;

void main()
{
vColor = color;
gl_Position = ubuf.matrix * position;
}
Loading

0 comments on commit 5ec00bf

Please sign in to comment.