Skip to content

JellyBoonz review#3

Draft
pbantolas wants to merge 4 commits into
pbantolas:mainfrom
JellyBoonz:main
Draft

JellyBoonz review#3
pbantolas wants to merge 4 commits into
pbantolas:mainfrom
JellyBoonz:main

Conversation

@pbantolas

Copy link
Copy Markdown
Owner

code review

@pbantolas pbantolas left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job and the separation makes sense mostly

The main notes I have:

  • Renderer doesn't have a lot of app policy for the input, but consider how we could keep the renderer agnostic of what input is: the renderer just needs to know the view transform (a matrix), doesn't need to know we can pan/zoom. E.g. can the visual runtime keep track of that logic, and just set the relevant state to the renderer?
  • Ideally rectangle API needs some parameters to allow for rectangles to be customised
  • Be careful with error accumulating in the input and view matrices: constantly updating the existing matrix with the new input can create instability


void (*pan)(VisualRuntimeState *, float dx, float dy);
void (*zoom)(VisualRuntimeState *, float delta);
void (*addRectangle)();

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs some parameters to customise the rectangle (position, size, color)

}

void RendererBackend::zoom(float delta) {
float factor = 1.0f + delta * 0.02f;

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces app-side policy (how quickly the world is scaled) in the renderer. Also, this function continuously updates the camera_transform and will start losing precision (aka user cannot set a specific zoom level if they wanted).

Comment on lines +325 to +330
if (vertex_buffer_) {
vertex_buffer_->release();
vertex_buffer_ = nullptr;
}
vertex_buffer_ = device_->newBuffer(geometry_.data(), geometry_.size() * sizeof(Vertex), MTL::ResourceStorageModeShared);
vertex_count_ = geometry_.size();

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reallocates the entire GPU buffer every time a new rectangle is added. Can you think of a way to avoid doing that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants