| OLD | NEW |
| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 if (vp_param) cgSetParameter1i(vp_param, *static_cast<const int *>(data)); | 211 if (vp_param) cgSetParameter1i(vp_param, *static_cast<const int *>(data)); |
| 212 if (fp_param) cgSetParameter1i(fp_param, *static_cast<const int *>(data)); | 212 if (fp_param) cgSetParameter1i(fp_param, *static_cast<const int *>(data)); |
| 213 break; | 213 break; |
| 214 case effect_param::BOOL: { | 214 case effect_param::BOOL: { |
| 215 int bool_value = *static_cast<const bool *>(data)?1:0; | 215 int bool_value = *static_cast<const bool *>(data)?1:0; |
| 216 if (vp_param) cgSetParameter1i(vp_param, bool_value); | 216 if (vp_param) cgSetParameter1i(vp_param, bool_value); |
| 217 if (fp_param) cgSetParameter1i(fp_param, bool_value); | 217 if (fp_param) cgSetParameter1i(fp_param, bool_value); |
| 218 break; | 218 break; |
| 219 } | 219 } |
| 220 case effect_param::SAMPLER: { | 220 case effect_param::SAMPLER: { |
| 221 DCHECK_GE(low_level_param.sampler_ids.size(), 1); | 221 DCHECK_GE(low_level_param.sampler_ids.size(), 1U); |
| 222 low_level_param.sampler_ids[0] = *static_cast<const ResourceID *>(data); | 222 low_level_param.sampler_ids[0] = *static_cast<const ResourceID *>(data); |
| 223 if (effect_ == gapi->current_effect()) { | 223 if (effect_ == gapi->current_effect()) { |
| 224 gapi->DirtyEffect(); | 224 gapi->DirtyEffect(); |
| 225 } | 225 } |
| 226 break; | 226 break; |
| 227 } | 227 } |
| 228 default: | 228 default: |
| 229 DLOG(ERROR) << "Invalid parameter type."; | 229 DLOG(ERROR) << "Invalid parameter type."; |
| 230 return false; | 230 return false; |
| 231 } | 231 } |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 continue; | 438 continue; |
| 439 const char *name = cgGetParameterName(cg_param); | 439 const char *name = cgGetParameterName(cg_param); |
| 440 if (!name) | 440 if (!name) |
| 441 continue; | 441 continue; |
| 442 | 442 |
| 443 CGtype cg_type = cgGetParameterType(cg_param); | 443 CGtype cg_type = cgGetParameterType(cg_param); |
| 444 | 444 |
| 445 int num_elements; | 445 int num_elements; |
| 446 if (cg_type == CG_ARRAY) { | 446 if (cg_type == CG_ARRAY) { |
| 447 num_elements = cgGetArraySize(cg_param, 0); | 447 num_elements = cgGetArraySize(cg_param, 0); |
| 448 // Substitute the first element's type for our type.» | 448 // Substitute the first element's type for our type. |
| 449 cg_type = cgGetParameterType(cgGetArrayParameter(cg_param, 0)); | 449 cg_type = cgGetParameterType(cgGetArrayParameter(cg_param, 0)); |
| 450 } else { | 450 } else { |
| 451 num_elements = 0; | 451 num_elements = 0; |
| 452 } | 452 } |
| 453 | 453 |
| 454 int index = GetLowLevelParamIndexByName(name); | 454 int index = GetLowLevelParamIndexByName(name); |
| 455 if (index < 0) { | 455 if (index < 0) { |
| 456 LowLevelParam param; | 456 LowLevelParam param; |
| 457 param.name = name; | 457 param.name = name; |
| 458 param.vp_param = NULL; | 458 param.vp_param = NULL; |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 DCHECK(validate_effect_); | 840 DCHECK(validate_effect_); |
| 841 DCHECK(!current_effect_); | 841 DCHECK(!current_effect_); |
| 842 current_effect_ = effects_.Get(current_effect_id_); | 842 current_effect_ = effects_.Get(current_effect_id_); |
| 843 if (!current_effect_) return false; | 843 if (!current_effect_) return false; |
| 844 validate_effect_ = false; | 844 validate_effect_ = false; |
| 845 return current_effect_->Begin(this); | 845 return current_effect_->Begin(this); |
| 846 } | 846 } |
| 847 | 847 |
| 848 } // namespace command_buffer | 848 } // namespace command_buffer |
| 849 } // namespace o3d | 849 } // namespace o3d |
| OLD | NEW |