BLEN-352: Move to use DNA API in engines #12

Merged
Bogdan Nagirniak merged 8 commits from BLEN-352 into hydra-render 2023-03-10 17:38:05 +01:00

Purpose

There is still part of code which use RNA API instead of native DNA API.

Technical steps

  1. Changed to DNA API in: camera.cc/.h, engine files.
  2. Added set_env_paths() to utils.
  3. Made some renamings.
### Purpose There is still part of code which use RNA API instead of native DNA API. ### Technical steps 1. Changed to DNA API in: camera.cc/.h, engine files. 2. Added set_env_paths() to utils. 3. Made some renamings.
Brian Savery (AMD) was assigned by Bogdan Nagirniak 2023-03-09 14:56:25 +01:00
Georgiy Markelov was assigned by Bogdan Nagirniak 2023-03-09 14:56:25 +01:00
George-Shakula was assigned by Bogdan Nagirniak 2023-03-09 14:56:25 +01:00
Bogdan Nagirniak added 8 commits 2023-03-09 14:56:44 +01:00
Bogdan Nagirniak requested review from Brian Savery (AMD) 2023-03-09 14:56:54 +01:00
Bogdan Nagirniak requested review from Georgiy Markelov 2023-03-09 14:56:55 +01:00
Bogdan Nagirniak requested review from George-Shakula 2023-03-09 14:56:55 +01:00
Georgiy Markelov requested changes 2023-03-10 14:32:40 +01:00
Georgiy Markelov left a comment
Collaborator

Border render doesn't work + renamings

Border render doesn't work + renamings
@ -16,32 +16,31 @@ using namespace pxr;
Collaborator

add using namespace std; and remove std::

add `using namespace std;` and remove `std::`
BogdanNagirniak marked this conversation as resolved
@ -18,3 +18,2 @@
Engine::Engine(BL::RenderEngine &b_engine, const std::string &delegateId)
: b_engine(b_engine)
Engine::Engine(RenderEngine *bl_engine, const std::string &delegateId)
Collaborator

delegateId -> delegate_id

delegateId -> delegate_id
BogdanNagirniak marked this conversation as resolved
@ -20,3 +18,3 @@
namespace blender::render::hydra {
void FinalEngine::sync(BL::Depsgraph &b_depsgraph, BL::Context &b_context, HdRenderSettingsMap &renderSettings)
void FinalEngine::sync(Depsgraph *depsgraph, bContext *context, HdRenderSettingsMap &renderSettings)
Collaborator

renderSettings -> render_settings

renderSettings -> render_settings
BogdanNagirniak marked this conversation as resolved
@ -23,2 +20,3 @@
void FinalEngine::sync(Depsgraph *depsgraph, bContext *context, HdRenderSettingsMap &renderSettings)
{
sceneDelegate = std::make_unique<BlenderSceneDelegate>(renderIndex.get(),
scene_delegate = std::make_unique<BlenderSceneDelegate>(render_index.get(),
Collaborator

remove std::

remove `std::`
BogdanNagirniak marked this conversation as resolved
@ -53,0 +39,4 @@
RenderData &r = scene->r;
GfVec4f border(0, 0, 1, 1);
if (r.mode & R_BORDER) {
Collaborator

Border render doesn't work

Border render doesn't work
Author
Owner

Tested again - it works

Tested again - it works
BogdanNagirniak marked this conversation as resolved
@ -59,3 +61,3 @@
tasks.push_back(renderTaskDelegate->GetTask());
tasks.push_back(render_task_delegate->GetTask());
chrono::time_point<chrono::steady_clock> timeBegin = chrono::steady_clock::now(), timeCurrent;
Collaborator

timeBegin -> time_begin
timeCurrent -> time_current

timeBegin -> time_begin timeCurrent -> time_current
BogdanNagirniak marked this conversation as resolved
@ -60,3 +61,4 @@
tasks.push_back(render_task_delegate->GetTask());
chrono::time_point<chrono::steady_clock> timeBegin = chrono::steady_clock::now(), timeCurrent;
chrono::milliseconds elapsedTime;
Collaborator

elapsedTime -> elapsed_time

elapsedTime -> elapsed_time
BogdanNagirniak marked this conversation as resolved
@ -64,92 +66,108 @@ void FinalEngine::render(BL::Depsgraph &b_depsgraph)
float percentDone = 0.0;
Collaborator

percentDone -> percent_done

percentDone -> percent_done
BogdanNagirniak marked this conversation as resolved
@ -64,92 +66,108 @@ void FinalEngine::render(BL::Depsgraph &b_depsgraph)
float percentDone = 0.0;
map<string, vector<float>> renderImages{
Collaborator

renderImages -> render_images

renderImages -> render_images
BogdanNagirniak marked this conversation as resolved
@ -92,2 +94,2 @@
renderTaskDelegate->GetRendererAovData(HdAovTokens->color, pixels.data());
updateRenderResult(renderImages, layerName, buffer_res[0], buffer_res[1]);
render_task_delegate->GetRendererAovData(HdAovTokens->color, pixels.data());
updateRenderResult(renderImages, layer_name, res[0], res[1]);
Collaborator

updateRenderResult -> update_render_result

updateRenderResult -> update_render_result
BogdanNagirniak marked this conversation as resolved
@ -12,3 +12,3 @@
namespace blender::render::hydra {
void PreviewEngine::sync(BL::Depsgraph &b_depsgraph, BL::Context &b_context, HdRenderSettingsMap &renderSettings)
void PreviewEngine::sync(Depsgraph *depsgraph, bContext *context, HdRenderSettingsMap &renderSettings)
Collaborator

renderSettings -> render_settings

renderSettings -> render_settings
BogdanNagirniak marked this conversation as resolved
@ -31,2 +28,3 @@
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
GfCamera gfCamera = CameraData((Object *)b_scene.camera().ptr.data, buffer_res, GfVec4f(0, 0, 1, 1)).gf_camera(GfVec4f(0, 0, 1, 1));
string layerName = view_layer->name;
Collaborator

layerName -> layer_name

layerName -> layer_name
BogdanNagirniak marked this conversation as resolved
@ -61,2 +62,2 @@
renderTaskDelegate->GetRendererAovData(HdAovTokens->color, pixels.data());
updateRenderResult(layerName, buffer_res[0], buffer_res[1], pixels);
render_task_delegate->GetRendererAovData(HdAovTokens->color, pixels.data());
updateRenderResult(layerName, res[0], res[1], pixels);
Collaborator

updateRenderResult -> update_render_result

updateRenderResult -> update_render_result
BogdanNagirniak marked this conversation as resolved
@ -165,3 +135,2 @@
PyObject *pyengine;
char *engineType, *delegateId;
if (!PyArg_ParseTuple(args, "Oss", &pyengine, &engineType, &delegateId)) {
char *engineType, *render_delegate_id;
Collaborator

engineType -> engine_type

engineType -> engine_type
BogdanNagirniak marked this conversation as resolved
@ -241,3 +240,3 @@
}
void ViewportEngine::sync(BL::Depsgraph &b_depsgraph, BL::Context &b_context, HdRenderSettingsMap &renderSettings)
void ViewportEngine::sync(Depsgraph *depsgraph, bContext *context, HdRenderSettingsMap &renderSettings)
Collaborator

renderSettings -> render_settings

renderSettings -> render_settings
BogdanNagirniak marked this conversation as resolved
@ -245,2 +244,2 @@
if (!sceneDelegate) {
sceneDelegate = std::make_unique<BlenderSceneDelegate>(renderIndex.get(),
if (!scene_delegate) {
scene_delegate = std::make_unique<BlenderSceneDelegate>(render_index.get(),
Collaborator

remove std::

remove `std::`
BogdanNagirniak marked this conversation as resolved
@ -261,4 +260,3 @@
};
BL::Scene b_scene = b_depsgraph.scene_eval();
GfCamera gfCamera = viewSettings.gf_camera();
Collaborator

viewSettings -> view_settings

viewSettings -> view_settings
BogdanNagirniak marked this conversation as resolved
@ -276,3 +273,3 @@
if (getRendererPercentDone() == 0.0f) {
if (renderer_percent_done() == 0.0f) {
timeBegin = chrono::steady_clock::now();
Collaborator

timeBegin -> time_begin

timeBegin -> time_begin
BogdanNagirniak marked this conversation as resolved
@ -301,2 +297,4 @@
GPU_shader_unbind();
chrono::time_point<chrono::steady_clock> timeCurrent = chrono::steady_clock::now();
Collaborator

timeCurrent -> time_current

timeCurrent -> time_current
BogdanNagirniak marked this conversation as resolved
@ -301,3 +298,4 @@
GPU_shader_unbind();
chrono::time_point<chrono::steady_clock> timeCurrent = chrono::steady_clock::now();
chrono::milliseconds elapsedTime = chrono::duration_cast<chrono::milliseconds>(timeCurrent - timeBegin);
Collaborator

elapsedTime -> elapsed_time

elapsedTime -> elapsed_time
BogdanNagirniak marked this conversation as resolved
@ -302,4 +300,4 @@
chrono::time_point<chrono::steady_clock> timeCurrent = chrono::steady_clock::now();
chrono::milliseconds elapsedTime = chrono::duration_cast<chrono::milliseconds>(timeCurrent - timeBegin);
string formattedTime = format_duration(elapsedTime);
Collaborator

formattedTime -> formatted_time

formattedTime -> formatted_time
BogdanNagirniak marked this conversation as resolved
Author
Owner

Let we do renamings in separate task, there will be so much changes.

Let we do renamings in separate task, there will be so much changes.
Georgiy Markelov approved these changes 2023-03-10 17:30:45 +01:00
Bogdan Nagirniak merged commit 6b83ff9ed4 into hydra-render 2023-03-10 17:38:04 +01:00
Sign in to join this conversation.
No Label
No Milestone
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: BogdanNagirniak/blender#12
No description provided.