OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 // Return the union of |rect1| and |rect2| if they share an edge. | 210 // Return the union of |rect1| and |rect2| if they share an edge. |
211 if (rect1.SharesEdgeWith(rect2)) { | 211 if (rect1.SharesEdgeWith(rect2)) { |
212 *result = gfx::UnionRects(rect1, rect2); | 212 *result = gfx::UnionRects(rect1, rect2); |
213 return true; | 213 return true; |
214 } | 214 } |
215 | 215 |
216 // Return false if it's not possible to combine |rect1| and |rect2|. | 216 // Return false if it's not possible to combine |rect1| and |rect2|. |
217 return false; | 217 return false; |
218 } | 218 } |
219 | 219 |
220 bool IsValidPathCommandMask(GLenum fill_mode, GLuint mask) { | |
221 /* The error INVALID_VALUE | |
222 is generated if /fillMode/ is COUNT_UP_CHROMIUM or COUNT_DOWN_CHROMIUM and | |
223 the effective /mask/+1 is not an integer power of two | |
224 */ | |
225 return (fill_mode != GL_COUNT_UP_CHROMIUM && | |
226 fill_mode != GL_COUNT_DOWN_CHROMIUM) || | |
227 !GLES2Util::IsNPOT(mask + 1); | |
Zhenyao Mo
2015/10/06 22:51:01
overflow check for mask + 1
Kimmo Kinnunen
2015/10/08 09:28:29
While not terribly useful, I think overflow is int
| |
228 } | |
229 | |
220 } // namespace | 230 } // namespace |
221 | 231 |
222 class GLES2DecoderImpl; | 232 class GLES2DecoderImpl; |
223 | 233 |
224 // Local versions of the SET_GL_ERROR macros | 234 // Local versions of the SET_GL_ERROR macros |
225 #define LOCAL_SET_GL_ERROR(error, function_name, msg) \ | 235 #define LOCAL_SET_GL_ERROR(error, function_name, msg) \ |
226 ERRORSTATE_SET_GL_ERROR(state_.GetErrorState(), error, function_name, msg) | 236 ERRORSTATE_SET_GL_ERROR(state_.GetErrorState(), error, function_name, msg) |
227 #define LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, value, label) \ | 237 #define LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, value, label) \ |
228 ERRORSTATE_SET_GL_ERROR_INVALID_ENUM(state_.GetErrorState(), \ | 238 ERRORSTATE_SET_GL_ERROR_INVALID_ENUM(state_.GetErrorState(), \ |
229 function_name, value, label) | 239 function_name, value, label) |
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1906 back_buffer_color_format_ == GL_RGBA8); | 1916 back_buffer_color_format_ == GL_RGBA8); |
1907 } | 1917 } |
1908 | 1918 |
1909 // Set remaining commands to process to 0 to force DoCommands to return | 1919 // Set remaining commands to process to 0 to force DoCommands to return |
1910 // and allow context preemption and GPU watchdog checks in GpuScheduler(). | 1920 // and allow context preemption and GPU watchdog checks in GpuScheduler(). |
1911 void ExitCommandProcessingEarly() { commands_to_process_ = 0; } | 1921 void ExitCommandProcessingEarly() { commands_to_process_ = 0; } |
1912 | 1922 |
1913 void ProcessPendingReadPixels(bool did_finish); | 1923 void ProcessPendingReadPixels(bool did_finish); |
1914 void FinishReadPixels(const cmds::ReadPixels& c, GLuint buffer); | 1924 void FinishReadPixels(const cmds::ReadPixels& c, GLuint buffer); |
1915 | 1925 |
1926 bool PrepareInstancedPathCommand(GLsizei num_paths, | |
1927 GLenum path_name_type, | |
1928 uint32 paths_shm_id, | |
1929 uint32 paths_shm_offset, | |
1930 GLuint path_base, | |
1931 GLenum transform_type, | |
1932 uint32 transforms_shm_id, | |
1933 uint32 transforms_shm_offset, | |
1934 error::Error* out_error, | |
1935 GLuint** out_paths, | |
1936 const GLfloat** out_transforms, | |
1937 scoped_ptr<GLuint[]>* out_temp_path_buffer); | |
1938 template <typename T> | |
1939 bool PrepareInstancedPathCommand(GLsizei num_paths, | |
1940 uint32 paths_shm_id, | |
1941 uint32 paths_shm_offset, | |
1942 GLuint path_base, | |
1943 GLenum transform_type, | |
1944 uint32 transforms_shm_id, | |
1945 uint32 transforms_shm_offset, | |
1946 error::Error* out_error, | |
1947 GLuint** out_paths, | |
1948 const GLfloat** out_transforms, | |
1949 scoped_ptr<GLuint[]>* out_temp_path_buffer); | |
1950 | |
1916 // Generate a member function prototype for each command in an automated and | 1951 // Generate a member function prototype for each command in an automated and |
1917 // typesafe way. | 1952 // typesafe way. |
1918 #define GLES2_CMD_OP(name) \ | 1953 #define GLES2_CMD_OP(name) \ |
1919 Error Handle##name(uint32 immediate_data_size, const void* data); | 1954 Error Handle##name(uint32 immediate_data_size, const void* data); |
1920 | 1955 |
1921 GLES2_COMMAND_LIST(GLES2_CMD_OP) | 1956 GLES2_COMMAND_LIST(GLES2_CMD_OP) |
1922 | 1957 |
1923 #undef GLES2_CMD_OP | 1958 #undef GLES2_CMD_OP |
1924 | 1959 |
1925 // The GL context this decoder renders to on behalf of the client. | 1960 // The GL context this decoder renders to on behalf of the client. |
(...skipping 12968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
14894 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | 14929 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, |
14895 "function not available"); | 14930 "function not available"); |
14896 return error::kNoError; | 14931 return error::kNoError; |
14897 } | 14932 } |
14898 GLenum fill_mode = static_cast<GLenum>(c.fillMode); | 14933 GLenum fill_mode = static_cast<GLenum>(c.fillMode); |
14899 if (!validators_->path_fill_mode.IsValid(fill_mode)) { | 14934 if (!validators_->path_fill_mode.IsValid(fill_mode)) { |
14900 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, fill_mode, "fillMode"); | 14935 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, fill_mode, "fillMode"); |
14901 return error::kNoError; | 14936 return error::kNoError; |
14902 } | 14937 } |
14903 GLuint mask = static_cast<GLuint>(c.mask); | 14938 GLuint mask = static_cast<GLuint>(c.mask); |
14904 if ((fill_mode == GL_COUNT_UP_CHROMIUM || | 14939 if (!IsValidPathCommandMask(fill_mode, mask)) { |
14905 fill_mode == GL_COUNT_DOWN_CHROMIUM) && | |
14906 GLES2Util::IsNPOT(mask + 1)) { | |
14907 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | 14940 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, |
14908 "mask + 1 is not power of two"); | 14941 "mask + 1 is not power of two"); |
14909 return error::kNoError; | 14942 return error::kNoError; |
14910 } | 14943 } |
14911 GLuint service_id = 0; | 14944 GLuint service_id = 0; |
14912 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { | 14945 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) { |
14913 // "If /path/ does not name an existing path object, the command does | 14946 // "If /path/ does not name an existing path object, the command does |
14914 // nothing (and no error is generated)." | 14947 // nothing (and no error is generated)." |
14915 // This holds for other rendering functions, too. | 14948 // This holds for other rendering functions, too. |
14916 return error::kNoError; | 14949 return error::kNoError; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15003 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | 15036 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, |
15004 "function not available"); | 15037 "function not available"); |
15005 return error::kNoError; | 15038 return error::kNoError; |
15006 } | 15039 } |
15007 GLenum fill_mode = static_cast<GLenum>(c.fillMode); | 15040 GLenum fill_mode = static_cast<GLenum>(c.fillMode); |
15008 if (!validators_->path_fill_mode.IsValid(fill_mode)) { | 15041 if (!validators_->path_fill_mode.IsValid(fill_mode)) { |
15009 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, fill_mode, "fillMode"); | 15042 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, fill_mode, "fillMode"); |
15010 return error::kNoError; | 15043 return error::kNoError; |
15011 } | 15044 } |
15012 GLuint mask = static_cast<GLuint>(c.mask); | 15045 GLuint mask = static_cast<GLuint>(c.mask); |
15013 if ((fill_mode == GL_COUNT_UP_CHROMIUM || | 15046 if (!IsValidPathCommandMask(fill_mode, mask)) { |
15014 fill_mode == GL_COUNT_DOWN_CHROMIUM) && | |
15015 GLES2Util::IsNPOT(mask + 1)) { | |
15016 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | 15047 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, |
15017 "mask + 1 is not power of two"); | 15048 "mask + 1 is not power of two"); |
15018 return error::kNoError; | 15049 return error::kNoError; |
15019 } | 15050 } |
15020 GLenum cover_mode = static_cast<GLenum>(c.coverMode); | 15051 GLenum cover_mode = static_cast<GLenum>(c.coverMode); |
15021 if (!validators_->path_cover_mode.IsValid(cover_mode)) { | 15052 if (!validators_->path_cover_mode.IsValid(cover_mode)) { |
15022 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, cover_mode, "coverMode"); | 15053 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, cover_mode, "coverMode"); |
15023 return error::kNoError; | 15054 return error::kNoError; |
15024 } | 15055 } |
15025 GLuint service_id = 0; | 15056 GLuint service_id = 0; |
(...skipping 26 matching lines...) Expand all Loading... | |
15052 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) | 15083 if (!path_manager()->GetPath(static_cast<GLuint>(c.path), &service_id)) |
15053 return error::kNoError; | 15084 return error::kNoError; |
15054 | 15085 |
15055 GLint reference = static_cast<GLint>(c.reference); | 15086 GLint reference = static_cast<GLint>(c.reference); |
15056 GLuint mask = static_cast<GLuint>(c.mask); | 15087 GLuint mask = static_cast<GLuint>(c.mask); |
15057 ApplyDirtyState(); | 15088 ApplyDirtyState(); |
15058 glStencilThenCoverStrokePathNV(service_id, reference, mask, cover_mode); | 15089 glStencilThenCoverStrokePathNV(service_id, reference, mask, cover_mode); |
15059 return error::kNoError; | 15090 return error::kNoError; |
15060 } | 15091 } |
15061 | 15092 |
15093 bool GLES2DecoderImpl::PrepareInstancedPathCommand( | |
15094 GLsizei num_paths, | |
15095 GLenum path_name_type, | |
15096 uint32 paths_shm_id, | |
15097 uint32 paths_shm_offset, | |
15098 GLuint path_base, | |
15099 GLenum transform_type, | |
15100 uint32 transforms_shm_id, | |
15101 uint32 transforms_shm_offset, | |
15102 error::Error* out_error, | |
15103 GLuint** out_paths, | |
15104 const GLfloat** out_transforms, | |
15105 scoped_ptr<GLuint[]>* out_temp_path_buffer) { | |
15106 if (path_name_type == GL_BYTE) { | |
Zhenyao Mo
2015/10/06 22:51:00
A switch (path_name_type) is much cleaner here.
Kimmo Kinnunen
2015/10/08 09:28:29
Done.
| |
15107 DCHECK(validators_->path_name_type.IsValid(path_name_type)); | |
15108 return PrepareInstancedPathCommand<GLbyte>( | |
15109 num_paths, paths_shm_id, paths_shm_offset, path_base, transform_type, | |
15110 transforms_shm_id, transforms_shm_offset, out_error, out_paths, | |
15111 out_transforms, out_temp_path_buffer); | |
15112 } else if (path_name_type == GL_UNSIGNED_BYTE) { | |
15113 DCHECK(validators_->path_name_type.IsValid(path_name_type)); | |
15114 return PrepareInstancedPathCommand<GLubyte>( | |
15115 num_paths, paths_shm_id, paths_shm_offset, path_base, transform_type, | |
15116 transforms_shm_id, transforms_shm_offset, out_error, out_paths, | |
15117 out_transforms, out_temp_path_buffer); | |
15118 } else if (path_name_type == GL_SHORT) { | |
15119 DCHECK(validators_->path_name_type.IsValid(path_name_type)); | |
15120 return PrepareInstancedPathCommand<GLshort>( | |
15121 num_paths, paths_shm_id, paths_shm_offset, path_base, transform_type, | |
15122 transforms_shm_id, transforms_shm_offset, out_error, out_paths, | |
15123 out_transforms, out_temp_path_buffer); | |
15124 } else if (path_name_type == GL_UNSIGNED_SHORT) { | |
15125 DCHECK(validators_->path_name_type.IsValid(path_name_type)); | |
15126 return PrepareInstancedPathCommand<GLushort>( | |
15127 num_paths, paths_shm_id, paths_shm_offset, path_base, transform_type, | |
15128 transforms_shm_id, transforms_shm_offset, out_error, out_paths, | |
15129 out_transforms, out_temp_path_buffer); | |
15130 } else if (path_name_type == GL_INT) { | |
15131 DCHECK(validators_->path_name_type.IsValid(path_name_type)); | |
15132 return PrepareInstancedPathCommand<GLint>( | |
15133 num_paths, paths_shm_id, paths_shm_offset, path_base, transform_type, | |
15134 transforms_shm_id, transforms_shm_offset, out_error, out_paths, | |
15135 out_transforms, out_temp_path_buffer); | |
15136 } else if (path_name_type == GL_UNSIGNED_INT) { | |
15137 DCHECK(validators_->path_name_type.IsValid(path_name_type)); | |
15138 return PrepareInstancedPathCommand<GLuint>( | |
15139 num_paths, paths_shm_id, paths_shm_offset, path_base, transform_type, | |
15140 transforms_shm_id, transforms_shm_offset, out_error, out_paths, | |
15141 out_transforms, out_temp_path_buffer); | |
15142 } | |
15143 | |
15144 DCHECK(!validators_->path_name_type.IsValid(path_name_type)); | |
15145 NOTREACHED(); | |
15146 | |
15147 *out_error = error::kOutOfBounds; | |
15148 return false; | |
15149 } | |
15150 | |
15151 template <typename T> | |
15152 bool GLES2DecoderImpl::PrepareInstancedPathCommand( | |
15153 GLsizei num_paths, | |
15154 uint32 paths_shm_id, | |
15155 uint32 paths_shm_offset, | |
15156 GLuint path_base, | |
15157 GLenum transform_type, | |
15158 uint32 transforms_shm_id, | |
15159 uint32 transforms_shm_offset, | |
15160 error::Error* out_error, | |
15161 GLuint** out_paths, | |
15162 const GLfloat** out_transforms, | |
15163 scoped_ptr<GLuint[]>* out_temp_path_buffer) { | |
15164 if (num_paths == 0) { | |
15165 // No GL error, just nothing to do. | |
15166 *out_error = error::kNoError; | |
15167 return false; | |
15168 } | |
15169 uint32 paths_size = 0; | |
15170 if (!SafeMultiplyUint32(num_paths, sizeof(T), &paths_size)) { | |
15171 *out_error = error::kOutOfBounds; | |
15172 return false; | |
15173 } | |
15174 | |
15175 T* paths = NULL; | |
Zhenyao Mo
2015/10/06 22:51:00
const T*
Kimmo Kinnunen
2015/10/08 09:28:29
Still left this as is, see below. (The optimizatio
| |
15176 if (paths_shm_id != 0 || paths_shm_offset != 0) | |
15177 paths = GetSharedMemoryAs<T*>(paths_shm_id, paths_shm_offset, paths_size); | |
15178 | |
15179 if (!paths) { | |
15180 *out_error = error::kOutOfBounds; | |
15181 return false; | |
15182 } | |
15183 | |
15184 const GLfloat* transforms = NULL; | |
15185 | |
15186 if (transform_type != GL_NONE) { | |
15187 uint32 transforms_component_count = | |
15188 GLES2Util::GetComponentCountForGLTransformType(transform_type); | |
15189 // Below multiplication will not overflow. | |
15190 DCHECK(transforms_component_count <= 12); | |
15191 uint32 one_transform_size = sizeof(GLfloat) * transforms_component_count; | |
15192 | |
15193 uint32 transforms_size = 0; | |
15194 if (!SafeMultiplyUint32(one_transform_size, num_paths, &transforms_size)) { | |
15195 *out_error = error::kOutOfBounds; | |
15196 return false; | |
15197 } | |
15198 if (transforms_shm_id != 0 || transforms_shm_offset != 0) | |
15199 transforms = GetSharedMemoryAs<const GLfloat*>( | |
15200 transforms_shm_id, transforms_shm_offset, transforms_size); | |
15201 | |
15202 if (!transforms) { | |
15203 *out_error = error::kOutOfBounds; | |
15204 return false; | |
15205 } | |
15206 } | |
15207 | |
15208 scoped_ptr<GLuint[]> temp_path_buffer; | |
15209 GLuint* result_paths; | |
15210 if (sizeof(T) == sizeof(GLuint)) { | |
Zhenyao Mo
2015/10/06 22:51:00
I think this optimization is unnecessary and makes
Kimmo Kinnunen
2015/10/08 09:28:28
I tried to make this less ugly. If it is still ugl
| |
15211 result_paths = reinterpret_cast<GLuint*>(paths); | |
15212 } else { | |
15213 result_paths = new GLuint[num_paths]; | |
15214 temp_path_buffer.reset(result_paths); | |
15215 } | |
15216 bool has_paths = false; | |
15217 for (GLsizei i = 0; i < num_paths; ++i) { | |
15218 GLuint service_id = 0; | |
15219 uint32 client_id = 0; | |
15220 if (!SafeAddUint32(paths[i], path_base, &client_id)) { | |
15221 *out_error = error::kOutOfBounds; | |
Zhenyao Mo
2015/10/06 22:51:01
This is incorrect. You should generate an INVALID
Kimmo Kinnunen
2015/10/08 09:28:29
Done.
| |
15222 return false; | |
15223 } | |
15224 | |
15225 if (path_manager()->GetPath(client_id, &service_id)) | |
15226 has_paths = true; | |
15227 | |
15228 // Will use path 0 if the path is not found. This is in line | |
15229 // of the spec: missing paths will produce nothing, let | |
15230 // the instanced draw continue. | |
15231 result_paths[i] = service_id; | |
15232 } | |
15233 | |
15234 if (!has_paths) { | |
15235 *out_error = error::kNoError; | |
15236 return false; | |
15237 } | |
15238 *out_error = error::kNoError; | |
15239 *out_paths = result_paths; | |
15240 *out_transforms = transforms; | |
15241 out_temp_path_buffer->swap(temp_path_buffer); | |
15242 return true; | |
15243 } | |
15244 | |
15245 error::Error GLES2DecoderImpl::HandleStencilFillPathInstancedCHROMIUM( | |
15246 uint32 immediate_data_size, | |
15247 const void* cmd_data) { | |
15248 static const char kFunctionName[] = "glStencilFillPathInstancedCHROMIUM"; | |
15249 const gles2::cmds::StencilFillPathInstancedCHROMIUM& c = | |
15250 *static_cast<const gles2::cmds::StencilFillPathInstancedCHROMIUM*>( | |
15251 cmd_data); | |
15252 if (!features().chromium_path_rendering) { | |
15253 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | |
Zhenyao Mo
2015/10/06 22:51:01
no GL error, but return error::kUnknownCommand ins
Kimmo Kinnunen
2015/10/08 09:28:29
Done.
| |
15254 "function not available"); | |
15255 return error::kNoError; | |
15256 } | |
15257 | |
15258 GLsizei num_paths = static_cast<GLsizei>(c.numPaths); | |
15259 if (num_paths < 0) { | |
Zhenyao Mo
2015/10/06 22:51:00
It looks to me that the validation of num_paths, p
Kimmo Kinnunen
2015/10/08 09:28:28
The order of the error checking is significant.
I
| |
15260 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numPaths < 0"); | |
15261 return error::kNoError; | |
15262 } | |
15263 | |
15264 GLenum path_name_type = static_cast<GLsizei>(c.pathNameType); | |
15265 if (!validators_->path_name_type.IsValid(path_name_type)) { | |
15266 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, path_name_type, | |
15267 "pathNameType"); | |
15268 return error::kNoError; | |
15269 } | |
15270 | |
15271 GLenum fill_mode = static_cast<GLenum>(c.fillMode); | |
15272 if (!validators_->path_fill_mode.IsValid(fill_mode)) { | |
15273 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, fill_mode, "fillMode"); | |
15274 return error::kNoError; | |
15275 } | |
15276 | |
15277 GLuint mask = static_cast<GLuint>(c.mask); | |
15278 if (!IsValidPathCommandMask(fill_mode, mask)) { | |
15279 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | |
15280 "mask+1 is not power of two"); | |
15281 return error::kNoError; | |
15282 } | |
15283 | |
15284 GLenum transform_type = static_cast<GLenum>(c.transformType); | |
15285 if (!validators_->path_transform_type.IsValid(transform_type)) { | |
15286 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, transform_type, | |
15287 "transformType"); | |
15288 return error::kNoError; | |
15289 } | |
15290 | |
15291 GLuint path_base = static_cast<GLuint>(c.pathBase); | |
15292 | |
15293 uint32 paths_shm_id = static_cast<uint32>(c.paths_shm_id); | |
15294 uint32 paths_shm_offset = static_cast<uint32>(c.paths_shm_offset); | |
15295 uint32 transforms_shm_id = static_cast<uint32>(c.transformValues_shm_id); | |
15296 uint32 transforms_shm_offset = | |
15297 static_cast<uint32>(c.transformValues_shm_offset); | |
15298 | |
15299 GLuint* paths = NULL; | |
15300 const GLfloat* transforms = NULL; | |
15301 error::Error prepare_error = error::kNoError; | |
15302 scoped_ptr<GLuint[]> temp_path_buffer; | |
15303 if (!PrepareInstancedPathCommand( | |
15304 num_paths, path_name_type, paths_shm_id, paths_shm_offset, path_base, | |
15305 transform_type, transforms_shm_id, transforms_shm_offset, | |
15306 &prepare_error, &paths, &transforms, &temp_path_buffer)) { | |
15307 return prepare_error; | |
15308 } | |
15309 | |
15310 ApplyDirtyState(); | |
15311 glStencilFillPathInstancedNV(num_paths, path_name_type, paths, 0, fill_mode, | |
Zhenyao Mo
2015/10/06 22:51:01
Should you always use GL_UNSIGNED_INT here as the
Kimmo Kinnunen
2015/10/08 09:28:29
Done.
| |
15312 mask, transform_type, transforms); | |
15313 | |
15314 return error::kNoError; | |
15315 } | |
15316 | |
15317 error::Error GLES2DecoderImpl::HandleStencilStrokePathInstancedCHROMIUM( | |
15318 uint32 immediate_data_size, | |
15319 const void* cmd_data) { | |
15320 static const char kFunctionName[] = "glStencilStrokePathInstancedCHROMIUM"; | |
15321 const gles2::cmds::StencilStrokePathInstancedCHROMIUM& c = | |
15322 *static_cast<const gles2::cmds::StencilStrokePathInstancedCHROMIUM*>( | |
15323 cmd_data); | |
15324 if (!features().chromium_path_rendering) { | |
15325 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | |
Zhenyao Mo
2015/10/06 22:51:01
Same here, no GL error, but return error::kUnknown
Kimmo Kinnunen
2015/10/08 09:28:29
Done.
| |
15326 "function not available"); | |
15327 return error::kNoError; | |
15328 } | |
15329 GLsizei num_paths = static_cast<GLsizei>(c.numPaths); | |
15330 if (num_paths < 0) { | |
15331 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numPaths < 0"); | |
15332 return error::kNoError; | |
15333 } | |
15334 | |
15335 GLenum path_name_type = static_cast<GLsizei>(c.pathNameType); | |
15336 if (!validators_->path_name_type.IsValid(path_name_type)) { | |
15337 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, path_name_type, | |
15338 "pathNameType"); | |
15339 return error::kNoError; | |
15340 } | |
15341 | |
15342 GLenum transform_type = static_cast<GLenum>(c.transformType); | |
15343 if (!validators_->path_transform_type.IsValid(transform_type)) { | |
15344 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, transform_type, | |
15345 "transformType"); | |
15346 return error::kNoError; | |
15347 } | |
15348 | |
15349 GLuint path_base = static_cast<GLuint>(c.pathBase); | |
15350 GLuint ref = static_cast<GLuint>(c.reference); | |
Zhenyao Mo
2015/10/06 22:51:00
In the spec, reference is defined as GLint, not GL
Kimmo Kinnunen
2015/10/08 09:28:29
Done.
| |
15351 GLuint mask = static_cast<GLuint>(c.mask); | |
15352 | |
15353 uint32 paths_shm_id = static_cast<uint32>(c.paths_shm_id); | |
15354 uint32 paths_shm_offset = static_cast<uint32>(c.paths_shm_offset); | |
15355 uint32 transforms_shm_id = static_cast<uint32>(c.transformValues_shm_id); | |
15356 uint32 transforms_shm_offset = | |
15357 static_cast<uint32>(c.transformValues_shm_offset); | |
15358 | |
15359 GLuint* paths = NULL; | |
15360 const GLfloat* transforms = NULL; | |
15361 error::Error prepare_error = error::kNoError; | |
15362 scoped_ptr<GLuint[]> temp_path_buffer; | |
15363 if (!PrepareInstancedPathCommand( | |
15364 num_paths, path_name_type, paths_shm_id, paths_shm_offset, path_base, | |
15365 transform_type, transforms_shm_id, transforms_shm_offset, | |
15366 &prepare_error, &paths, &transforms, &temp_path_buffer)) { | |
15367 return prepare_error; | |
15368 } | |
15369 | |
15370 ApplyDirtyState(); | |
15371 glStencilStrokePathInstancedNV(num_paths, path_name_type, paths, 0, ref, mask, | |
15372 transform_type, transforms); | |
15373 | |
15374 return error::kNoError; | |
15375 } | |
15376 | |
15377 error::Error GLES2DecoderImpl::HandleCoverFillPathInstancedCHROMIUM( | |
15378 uint32 immediate_data_size, | |
15379 const void* cmd_data) { | |
15380 static const char kFunctionName[] = "glCoverFillPathInstancedCHROMIUM"; | |
15381 const gles2::cmds::CoverFillPathInstancedCHROMIUM& c = | |
15382 *static_cast<const gles2::cmds::CoverFillPathInstancedCHROMIUM*>( | |
15383 cmd_data); | |
15384 if (!features().chromium_path_rendering) { | |
15385 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | |
Zhenyao Mo
2015/10/06 22:51:01
Same here, no GL error, but return error::kUnknown
Kimmo Kinnunen
2015/10/08 09:28:28
Done.
| |
15386 "function not available"); | |
15387 return error::kNoError; | |
15388 } | |
15389 | |
15390 GLsizei num_paths = static_cast<GLsizei>(c.numPaths); | |
15391 if (num_paths < 0) { | |
15392 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numPaths < 0"); | |
15393 return error::kNoError; | |
15394 } | |
15395 | |
15396 GLenum path_name_type = static_cast<GLsizei>(c.pathNameType); | |
15397 if (!validators_->path_name_type.IsValid(path_name_type)) { | |
15398 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, path_name_type, | |
15399 "pathNameType"); | |
15400 return error::kNoError; | |
15401 } | |
15402 | |
15403 GLenum cover_mode = static_cast<GLuint>(c.coverMode); | |
15404 if (!validators_->path_instanced_cover_mode.IsValid(cover_mode)) { | |
15405 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, cover_mode, "coverMode"); | |
15406 return error::kNoError; | |
15407 } | |
15408 | |
15409 GLenum transform_type = static_cast<GLenum>(c.transformType); | |
15410 if (!validators_->path_transform_type.IsValid(transform_type)) { | |
15411 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, transform_type, | |
15412 "transformType"); | |
15413 return error::kNoError; | |
15414 } | |
15415 | |
15416 GLuint path_base = static_cast<GLuint>(c.pathBase); | |
15417 | |
15418 uint32 paths_shm_id = static_cast<uint32>(c.paths_shm_id); | |
15419 uint32 paths_shm_offset = static_cast<uint32>(c.paths_shm_offset); | |
15420 uint32 transforms_shm_id = static_cast<uint32>(c.transformValues_shm_id); | |
15421 uint32 transforms_shm_offset = | |
15422 static_cast<uint32>(c.transformValues_shm_offset); | |
15423 | |
15424 GLuint* paths = NULL; | |
15425 const GLfloat* transforms = NULL; | |
15426 error::Error prepare_error = error::kNoError; | |
15427 scoped_ptr<GLuint[]> temp_path_buffer; | |
15428 if (!PrepareInstancedPathCommand( | |
15429 num_paths, path_name_type, paths_shm_id, paths_shm_offset, path_base, | |
15430 transform_type, transforms_shm_id, transforms_shm_offset, | |
15431 &prepare_error, &paths, &transforms, &temp_path_buffer)) { | |
15432 return prepare_error; | |
15433 } | |
15434 | |
15435 ApplyDirtyState(); | |
15436 glCoverFillPathInstancedNV(num_paths, path_name_type, paths, 0, cover_mode, | |
15437 transform_type, transforms); | |
15438 | |
15439 return error::kNoError; | |
15440 } | |
15441 | |
15442 error::Error GLES2DecoderImpl::HandleCoverStrokePathInstancedCHROMIUM( | |
15443 uint32 immediate_data_size, | |
15444 const void* cmd_data) { | |
15445 static const char kFunctionName[] = "glCoverStrokePathInstancedCHROMIUM"; | |
15446 const gles2::cmds::CoverStrokePathInstancedCHROMIUM& c = | |
15447 *static_cast<const gles2::cmds::CoverStrokePathInstancedCHROMIUM*>( | |
15448 cmd_data); | |
15449 if (!features().chromium_path_rendering) { | |
15450 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | |
Zhenyao Mo
2015/10/06 22:51:01
Same here, no GL error, but return error::kUnknown
Kimmo Kinnunen
2015/10/08 09:28:29
Done.
| |
15451 "function not available"); | |
15452 return error::kNoError; | |
15453 } | |
15454 | |
15455 GLsizei num_paths = static_cast<GLsizei>(c.numPaths); | |
15456 if (num_paths < 0) { | |
15457 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numPaths < 0"); | |
15458 return error::kNoError; | |
15459 } | |
15460 | |
15461 GLenum path_name_type = static_cast<GLsizei>(c.pathNameType); | |
15462 if (!validators_->path_name_type.IsValid(path_name_type)) { | |
15463 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, path_name_type, | |
15464 "pathNameType"); | |
15465 return error::kNoError; | |
15466 } | |
15467 | |
15468 GLenum cover_mode = static_cast<GLenum>(c.coverMode); | |
15469 if (!validators_->path_instanced_cover_mode.IsValid(cover_mode)) { | |
15470 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, cover_mode, "coverMode"); | |
15471 return error::kNoError; | |
15472 } | |
15473 | |
15474 GLenum transform_type = static_cast<GLenum>(c.transformType); | |
15475 if (!validators_->path_transform_type.IsValid(transform_type)) { | |
15476 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, transform_type, | |
15477 "transformType"); | |
15478 return error::kNoError; | |
15479 } | |
15480 | |
15481 GLuint path_base = static_cast<GLuint>(c.pathBase); | |
15482 | |
15483 uint32 paths_shm_id = static_cast<uint32>(c.paths_shm_id); | |
15484 uint32 paths_shm_offset = static_cast<uint32>(c.paths_shm_offset); | |
15485 uint32 transforms_shm_id = static_cast<uint32>(c.transformValues_shm_id); | |
15486 uint32 transforms_shm_offset = | |
15487 static_cast<uint32>(c.transformValues_shm_offset); | |
15488 | |
15489 GLuint* paths = NULL; | |
15490 const GLfloat* transforms = NULL; | |
15491 error::Error prepare_error = error::kNoError; | |
15492 scoped_ptr<GLuint[]> temp_path_buffer; | |
15493 if (!PrepareInstancedPathCommand( | |
15494 num_paths, path_name_type, paths_shm_id, paths_shm_offset, path_base, | |
15495 transform_type, transforms_shm_id, transforms_shm_offset, | |
15496 &prepare_error, &paths, &transforms, &temp_path_buffer)) { | |
15497 return prepare_error; | |
15498 } | |
15499 | |
15500 ApplyDirtyState(); | |
15501 glCoverStrokePathInstancedNV(num_paths, path_name_type, paths, 0, cover_mode, | |
15502 transform_type, transforms); | |
15503 | |
15504 return error::kNoError; | |
15505 } | |
15506 | |
15507 error::Error GLES2DecoderImpl::HandleStencilThenCoverFillPathInstancedCHROMIUM( | |
15508 uint32 immediate_data_size, | |
15509 const void* cmd_data) { | |
15510 static const char kFunctionName[] = | |
15511 "glStencilThenCoverFillPathInstancedCHROMIUM"; | |
15512 const gles2::cmds::StencilThenCoverFillPathInstancedCHROMIUM& c = | |
15513 *static_cast< | |
15514 const gles2::cmds::StencilThenCoverFillPathInstancedCHROMIUM*>( | |
15515 cmd_data); | |
15516 if (!features().chromium_path_rendering) { | |
15517 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | |
Zhenyao Mo
2015/10/06 22:51:01
Same here, no GL error, but return error::kUnknown
Kimmo Kinnunen
2015/10/08 09:28:28
Done.
| |
15518 "function not available"); | |
15519 return error::kNoError; | |
15520 } | |
15521 | |
15522 GLsizei num_paths = static_cast<GLsizei>(c.numPaths); | |
15523 if (num_paths < 0) { | |
15524 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numPaths < 0"); | |
15525 return error::kNoError; | |
15526 } | |
15527 | |
15528 GLenum path_name_type = static_cast<GLsizei>(c.pathNameType); | |
15529 if (!validators_->path_name_type.IsValid(path_name_type)) { | |
15530 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, path_name_type, | |
15531 "pathNameType"); | |
15532 return error::kNoError; | |
15533 } | |
15534 | |
15535 GLenum fill_mode = static_cast<GLenum>(c.fillMode); | |
15536 if (!validators_->path_fill_mode.IsValid(fill_mode)) { | |
15537 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, fill_mode, "fillMode"); | |
15538 return error::kNoError; | |
15539 } | |
15540 | |
15541 GLuint mask = static_cast<GLuint>(c.mask); | |
15542 if (!IsValidPathCommandMask(fill_mode, mask)) { | |
15543 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, | |
15544 "mask+1 is not power of two"); | |
15545 return error::kNoError; | |
15546 } | |
15547 | |
15548 GLenum cover_mode = static_cast<GLenum>(c.coverMode); | |
15549 if (!validators_->path_instanced_cover_mode.IsValid(cover_mode)) { | |
15550 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, cover_mode, "coverMode"); | |
15551 return error::kNoError; | |
15552 } | |
15553 | |
15554 GLenum transform_type = static_cast<GLenum>(c.transformType); | |
15555 if (!validators_->path_transform_type.IsValid(transform_type)) { | |
15556 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, transform_type, | |
15557 "transformType"); | |
15558 return error::kNoError; | |
15559 } | |
15560 | |
15561 GLuint path_base = static_cast<GLuint>(c.pathBase); | |
15562 | |
15563 uint32 paths_shm_id = static_cast<uint32>(c.paths_shm_id); | |
15564 uint32 paths_shm_offset = static_cast<uint32>(c.paths_shm_offset); | |
15565 uint32 transforms_shm_id = static_cast<uint32>(c.transformValues_shm_id); | |
15566 uint32 transforms_shm_offset = | |
15567 static_cast<uint32>(c.transformValues_shm_offset); | |
15568 | |
15569 GLuint* paths = NULL; | |
15570 const GLfloat* transforms = NULL; | |
15571 error::Error prepare_error = error::kNoError; | |
15572 scoped_ptr<GLuint[]> temp_path_buffer; | |
15573 if (!PrepareInstancedPathCommand( | |
15574 num_paths, path_name_type, paths_shm_id, paths_shm_offset, path_base, | |
15575 transform_type, transforms_shm_id, transforms_shm_offset, | |
15576 &prepare_error, &paths, &transforms, &temp_path_buffer)) { | |
15577 return prepare_error; | |
15578 } | |
15579 | |
15580 ApplyDirtyState(); | |
15581 glStencilThenCoverFillPathInstancedNV(num_paths, path_name_type, paths, 0, | |
15582 fill_mode, mask, cover_mode, | |
15583 transform_type, transforms); | |
15584 | |
15585 return error::kNoError; | |
15586 } | |
15587 | |
15588 error::Error | |
15589 GLES2DecoderImpl::HandleStencilThenCoverStrokePathInstancedCHROMIUM( | |
15590 uint32 immediate_data_size, | |
15591 const void* cmd_data) { | |
15592 static const char kFunctionName[] = | |
15593 "glStencilThenCoverStrokeInstancedCHROMIUM"; | |
15594 const gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM& c = | |
15595 *static_cast< | |
15596 const gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM*>( | |
15597 cmd_data); | |
15598 if (!features().chromium_path_rendering) { | |
15599 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | |
Zhenyao Mo
2015/10/06 22:51:00
Same here, no GL error, but return error::kUnknown
Kimmo Kinnunen
2015/10/08 09:28:29
Done.
| |
15600 "function not available"); | |
15601 return error::kNoError; | |
15602 } | |
15603 | |
15604 GLsizei num_paths = static_cast<GLsizei>(c.numPaths); | |
15605 if (num_paths < 0) { | |
15606 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, "numPaths < 0"); | |
15607 return error::kNoError; | |
15608 } | |
15609 | |
15610 GLenum path_name_type = static_cast<GLsizei>(c.pathNameType); | |
15611 if (!validators_->path_name_type.IsValid(path_name_type)) { | |
15612 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, path_name_type, | |
15613 "pathNameType"); | |
15614 return error::kNoError; | |
15615 } | |
15616 | |
15617 GLenum cover_mode = static_cast<GLenum>(c.coverMode); | |
15618 if (!validators_->path_instanced_cover_mode.IsValid(cover_mode)) { | |
15619 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, cover_mode, "coverMode"); | |
15620 return error::kNoError; | |
15621 } | |
15622 | |
15623 GLenum transform_type = static_cast<GLenum>(c.transformType); | |
15624 if (!validators_->path_transform_type.IsValid(transform_type)) { | |
15625 LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, transform_type, | |
15626 "transformType"); | |
15627 return error::kNoError; | |
15628 } | |
15629 | |
15630 GLuint path_base = static_cast<GLuint>(c.pathBase); | |
15631 GLuint reference = static_cast<GLuint>(c.reference); | |
Zhenyao Mo
2015/10/06 22:51:00
GLint instead of GLuint
Kimmo Kinnunen
2015/10/08 09:28:29
Done.
| |
15632 GLuint mask = static_cast<GLuint>(c.mask); | |
15633 | |
15634 uint32 paths_shm_id = static_cast<uint32>(c.paths_shm_id); | |
15635 uint32 paths_shm_offset = static_cast<uint32>(c.paths_shm_offset); | |
15636 uint32 transforms_shm_id = static_cast<uint32>(c.transformValues_shm_id); | |
15637 uint32 transforms_shm_offset = | |
15638 static_cast<uint32>(c.transformValues_shm_offset); | |
15639 | |
15640 GLuint* paths = NULL; | |
15641 const GLfloat* transforms = NULL; | |
15642 error::Error prepare_error = error::kNoError; | |
15643 scoped_ptr<GLuint[]> temp_path_buffer; | |
15644 if (!PrepareInstancedPathCommand( | |
15645 num_paths, path_name_type, paths_shm_id, paths_shm_offset, path_base, | |
15646 transform_type, transforms_shm_id, transforms_shm_offset, | |
15647 &prepare_error, &paths, &transforms, &temp_path_buffer)) { | |
15648 return prepare_error; | |
15649 } | |
15650 | |
15651 ApplyDirtyState(); | |
15652 glStencilThenCoverStrokePathInstancedNV(num_paths, path_name_type, paths, 0, | |
15653 reference, mask, cover_mode, | |
15654 transform_type, transforms); | |
15655 | |
15656 return error::kNoError; | |
15657 } | |
15658 | |
15062 // Include the auto-generated part of this file. We split this because it means | 15659 // Include the auto-generated part of this file. We split this because it means |
15063 // we can easily edit the non-auto generated parts right here in this file | 15660 // we can easily edit the non-auto generated parts right here in this file |
15064 // instead of having to edit some template or the code generator. | 15661 // instead of having to edit some template or the code generator. |
15065 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15662 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
15066 | 15663 |
15067 } // namespace gles2 | 15664 } // namespace gles2 |
15068 } // namespace gpu | 15665 } // namespace gpu |
OLD | NEW |