-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reserve space for LocalVector if size is known #100269
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2164,6 +2164,7 @@ RDD::RenderPassID RenderingDevice::_render_pass_create(RenderingDeviceDriver *p_ | |
|
||
LocalVector<RDD::Attachment> attachments; | ||
LocalVector<int> attachment_remap; | ||
attachment_remap.reserve(p_attachments.size()); | ||
|
||
for (int i = 0; i < p_attachments.size(); i++) { | ||
if (p_attachments[i].usage_flags == AttachmentFormat::UNUSED_ATTACHMENT) { | ||
|
@@ -2229,6 +2230,9 @@ RDD::RenderPassID RenderingDevice::_render_pass_create(RenderingDeviceDriver *p_ | |
for (int i = 0; i < p_passes.size(); i++) { | ||
const FramebufferPass *pass = &p_passes[i]; | ||
RDD::Subpass &subpass = subpasses[i]; | ||
subpass.color_references.reserve(pass->color_attachments.size()); | ||
subpass.input_references.reserve(pass->input_attachments.size()); | ||
subpass.resolve_references.reserve(pass->resolve_attachments.size()); | ||
|
||
TextureSamples texture_samples = TEXTURE_SAMPLES_1; | ||
bool is_multisample_first = true; | ||
|
@@ -2415,6 +2419,8 @@ RenderingDevice::FramebufferFormatID RenderingDevice::framebuffer_format_create_ | |
Vector<TextureSamples> samples; | ||
LocalVector<RDD::AttachmentLoadOp> load_ops; | ||
LocalVector<RDD::AttachmentStoreOp> store_ops; | ||
load_ops.reserve(p_attachments.size()); | ||
store_ops.reserve(p_attachments.size()); | ||
for (int64_t i = 0; i < p_attachments.size(); i++) { | ||
load_ops.push_back(RDD::ATTACHMENT_LOAD_OP_CLEAR); | ||
store_ops.push_back(RDD::ATTACHMENT_STORE_OP_STORE); | ||
|
@@ -2554,6 +2560,7 @@ RID RenderingDevice::framebuffer_create_multipass(const Vector<RID> &p_texture_a | |
Vector<AttachmentFormat> attachments; | ||
LocalVector<RDD::TextureID> textures; | ||
LocalVector<RDG::ResourceTracker *> trackers; | ||
trackers.reserve(p_texture_attachments.size()); | ||
attachments.resize(p_texture_attachments.size()); | ||
Size2i size; | ||
bool size_set = false; | ||
|
@@ -3181,6 +3188,7 @@ RID RenderingDevice::uniform_set_create(const Collection &p_uniforms, RID p_shad | |
RDD::BoundUniform &driver_uniform = driver_uniforms[i]; | ||
driver_uniform.type = uniform.uniform_type; | ||
driver_uniform.binding = uniform.binding; | ||
driver_uniform.ids.reserve(uniform.get_id_count()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The whole |
||
|
||
// Mark immutable samplers to be skipped when creating uniform set. | ||
driver_uniform.immutable_sampler = uniform.immutable_sampler; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -368,6 +368,7 @@ String ShaderPreprocessor::vector_to_string(const LocalVector<char32_t> &p_v, in | |
|
||
String ShaderPreprocessor::tokens_to_string(const LocalVector<Token> &p_tokens) { | ||
LocalVector<char32_t> result; | ||
result.reserve(p_tokens.size()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This may be better served with an in-place |
||
for (const Token &token : p_tokens) { | ||
result.push_back(token.text); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure the subpass lists are empty at this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the whole
subpasses
is freshly defined just 7 lines above.