Chromium Code Reviews

Side by Side Diff: command_buffer/service/win/d3d9/sampler_d3d9.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.
Jump to:
View unified diff | | 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 121 matching lines...)
132 132
133 void SamplerD3D9::SetBorderColor(const RGBA &color) { 133 void SamplerD3D9::SetBorderColor(const RGBA &color) {
134 d3d_border_color_ = RGBAToD3DCOLOR(color); 134 d3d_border_color_ = RGBAToD3DCOLOR(color);
135 } 135 }
136 136
137 BufferSyncInterface::ParseError GAPID3D9::CreateSampler( 137 BufferSyncInterface::ParseError GAPID3D9::CreateSampler(
138 ResourceID id) { 138 ResourceID id) {
139 // Dirty effect, because this sampler id may be used 139 // Dirty effect, because this sampler id may be used
140 DirtyEffect(); 140 DirtyEffect();
141 samplers_.Assign(id, new SamplerD3D9()); 141 samplers_.Assign(id, new SamplerD3D9());
142 return BufferSyncInterface::PARSE_NO_ERROR; 142 return BufferSyncInterface::kParseNoError;
143 } 143 }
144 144
145 // Destroys the Sampler resource. 145 // Destroys the Sampler resource.
146 BufferSyncInterface::ParseError GAPID3D9::DestroySampler(ResourceID id) { 146 BufferSyncInterface::ParseError GAPID3D9::DestroySampler(ResourceID id) {
147 // Dirty effect, because this sampler id may be used 147 // Dirty effect, because this sampler id may be used
148 DirtyEffect(); 148 DirtyEffect();
149 return samplers_.Destroy(id) ? 149 return samplers_.Destroy(id) ?
150 BufferSyncInterface::PARSE_NO_ERROR : 150 BufferSyncInterface::kParseNoError :
151 BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 151 BufferSyncInterface::kParseInvalidArguments;
152 } 152 }
153 153
154 BufferSyncInterface::ParseError GAPID3D9::SetSamplerStates( 154 BufferSyncInterface::ParseError GAPID3D9::SetSamplerStates(
155 ResourceID id, 155 ResourceID id,
156 sampler::AddressingMode addressing_u, 156 sampler::AddressingMode addressing_u,
157 sampler::AddressingMode addressing_v, 157 sampler::AddressingMode addressing_v,
158 sampler::AddressingMode addressing_w, 158 sampler::AddressingMode addressing_w,
159 sampler::FilteringMode mag_filter, 159 sampler::FilteringMode mag_filter,
160 sampler::FilteringMode min_filter, 160 sampler::FilteringMode min_filter,
161 sampler::FilteringMode mip_filter, 161 sampler::FilteringMode mip_filter,
162 unsigned int max_anisotropy) { 162 unsigned int max_anisotropy) {
163 SamplerD3D9 *sampler = samplers_.Get(id); 163 SamplerD3D9 *sampler = samplers_.Get(id);
164 if (!sampler) 164 if (!sampler)
165 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 165 return BufferSyncInterface::kParseInvalidArguments;
166 // Dirty effect, because this sampler id may be used 166 // Dirty effect, because this sampler id may be used
167 DirtyEffect(); 167 DirtyEffect();
168 sampler->SetStates(addressing_u, addressing_v, addressing_w, 168 sampler->SetStates(addressing_u, addressing_v, addressing_w,
169 mag_filter, min_filter, mip_filter, max_anisotropy); 169 mag_filter, min_filter, mip_filter, max_anisotropy);
170 return BufferSyncInterface::PARSE_NO_ERROR; 170 return BufferSyncInterface::kParseNoError;
171 } 171 }
172 172
173 BufferSyncInterface::ParseError GAPID3D9::SetSamplerBorderColor( 173 BufferSyncInterface::ParseError GAPID3D9::SetSamplerBorderColor(
174 ResourceID id, 174 ResourceID id,
175 const RGBA &color) { 175 const RGBA &color) {
176 SamplerD3D9 *sampler = samplers_.Get(id); 176 SamplerD3D9 *sampler = samplers_.Get(id);
177 if (!sampler) 177 if (!sampler)
178 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 178 return BufferSyncInterface::kParseInvalidArguments;
179 // Dirty effect, because this sampler id may be used 179 // Dirty effect, because this sampler id may be used
180 DirtyEffect(); 180 DirtyEffect();
181 sampler->SetBorderColor(color); 181 sampler->SetBorderColor(color);
182 return BufferSyncInterface::PARSE_NO_ERROR; 182 return BufferSyncInterface::kParseNoError;
183 } 183 }
184 184
185 BufferSyncInterface::ParseError GAPID3D9::SetSamplerTexture( 185 BufferSyncInterface::ParseError GAPID3D9::SetSamplerTexture(
186 ResourceID id, 186 ResourceID id,
187 ResourceID texture_id) { 187 ResourceID texture_id) {
188 SamplerD3D9 *sampler = samplers_.Get(id); 188 SamplerD3D9 *sampler = samplers_.Get(id);
189 if (!sampler) 189 if (!sampler)
190 return BufferSyncInterface::PARSE_INVALID_ARGUMENTS; 190 return BufferSyncInterface::kParseInvalidArguments;
191 // Dirty effect, because this sampler id may be used 191 // Dirty effect, because this sampler id may be used
192 DirtyEffect(); 192 DirtyEffect();
193 sampler->SetTexture(texture_id); 193 sampler->SetTexture(texture_id);
194 return BufferSyncInterface::PARSE_NO_ERROR; 194 return BufferSyncInterface::kParseNoError;
195 } 195 }
196 196
197 197
198 } // namespace command_buffer 198 } // namespace command_buffer
199 } // namespace o3d 199 } // namespace o3d
OLDNEW
« no previous file with comments | « command_buffer/service/win/d3d9/render_surface_d3d9.cc ('k') | command_buffer/service/win/d3d9/texture_d3d9.cc » ('j') | no next file with comments »

Powered by Google App Engine