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

Side by Side Diff: command_buffer/service/cross/gl/sampler_gl.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 unified diff | Download patch | Annotate | Revision Log
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 gl_border_color_[1] = color.green; 168 gl_border_color_[1] = color.green;
169 gl_border_color_[2] = color.blue; 169 gl_border_color_[2] = color.blue;
170 gl_border_color_[3] = color.alpha; 170 gl_border_color_[3] = color.alpha;
171 } 171 }
172 172
173 BufferSyncInterface::ParseError GAPIGL::CreateSampler( 173 BufferSyncInterface::ParseError GAPIGL::CreateSampler(
174 ResourceID id) { 174 ResourceID id) {
175 // Dirty effect, because this sampler id may be used. 175 // Dirty effect, because this sampler id may be used.
176 DirtyEffect(); 176 DirtyEffect();
177 samplers_.Assign(id, new SamplerGL()); 177 samplers_.Assign(id, new SamplerGL());
178 return BufferSyncInterface::PARSE_NO_ERROR; 178 return BufferSyncInterface::kParseNoError;
179 } 179 }
180 180
181 // Destroys the Sampler resource. 181 // Destroys the Sampler resource.
182 BufferSyncInterface::ParseError GAPIGL::DestroySampler(ResourceID id) { 182 BufferSyncInterface::ParseError GAPIGL::DestroySampler(ResourceID id) {
183 // Dirty effect, because this sampler id may be used. 183 // Dirty effect, because this sampler id may be used.
184 DirtyEffect(); 184 DirtyEffect();
185 return samplers_.Destroy(id) ? 185 return samplers_.Destroy(id) ?
186 BufferSyncInterface::PARSE_NO_ERROR : 186 BufferSyncInterface::kParseNoError :
187 BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 187 BufferSyncInterface::kParseInvalidArguments;
188 } 188 }
189 189
190 BufferSyncInterface::ParseError GAPIGL::SetSamplerStates( 190 BufferSyncInterface::ParseError GAPIGL::SetSamplerStates(
191 ResourceID id, 191 ResourceID id,
192 sampler::AddressingMode addressing_u, 192 sampler::AddressingMode addressing_u,
193 sampler::AddressingMode addressing_v, 193 sampler::AddressingMode addressing_v,
194 sampler::AddressingMode addressing_w, 194 sampler::AddressingMode addressing_w,
195 sampler::FilteringMode mag_filter, 195 sampler::FilteringMode mag_filter,
196 sampler::FilteringMode min_filter, 196 sampler::FilteringMode min_filter,
197 sampler::FilteringMode mip_filter, 197 sampler::FilteringMode mip_filter,
198 unsigned int max_anisotropy) { 198 unsigned int max_anisotropy) {
199 SamplerGL *sampler = samplers_.Get(id); 199 SamplerGL *sampler = samplers_.Get(id);
200 if (!sampler) 200 if (!sampler)
201 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 201 return BufferSyncInterface::kParseInvalidArguments;
202 // Dirty effect, because this sampler id may be used. 202 // Dirty effect, because this sampler id may be used.
203 DirtyEffect(); 203 DirtyEffect();
204 sampler->SetStates(addressing_u, addressing_v, addressing_w, 204 sampler->SetStates(addressing_u, addressing_v, addressing_w,
205 mag_filter, min_filter, mip_filter, max_anisotropy); 205 mag_filter, min_filter, mip_filter, max_anisotropy);
206 return BufferSyncInterface::PARSE_NO_ERROR; 206 return BufferSyncInterface::kParseNoError;
207 } 207 }
208 208
209 BufferSyncInterface::ParseError GAPIGL::SetSamplerBorderColor( 209 BufferSyncInterface::ParseError GAPIGL::SetSamplerBorderColor(
210 ResourceID id, 210 ResourceID id,
211 const RGBA &color) { 211 const RGBA &color) {
212 SamplerGL *sampler = samplers_.Get(id); 212 SamplerGL *sampler = samplers_.Get(id);
213 if (!sampler) 213 if (!sampler)
214 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 214 return BufferSyncInterface::kParseInvalidArguments;
215 // Dirty effect, because this sampler id may be used. 215 // Dirty effect, because this sampler id may be used.
216 DirtyEffect(); 216 DirtyEffect();
217 sampler->SetBorderColor(color); 217 sampler->SetBorderColor(color);
218 return BufferSyncInterface::PARSE_NO_ERROR; 218 return BufferSyncInterface::kParseNoError;
219 } 219 }
220 220
221 BufferSyncInterface::ParseError GAPIGL::SetSamplerTexture( 221 BufferSyncInterface::ParseError GAPIGL::SetSamplerTexture(
222 ResourceID id, 222 ResourceID id,
223 ResourceID texture_id) { 223 ResourceID texture_id) {
224 SamplerGL *sampler = samplers_.Get(id); 224 SamplerGL *sampler = samplers_.Get(id);
225 if (!sampler) 225 if (!sampler)
226 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 226 return BufferSyncInterface::kParseInvalidArguments;
227 // Dirty effect, because this sampler id may be used. 227 // Dirty effect, because this sampler id may be used.
228 DirtyEffect(); 228 DirtyEffect();
229 sampler->SetTexture(texture_id); 229 sampler->SetTexture(texture_id);
230 return BufferSyncInterface::PARSE_NO_ERROR; 230 return BufferSyncInterface::kParseNoError;
231 } 231 }
232 232
233 233
234 } // namespace command_buffer 234 } // namespace command_buffer
235 } // namespace o3d 235 } // namespace o3d
OLDNEW
« no previous file with comments | « command_buffer/service/cross/gl/geometry_gl.cc ('k') | command_buffer/service/cross/gl/texture_gl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698