Skip to content

Commit 528f6d6

Browse files
committed
Merge branch 'AcademySoftwareFoundation:main' into add-testrender-volumes
2 parents d3fa513 + 190c3f0 commit 528f6d6

File tree

8 files changed

+41
-33
lines changed

8 files changed

+41
-33
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ jobs:
475475
PUGIXML_VERSION=v1.15
476476
FREETYPE_VERSION=VER-2-14-3
477477
- desc: clang14/C++17 llvm14 py3.10 avx2 batch-b16avx512
478-
nametag: linux-latest-releases-clang
478+
nametag: linux-clang14
479479
runner: ubuntu-22.04
480480
cxx_compiler: clang++
481481
cc_compiler: clang

Testing/Temporary/CTestCostData.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/testrender/shading.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2050,7 +2050,7 @@ process_bsdf_closure(const ShaderGlobalsType& sg, float path_roughness,
20502050
}
20512051
}
20522052
break;
2053-
}
2053+
};
20542054
case MX_TRANSLUCENT_ID: {
20552055
const MxTranslucentParams* srcparams
20562056
= comp->as<MxTranslucentParams>();

src/testrender/shading.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,6 @@ struct BSDF : public AbstractBSDF {
368368
#endif
369369
};
370370

371-
template<typename, typename = void> struct has_equal : std::false_type {};
372-
373-
template<typename T>
374-
struct has_equal<T, std::void_t<decltype(std::declval<const T&>()
375-
== std::declval<const T&>())>>
376-
: std::true_type {};
377-
378371
struct Medium : public AbstractMedium {
379372
struct Sample {
380373
OSL_HOSTDEVICE Sample() : t(0.0f), transmittance(0.0f), weight(0.0f) {}
@@ -471,7 +464,7 @@ struct CompositeBSDF {
471464

472465
OSL_HOSTDEVICE BSDF::Sample eval(const Vec3& wo, const Vec3& wi) const
473466
{
474-
BSDF::Sample s; // Use default constructor instead of {} initialization
467+
BSDF::Sample s {};
475468
for (int i = 0; i < num_bsdfs; i++) {
476469
BSDF::Sample b = bsdfs[i]->eval_vrtl(wo, wi);
477470
b.weight *= weights[i];

src/testrender/simpleraytracer.cpp

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -968,14 +968,14 @@ SimpleRaytracer::subpixel_radiance(float x, float y, Sampler& sampler,
968968
Color3 path_radiance(0, 0, 0);
969969
int prev_id = -1;
970970
float bsdf_pdf = inf; // camera ray has only one possible direction
971-
972971
MediumStack medium_stack;
973972

973+
974974
for (int b = 0; b <= max_bounces; b++) {
975975
ShaderGlobalsType sg;
976+
976977
// trace the ray against the scene
977978
Intersection hit = scene.intersect(r, inf, prev_id);
978-
979979
if (hit.t == inf) {
980980
// we hit nothing? check background shader
981981
if (backgroundShaderID >= 0) {
@@ -994,9 +994,8 @@ SimpleRaytracer::subpixel_radiance(float x, float y, Sampler& sampler,
994994
}
995995
break;
996996
}
997-
998-
if (medium_stack.integrate(r, sampler, hit, path_weight, path_radiance,
999-
bsdf_pdf)) {
997+
998+
if (medium_stack.integrate(r, sampler, hit, path_weight, path_radiance, bsdf_pdf)) {
1000999
continue;
10011000
}
10021001

@@ -1026,9 +1025,8 @@ SimpleRaytracer::subpixel_radiance(float x, float y, Sampler& sampler,
10261025
int shaderID = scene.shaderid(hit.id);
10271026

10281027
#ifndef __CUDACC__
1029-
if (shaderID < 0 || !m_shaders[shaderID].surf) {
1028+
if (shaderID < 0 || !m_shaders[shaderID].surf)
10301029
break; // no shader attached? done
1031-
}
10321030

10331031
// execute shader and process the resulting list of closures
10341032
shadingsys->execute(*ctx, *m_shaders[shaderID].surf, sg);
@@ -1094,7 +1092,6 @@ SimpleRaytracer::subpixel_radiance(float x, float y, Sampler& sampler,
10941092
Ray::SHADOW);
10951093
Intersection shadow_hit = scene.intersect(shadow_ray, inf,
10961094
hit.id);
1097-
10981095
if (shadow_hit.t == inf) // ray reached the background?
10991096
path_radiance += contrib;
11001097
}
@@ -1124,30 +1121,37 @@ SimpleRaytracer::subpixel_radiance(float x, float y, Sampler& sampler,
11241121
Ray shadow_ray = Ray(sg.P, sample.dir, radius, 0, 0,
11251122
Ray::SHADOW);
11261123
// trace a shadow ray and see if we actually hit the target
1124+
// in this tiny renderer, tracing a ray is probably cheaper than evaluating the light shader
11271125
Intersection shadow_hit
11281126
= scene.intersect(shadow_ray, sample.dist, hit.id, lid);
11291127

11301128
#ifndef __CUDACC__
11311129
const bool did_hit = shadow_hit.t == sample.dist;
11321130
#else
1131+
// The hit distance on the device is not as precise as on
1132+
// the CPU, so we need to allow a little wiggle room. An
1133+
// epsilon of 1e-3f empirically gives results that closely
1134+
// match the CPU for the test scenes, so that's what we're
1135+
// using.
11331136
const bool did_hit = fabsf(shadow_hit.t - sample.dist)
11341137
< 1e-3f;
11351138
#endif
1136-
11371139
if (did_hit) {
1140+
// setup a shader global for the point on the light
11381141
globals_from_hit(light_sg, shadow_ray, sample.dist, lid,
11391142
sample.u, sample.v);
11401143
#ifndef __CUDACC__
1144+
// execute the light shader (for emissive closures only)
11411145
shadingsys->execute(*ctx, *m_shaders[shaderID].surf,
11421146
light_sg);
11431147
#else
11441148
execute_shader(light_sg, shaderID, light_closure_pool);
11451149
#endif
11461150
ShadingResult light_result;
11471151
process_closure(light_sg, r.roughness, light_result,
1148-
medium_stack,
1149-
(const ClosureColor*)light_sg.Ci, true);
1150-
1152+
medium_stack, (const ClosureColor*)light_sg.Ci,
1153+
true);
1154+
// accumulate contribution
11511155
path_radiance += contrib * light_result.Le;
11521156
}
11531157
}
@@ -1164,13 +1168,13 @@ SimpleRaytracer::subpixel_radiance(float x, float y, Sampler& sampler,
11641168
// Just simply use roughness as spread slope
11651169
r.spread = std::max(r.spread, p.roughness);
11661170
r.roughness = p.roughness;
1167-
1171+
11681172
if (sg.backfacing) { // if exiting
11691173
medium_stack.pop_medium();
11701174
}
1171-
1172-
if (!(path_weight.x > 0) && !(path_weight.y > 0) && !(path_weight.z > 0)
1173-
&& b > 10)
1175+
1176+
if (!(path_weight.x > 0) && !(path_weight.y > 0)
1177+
&& !(path_weight.z > 0) && b > 10)
11741178
break; // filter out all 0's or NaNs
11751179
prev_id = hit.id;
11761180
r.origin = sg.P;
@@ -1179,6 +1183,7 @@ SimpleRaytracer::subpixel_radiance(float x, float y, Sampler& sampler,
11791183
}
11801184

11811185

1186+
11821187
OSL_HOSTDEVICE Color3
11831188
SimpleRaytracer::antialias_pixel(int x, int y, ShadingContext* ctx)
11841189
{
325 KB
Binary file not shown.

testsuite/render-mx-medium-vdf-glass/OPTIX

Whitespace-only changes.

testsuite/runtest.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,24 @@ def make_relpath (path, start=os.curdir):
7878
command = ""
7979
outputs = [ "out.txt" ] # default
8080

81-
# Control image differencing
81+
# The image comparison thresholds are tricky to remember. Here's the key:
82+
# A test fails if more than `failpercent` of pixel values differ by more
83+
# than `failthresh` AND the difference is more than `failrelative` times the
84+
# correct pixel value, or if even one pixel differs by more than `hardfail`.
85+
failthresh = 0.004 # "Failure" threshold for any pixel value
86+
hardfail = 0.01 # Even one pixel this wrong => hard failure
87+
failpercent = 0.02 # Ok fo this percentage of pixels to "fail"
88+
failrelative = 0.001 # Ok to fail up to this amount vs the pixel value
89+
allowfailures = 0 # Freebie failures
90+
91+
# Some tests are designed for the app running to "fail" (in the sense of
92+
# terminating with an error return code), for example, a test that is designed
93+
# to present an error condition to check that it issues the right error. That
94+
# "failure" is a success of the test! For those cases, set `failureok = 1` to
95+
# indicate that the app having an error is fine, and the full test will pass
96+
# or fail based on comparing the output files.
8297
failureok = 0
83-
failthresh = 0.004
84-
hardfail = 0.01
85-
failpercent = 0.02
86-
failrelative = 0.001
87-
allowfailures = 0
98+
8899
idiff_program = "oiiotool"
89100
idiff_postfilecmd = ""
90101
skip_diff = int(os.environ.get("OSL_TESTSUITE_SKIP_DIFF", "0"))

0 commit comments

Comments
 (0)