Skip to content

Commit

Permalink
Merge pull request #133 from GPUOpen-LibrariesAndSDKs/develop
Browse files Browse the repository at this point in the history
Merge develop to master version 3.0
  • Loading branch information
bsavery authored Nov 16, 2020
2 parents 83c658a + 36d8e0c commit 058b861
Show file tree
Hide file tree
Showing 48 changed files with 1,232 additions and 487 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ bindings-ok

kernelsCache/
.hybrid_cache
.tex_cache

vscode/

Expand Down
4 changes: 3 additions & 1 deletion BlenderPkg/create_zip_addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#********************************************************************

import zipfile
import zlib
import platform
from pathlib import Path
import subprocess
Expand Down Expand Up @@ -93,7 +94,8 @@ def create_zip_addon(build_dir):
zip_addon = build_dir / f"rprblender-{ver[0]}.{ver[1]}.{ver[2]}-{ver[3]}-{OS.lower()}.zip"

print(f"Compressing addon files to: {zip_addon}")
with zipfile.ZipFile(zip_addon, 'w') as myzip:
with zipfile.ZipFile(zip_addon, 'w', compression=zipfile.ZIP_DEFLATED,
compresslevel=zlib.Z_BEST_COMPRESSION) as myzip:
for src, package_path in enumerate_addon_data():
print(f"adding {src} --> {package_path}")

Expand Down
74 changes: 29 additions & 45 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,34 @@
# Version 2.5.1
# Version 3.0
## New Features:
- The new plug-in version incorporates version 2.0 of our Radeon™ ProRender system and brings about these significant changes and enhancements:
- Hardware-accelerated ray tracing on AMD Radeon™ RX 6000 series GPUs
- Better scaling across multiple devices: the use of two or more GPUs gives a better performance improvement with Radeon ProRender 2.0 than with Radeon ProRender 1.0 in most cases.
- Less noise for a given number of render samples. Using the same number of samples as with Radeon ProRender 1.0 may be slower in some scenes, but noise will be significantly lower.
- RPR 2.0 is the default render mode called “Full”. Users who wish to use RPR 1.0 can set the render quality mode to “Legacy”.
- A new setting for texture cache has been added. The specified folder will cache textures for rendering, and can be cleaned up by the user if it becomes too large.
- A new setting called “Contour Rendering” allows non-photorealistic outline style renders.
- A setting has been added to allow “Motion Blur only in the Velocity AOV” in the Motion Blur settings. Enabling this setting means that all AOVs will not have motion blur, but the Velocity AOV will contain motion blur information to allow compositing of post-process motion blur.
- Support for UDIM based tiled image textures has been added

## New Features
- **Beta support for RPR 2.0 and the capability of using it for Viewport Rendering has been added. This also gives better support for Point and Spot light softness parameters. For equivalent sample counts, in most scenes, the noise should be lower, and scaling of render speeds across multiple devices should be better.**
- The ML Denoising filter speed has been improved.
- The viewport shading panel has been added in the viewport render mode.
- Support for “Multiply Add” in the Math node has been added (thanks to user cmdrf for their contribution).
- Support for muting nodes with the “M” key in the shader editor has been added.
- Support for the Local mode with the “/” key in the viewport has been added.
- The Object Info node is now supported in the Full mode.
- The default adaptive tile size has been increased to 32 for adaptive rendering, which gives better results when rendering with multiple GPUs.
A new setting in Viewport Sampling called “Samples per second” has been added, with the default being 15. This setting is roughly analogous to “Frames per second”. The viewport render resolution is adjusted during rendering to try and maintain this interactivity. There is also a “Minimum viewport resolution” setting which limits resolution downscaling. For users with high resolution displays, this adaptive resolution can maintain a much better viewport experience.
- Support of image sequences of textures and sequences of animated OpenVDB files has been added.
- Final rendering no longer uses the setting “Update samples”. Renders are exponentially updated after 1, 1, 2, 4, 8, 16, 32, and every 32 samples thereafter. This is done to maximize performance, especially with RPR 2.0. Viewport rendering is unchanged.
- For users interested in testing the latest developments in the Radeon ProRender for Blender plugin, a weekly “Development Build” will be posted on future Mondays. See https://github.com/GPUOpen-LibrariesAndSDKs/RadeonProRenderBlenderAddon/releases or follow the repository on github to get weekly updates.
- Support for Blender 2.90

## Fixed Issues
- The Physical Light normalization now takes transform scaling into account.
- Export of .rpr files now uses the scene camera property.
- Backplate images now work in viewport renders.
- An issue with image texture gamma correction in Hybrid modes has been fixed.
- Pixel filter settings are now exported to .rpr files.
- CPU rendering is now selectable in the UI with RPR 2.0 enabled.
- Rendering animations can no longer cause a memory leak and eventual crash.
- Export of .rpr files should no longer be slow with many textures in Blender 2.83.
- Scene sync and render times are now logged to the console.
- AOV names in the config.json file exported with .rpr are no longer different from expected names.
- When using collections of objects with the same name there could be a name duplication leading to some objects not being rendered — fixed.
- Sometimes switching from the Object to the Edit mode in the viewport could result in the loss of an object’s UV coordinates — fixed.
- Mapping node transformations were off, in particular, combinations of transforms and rotations only took Z into account — fixed.
- “Generated” UV in the Texture Coordinate mode is now correct.
- The scale wrap, sin, cos and tan functions in the vector math node are now not supported.
- Exporting .rpr files to directories with non-latin characters is now supported
- Fixed artifacts while using the denoiser with tiled rendering
- Light Group AOVs and ID’s now use 1-4 instead of selecting a “key” or “fill” light group.

## Known Issues
- macOS ML denoiser may have issues (driver issue being investigated)
- RPR 2.0 known issues
- Shadow and reflection catchers are not yet enabled
- Adaptive sampling is disabled
- Adaptive subdivision is disabled
- On macOS, currently RPR 2.0 uses OpenCL and not metal.
- Volumetric absorption does not currently work
## Issues Fixed:
- Using the Uber shader with the “Metalness” reflection mode now matches the Disney shader PBR standard more closely. Among other improvements, the Blender “Principled BRDF” node respects the “Specular” parameter better.
- Motion Blur, particularly for rotation, is now more correct.
- Animated World settings were not being applied correctly — fixed.
- An error when using RGB Curve nodes in some instances — fixed.
- Object and material “Pass Index” Blender’s settings are now fully supported.
- Some errors in Hybrid rendering have been resolved.
- Some users (particularly users with 4GB VRAM GPUs) could not use Hybrid rendering. We have added a setting for them to use Hybrid in these instances with lower memory.
- A memory leak when rendering animations has been fixed.
- An issue involving OpenVDB compatibility with Blender 2.91 has been fixed.

## Known Issues:
- RPR 2.0 has some forthcoming features. If these are needed, please use the “Legacy” render mode:
- Heterogenous volumes;
- Adaptive sampling;
- Adaptive subdivision.
- The first render on macOS® with RPR 2.0 can take a few minutes to start, while the kernels are being compiled.
macOS® Mojave users should use Legacy mode if seeing crashes with Full mode.
- Pixelated textures or color artifacts in textures can sometimes happen in Full mode.

# Version 2.4.11

Expand Down Expand Up @@ -122,6 +107,5 @@ A new setting in Viewport Sampling called “Samples per second” has been adde
- ML Denoiser on macOS (with certain Vega cards) and Ubuntu can produce black pixels.

- Viewport rendering with RPR 2.0 falls back to use RPR 1.0.


- Invisible area lights can cause firefly artifacts in RPR 2.0.
4 changes: 2 additions & 2 deletions README-OSX.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ NOTES:

### Running

Ensure that the BLENDER_28X_EXE environment variable is set. For example, add the following to
Ensure that the BLENDER_EXE environment variable is set. For example, add the following to
your ~/.profile with the correct path to the Blender executable:

export BLENDER_28X_EXE="/Users/amd/Downloads/blender-2.78c-OSX_10.6-x86_64/blender.app/Contents/MacOS/blender"
export BLENDER_EXE="/Users/amd/Downloads/blender-2.78c-OSX_10.6-x86_64/blender.app/Contents/MacOS/blender"

To run the local build, use:
- ./run_blender_with_rpr_osx.sh
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ run `build.py` to build.
## Run Addon while developing it(without real installation)

- make sure you have no installed addon for Blender version you want to use; remove installed version if needed.
- set environment variable BLENDER_28x_EXE to blender.exe you want to use via the command line or system environment settings.
- set environment variable BLENDER_EXE to blender.exe you want to use via the command line or system environment settings.
- run run_blender_with_rpr.cmd

Example:

`set BLENDER_28X_EXE="C:\Program Files\Blender Foundation\Blender 2.81\blender.exe" && run_blender_with_rpr.cmd`
`set BLENDER_EXE="C:\Program Files\Blender Foundation\Blender 2.81\blender.exe" && run_blender_with_rpr.cmd`

### Debugging

Expand Down
2 changes: 1 addition & 1 deletion RadeonProImageProcessingSDK
Submodule RadeonProImageProcessingSDK updated 67 files
+0 −0 CentOS7/Dynamic/libMIOpen.so
+1 −0 CentOS7/Dynamic/libMIOpen.so.2
+ CentOS7/Dynamic/libMIOpen.so.2.0.4
+0 −0 CentOS7/Dynamic/libOpenImageDenoise.so
+0 −0 CentOS7/Dynamic/libOpenImageDenoise.so.0
+ CentOS7/Dynamic/libOpenImageDenoise.so.0.9.0
+0 −0 CentOS7/Dynamic/libRadeonImageFilters.so
+1 −0 CentOS7/Dynamic/libRadeonImageFilters.so.1
+ CentOS7/Dynamic/libRadeonImageFilters.so.1.6.1
+0 −0 CentOS7/Dynamic/libRadeonML_MIOpen.so
+1 −0 CentOS7/Dynamic/libRadeonML_MIOpen.so.0
+ CentOS7/Dynamic/libRadeonML_MIOpen.so.0.9.8
+ CentOS7/Static/libRadeonImageFilters.a
+0 −1 CentOS7/libMIOpen.so.2
+0 −1 CentOS7/libRadeonImageFilters.so.1
+ CentOS7/libRadeonImageFilters.so.1.5.4
+0 −1 CentOS7/libRadeonML_MIOpen.so.0
+ OSX/Dynamic/libOpenImageDenoise.0.9.0.dylib
+0 −0 OSX/Dynamic/libOpenImageDenoise.0.dylib
+0 −0 OSX/Dynamic/libOpenImageDenoise.dylib
+ OSX/Dynamic/libRadeonImageFilters.1.6.1.dylib
+1 −0 OSX/Dynamic/libRadeonImageFilters.1.dylib
+0 −0 OSX/Dynamic/libRadeonImageFilters.dylib
+ OSX/Dynamic/libRadeonML_MPS.0.9.8.dylib
+1 −0 OSX/Dynamic/libRadeonML_MPS.0.dylib
+0 −0 OSX/Dynamic/libRadeonML_MPS.dylib
+ OSX/Static/libRadeonImageFilters.a
+ OSX/libRadeonImageFilters.1.5.4.dylib
+0 −1 OSX/libRadeonImageFilters.1.dylib
+0 −1 OSX/libRadeonML_MPS.0.dylib
+5 −0 README.md
+0 −6 RELEASENOTES.md
+15 −0 RELEASENOTES1.6.0.md
+11 −0 RELEASENOTES1.6.1.md
+0 −0 Ubuntu18/Dynamic/libMIOpen.so
+1 −0 Ubuntu18/Dynamic/libMIOpen.so.2
+ Ubuntu18/Dynamic/libMIOpen.so.2.0.4
+0 −0 Ubuntu18/Dynamic/libOpenImageDenoise.so
+0 −0 Ubuntu18/Dynamic/libOpenImageDenoise.so.0
+ Ubuntu18/Dynamic/libOpenImageDenoise.so.0.9.0
+0 −0 Ubuntu18/Dynamic/libRadeonImageFilters.so
+1 −0 Ubuntu18/Dynamic/libRadeonImageFilters.so.1
+ Ubuntu18/Dynamic/libRadeonImageFilters.so.1.6.1
+0 −0 Ubuntu18/Dynamic/libRadeonML_MIOpen.so
+1 −0 Ubuntu18/Dynamic/libRadeonML_MIOpen.so.0
+ Ubuntu18/Dynamic/libRadeonML_MIOpen.so.0.9.8
+ Ubuntu18/Static/libRadeonImageFilters.a
+0 −1 Ubuntu18/libMIOpen.so.2
+0 −1 Ubuntu18/libRadeonImageFilters.so.1
+ Ubuntu18/libRadeonImageFilters.so.1.5.4
+0 −1 Ubuntu18/libRadeonML_MIOpen.so.0
+ Windows/Dynamic/MIOpen.dll
+ Windows/Dynamic/OpenImageDenoise.dll
+ Windows/Dynamic/RadeonImageFilters.dll
+ Windows/Dynamic/RadeonImageFilters.lib
+ Windows/Dynamic/RadeonML_DirectML.dll
+ Windows/Dynamic/RadeonML_MIOpen.dll
+ Windows/Dynamic/dxcompiler.dll
+ Windows/Dynamic/dxil.dll
+ Windows/RadeonImageFilters.dll
+ Windows/RadeonML_DirectML.dll
+ Windows/RadeonML_MIOpen.dll
+ Windows/Static/RadeonImageFilters.lib
+495 −485 include/RadeonImageFilters.h
+42 −43 include/RadeonImageFilters_directx12.h
+19 −19 include/RadeonImageFilters_metal.h
+14 −3 include/RadeonImageFilters_version.h
2 changes: 1 addition & 1 deletion RadeonProRenderSDK
Submodule RadeonProRenderSDK updated 76 files
+ RadeonProRender/binCentOS7/Hybrid.so
+ RadeonProRender/binCentOS7/RprsRender64
+ RadeonProRender/binCentOS7/libNorthstar64.so
+ RadeonProRender/binCentOS7/libRadeonProRender64.so
+ RadeonProRender/binCentOS7/libRprLoadStore64.so
+ RadeonProRender/binCentOS7/libTahoe64.so
+ RadeonProRender/binMacOS/RprsRender64
+ RadeonProRender/binMacOS/libNorthstar64.dylib
+ RadeonProRender/binMacOS/libProRenderGLTF.dylib
+ RadeonProRender/binMacOS/libRadeonProRender64.dylib
+ RadeonProRender/binMacOS/libRprLoadStore64.dylib
+ RadeonProRender/binMacOS/libTahoe64.dylib
+ RadeonProRender/binUbuntu18/Hybrid.so
+ RadeonProRender/binUbuntu18/RprsRender64
+ RadeonProRender/binUbuntu18/libNorthstar64.so
+ RadeonProRender/binUbuntu18/libProRenderGLTF.so
+ RadeonProRender/binUbuntu18/libRadeonProRender64.so
+ RadeonProRender/binUbuntu18/libRprLoadStore64.so
+ RadeonProRender/binUbuntu18/libTahoe64.so
+ RadeonProRender/binWin64/Hybrid.dll
+ RadeonProRender/binWin64/Northstar64.dll
+ RadeonProRender/binWin64/ProRenderGLTF.dll
+ RadeonProRender/binWin64/RadeonProRender64.dll
+ RadeonProRender/binWin64/RprLoadStore64.dll
+ RadeonProRender/binWin64/RprsRender64.exe
+ RadeonProRender/binWin64/Tahoe64.dll
+5 −6 RadeonProRender/inc/ProRenderGLTF.h
+153 −42 RadeonProRender/inc/RadeonProRender.cs
+109 −34 RadeonProRender/inc/RadeonProRender.h
+2 −1 RadeonProRender/inc/RadeonProRender_Baikal.h
+1 −1 RadeonProRender/inc/RadeonProRender_CL.h
+1 −1 RadeonProRender/inc/RadeonProRender_GL.h
+1 −1 RadeonProRender/inc/RadeonProRender_Metal.h
+11 −0 RadeonProRender/inc/RadeonProRender_VK.h
+109 −34 RadeonProRender/inc/RadeonProRender_v2.h
+48 −4 RadeonProRender/inc/RprLoadStore.cs
+23 −4 RadeonProRender/inc/RprLoadStore.h
+2 −0 RadeonProRender/inc/rprDeprecatedApi.h
+ RadeonProRender/libWin64/ProRenderGLTF.lib
+ RadeonProRender/libWin64/RadeonProRender64.exp
+ RadeonProRender/libWin64/RadeonProRender64.lib
+ RadeonProRender/libWin64/RprLoadStore64.exp
+ RadeonProRender/libWin64/RprLoadStore64.lib
+18 −1 RadeonProRender/rprTools/RPRStringIDMapper.cpp
+2 −0 RadeonProRender/rprTools/RadeonProRender.hpp
+21 −0 RadeonProRender/rprTools/RadeonProRenderCpp.cpp
+2,051 −0 RadeonProRender/rprTools/rprMtlxLoader.cpp
+112 −0 RadeonProRender/rprTools/rprMtlxLoader.h
+64 −0 release_notes.txt
+2 −2 tutorials/00_context_creation/main.cpp
+11 −11 tutorials/01_camera_setup/main.cpp
+21 −21 tutorials/02_mesh/main.cpp
+33 −33 tutorials/03_instance/main.cpp
+11 −11 tutorials/10_light_point/main.cpp
+27 −26 tutorials/11_light_mesh/main.cpp
+17 −17 tutorials/12_light_environment/main.cpp
+10 −10 tutorials/20_material_textured/main.cpp
+11 −11 tutorials/21_material_layered/main.cpp
+30 −15 tutorials/22_material_uber/main.cpp
+11 −16 tutorials/23_material_uber_sss/main.cpp
+4 −6 tutorials/30_tiled_render/main.cpp
+76 −33 tutorials/31_framebuffer_access/main.cpp
+1 −1 tutorials/32_gl_interop/ShaderManager.h
+154 −68 tutorials/32_gl_interop/main.cpp
+18 −12 tutorials/33_aov/main.cpp
+11 −11 tutorials/40_postprocess_bloom/main.cpp
+11 −12 tutorials/41_postprocess_gamma/main.cpp
+12 −12 tutorials/50_curve/main.cpp
+18 −16 tutorials/51_volume/main.cpp
+10 −11 tutorials/60_mesh_export/main.cpp
+11 −11 tutorials/61_mesh_import/main.cpp
+10 −18 tutorials/62_matball_demo/main.cpp
+6 −8 tutorials/63_hybrid/main.cpp
+705 −702 tutorials/64_mesh_obj_demo/main.cpp
+28 −0 tutorials/common/common.h
+3 −1 tutorials/premake5.lua
2 changes: 1 addition & 1 deletion RadeonProRenderSharedComponents
12 changes: 6 additions & 6 deletions cmd_tools/create_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def copy_rif_sdk():
'Linux': "Ubuntu18",
'Darwin': "OSX"
}[OS]
bin_dir = rif_dir / os_str
bin_dir = rif_dir / os_str / "Dynamic"

# copying inc files
shutil.copytree(str(rif_dir / "include"), str(sdk_rif_dir / "inc"))
Expand All @@ -109,21 +109,21 @@ def copy_rif_sdk():
shutil.copy(str(lib), str(sdk_lib_dir))

elif OS == 'Linux':
shutil.copy(str(bin_dir / "libRadeonImageFilters.so.1.5.4"),
shutil.copy(str(bin_dir / "libRadeonImageFilters.so.1.6.1"),
str(sdk_bin_dir / "libRadeonImageFilters.so"))
shutil.copy(str(bin_dir / "libRadeonML_MIOpen.so.0.9.7"),
shutil.copy(str(bin_dir / "libRadeonML_MIOpen.so.0.9.8"),
str(sdk_bin_dir / "libRadeonML_MIOpen.so"))
shutil.copy(str(bin_dir / "libOpenImageDenoise.so.0.9.0"),
str(sdk_bin_dir / "libOpenImageDenoise.so"))
shutil.copy(str(bin_dir / "libMIOpen.so.2.0.1"),
shutil.copy(str(bin_dir / "libMIOpen.so.2.0.4"),
str(sdk_bin_dir / "libMIOpen.so.2"))

elif OS == 'Darwin':
shutil.copy(str(bin_dir / "libRadeonImageFilters.1.5.4.dylib"),
shutil.copy(str(bin_dir / "libRadeonImageFilters.1.6.1.dylib"),
str(sdk_bin_dir / "libRadeonImageFilters.dylib"))
shutil.copy(str(bin_dir / "libOpenImageDenoise.0.9.0.dylib"),
str(sdk_bin_dir / "libOpenImageDenoise.dylib"))
shutil.copy(str(bin_dir / "libRadeonML_MPS.0.9.7.dylib"),
shutil.copy(str(bin_dir / "libRadeonML_MPS.0.9.8.dylib"),
str(sdk_bin_dir / "libRadeonML_MPS.dylib"))

# adjusting id of RIF libs
Expand Down
6 changes: 3 additions & 3 deletions run_blender_with_rpr.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ REM *******************************************************************

@echo on

if ""=="%BLENDER_28x_EXE%" goto error
if ""=="%BLENDER_EXE%" goto error

py cmd_tools/run_blender.py "%BLENDER_28x_EXE%" cmd_tools/test_rpr.py
py cmd_tools/run_blender.py "%BLENDER_EXE%" cmd_tools/test_rpr.py
pause
REM it's much easier to get issue traceback on crash if pause is present; remove if not needed
exit

:error
echo "Please set BLENDER_28x_EXE environment variable"
echo "Please set BLENDER_EXE environment variable"
6 changes: 3 additions & 3 deletions run_blender_with_rpr_Ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ GLTF_LIBNAME="libProRenderGLTF.so"

function init()
{
if [ ! -x "$BLENDER_28x_EXE" ]; then
echo "Could not find blender application. Please, specify BLENDER_28x_EXE environment variable"
if [ ! -x "$BLENDER_EXE" ]; then
echo "Could not find blender application. Please, specify BLENDER_EXE environment variable"
exit 1
fi

Expand Down Expand Up @@ -67,7 +67,7 @@ function main()

export LD_LIBRARY_PATH="$WORK_DIR:$LD_LIBRARY_PATH"

python3 cmd_tools/run_blender.py "$BLENDER_28x_EXE" cmd_tools/test_rpr.py
python3 cmd_tools/run_blender.py "$BLENDER_EXE" cmd_tools/test_rpr.py

}

Expand Down
6 changes: 3 additions & 3 deletions run_blender_with_rpr_osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
# limitations under the License.
#********************************************************************

echo BLENDER_28x_EXE "${BLENDER_28x_EXE}"
echo BLENDER_EXE "${BLENDER_EXE}"

DEBUGGER_EXE="$1"

if [ -x "${BLENDER_28x_EXE}" ]; then
if [ -x "${BLENDER_EXE}" ]; then
rm -rf dist/
mkdir dist
cp -r .sdk/rpr/bin dist/
Expand All @@ -32,7 +32,7 @@ if [ -x "${BLENDER_28x_EXE}" ]; then

export LD_LIBRARY_PATH="$DIST_LIB"

python3 cmd_tools/run_blender.py "$BLENDER_28x_EXE" cmd_tools/test_rpr.py "$DEBUGGER_EXE"
python3 cmd_tools/run_blender.py "$BLENDER_EXE" cmd_tools/test_rpr.py "$DEBUGGER_EXE"

rm distlib

Expand Down
1 change: 1 addition & 0 deletions src/RPRBlender.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<Compile Include="rprblender\engine\render_engine.py" />
<Compile Include="rprblender\engine\render_engine_hybrid.py" />
<Compile Include="rprblender\engine\viewport_engine.py" />
<Compile Include="rprblender\engine\viewport_engine_2.py" />
<Compile Include="rprblender\engine\viewport_engine_hybrid.py" />
<Compile Include="rprblender\engine\__init__.py">
<SubType>Code</SubType>
Expand Down
17 changes: 7 additions & 10 deletions src/bindings/pyrpr/src/pyhybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def wrapper(*args, **kwargs):
return function(*args, **kwargs)

except pyrpr.CoreError as e:
if e.status not in (pyrpr.ERROR_UNSUPPORTED, pyrpr.ERROR_INVALID_PARAMETER):
if e.status not in (pyrpr.ERROR_UNSUPPORTED, pyrpr.ERROR_INVALID_PARAMETER,
pyrpr.ERROR_UNIMPLEMENTED):
raise

if hybrid_unsupported_log_warn:
Expand Down Expand Up @@ -59,8 +60,8 @@ def class_ignore_unsupported(cls):
enabled = True


@class_ignore_unsupported
class Context(pyrpr.Context):
@ignore_unsupported
def set_parameter(self, key, param):
if key == pyrpr.CONTEXT_ITERATIONS:
self.parameters[key] = param
Expand All @@ -73,14 +74,6 @@ def render(self):
for _ in range(iterations):
super().render()

@ignore_unsupported
def attach_aov(self, aov, frame_buffer):
super().attach_aov(aov, frame_buffer)

@ignore_unsupported
def detach_aov(self, aov):
super().detach_aov(aov)


@class_ignore_unsupported
class IESLight(pyrpr.PointLight):
Expand Down Expand Up @@ -150,6 +143,10 @@ def set_input(self, name, value):

super().set_input(name, value)

def delete(self):
self.inputs.clear()
super().delete()


class EmptyMaterialNode(MaterialNode):
def __init__(self, material_type):
Expand Down
41 changes: 29 additions & 12 deletions src/bindings/pyrpr/src/pyrpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,8 @@ def __repr__(self):
class Object:
core_type_name = 'void*'

def __init__(self, core_type_name=None):
self.ffi_type_name = (core_type_name if core_type_name is not None else self.core_type_name) + '*'
self._reset_handle()
def __init__(self):
self._handle_ptr = ffi.new(self.core_type_name + '*', ffi.NULL)
self.name = None

def __del__(self):
Expand All @@ -244,14 +243,11 @@ def __del__(self):
_init_data._log_fun('EXCEPTION:', traceback.format_exc())

def delete(self):
if self._handle_ptr and self._get_handle():
if lib_wrapped_log_calls:
_init_data._log_fun('delete: ', self.name, self)
ObjectDelete(self._get_handle())
self._reset_handle()
if lib_wrapped_log_calls:
_init_data._log_fun('delete: ', self.name, self)

def _reset_handle(self):
self._handle_ptr = ffi.new(self.ffi_type_name, ffi.NULL)
if self._get_handle():
ObjectDelete(self._get_handle())

def _get_handle(self):
return self._handle_ptr[0]
Expand Down Expand Up @@ -357,6 +353,9 @@ def set_scene(self, scene):

def render(self):
ContextRender(self)

def abort_render(self):
ContextAbortRender(self)

def render_tile(self, xmin, xmax, ymin, ymax):
ContextRenderTile(self, xmin, xmax, ymin, ymax)
Expand All @@ -374,8 +373,8 @@ def detach_aov(self, aov):
ContextSetAOV(self, aov, None)
del self.aovs[aov]

def set_aov_index_lookup(self, input, r, g, b, a):
ContextSetAOVindexLookup(self, input, r, g, b, a)
def set_aov_index_lookup(self, key, r, g, b, a):
ContextSetAOVindexLookup(self, key, r, g, b, a)

def get_info_size(self, context_info):
size = ffi.new('size_t *', 0)
Expand Down Expand Up @@ -618,6 +617,9 @@ def set_subdivision_boundary_interop(self, boundary):
def set_subdivision_crease_weight(self, factor):
ShapeSetSubdivisionCreaseWeight(self, factor)

def set_subdivision_auto_ratio_cap(self, auto_ratio_cap):
ShapeSetSubdivisionAutoRatioCap(self, auto_ratio_cap)

def set_light_group_id(self, group_id):
ShapeSetLightGroupID(self, group_id)

Expand Down Expand Up @@ -1166,6 +1168,18 @@ def __init__(self, material_system, material_type):
self.type = material_type
MaterialSystemCreateNode(self.material_system, self.type, self)

def delete(self):
for name, value in self.inputs.items():
if isinstance(value, MaterialNode):
MaterialNodeSetInputNByKey(self, name, None)
elif isinstance(value, Image):
MaterialNodeSetInputImageDataByKey(self, name, None)
elif isinstance(value, Buffer):
MaterialNodeSetInputBufferDataByKey(self, name, None)
self.inputs.clear()

super().delete()

def set_input(self, name, value):
if isinstance(value, MaterialNode):
MaterialNodeSetInputNByKey(self, name, value)
Expand All @@ -1188,6 +1202,9 @@ def set_input(self, name, value):

self.inputs[name] = value

def set_id(self, id):
MaterialNodeSetID(self, id)


class Light(Object):
core_type_name = 'rpr_light'
Expand Down
Loading

0 comments on commit 058b861

Please sign in to comment.