Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jkrumbiegel authored Oct 15, 2024
2 parents 907f1e7 + e74adcb commit 9105701
Show file tree
Hide file tree
Showing 41 changed files with 775 additions and 151 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Install Julia
uses: julia-actions/setup-julia@v2
with:
version: '1'
version: '1.10'
- uses: julia-actions/cache@v2
- name: Build and deploy docs
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
version:
- '1.6'
- '1' # automatically expands to the latest stable 1.x release of Julia
- '1.10'
os:
- ubuntu-20.04
arch:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/compilation-benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y xorg-dev mesa-utils xvfb libgl1 freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev
- uses: julia-actions/setup-julia@v2
with:
version: '1'
version: '1.10'
arch: x64
- uses: julia-actions/cache@v2
- name: Benchmark
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/reference_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
version:
- '1.6'
- '1' # automatically expands to the latest stable 1.x release of Julia
- '1.10'
os:
- ubuntu-20.04
arch:
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
matrix:
version:
- '1.6'
- '1' # automatically expands to the latest stable 1.x release of Julia
- '1.10'
os:
- ubuntu-20.04
arch:
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
matrix:
version:
- '1.6'
- '1' # automatically expands to the latest stable 1.x release of Julia
- '1.10'
os:
- ubuntu-20.04
arch:
Expand Down Expand Up @@ -172,15 +172,15 @@ jobs:
steps:
- uses: actions/download-artifact@v4
with:
name: ReferenceImages_WGLMakie_1
name: ReferenceImages_WGLMakie_1.10
path: ./ReferenceImages/WGLMakie
- uses: actions/download-artifact@v4
with:
name: ReferenceImages_CairoMakie_1
name: ReferenceImages_CairoMakie_1.10
path: ./ReferenceImages/CairoMakie
- uses: actions/download-artifact@v4
with:
name: ReferenceImages_GLMakie_1
name: ReferenceImages_GLMakie_1.10
path: ./ReferenceImages/GLMakie
- name: Consolidate reference image folders
run: |
Expand All @@ -198,9 +198,10 @@ jobs:
# Loop through the directories and concatenate the files, and copy recorded folders
for dir in WGLMakie CairoMakie GLMakie; do
# Concatenate scores.tsv and new_files.txt
# Concatenate scores.tsv, new_files.txt and missing_files.txt
cat "${baseDir}/${dir}/scores.tsv" >> "./ReferenceImagesCombined/scores.tsv"
cat "${baseDir}/${dir}/new_files.txt" >> "./ReferenceImagesCombined/new_files.txt"
cat "${baseDir}/${dir}/missing_files.txt" >> "./ReferenceImagesCombined/missing_files.txt"
# Copy recorded folder
mkdir -p "./ReferenceImagesCombined/recorded/${dir}/"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/relocatability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1' # automatically expands to the latest stable 1.x release of Julia
- '1.10'
os:
- ubuntu-20.04
arch:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rprmakie.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1' # automatically expands to the latest stable 1.x release of Julia
- '1.10'
os:
- ubuntu-20.04
arch:
Expand Down
15 changes: 11 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@

## [Unreleased]

- Add SwarmMakie to the ecosystem page of the documentation and add URLs for the other examples [#4460](https://github.com/MakieOrg/Makie.jl/pull/4460).
- Improved performance of `record` by avoiding unnecessary copying in common cases [#4475](https://github.com/MakieOrg/Makie.jl/pull/4475).

## [0.21.14] - 2024-10-11

- Fixed relocatability of GLMakie [#4461](https://github.com/MakieOrg/Makie.jl/pull/4461).
- Fixed relocatability of WGLMakie [#4467](https://github.com/MakieOrg/Makie.jl/pull/4467).
- Fixed `space` keyword for `barplot` [#4435](https://github.com/MakieOrg/Makie.jl/pull/4435).

## [0.21.13] - 2024-10-07

- Optimize SpecApi, re-use Blocks better and add API to access the created block objects [#4354](https://github.com/MakieOrg/Makie.jl/pull/4354).
- Fix `merge(attr1, attr2)` modifying nested attributes in `attr1` [#4416](https://github.com/MakieOrg/Makie.jl/pull/4416)
- Fixed `merge(attr1, attr2)` modifying nested attributes in `attr1` [#4416](https://github.com/MakieOrg/Makie.jl/pull/4416)
- Fixed issue with CairoMakie rendering scene backgrounds at the wrong position [#4425](https://github.com/MakieOrg/Makie.jl/pull/4425)
- Fix incorrect inverse transformation in `position_on_plot` for lines, causing incorrect tooltip placement in DataInspector [#4402](https://github.com/MakieOrg/Makie.jl/pull/4402)
- Fixed incorrect inverse transformation in `position_on_plot` for lines, causing incorrect tooltip placement in DataInspector [#4402](https://github.com/MakieOrg/Makie.jl/pull/4402)
- Added new `Checkbox` block [#4336](https://github.com/MakieOrg/Makie.jl/pull/4336).
- Added ability to override legend element attributes by pairing labels or plots with override attributes [#4427](https://github.com/MakieOrg/Makie.jl/pull/4427).
- Added threshold before a drag starts which improves false negative rates for clicks. `Button` can now trigger on click and not mouse-down which is the canonical behavior in other GUI systems [#4336](https://github.com/MakieOrg/Makie.jl/pull/4336).
Expand Down Expand Up @@ -623,7 +629,8 @@ All other changes are collected [in this PR](https://github.com/MakieOrg/Makie.j
- Fixed rendering of `heatmap`s with one or more reversed ranges in CairoMakie, as in `heatmap(1:10, 10:-1:1, rand(10, 10))` [#1100](https://github.com/MakieOrg/Makie.jl/pull/1100).
- Fixed volume slice recipe and added docs for it [#1123](https://github.com/MakieOrg/Makie.jl/pull/1123).

[Unreleased]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.13...HEAD
[Unreleased]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.14...HEAD
[0.21.14]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.13...v0.21.14
[0.21.13]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.12...v0.21.13
[0.21.12]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.11...v0.21.12
[0.21.11]: https://github.com/MakieOrg/Makie.jl/compare/v0.21.10...v0.21.11
Expand Down
4 changes: 2 additions & 2 deletions CairoMakie/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CairoMakie"
uuid = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
author = ["Simon Danisch <[email protected]>"]
version = "0.12.13"
version = "0.12.14"

[deps]
CRC32c = "8bf52ea8-c179-5cab-976a-9e18b702a9bc"
Expand All @@ -24,7 +24,7 @@ FileIO = "1.1"
FreeType = "3, 4.0"
GeometryBasics = "0.4.11"
LinearAlgebra = "1.0, 1.6"
Makie = "=0.21.13"
Makie = "=0.21.14"
PrecompileTools = "1.0"
julia = "1.3"

Expand Down
2 changes: 1 addition & 1 deletion CairoMakie/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ functions = [:volume, :volume!, :uv_mesh]
CairoMakie.activate!(type = "png", px_per_unit = 1)
ReferenceTests.mark_broken_tests(excludes, functions=functions)
recorded_files, recording_dir = @include_reference_tests CairoMakie "refimages.jl"
missing_images, scores = ReferenceTests.record_comparison(recording_dir)
missing_images, scores = ReferenceTests.record_comparison(recording_dir, "CairoMakie")
ReferenceTests.test_comparison(scores; threshold = 0.05)
end

Expand Down
4 changes: 2 additions & 2 deletions GLMakie/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "GLMakie"
uuid = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
version = "0.10.13"
version = "0.10.14"

[deps]
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
Expand Down Expand Up @@ -30,7 +30,7 @@ FreeTypeAbstraction = "0.10"
GLFW = "3.4.3"
GeometryBasics = "0.4.11"
LinearAlgebra = "1.0, 1.6"
Makie = "=0.21.13"
Makie = "=0.21.14"
Markdown = "1.0, 1.6"
MeshIO = "0.4"
ModernGL = "1"
Expand Down
Binary file removed GLMakie/assets/loading.bin
Binary file not shown.
35 changes: 23 additions & 12 deletions GLMakie/src/GLMakie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,31 +55,42 @@ function ShaderSource(path)
return ShaderSource(typ, source, name)
end

const GL_ASSET_DIR = RelocatableFolders.@path joinpath(@__DIR__, "..", "assets")
const SHADER_DIR = RelocatableFolders.@path joinpath(GL_ASSET_DIR, "shader")
const SHADER_DIR = normpath(joinpath(@__DIR__, "..", "assets", "shader"))
const LOADED_SHADERS = Dict{String, ShaderSource}()
const WARN_ON_LOAD = Ref(false)

const SHADER_PATHS = Dict{String,Union{RelocatableFolders.Path, String}}()

# Turns out, loading shaders is so slow, that it actually makes sense to memoize it :-O
# when creating 1000 plots with the PlotSpec API, timing drop from 1.5s to 1s just from this change:
function shader_path(name)
return get!(SHADER_PATHS, name) do
return joinpath(SHADER_DIR, name)
function loadshader(name)
return get!(LOADED_SHADERS, name) do
if WARN_ON_LOAD[]
@warn("Reloading shader")
end
return ShaderSource(joinpath(SHADER_DIR, name))
end
end

function loadshader(name)
return get!(LOADED_SHADERS, name) do
return ShaderSource(shader_path(name))
function load_all_shaders(folder)
for name in readdir(folder)
path = joinpath(folder, name)
if isdir(path)
load_all_shaders(path)
elseif any(x -> endswith(name, x), [".frag", ".vert", ".geom"])
path = relpath(path, SHADER_DIR)
loadshader(replace(path, "\\" => "/"))
end
end
end


gl_texture_atlas() = Makie.get_texture_atlas(2048, 64)

# don't put this into try catch, to not mess with normal errors
include("gl_backend.jl")

# We load all shaders to compile them into the package Image
# Making them relocatable
load_all_shaders(SHADER_DIR)
WARN_ON_LOAD[] = true

function __init__()
activate!()
end
Expand Down
2 changes: 1 addition & 1 deletion GLMakie/src/precompiles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ let
close(screen)

empty!(atlas_texture_cache)
closeall()
closeall(; empty_shader=false)
@assert isempty(SCREEN_REUSE_POOL)
@assert isempty(ALL_SCREENS)
@assert isempty(SINGLETON_SCREEN)
Expand Down
53 changes: 5 additions & 48 deletions GLMakie/src/screen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -677,10 +677,13 @@ function Base.close(screen::Screen; reuse=true)
return
end

function closeall()
function closeall(; empty_shader=true)
# Since we call closeall to reload any shader
# We empty the shader source cache here
empty!(LOADED_SHADERS)
if empty_shader
empty!(LOADED_SHADERS)
WARN_ON_LOAD[] = false
end
while !isempty(SCREEN_REUSE_POOL)
screen = pop!(SCREEN_REUSE_POOL)
delete!(ALL_SCREENS, screen)
Expand Down Expand Up @@ -811,52 +814,6 @@ end

Makie.to_native(x::Screen) = x.glscreen

"""
get_loading_image(resolution)
Loads the makie loading icon, embeds it in an image the size of `resolution`,
and returns the image.
"""
function get_loading_image(resolution)
icon = Matrix{N0f8}(undef, 192, 192)
open(joinpath(GL_ASSET_DIR, "loading.bin")) do io
read!(io, icon)
end
img = zeros(RGBA{N0f8}, resolution...)
center = resolution 2
center_icon = size(icon) 2
start = CartesianIndex(max.(center .- center_icon, 1))
I1 = CartesianIndex(1, 1)
stop = min(start + CartesianIndex(size(icon)) - I1, CartesianIndex(resolution))
for idx in start:stop
gray = icon[idx - start + I1]
img[idx] = RGBA{N0f8}(gray, gray, gray, 1.0)
end
return img
end

function display_loading_image(screen::Screen)
fb = screen.framebuffer
fbsize = size(fb)
image = get_loading_image(fbsize)
if size(image) == fbsize
nw = to_native(screen)
# transfer loading image to gpu framebuffer
fb.buffers[:color][1:size(image, 1), 1:size(image, 2)] = image
ShaderAbstractions.is_context_active(nw) || return
w, h = fbsize
glBindFramebuffer(GL_FRAMEBUFFER, 0) # transfer back to window
glViewport(0, 0, w, h)
glClearColor(0, 0, 0, 0)
glClear(GL_COLOR_BUFFER_BIT)
# GLAbstraction.render(fb.postprocess[end]) # copy postprocess
GLAbstraction.render(screen.postprocessors[end].robjs[1])
GLFW.SwapBuffers(nw)
else
error("loading_image needs to be Matrix{RGBA{N0f8}} with size(loading_image) == resolution")
end
end

function renderloop_running(screen::Screen)
return !screen.stop_renderloop && !isnothing(screen.rendertask) && !istaskdone(screen.rendertask)
end
Expand Down
2 changes: 1 addition & 1 deletion GLMakie/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ include("unit_tests.jl")
@testset "refimages" begin
ReferenceTests.mark_broken_tests()
recorded_files, recording_dir = @include_reference_tests GLMakie "refimages.jl" joinpath(@__DIR__, "glmakie_refimages.jl")
missing_images, scores = ReferenceTests.record_comparison(recording_dir)
missing_images, scores = ReferenceTests.record_comparison(recording_dir, "GLMakie")
ReferenceTests.test_comparison(scores; threshold = 0.05)
end

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Makie"
uuid = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
authors = ["Simon Danisch", "Julius Krumbiegel"]
version = "0.21.13"
version = "0.21.14"

[deps]
Animations = "27a7e980-b3e6-11e9-2bcd-0b925532e340"
Expand Down
4 changes: 2 additions & 2 deletions RPRMakie/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "RPRMakie"
uuid = "22d9f318-5e34-4b44-b769-6e3734a732a6"
authors = ["Simon Danisch"]
version = "0.7.13"
version = "0.7.14"

[deps]
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Expand All @@ -17,7 +17,7 @@ Colors = "0.9, 0.10, 0.11, 0.12"
FileIO = "1.6"
GeometryBasics = "0.4.11"
LinearAlgebra = "1.0, 1.6"
Makie = "=0.21.13"
Makie = "=0.21.14"
Printf = "1.0, 1.6"
RadeonProRender = "0.3.0"
julia = "1.3"
Expand Down
5 changes: 5 additions & 0 deletions ReferenceTests/src/database.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const RECORDING_DIR = Base.RefValue{String}()
const SKIP_TITLES = Set{String}()
const SKIP_FUNCTIONS = Set{Symbol}()
const COUNTER = Ref(0)
const SKIPPED_NAMES = Set{String}() # names skipped due to title exclusion or function exclusion

"""
@reference_test(name, code)
Expand All @@ -32,6 +33,7 @@ macro reference_test(name, code)
@testset $(title) begin
if $skip
@test_broken false
mark_skipped!($title)
else
t1 = time()
if $title in $REGISTERED_TESTS
Expand Down Expand Up @@ -84,10 +86,13 @@ end
function mark_broken_tests(title_excludes = []; functions=[])
empty!(SKIP_TITLES)
empty!(SKIP_FUNCTIONS)
empty!(SKIPPED_NAMES)
union!(SKIP_TITLES, title_excludes)
union!(SKIP_FUNCTIONS, functions)
end

mark_skipped!(name::String) = push!(SKIPPED_NAMES, name)

macro include_reference_tests(backend::Symbol, path, paths...)
toplevel_folder = dirname(string(__source__.file))
return esc(quote
Expand Down
Loading

0 comments on commit 9105701

Please sign in to comment.