This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Commit d51c75c
Jonah Williams
[Impeller] pass const ref to binding helpers. (#48318)
No point in passing by value and moving, just pass a const ref through. Trivial performance improvement.
# Before
```cpp
/// Bind uniform buffer for resource named FragInfo.
static bool BindFragInfo(ResourceBinder& command, BufferView view) {
return command.BindResource(ShaderStage::kFragment, kResourceFragInfo, kMetadataFragInfo, std::move(view));
}
/// Bind combined image sampler for resource named texture_sampler.
static bool BindTextureSampler(ResourceBinder& command, std::shared_ptr<const Texture> texture, std::shared_ptr<const Sampler> sampler) {
return command.BindResource(ShaderStage::kFragment, kResourceTextureSampler, kMetadataTextureSampler, std::move(texture), std::move(sampler));
}
```
# After
```cpp
/// Bind uniform buffer for resource named FragInfo.
static bool BindFragInfo(ResourceBinder& command, const BufferView& view) {
return command.BindResource(ShaderStage::kFragment, kResourceFragInfo, kMetadataFragInfo, view);
}
/// Bind combined image sampler for resource named texture_sampler.
static bool BindTextureSampler(ResourceBinder& command, const std::shared_ptr<const Texture>& texture, const std::shared_ptr<const Sampler>& sampler) {
return command.BindResource(ShaderStage::kFragment, kResourceTextureSampler, kMetadataTextureSampler, texture, sampler);
}
```1 parent d02bf96 commit d51c75c
2 files changed
+7
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1137 | 1137 | | |
1138 | 1138 | | |
1139 | 1139 | | |
1140 | | - | |
| 1140 | + | |
1141 | 1141 | | |
1142 | 1142 | | |
1143 | 1143 | | |
| |||
1156 | 1156 | | |
1157 | 1157 | | |
1158 | 1158 | | |
1159 | | - | |
| 1159 | + | |
1160 | 1160 | | |
1161 | 1161 | | |
1162 | 1162 | | |
| |||
1175 | 1175 | | |
1176 | 1176 | | |
1177 | 1177 | | |
1178 | | - | |
| 1178 | + | |
1179 | 1179 | | |
1180 | 1180 | | |
1181 | 1181 | | |
1182 | | - | |
| 1182 | + | |
1183 | 1183 | | |
1184 | 1184 | | |
1185 | 1185 | | |
| |||
1198 | 1198 | | |
1199 | 1199 | | |
1200 | 1200 | | |
1201 | | - | |
| 1201 | + | |
1202 | 1202 | | |
1203 | 1203 | | |
1204 | 1204 | | |
| |||
1217 | 1217 | | |
1218 | 1218 | | |
1219 | 1219 | | |
1220 | | - | |
| 1220 | + | |
1221 | 1221 | | |
1222 | 1222 | | |
1223 | 1223 | | |
| |||
0 commit comments