Skip to content

Commit

Permalink
Merge branch 'master' into ff/missing-refimages
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer authored Oct 15, 2024
2 parents 966efc3 + 97a8bb0 commit 8561447
Show file tree
Hide file tree
Showing 36 changed files with 540 additions and 116 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
12 changes: 6 additions & 6 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 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: 12 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@

## [Unreleased]

- 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 @@ -621,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 <sdanisch@gmail.com>"]
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
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 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
2 changes: 1 addition & 1 deletion ReferenceUpdater/src/ReferenceUpdater.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ function __init__()
atexit(wipe_cache!)
end

end
end
5 changes: 2 additions & 3 deletions ReferenceUpdater/src/local_server.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ function serve_update_page_from_dir(folder)

folder = realpath(folder)
@assert isdir(folder) "$folder is not a valid directory."

group_scores(folder)
group_files(folder, "new_files.txt", "new_files_grouped.txt")
group_files(folder, "missing_files.txt", "missing_files_grouped.txt")
Expand Down Expand Up @@ -121,7 +120,7 @@ function serve_update_page(; commit = nothing, pr = nothing)
checkruns = filter(checksinfo["check_runs"]) do checkrun
name = checkrun["name"]
id = checkrun["id"]

if name == "Merge artifacts"
job = JSON3.read(authget("https://api.github.com/repos/MakieOrg/Makie.jl/actions/jobs/$(id)").body)
run = JSON3.read(authget(job["run_url"]).body)
Expand Down Expand Up @@ -230,7 +229,7 @@ function group_scores(path)
end
end
end

# sort by max score across all backends so problem come first
data_vec = collect(pairs(data))
sort!(data_vec, by = x -> maximum(x[2]), rev = true)
Expand Down
4 changes: 2 additions & 2 deletions WGLMakie/Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "WGLMakie"
uuid = "276b4fcb-3e11-5398-bf8b-a0c2d153d008"
authors = ["SimonDanisch <sdanisch@gmail.com>"]
version = "0.10.13"
version = "0.10.14"

[deps]
Bonito = "824d6782-a2ef-11e9-3a09-e5662e0c26f8"
Expand All @@ -27,7 +27,7 @@ FreeTypeAbstraction = "0.10"
GeometryBasics = "0.4.11"
Hyperscript = "0.0.3, 0.0.4, 0.0.5"
LinearAlgebra = "1.0, 1.6"
Makie = "=0.21.13"
Makie = "=0.21.14"
Observables = "0.5.1"
PNGFiles = "0.3, 0.4"
PrecompileTools = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion WGLMakie/src/picking.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ struct ToolTip
end
end

const POPUP_CSS = Bonito.Asset(joinpath(@__DIR__, "popup.css"))
const POPUP_CSS = Bonito.Asset(@path joinpath(@__DIR__, "popup.css"))

function Bonito.jsrender(session::Session, tt::ToolTip)
scene = tt.scene
Expand Down
3 changes: 2 additions & 1 deletion WGLMakie/src/serialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ function flatten_buffer(array::AbstractArray{T}) where {T}
return flatten_buffer(collect(reinterpret(eltype(T), array)))
end

lasset(paths...) = read(joinpath(@__DIR__, "..", "assets", paths...), String)
const ASSETS_DIR = @path joinpath(@__DIR__, "..", "assets")
lasset(paths...) = read(joinpath(ASSETS_DIR, paths...), String)

isscalar(x::StaticVector) = true
isscalar(x::Mat) = true
Expand Down
Binary file added assets/cursor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/cursor_pressed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8561447

Please sign in to comment.