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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
6 | 6 |
7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 | 8 |
9 #include <GLES2/gl2ext.h> | 9 #include <GLES2/gl2ext.h> |
10 #include <GLES2/gl2extchromium.h> | 10 #include <GLES2/gl2extchromium.h> |
(...skipping 3935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3946 if (height <= 0) { | 3946 if (height <= 0) { |
3947 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "height <= 0"); | 3947 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "height <= 0"); |
3948 return 0; | 3948 return 0; |
3949 } | 3949 } |
3950 | 3950 |
3951 if (!ValidImageFormat(internalformat)) { | 3951 if (!ValidImageFormat(internalformat)) { |
3952 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "invalid format"); | 3952 SetGLError(GL_INVALID_VALUE, "glCreateImageCHROMIUM", "invalid format"); |
3953 return 0; | 3953 return 0; |
3954 } | 3954 } |
3955 | 3955 |
3956 // Flush the command stream to ensure ordering in case the newly | |
3957 // returned image_id has recently been in use with a different buffer. | |
3958 helper_->CommandBufferHelper::Flush(); | |
3959 int32_t image_id = | 3956 int32_t image_id = |
3960 gpu_control_->CreateImage(buffer, width, height, internalformat); | 3957 gpu_control_->CreateImage(buffer, width, height, internalformat); |
3961 if (image_id < 0) { | 3958 if (image_id < 0) { |
3962 SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "image_id < 0"); | 3959 SetGLError(GL_OUT_OF_MEMORY, "glCreateImageCHROMIUM", "image_id < 0"); |
3963 return 0; | 3960 return 0; |
3964 } | 3961 } |
3965 return image_id; | 3962 return image_id; |
3966 } | 3963 } |
3967 | 3964 |
3968 GLuint GLES2Implementation::CreateImageCHROMIUM(ClientBuffer buffer, | 3965 GLuint GLES2Implementation::CreateImageCHROMIUM(ClientBuffer buffer, |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4082 return true; | 4079 return true; |
4083 } | 4080 } |
4084 | 4081 |
4085 // Include the auto-generated part of this file. We split this because it means | 4082 // Include the auto-generated part of this file. We split this because it means |
4086 // we can easily edit the non-auto generated parts right here in this file | 4083 // we can easily edit the non-auto generated parts right here in this file |
4087 // instead of having to edit some template or the code generator. | 4084 // instead of having to edit some template or the code generator. |
4088 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 4085 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
4089 | 4086 |
4090 } // namespace gles2 | 4087 } // namespace gles2 |
4091 } // namespace gpu | 4088 } // namespace gpu |
OLD | NEW |