Cycles: Replace use_qbvh boolean flag with an enum-based property

This was we can introduce other types of BVH, for example, wider ones, without
causing too much mess around boolean flags.

Thoughs:

- Ideally device info should probably return bitflag of what BVH types it
  supports.

  It is possible to implement based on simple logic in device/ and mesh.cpp,
  rest of the changes will stay the same.

- Not happy with workarounds in util_debug and duplicated enum in kernel.
  Maybe enbum should be stores in kernel, but then it's kind of weird to include
  kernel types from utils. Soudns some cyclkic dependency.

Reviewers: brecht, maxim_d33

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D3011
This commit is contained in:
Sergey Sharybin
2018-01-19 10:59:58 +01:00
parent 0f69026b1c
commit 2f79d1c058
23 changed files with 267 additions and 136 deletions

View File

@@ -18,6 +18,8 @@
#include <stdlib.h>
#include "bvh/bvh_params.h"
#include "util/util_logging.h"
#include "util/util_string.h"
@@ -29,7 +31,7 @@ DebugFlags::CPU::CPU()
sse41(true),
sse3(true),
sse2(true),
qbvh(true),
bvh_layout(BVH_LAYOUT_DEFAULT),
split_kernel(false)
{
reset();
@@ -55,7 +57,7 @@ void DebugFlags::CPU::reset()
#undef STRINGIFY
#undef CHECK_CPU_FLAGS
qbvh = true;
bvh_layout = BVH_LAYOUT_DEFAULT;
split_kernel = false;
}
@@ -139,13 +141,13 @@ std::ostream& operator <<(std::ostream &os,
DebugFlagsConstRef debug_flags)
{
os << "CPU flags:\n"
<< " AVX2 : " << string_from_bool(debug_flags.cpu.avx2) << "\n"
<< " AVX : " << string_from_bool(debug_flags.cpu.avx) << "\n"
<< " SSE4.1 : " << string_from_bool(debug_flags.cpu.sse41) << "\n"
<< " SSE3 : " << string_from_bool(debug_flags.cpu.sse3) << "\n"
<< " SSE2 : " << string_from_bool(debug_flags.cpu.sse2) << "\n"
<< " QBVH : " << string_from_bool(debug_flags.cpu.qbvh) << "\n"
<< " Split : " << string_from_bool(debug_flags.cpu.split_kernel) << "\n";
<< " AVX2 : " << string_from_bool(debug_flags.cpu.avx2) << "\n"
<< " AVX : " << string_from_bool(debug_flags.cpu.avx) << "\n"
<< " SSE4.1 : " << string_from_bool(debug_flags.cpu.sse41) << "\n"
<< " SSE3 : " << string_from_bool(debug_flags.cpu.sse3) << "\n"
<< " SSE2 : " << string_from_bool(debug_flags.cpu.sse2) << "\n"
<< " BVH layout : " << bvh_layout_name(debug_flags.cpu.bvh_layout) << "\n"
<< " Split : " << string_from_bool(debug_flags.cpu.split_kernel) << "\n";
os << "CUDA flags:\n"
<< " Adaptive Compile: " << string_from_bool(debug_flags.cuda.adaptive_compile) << "\n";