Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1b94169
Guard disk cache clearing with marker file
Jun 6, 2026
33e5013
factor context creation out so to remove the qt dependency
toloudis Jun 28, 2026
83802e2
initial vulkan impl, incomplete
toloudis Jun 30, 2026
73b1c59
ported shaders and some of the renderer
toloudis Jun 30, 2026
cf5045e
swapchain work
toloudis Jun 30, 2026
4dce0f2
hook up the vulkan view and get mouse working
toloudis Jun 30, 2026
2cc24a7
hook up the pathtrace shader
toloudis Jul 1, 2026
4c08817
working on gesture rendering and picking
toloudis Jul 1, 2026
0bd5b1d
swapchain updating to ensure proper positioning
toloudis Jul 1, 2026
c913a40
try to fix build and add swapchain for windows
toloudis Jul 1, 2026
52d688a
thick lines
toloudis Jul 1, 2026
ec3318c
fixing underlay rendering
toloudis Jul 1, 2026
6939860
fix render dialog and also shader compilation
toloudis Jul 1, 2026
d40886d
fonts
toloudis Jul 1, 2026
323e8be
vulkan installer with fix for macos
toloudis Jul 1, 2026
59dc8e2
fix backend logic; autoformatting
toloudis Jul 2, 2026
1c2e0c3
performance timer reporting
toloudis Jul 2, 2026
8eb8e5b
fix volume texture preparation for gpu
toloudis Jul 2, 2026
5f0d695
light updating
toloudis Jul 2, 2026
7886be4
formatting
toloudis Jul 2, 2026
e7d59fe
fix opengl blending!
toloudis Jul 2, 2026
b55a2ab
more efficient parameter updates, fewer full volume uploads
toloudis Jul 2, 2026
fc5e79d
important update for dpr
toloudis Jul 2, 2026
3c03c55
update volume sampling repeat
toloudis Jul 2, 2026
f499b31
get more consistent stats timings in opengl and vulkan, with special …
toloudis Jul 2, 2026
6441484
add linux surface creation first attempt, untested
toloudis Jul 3, 2026
dba88df
add vulkan resource management in the Device
toloudis Jul 10, 2026
878693e
resource cleanup
toloudis Jul 10, 2026
0c20b52
extra extra cleanup
toloudis Jul 10, 2026
d4f0a70
clang-format
toloudis Jul 10, 2026
8545d47
refactor to common rendering helper function
toloudis Jul 17, 2026
2439b30
fix override warnings and a couple initializers
toloudis Jul 18, 2026
d78c5a0
build fix
toloudis Aug 16, 2026
d429ea2
build fixup
toloudis Aug 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ jobs:
with:
version: 6.9.3
modules: qtwebsockets qtimageformats
- name: Install Vulkan SDK
uses: humbletim/install-vulkan-sdk@e7d6e7b937bde4503c7ba5c9584c9dc68f44c4b8
with:
version: 1.4.350.0
cache: true
- name: macos install deps
if: contains(matrix.os, 'macos')
env:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/tagged_master_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ jobs:
with:
version: 6.9.3
modules: qtwebsockets qtimageformats
- name: Install Vulkan SDK
uses: humbletim/install-vulkan-sdk@e7d6e7b937bde4503c7ba5c9584c9dc68f44c4b8
with:
version: 1.4.350.0
cache: true
- name: macos install deps
if: contains(matrix.os, 'macos')
env:
Expand Down
92 changes: 92 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,98 @@ find_package(CURL REQUIRED)

find_package(OpenGL)

option(AGAVE_ENABLE_VULKAN "Build the Vulkan graphics backend when the Vulkan SDK is available." ON)
set(AGAVE_HAS_VULKAN OFF)
set(AGAVE_VULKAN_RUNTIME_LIBRARY "")
if(AGAVE_ENABLE_VULKAN)
set(AGAVE_VULKAN_SDK_ROOT "$ENV{VULKAN_SDK}" CACHE PATH "Path to the Vulkan SDK platform directory")
if(NOT AGAVE_VULKAN_SDK_ROOT)
# No VULKAN_SDK env var and no cached value: look for a locally-installed
# SDK in the platform's default install root and pick the highest version.
if(WIN32)
set(_agave_vulkan_search_glob "C:/VulkanSDK/*")
set(_agave_vulkan_platform_subdir "")
elseif(APPLE)
set(_agave_vulkan_search_glob "$ENV{HOME}/VulkanSDK/*")
set(_agave_vulkan_platform_subdir "macOS")
else()
set(_agave_vulkan_search_glob "$ENV{HOME}/VulkanSDK/*")
set(_agave_vulkan_platform_subdir "x86_64")
endif()
file(GLOB _agave_vulkan_candidates LIST_DIRECTORIES true "${_agave_vulkan_search_glob}")
list(SORT _agave_vulkan_candidates)
list(REVERSE _agave_vulkan_candidates)
foreach(_agave_vulkan_candidate IN LISTS _agave_vulkan_candidates)
if(_agave_vulkan_platform_subdir)
set(_agave_vulkan_candidate "${_agave_vulkan_candidate}/${_agave_vulkan_platform_subdir}")
endif()
if(IS_DIRECTORY "${_agave_vulkan_candidate}" AND EXISTS "${_agave_vulkan_candidate}/include/vulkan/vulkan.h")
set(AGAVE_VULKAN_SDK_ROOT "${_agave_vulkan_candidate}" CACHE PATH "Path to the Vulkan SDK platform directory" FORCE)
break()
endif()
endforeach()
unset(_agave_vulkan_search_glob)
unset(_agave_vulkan_platform_subdir)
unset(_agave_vulkan_candidates)
unset(_agave_vulkan_candidate)
endif()
if(AGAVE_VULKAN_SDK_ROOT)
set(ENV{VULKAN_SDK} "${AGAVE_VULKAN_SDK_ROOT}")
list(INSERT CMAKE_PREFIX_PATH 0 "${AGAVE_VULKAN_SDK_ROOT}")
if(EXISTS "${AGAVE_VULKAN_SDK_ROOT}/include/vulkan/vulkan.h")
set(Vulkan_INCLUDE_DIR "${AGAVE_VULKAN_SDK_ROOT}/include" CACHE PATH "Vulkan SDK include directory" FORCE)
endif()
if(EXISTS "${AGAVE_VULKAN_SDK_ROOT}/bin/glslc")
set(Vulkan_GLSLC_EXECUTABLE "${AGAVE_VULKAN_SDK_ROOT}/bin/glslc" CACHE FILEPATH "Vulkan glslc executable" FORCE)
endif()
if(EXISTS "${AGAVE_VULKAN_SDK_ROOT}/bin/glslangValidator")
set(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE
"${AGAVE_VULKAN_SDK_ROOT}/bin/glslangValidator"
CACHE FILEPATH
"Vulkan glslangValidator executable"
FORCE)
endif()
if(EXISTS "${AGAVE_VULKAN_SDK_ROOT}/lib/libshaderc_combined.a")
set(Vulkan_shaderc_combined_LIBRARY
"${AGAVE_VULKAN_SDK_ROOT}/lib/libshaderc_combined.a"
CACHE FILEPATH
"Vulkan shaderc_combined library"
FORCE)
endif()
if(WIN32 AND EXISTS "${AGAVE_VULKAN_SDK_ROOT}/Lib/vulkan-1.lib")
set(Vulkan_LIBRARY "${AGAVE_VULKAN_SDK_ROOT}/Lib/vulkan-1.lib" CACHE FILEPATH "Vulkan loader library" FORCE)
elseif(APPLE AND EXISTS "${AGAVE_VULKAN_SDK_ROOT}/lib/libvulkan.dylib")
set(Vulkan_LIBRARY "${AGAVE_VULKAN_SDK_ROOT}/lib/libvulkan.dylib" CACHE FILEPATH "Vulkan loader library" FORCE)
elseif(EXISTS "${AGAVE_VULKAN_SDK_ROOT}/lib/libvulkan.so")
set(Vulkan_LIBRARY "${AGAVE_VULKAN_SDK_ROOT}/lib/libvulkan.so" CACHE FILEPATH "Vulkan loader library" FORCE)
endif()
endif()
find_package(Vulkan COMPONENTS glslc shaderc_combined QUIET)
if(Vulkan_FOUND AND Vulkan_shaderc_combined_FOUND)
set(AGAVE_HAS_VULKAN ON)
set(AGAVE_VULKAN_RUNTIME_LIBRARY "${Vulkan_LIBRARY}")
if(APPLE)
find_library(AGAVE_VULKAN_KOSMICKRISP_LIBRARY
NAMES vulkan_kosmickrisp
PATHS
"${AGAVE_VULKAN_SDK_ROOT}/lib"
"$ENV{VULKAN_SDK}/lib"
"${Vulkan_LIBRARY_DIR}"
NO_DEFAULT_PATH
)
if(AGAVE_VULKAN_KOSMICKRISP_LIBRARY)
set(AGAVE_VULKAN_RUNTIME_LIBRARY "${AGAVE_VULKAN_KOSMICKRISP_LIBRARY}")
message(STATUS "Using macOS Vulkan runtime: ${AGAVE_VULKAN_RUNTIME_LIBRARY}")
else()
message(WARNING "libvulkan_kosmickrisp.dylib was not found; falling back to ${Vulkan_LIBRARY}")
endif()
endif()
message(STATUS "Vulkan backend enabled: SDK ${Vulkan_VERSION}")
else()
message(WARNING "AGAVE_ENABLE_VULKAN is ON, but Vulkan SDK with shaderc_combined was not found. Vulkan backend disabled.")
endif()
endif()

# normally CMAKE_INSTALL_PREFIX is meant to be outside of the build tree
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install)
Expand Down
37 changes: 23 additions & 14 deletions agave_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,18 @@ target_sources(agaveapp PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/Focus.h"
"${CMAKE_CURRENT_SOURCE_DIR}/GLView3D.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GLView3D.h"
"${CMAKE_CURRENT_SOURCE_DIR}/IAppView3D.h"
"${CMAKE_CURRENT_SOURCE_DIR}/loadDialog.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/loadDialog.h"
"${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.h"
"${CMAKE_CURRENT_SOURCE_DIR}/ObjectTransformMode.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ObjectTransformMode.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Projection.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Projection.h"
"${CMAKE_CURRENT_SOURCE_DIR}/QtGLContext.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/QtGLContext.h"
"${CMAKE_CURRENT_SOURCE_DIR}/QRenderSettings.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Projection.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Projection.h"
"${CMAKE_CURRENT_SOURCE_DIR}/QtGLContext.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/QtGLContext.h"
"${CMAKE_CURRENT_SOURCE_DIR}/QRenderSettings.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/QRenderSettings.h"
"${CMAKE_CURRENT_SOURCE_DIR}/RangeWidget.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/RangeWidget.h"
Expand Down Expand Up @@ -85,15 +86,23 @@ target_sources(agaveapp PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/TimelineDockWidget.h"
"${CMAKE_CURRENT_SOURCE_DIR}/ViewerState.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ViewerState.h"
"${CMAKE_CURRENT_SOURCE_DIR}/ViewToolbar.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ViewToolbar.h"
)
option(AGAVE_ENABLE_PYRENDERER "Build the legacy unused Python offscreen renderer." OFF)
if(AGAVE_ENABLE_PYRENDERER)
add_subdirectory(python)
endif()

add_subdirectory(tfeditor)
"${CMAKE_CURRENT_SOURCE_DIR}/ViewToolbar.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ViewToolbar.h"
)
if(AGAVE_HAS_VULKAN)
target_sources(agaveapp PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/QtVulkanSurface.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/QtVulkanSurface.h"
"${CMAKE_CURRENT_SOURCE_DIR}/VulkanView3D.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/VulkanView3D.h"
)
endif()
option(AGAVE_ENABLE_PYRENDERER "Build the legacy unused Python offscreen renderer." OFF)
if(AGAVE_ENABLE_PYRENDERER)
add_subdirectory(python)
endif()

add_subdirectory(tfeditor)

if(MSVC)
target_sources(agaveapp PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/version.rc")
Expand Down
47 changes: 14 additions & 33 deletions agave_app/GLView3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "renderlib/Status.h"
#include "renderlib/gfxapi/Backend.h"
#include "renderlib/gfxapi/Framebuffer.h"
#include "renderlib/gfxapi/RenderToFramebuffer.h"
#include "renderlib/renderlib.h"

#include <glm.h>
Expand All @@ -23,36 +24,19 @@
#include <QTimer>
#include <QWindow>

#include <cmath>
#include <iostream>
#include <cmath>
#include <cstddef>
#include <iostream>
#include <memory>

// Only Microsoft issue warnings about correct behaviour...
#ifdef _MSVC_VER
#pragma warning(disable : 4351)
#endif

namespace {

gfxApi::ClearColor
backgroundClearColor(const Scene* scene)
{
if (!scene) {
return {};
}

return { scene->m_material.m_backgroundColor[0],
scene->m_material.m_backgroundColor[1],
scene->m_material.m_backgroundColor[2],
1.0f };
}

} // namespace

GLView3D::GLView3D(QCamera* cam, QRenderSettings* qrs, RenderSettings* rs, QWidget* parent)
GLView3D::GLView3D(QCamera* cam, QRenderSettings* qrs, RenderSettings* rs, QWidget* parent)
: QOpenGLWidget(parent)
, m_etimer()
, m_qcamera(cam)
, m_viewerWindow(nullptr)
, m_qrendersettings(qrs)
{
m_viewerWindow = new ViewerWindow(rs);
Expand Down Expand Up @@ -578,18 +562,15 @@ GLView3D::captureQimage()
m_viewerWindow->m_gestureRenderer->updateSelectionBuffer(captureWidth, captureHeight);
m_viewerWindow->update(sceneView.viewport, m_viewerWindow->m_clock, m_viewerWindow->gesture);

fbo->bind();
fbo->clear(backgroundClearColor(sceneView.scene));
m_viewerWindow->m_gestureRenderer->drawUnderlay(sceneView, m_viewerWindow->gesture.graphics);
fbo->release();

m_viewerWindow->m_renderer->renderTo(sceneView.camera, fbo.get());

fbo->bind();
m_viewerWindow->m_gestureRenderer->draw(sceneView, m_viewerWindow->gesture.graphics);
fbo->release();
gfxApi::renderToFramebuffer(*fbo,
*m_viewerWindow->m_renderer,
*m_viewerWindow->m_gestureRenderer,
sceneView,
m_viewerWindow->gesture.graphics,
1.0f);

std::unique_ptr<uint8_t> bytes(new uint8_t[captureWidth * captureHeight * 4]);
const std::size_t byteCount = static_cast<std::size_t>(captureWidth) * captureHeight * 4;
auto bytes = std::make_unique<uint8_t[]>(byteCount);
fbo->toImage(bytes.get());

return QImage(bytes.get(), captureWidth, captureHeight, QImage::Format_ARGB32)
Expand Down
48 changes: 27 additions & 21 deletions agave_app/GLView3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

#include <memory>

#include "glm.h"
#include "renderlib/CCamera.h"
#include "renderlib/ViewerWindow.h"
#include "renderlib/gesture/gesture.h"
#include "IAppView3D.h"

#include "glm.h"
#include "renderlib/CCamera.h"
#include "renderlib/ViewerWindow.h"
#include "renderlib/gesture/gesture.h"

#include <QOpenGLWidget>
#include <QTimer>
Expand All @@ -22,7 +24,9 @@ struct ViewerState;
/**
* 3D GL view of an image with axes and gridlines.
*/
class GLView3D : public QOpenGLWidget
class GLView3D
: public QOpenGLWidget
, public IAppView3D
{
Q_OBJECT

Expand All @@ -44,9 +48,9 @@ class GLView3D : public QOpenGLWidget
QSize minimumSizeHint() const override;
QSize sizeHint() const override;

void initCameraFromImage(Scene* scene);
void retargetCameraForNewVolume(Scene* scene);
void toggleCameraProjection();
void initCameraFromImage(Scene* scene) override;
void retargetCameraForNewVolume(Scene* scene) override;
void toggleCameraProjection() override;
enum MANIPULATOR_MODE
{
NONE,
Expand All @@ -57,23 +61,25 @@ class GLView3D : public QOpenGLWidget

void toggleRotateControls();
void toggleTranslateControls();
void showRotateControls(bool show);
void showTranslateControls(bool show);
void showRotateControls(bool show) override;
void showTranslateControls(bool show) override;

void onNewImage(Scene* scene);
void onNewImage(Scene* scene) override;

const CCamera& getCamera() { return m_viewerWindow->m_CCamera; }
const CCamera& getCamera() override { return m_viewerWindow->m_CCamera; }

void fromViewerState(const Serialize::ViewerState& s);
void fromViewerState(const Serialize::ViewerState& s) override;

QPixmap capture();
QImage captureQimage();
QImage captureQimage() override;

QWidget* asWidget() override { return this; }

// DANGER this must NOT outlive the GLView3D
ViewerWindow* borrowRenderer() { return m_viewerWindow; }
ViewerWindow* borrowRenderer() override { return m_viewerWindow; }

void pauseRenderLoop();
void restartRenderLoop();
void pauseRenderLoop() override;
void restartRenderLoop() override;

signals:
void ChangedRenderer();
Expand All @@ -86,11 +92,11 @@ public slots:
void OnSelectionChanged(SceneObject* so);

public:
std::shared_ptr<CStatus> getStatus();
std::shared_ptr<CStatus> getStatus() override;

/// Resize the view.
void resizeGL(int w, int h) override;
void FitToScene(float transitionDurationSeconds = 0.0f);
void FitToScene(float transitionDurationSeconds = 0.0f) override;

protected:
/// Set up GL context and subsidiary objects.
Expand All @@ -110,9 +116,9 @@ public slots:
QRenderSettings* m_qrendersettings;

/// Rendering timer.
QTimer* m_etimer;
QTimer* m_etimer = nullptr;

ViewerWindow* m_viewerWindow;
ViewerWindow* m_viewerWindow = nullptr;

MANIPULATOR_MODE m_manipulatorMode = MANIPULATOR_MODE::NONE;
};
Loading
Loading