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

Side by Side Diff: core/win/d3d9/effect_d3d9.cc

Issue 147129: Adding in most of the unit tests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 11 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « core/core.gyp ('k') | import/cross/memory_stream_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 virtual void SetEffectParam(RendererD3D9* renderer, ID3DXEffect* d3d_effect) { 248 virtual void SetEffectParam(RendererD3D9* renderer, ID3DXEffect* d3d_effect) {
249 ParamArray* param = param_->value(); 249 ParamArray* param = param_->value();
250 if (param) { 250 if (param) {
251 unsigned size = param->size(); 251 unsigned size = param->size();
252 if (size != sampler_unit_index_arrays_.size()) { 252 if (size != sampler_unit_index_arrays_.size()) {
253 O3D_ERROR(param->service_locator()) 253 O3D_ERROR(param->service_locator())
254 << "number of params in ParamArray does not match number of params " 254 << "number of params in ParamArray does not match number of params "
255 << "needed by shader array"; 255 << "needed by shader array";
256 } else { 256 } else {
257 for (int i = 0; i < size; ++i) { 257 for (unsigned i = 0; i < size; ++i) {
258 SamplerUnitIndexArray& index_array = sampler_unit_index_arrays_[i]; 258 SamplerUnitIndexArray& index_array = sampler_unit_index_arrays_[i];
259 Param* untyped_element = param->GetUntypedParam(i); 259 Param* untyped_element = param->GetUntypedParam(i);
260 // TODO(gman): Make this check happen when building the param cache. 260 // TODO(gman): Make this check happen when building the param cache.
261 // To do that would require that ParamParamArray mark it's owner 261 // To do that would require that ParamParamArray mark it's owner
262 // as changed if a Param in it's ParamArray changes. 262 // as changed if a Param in it's ParamArray changes.
263 if (untyped_element->IsA(ParamSampler::GetApparentClass())) { 263 if (untyped_element->IsA(ParamSampler::GetApparentClass())) {
264 D3DXHANDLE dx_element = 264 D3DXHANDLE dx_element =
265 d3d_effect->GetParameterElement(phandle_, i); 265 d3d_effect->GetParameterElement(phandle_, i);
266 // Find the texture associated with the sampler first. 266 // Find the texture associated with the sampler first.
267 Sampler* sampler = 267 Sampler* sampler =
(...skipping 22 matching lines...) Expand all
290 } 290 }
291 291
292 // Resets the value of the parameter to default. Currently this is used 292 // Resets the value of the parameter to default. Currently this is used
293 // to unbind textures contained in Sampler params. 293 // to unbind textures contained in Sampler params.
294 virtual void ResetEffectParam(RendererD3D9* renderer, 294 virtual void ResetEffectParam(RendererD3D9* renderer,
295 ID3DXEffect* d3d_effect) { 295 ID3DXEffect* d3d_effect) {
296 ParamArray* param = param_->value(); 296 ParamArray* param = param_->value();
297 if (param) { 297 if (param) {
298 unsigned size = param->size(); 298 unsigned size = param->size();
299 if (size == sampler_unit_index_arrays_.size()) { 299 if (size == sampler_unit_index_arrays_.size()) {
300 for (int i = 0; i < size; ++i) { 300 for (unsigned i = 0; i < size; ++i) {
301 SamplerUnitIndexArray& index_array = sampler_unit_index_arrays_[i]; 301 SamplerUnitIndexArray& index_array = sampler_unit_index_arrays_[i];
302 Param* untyped_element = param->GetUntypedParam(i); 302 Param* untyped_element = param->GetUntypedParam(i);
303 // TODO(gman): Make this check happen when building the param cache. 303 // TODO(gman): Make this check happen when building the param cache.
304 // To do that would require that ParamParamArray mark it's owner 304 // To do that would require that ParamParamArray mark it's owner
305 // as changed if a Param in it's ParamArray changes. 305 // as changed if a Param in it's ParamArray changes.
306 if (untyped_element->IsA(ParamSampler::GetApparentClass())) { 306 if (untyped_element->IsA(ParamSampler::GetApparentClass())) {
307 D3DXHANDLE dx_element = 307 D3DXHANDLE dx_element =
308 d3d_effect->GetParameterElement(phandle_, i); 308 d3d_effect->GetParameterElement(phandle_, i);
309 // Find the texture associated with the sampler first. 309 // Find the texture associated with the sampler first.
310 Sampler* sampler = 310 Sampler* sampler =
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 // Handler for reset device. This restores the effect after a device reset. 1214 // Handler for reset device. This restores the effect after a device reset.
1215 // Returns true on success. 1215 // Returns true on success.
1216 bool EffectD3D9::OnResetDevice() { 1216 bool EffectD3D9::OnResetDevice() {
1217 if (d3dx_effect_) 1217 if (d3dx_effect_)
1218 return HR(d3dx_effect_->OnResetDevice()); 1218 return HR(d3dx_effect_->OnResetDevice());
1219 else 1219 else
1220 return true; 1220 return true;
1221 } 1221 }
1222 1222
1223 } // namespace o3d 1223 } // namespace o3d
OLDNEW
« no previous file with comments | « core/core.gyp ('k') | import/cross/memory_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698