Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meshes with specified materials lack color on MacOS #2769

Closed
asinghvi17 opened this issue Mar 15, 2023 · 8 comments
Closed

Meshes with specified materials lack color on MacOS #2769

asinghvi17 opened this issue Mar 15, 2023 · 8 comments
Labels
RPRMakie This relates to RPRMakie, the raytracing backend for Makie based on AMD's RadeonProRender framework.

Comments

@asinghvi17
Copy link
Member

asinghvi17 commented Mar 15, 2023

There's something wrong with materials in meshes on MacOS when using RPRMakie.
iTerm2 KrTps3
iTerm2 Tfp6lf

Specifically, an error pops up when trying to construct an RPR.Image. Run the earth and sun example, then try:

notify(mplot.color)

I get the error:

ERROR: Error code returned: RPR_ERROR_INVALID_PARAMETER
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] check_error
    @ ~/.julia/packages/RadeonProRender/R23Ls/src/LibRPR.jl:10 [inlined]
  [3] rprContextCreateImage(context::RadeonProRender.Context, format::RadeonProRender.RPR.rpr_image_format, image_desc::Base.RefValue{RadeonProRender.RPR.rpr_image_desc}, data::Matrix{RGB{Float32}})
    @ RadeonProRender.RPR ~/.julia/packages/RadeonProRender/R23Ls/src/LibRPR.jl:1872
  [4] Image
    @ ~/.julia/packages/RadeonProRender/R23Ls/src/highlevel-api.jl:374 [inlined]
  [5] (::RPRMakie.var"#32#35"{RadeonProRender.Context})(color::Matrix{RGB{N0f8}})
    @ RPRMakie ~/.julia/packages/RPRMakie/PMgeN/src/meshes.jl:28
  [6] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./essentials.jl:816
  [7] invokelatest(::Any, ::Any, ::Vararg{Any})
    @ Base ./essentials.jl:813
  [8] (::Observables.MapCallback)(value::Any)
    @ Observables ~/.julia/packages/Observables/PHGQ8/src/Observables.jl:431
  [9] #invokelatest#2
    @ ./essentials.jl:816 [inlined]
 [10] invokelatest
    @ ./essentials.jl:813 [inlined]
 [11] notify(observable::Observables.AbstractObservable)
    @ Observables ~/.julia/packages/Observables/PHGQ8/src/Observables.jl:169
 [12] top-level scope
    @ REPL[80]:1
@asinghvi17 asinghvi17 added the RPRMakie This relates to RPRMakie, the raytracing backend for Makie based on AMD's RadeonProRender framework. label Mar 15, 2023
@SimonDanisch
Copy link
Member

Which render plugin?

@asinghvi17
Copy link
Member Author

This was with Northstar. Specifically, the config was:

RPRMakie.activate!(resource=RPR.RPR_CREATION_FLAGS_ENABLE_CPU,
               plugin=RPR.Northstar, iterations=50)

which was quite slow, but GPU causes a reliable segfault on MacOS.

@SimonDanisch
Copy link
Member

What does Tahoe produce?

@SimonDanisch
Copy link
Member

Can you post an mwe for the Image parameter error?

@asinghvi17
Copy link
Member Author

huh, I'm trying to narrow it down but it's now magically working if I add lights. Will post an MWE when I have one :D

@asinghvi17
Copy link
Member Author

Tahoe tries to set the thread affinity, then crashes (illegal instruction, which makes sense - thread affinity might have been supported on Intel Macs, but it's not supported in the same way on M1)

@asinghvi17
Copy link
Member Author

asinghvi17 commented Mar 15, 2023

Ok, the image parameter has not errored since I restarted Julia. It might be that RPR somehow got a corrupted state.

The earth example seems to work with some lights added:

# define some lighting
radiance = 500
lights = Makie.AbstractLight[
    # EnvironmentLight(0.5, Makie.FileIO.load(RPR.assetpath("studio026.exr"))),
    PointLight(Vec3f(0, 0, 20), RGBf(radiance, radiance, radiance))
]

f, ax, mplot = Makie.mesh(m; color=rand(RGBAf, 10, 10), axis = (; scenekw = (; lights = lights), show_axis = false));
RPRMakie.Screen(ax.scene)

iTerm2 gQaeUo

but the material example is still colorless with Northstar, and Tahoe consistently fails by trying to set thread affinity.
iTerm2 Y9MPHc

For reference, here's the Tahoe error:

julia> RPRMakie.Screen(ax.scene; iterations = 50, plugin = RPR.Tahoe)
[ Info: releasing old context
Warning: Warning: setting thread affinity failed
Warning: setting threasetting thread affinity failed
Warning: settinWd affinity failed
arninggW:arninWgarn:  t hing: settinWarnign g: reads ettinWasranffinity tg thread affhread etitng:asffinietiy failfed
aiilnity tting thng
[34176] signal (4.1): Illegal instruction: 4
in expression starting at none:0
tedAllocations: 82431212 (Pool: 82413487; Big: 17725); GC: 117

read affinity failed
hread afsetfinitting thread failyaffinited f
[1]    34176 illegal hardware instruction  /Applications/Julia-1.9-x84.app/Contents/Resources/julia/bin/julia

@asinghvi17
Copy link
Member Author

Ok, this seems to work pretty well with RPR v3, so it's probably not an issue anymore!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RPRMakie This relates to RPRMakie, the raytracing backend for Makie based on AMD's RadeonProRender framework.
Projects
None yet
Development

No branches or pull requests

2 participants