Skip to content

Commit

Permalink
Write device info into metadata.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
dtarakanov1 committed Sep 6, 2018
1 parent 0788f81 commit bc60de8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
19 changes: 14 additions & 5 deletions BaikalDataGenerator/Source/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ const std::vector<OutputInfo> kSingleIteratedOutputs =
};

Render::Render(const std::filesystem::path& scene_file,
size_t output_width,
size_t output_height,
std::uint32_t num_bounces,
std::size_t device_idx)
size_t output_width,
size_t output_height,
std::uint32_t num_bounces,
unsigned device_idx)
: m_scene_file(scene_file),
m_width(static_cast<std::uint32_t>(output_width)),
m_height(static_cast<std::uint32_t>(output_height)),
m_num_bounces(num_bounces)
m_num_bounces(num_bounces),
m_device_idx(device_idx)
{
using namespace Baikal;

Expand Down Expand Up @@ -216,6 +217,14 @@ void Render::SaveMetadata(const std::filesystem::path& output_dir,
render_attribute->SetAttribute("num_bounces", m_num_bounces);
root->InsertEndChild(render_attribute);

auto* device_attribute = doc.NewElement("device");
auto device = GetDevices().at(m_device_idx);
device_attribute->SetAttribute("idx", m_device_idx);
device_attribute->SetAttribute("name", device.GetName().c_str());
device_attribute->SetAttribute("vendor", device.GetVendor().c_str());
device_attribute->SetAttribute("version", device.GetVersion().c_str());
root->InsertEndChild(device_attribute);

doc.SaveFile(file_name.string().c_str());
}

Expand Down
4 changes: 3 additions & 1 deletion BaikalDataGenerator/Source/render.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace Baikal
}

class CLWContext;
class CLWDevice;

class Render
{
Expand All @@ -55,7 +56,7 @@ class Render
size_t output_width,
size_t output_height,
std::uint32_t num_bounces,
std::size_t device_idx);
unsigned device_idx);

// This function generates dataset for network training
// 'cam_states' - camera states range
Expand Down Expand Up @@ -113,6 +114,7 @@ class Render
std::filesystem::path m_scene_file;
std::uint32_t m_width, m_height;
std::uint32_t m_num_bounces;
unsigned m_device_idx;
std::unique_ptr<Baikal::MonteCarloRenderer> m_renderer;
std::unique_ptr<Baikal::ClwRenderFactory> m_factory;
std::unique_ptr<Baikal::SceneController<Baikal::ClwScene>> m_controller;
Expand Down
2 changes: 1 addition & 1 deletion BaikalDataGenerator/Source/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ THE SOFTWARE.

struct DGenConfig
{
std::size_t device_idx = 0;
unsigned device_idx = 0;
std::filesystem::path scene_file;
std::filesystem::path light_file;
std::filesystem::path camera_file;
Expand Down

0 comments on commit bc60de8

Please sign in to comment.