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 13149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13160 GLuint64 timeout = GLES2Util::MapTwoUint32ToUint64(c.timeout_0, c.timeout_1); | 13160 GLuint64 timeout = GLES2Util::MapTwoUint32ToUint64(c.timeout_0, c.timeout_1); |
13161 GLsync service_sync = 0; | 13161 GLsync service_sync = 0; |
13162 if (!group_->GetSyncServiceId(sync, &service_sync)) { | 13162 if (!group_->GetSyncServiceId(sync, &service_sync)) { |
13163 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "WaitSync", "invalid sync"); | 13163 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "WaitSync", "invalid sync"); |
13164 return error::kNoError; | 13164 return error::kNoError; |
13165 } | 13165 } |
13166 glWaitSync(service_sync, flags, timeout); | 13166 glWaitSync(service_sync, flags, timeout); |
13167 return error::kNoError; | 13167 return error::kNoError; |
13168 } | 13168 } |
13169 | 13169 |
| 13170 error::Error GLES2DecoderImpl::HandleGetInternalformativ( |
| 13171 uint32_t immediate_data_size, const void* cmd_data) { |
| 13172 if (!unsafe_es3_apis_enabled()) |
| 13173 return error::kUnknownCommand; |
| 13174 const gles2::cmds::GetInternalformativ& c = |
| 13175 *static_cast<const gles2::cmds::GetInternalformativ*>(cmd_data); |
| 13176 GLenum target = static_cast<GLenum>(c.target); |
| 13177 GLenum format = static_cast<GLenum>(c.format); |
| 13178 GLenum pname = static_cast<GLenum>(c.pname); |
| 13179 if (!validators_->render_buffer_target.IsValid(target)) { |
| 13180 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetInternalformativ", target, "target"); |
| 13181 return error::kNoError; |
| 13182 } |
| 13183 if (!validators_->render_buffer_format.IsValid(format)) { |
| 13184 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetInternalformativ", format, "format"); |
| 13185 return error::kNoError; |
| 13186 } |
| 13187 if (!validators_->internal_format_parameter.IsValid(pname)) { |
| 13188 LOCAL_SET_GL_ERROR_INVALID_ENUM("glGetInternalformativ", pname, "pname"); |
| 13189 return error::kNoError; |
| 13190 } |
| 13191 typedef cmds::GetInternalformativ::Result Result; |
| 13192 GLsizei num_values = 0; |
| 13193 switch (pname) { |
| 13194 case GL_NUM_SAMPLE_COUNTS: |
| 13195 num_values = 1; |
| 13196 break; |
| 13197 case GL_SAMPLES: |
| 13198 { |
| 13199 GLint value = 0; |
| 13200 glGetInternalformativ(target, format, GL_NUM_SAMPLE_COUNTS, 1, &value); |
| 13201 num_values = static_cast<GLsizei>(value); |
| 13202 } |
| 13203 break; |
| 13204 default: |
| 13205 NOTREACHED(); |
| 13206 break; |
| 13207 } |
| 13208 Result* result = GetSharedMemoryAs<Result*>( |
| 13209 c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); |
| 13210 GLint* params = result ? result->GetData() : NULL; |
| 13211 if (params == NULL) { |
| 13212 return error::kOutOfBounds; |
| 13213 } |
| 13214 // Check that the client initialized the result. |
| 13215 if (result->size != 0) { |
| 13216 return error::kInvalidArguments; |
| 13217 } |
| 13218 glGetInternalformativ(target, format, pname, num_values, params); |
| 13219 result->SetNumResults(num_values); |
| 13220 return error::kNoError; |
| 13221 } |
| 13222 |
13170 error::Error GLES2DecoderImpl::HandleMapBufferRange( | 13223 error::Error GLES2DecoderImpl::HandleMapBufferRange( |
13171 uint32_t immediate_data_size, const void* cmd_data) { | 13224 uint32_t immediate_data_size, const void* cmd_data) { |
13172 if (!unsafe_es3_apis_enabled()) { | 13225 if (!unsafe_es3_apis_enabled()) { |
13173 return error::kUnknownCommand; | 13226 return error::kUnknownCommand; |
13174 } | 13227 } |
13175 const gles2::cmds::MapBufferRange& c = | 13228 const gles2::cmds::MapBufferRange& c = |
13176 *static_cast<const gles2::cmds::MapBufferRange*>(cmd_data); | 13229 *static_cast<const gles2::cmds::MapBufferRange*>(cmd_data); |
13177 GLenum target = static_cast<GLenum>(c.target); | 13230 GLenum target = static_cast<GLenum>(c.target); |
13178 GLbitfield access = static_cast<GLbitfield>(c.access); | 13231 GLbitfield access = static_cast<GLbitfield>(c.access); |
13179 GLintptr offset = static_cast<GLintptr>(c.offset); | 13232 GLintptr offset = static_cast<GLintptr>(c.offset); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13310 } | 13363 } |
13311 } | 13364 } |
13312 | 13365 |
13313 // Include the auto-generated part of this file. We split this because it means | 13366 // Include the auto-generated part of this file. We split this because it means |
13314 // we can easily edit the non-auto generated parts right here in this file | 13367 // we can easily edit the non-auto generated parts right here in this file |
13315 // instead of having to edit some template or the code generator. | 13368 // instead of having to edit some template or the code generator. |
13316 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 13369 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
13317 | 13370 |
13318 } // namespace gles2 | 13371 } // namespace gles2 |
13319 } // namespace gpu | 13372 } // namespace gpu |
OLD | NEW |