Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2483)

Unified Diff: core/cross/command_buffer/param_cache_cb.cc

Issue 212018: Change command buffer client code to use structures.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/cross/command_buffer/effect_cb.cc ('k') | core/cross/command_buffer/primitive_cb.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/cross/command_buffer/param_cache_cb.cc
===================================================================
--- core/cross/command_buffer/param_cache_cb.cc (revision 26638)
+++ core/cross/command_buffer/param_cache_cb.cc (working copy)
@@ -70,15 +70,8 @@
// This template definition only works for value types (floatn, matrix, int,
// ..., but not textures or samplers).
virtual void SetValue(CommandBufferHelper *helper) {
- static const unsigned int kEntryCount =
- (sizeof(typename T::DataType) + 3) / 4;
- CommandBufferEntry args[2 + kEntryCount];
typename T::DataType value = param_->value();
- args[0].value_uint32 = id_;
- args[1].value_uint32 = sizeof(value);
- memcpy(args + 2, &value, sizeof(value));
- helper->AddCommand(command_buffer::SET_PARAM_DATA_IMMEDIATE,
- 2 + kEntryCount, args);
+ helper->SetParamDataImmediate(id_, sizeof(value), &value);
}
private:
T* param_;
@@ -99,12 +92,8 @@
// Sends the param value to the service.
virtual void SetValue(CommandBufferHelper *helper) {
- CommandBufferEntry args[18];
Matrix4 value = transpose(param_->value());
- args[0].value_uint32 = id_;
- args[1].value_uint32 = sizeof(value);
- memcpy(args + 2, &value, sizeof(value));
- helper->AddCommand(command_buffer::SET_PARAM_DATA_IMMEDIATE, 18, args);
+ helper->SetParamDataImmediate(id_, sizeof(value), &value);
}
private:
ParamMatrix4* param_;
@@ -121,17 +110,15 @@
// Sends the param value to the service.
virtual void SetValue(CommandBufferHelper *helper) {
SamplerCB *sampler = down_cast<SamplerCB *>(param_->value());
- CommandBufferEntry args[3];
- args[0].value_uint32 = id_;
- args[1].value_uint32 = sizeof(ResourceID);
+ uint32 value;
if (!sampler) {
// TODO: use error sampler
- args[2].value_uint32 = command_buffer::kInvalidResource;
+ value = command_buffer::kInvalidResource;
} else {
sampler->SetTextureAndStates();
- args[2].value_uint32 = sampler->resource_id();
+ value = sampler->resource_id();
}
- helper->AddCommand(command_buffer::SET_PARAM_DATA_IMMEDIATE, 3, args);
+ helper->SetParamDataImmediate(id_, sizeof(value), &value);
}
private:
ParamSampler* param_;
« no previous file with comments | « core/cross/command_buffer/effect_cb.cc ('k') | core/cross/command_buffer/primitive_cb.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698