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

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 1542513002: Switch to standard integer types in gpu/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/client/gles2_implementation.cc
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 8fe6f98d6b367f2e3fe3de2ae0dfad3cf593c395..95b90de2b01cae3a13c44a8b5876926575b3a209 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -10,6 +10,8 @@
#include <GLES2/gl2ext.h>
#include <GLES2/gl2extchromium.h>
#include <GLES3/gl3.h>
+#include <stddef.h>
+#include <stdint.h>
#include <algorithm>
#include <map>
#include <set>
@@ -288,11 +290,11 @@ void* GLES2Implementation::GetResultBuffer() {
return transfer_buffer_->GetResultBuffer();
}
-int32 GLES2Implementation::GetResultShmId() {
+int32_t GLES2Implementation::GetResultShmId() {
return transfer_buffer_->GetShmId();
}
-uint32 GLES2Implementation::GetResultShmOffset() {
+uint32_t GLES2Implementation::GetResultShmOffset() {
return transfer_buffer_->GetResultOffset();
}
@@ -313,7 +315,7 @@ void GLES2Implementation::RunIfContextNotLost(const base::Closure& callback) {
callback.Run();
}
-void GLES2Implementation::SignalSyncPoint(uint32 sync_point,
+void GLES2Implementation::SignalSyncPoint(uint32_t sync_point,
const base::Closure& callback) {
gpu_control_->SignalSyncPoint(
sync_point,
@@ -345,7 +347,7 @@ void GLES2Implementation::SignalSyncToken(const gpu::SyncToken& sync_token,
}
}
-void GLES2Implementation::SignalQuery(uint32 query,
+void GLES2Implementation::SignalQuery(uint32_t query,
const base::Closure& callback) {
// Flush previously entered commands to ensure ordering with any
// glBeginQueryEXT() calls that may have been put into the context.
@@ -381,7 +383,7 @@ bool GLES2Implementation::OnMemoryDump(
if (!transfer_buffer_->HaveBuffer())
return true;
- const uint64 tracing_process_id =
+ const uint64_t tracing_process_id =
base::trace_event::MemoryDumpManager::GetInstance()
->GetTracingProcessId();
@@ -474,7 +476,7 @@ GLenum GLES2Implementation::GetClientSideGLError() {
}
GLenum error = GL_NO_ERROR;
- for (uint32 mask = 1; mask != 0; mask = mask << 1) {
+ for (uint32_t mask = 1; mask != 0; mask = mask << 1) {
if ((error_bits_ & mask) != 0) {
error = GLES2Util::GLErrorBitToGLError(mask);
break;
@@ -547,11 +549,11 @@ void GLES2Implementation::SetGLErrorInvalidEnum(
GLES2Util::GetStringEnum(value)).c_str());
}
-bool GLES2Implementation::GetBucketContents(uint32 bucket_id,
- std::vector<int8>* data) {
+bool GLES2Implementation::GetBucketContents(uint32_t bucket_id,
+ std::vector<int8_t>* data) {
TRACE_EVENT0("gpu", "GLES2::GetBucketContents");
DCHECK(data);
- const uint32 kStartSize = 32 * 1024;
+ const uint32_t kStartSize = 32 * 1024;
ScopedTransferBufferPtr buffer(kStartSize, helper_, transfer_buffer_);
if (!buffer.valid()) {
return false;
@@ -566,10 +568,10 @@ bool GLES2Implementation::GetBucketContents(uint32 bucket_id,
bucket_id, GetResultShmId(), GetResultShmOffset(),
buffer.size(), buffer.shm_id(), buffer.offset());
WaitForCmd();
- uint32 size = *result;
+ uint32_t size = *result;
data->resize(size);
if (size > 0u) {
- uint32 offset = 0;
+ uint32_t offset = 0;
while (size) {
if (!buffer.valid()) {
buffer.Reset(size);
@@ -580,7 +582,7 @@ bool GLES2Implementation::GetBucketContents(uint32 bucket_id,
bucket_id, offset, buffer.size(), buffer.shm_id(), buffer.offset());
WaitForCmd();
}
- uint32 size_to_copy = std::min(size, buffer.size());
+ uint32_t size_to_copy = std::min(size, buffer.size());
memcpy(&(*data)[offset], buffer.address(), size_to_copy);
offset += size_to_copy;
size -= size_to_copy;
@@ -594,18 +596,19 @@ bool GLES2Implementation::GetBucketContents(uint32 bucket_id,
return true;
}
-void GLES2Implementation::SetBucketContents(
- uint32 bucket_id, const void* data, size_t size) {
+void GLES2Implementation::SetBucketContents(uint32_t bucket_id,
+ const void* data,
+ size_t size) {
DCHECK(data);
helper_->SetBucketSize(bucket_id, size);
if (size > 0u) {
- uint32 offset = 0;
+ uint32_t offset = 0;
while (size) {
ScopedTransferBufferPtr buffer(size, helper_, transfer_buffer_);
if (!buffer.valid()) {
return;
}
- memcpy(buffer.address(), static_cast<const int8*>(data) + offset,
+ memcpy(buffer.address(), static_cast<const int8_t*>(data) + offset,
buffer.size());
helper_->SetBucketData(
bucket_id, offset, buffer.size(), buffer.shm_id(), buffer.offset());
@@ -615,8 +618,8 @@ void GLES2Implementation::SetBucketContents(
}
}
-void GLES2Implementation::SetBucketAsCString(
- uint32 bucket_id, const char* str) {
+void GLES2Implementation::SetBucketAsCString(uint32_t bucket_id,
+ const char* str) {
// NOTE: strings are passed NULL terminated. That means the empty
// string will have a size of 1 and no-string will have a size of 0
if (str) {
@@ -626,10 +629,10 @@ void GLES2Implementation::SetBucketAsCString(
}
}
-bool GLES2Implementation::GetBucketAsString(
- uint32 bucket_id, std::string* str) {
+bool GLES2Implementation::GetBucketAsString(uint32_t bucket_id,
+ std::string* str) {
DCHECK(str);
- std::vector<int8> data;
+ std::vector<int8_t> data;
// NOTE: strings are passed NULL terminated. That means the empty
// string will have a size of 1 and no-string will have a size of 0
if (!GetBucketContents(bucket_id, &data)) {
@@ -642,8 +645,8 @@ bool GLES2Implementation::GetBucketAsString(
return true;
}
-void GLES2Implementation::SetBucketAsString(
- uint32 bucket_id, const std::string& str) {
+void GLES2Implementation::SetBucketAsString(uint32_t bucket_id,
+ const std::string& str) {
// NOTE: strings are passed NULL terminated. That means the empty
// string will have a size of 1 and no-string will have a size of 0
SetBucketContents(bucket_id, str.c_str(), str.size() + 1);
@@ -1441,7 +1444,7 @@ void GLES2Implementation::GetVertexAttribPointerv(
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetVertexAttribPointer("
<< index << ", " << GLES2Util::GetStringVertexPointer(pname) << ", "
<< static_cast<void*>(ptr) << ")");
- GPU_CLIENT_LOG_CODE_BLOCK(int32 num_results = 1);
+ GPU_CLIENT_LOG_CODE_BLOCK(int32_t num_results = 1);
if (!vertex_array_object_manager_->GetAttribPointer(index, pname, ptr)) {
TRACE_EVENT0("gpu", "GLES2::GetVertexAttribPointerv");
typedef cmds::GetVertexAttribPointerv::Result Result;
@@ -1457,7 +1460,7 @@ void GLES2Implementation::GetVertexAttribPointerv(
GPU_CLIENT_LOG_CODE_BLOCK(num_results = result->GetNumResults());
}
GPU_CLIENT_LOG_CODE_BLOCK({
- for (int32 i = 0; i < num_results; ++i) {
+ for (int32_t i = 0; i < num_results; ++i) {
GPU_CLIENT_LOG(" " << i << ": " << ptr[i]);
}
});
@@ -1993,15 +1996,15 @@ void GLES2Implementation::BufferSubDataHelper(
return;
}
- int32 end = 0;
- int32 buffer_size = buffer->size();
+ int32_t end = 0;
+ int32_t buffer_size = buffer->size();
if (!SafeAddInt32(offset, size, &end) || end > buffer_size) {
SetGLError(GL_INVALID_VALUE, "glBufferSubData", "out of range");
return;
}
if (buffer->address() && data)
- memcpy(static_cast<uint8*>(buffer->address()) + offset, data, size);
+ memcpy(static_cast<uint8_t*>(buffer->address()) + offset, data, size);
return;
}
@@ -2015,7 +2018,7 @@ void GLES2Implementation::BufferSubDataHelperImpl(
DCHECK(buffer);
DCHECK_GT(size, 0);
- const int8* source = static_cast<const int8*>(data);
+ const int8_t* source = static_cast<const int8_t*>(data);
while (size) {
if (!buffer->valid() || buffer->size() == 0) {
buffer->Reset(size);
@@ -2045,7 +2048,7 @@ void GLES2Implementation::BufferSubData(
}
void GLES2Implementation::RemoveTransferBuffer(BufferTracker::Buffer* buffer) {
- int32 token = buffer->last_usage_token();
+ int32_t token = buffer->last_usage_token();
if (token) {
if (helper_->HasTokenPassed(token))
@@ -2286,15 +2289,14 @@ void GLES2Implementation::CompressedTexSubImage3D(
namespace {
-void CopyRectToBuffer(
- const void* pixels,
- uint32 height,
- uint32 unpadded_row_size,
- uint32 pixels_padded_row_size,
- void* buffer,
- uint32 buffer_padded_row_size) {
- const int8* source = static_cast<const int8*>(pixels);
- int8* dest = static_cast<int8*>(buffer);
+void CopyRectToBuffer(const void* pixels,
+ uint32_t height,
+ uint32_t unpadded_row_size,
+ uint32_t pixels_padded_row_size,
+ void* buffer,
+ uint32_t buffer_padded_row_size) {
+ const int8_t* source = static_cast<const int8_t*>(pixels);
+ int8_t* dest = static_cast<int8_t*>(buffer);
if (pixels_padded_row_size != buffer_padded_row_size) {
// the last row is copied unpadded at the end
for (; height > 1; --height) {
@@ -2304,7 +2306,7 @@ void CopyRectToBuffer(
}
memcpy(dest, source, unpadded_row_size);
} else {
- uint32 size = (height - 1) * pixels_padded_row_size + unpadded_row_size;
+ uint32_t size = (height - 1) * pixels_padded_row_size + unpadded_row_size;
memcpy(dest, source, size);
}
}
@@ -2332,9 +2334,9 @@ void GLES2Implementation::TexImage2D(
SetGLError(GL_INVALID_VALUE, "glTexImage2D", "border != 0");
return;
}
- uint32 size;
- uint32 unpadded_row_size;
- uint32 padded_row_size;
+ uint32_t size;
+ uint32_t unpadded_row_size;
+ uint32_t padded_row_size;
if (!GLES2Util::ComputeImageDataSizes(
width, height, 1, format, type, unpack_alignment_, &size,
&unpadded_row_size, &padded_row_size)) {
@@ -2368,7 +2370,7 @@ void GLES2Implementation::TexImage2D(
}
// compute the advance bytes per row for the src pixels
- uint32 src_padded_row_size;
+ uint32_t src_padded_row_size;
if (unpack_row_length_ > 0) {
if (!GLES2Util::ComputeImagePaddedRowSize(
unpack_row_length_, format, type, unpack_alignment_,
@@ -2382,12 +2384,12 @@ void GLES2Implementation::TexImage2D(
}
// advance pixels pointer past the skip rows and skip pixels
- pixels = reinterpret_cast<const int8*>(pixels) +
- unpack_skip_rows_ * src_padded_row_size;
+ pixels = reinterpret_cast<const int8_t*>(pixels) +
+ unpack_skip_rows_ * src_padded_row_size;
if (unpack_skip_pixels_) {
- uint32 group_size = GLES2Util::ComputeImageGroupSize(format, type);
- pixels = reinterpret_cast<const int8*>(pixels) +
- unpack_skip_pixels_ * group_size;
+ uint32_t group_size = GLES2Util::ComputeImageGroupSize(format, type);
+ pixels = reinterpret_cast<const int8_t*>(pixels) +
+ unpack_skip_pixels_ * group_size;
}
// Check if we can send it all at once.
@@ -2456,9 +2458,9 @@ void GLES2Implementation::TexImage3D(
SetGLError(GL_INVALID_VALUE, "glTexImage3D", "border != 0");
return;
}
- uint32 size;
- uint32 unpadded_row_size;
- uint32 padded_row_size;
+ uint32_t size;
+ uint32_t unpadded_row_size;
+ uint32_t padded_row_size;
if (!GLES2Util::ComputeImageDataSizes(
width, height, depth, format, type, unpack_alignment_, &size,
&unpadded_row_size, &padded_row_size)) {
@@ -2492,7 +2494,7 @@ void GLES2Implementation::TexImage3D(
}
// compute the advance bytes per row for the src pixels
- uint32 src_padded_row_size;
+ uint32_t src_padded_row_size;
if (unpack_row_length_ > 0) {
if (!GLES2Util::ComputeImagePaddedRowSize(
unpack_row_length_, format, type, unpack_alignment_,
@@ -2504,16 +2506,17 @@ void GLES2Implementation::TexImage3D(
} else {
src_padded_row_size = padded_row_size;
}
- uint32 src_height = unpack_image_height_ > 0 ? unpack_image_height_ : height;
+ uint32_t src_height =
+ unpack_image_height_ > 0 ? unpack_image_height_ : height;
// advance pixels pointer past the skip images/rows/pixels
- pixels = reinterpret_cast<const int8*>(pixels) +
- unpack_skip_images_ * src_padded_row_size * src_height +
- unpack_skip_rows_ * src_padded_row_size;
+ pixels = reinterpret_cast<const int8_t*>(pixels) +
+ unpack_skip_images_ * src_padded_row_size * src_height +
+ unpack_skip_rows_ * src_padded_row_size;
if (unpack_skip_pixels_) {
- uint32 group_size = GLES2Util::ComputeImageGroupSize(format, type);
- pixels = reinterpret_cast<const int8*>(pixels) +
- unpack_skip_pixels_ * group_size;
+ uint32_t group_size = GLES2Util::ComputeImageGroupSize(format, type);
+ pixels = reinterpret_cast<const int8_t*>(pixels) +
+ unpack_skip_pixels_ * group_size;
}
// Check if we can send it all at once.
@@ -2543,15 +2546,15 @@ void GLES2Implementation::TexImage3D(
if (buffer_pointer) {
for (GLsizei z = 0; z < depth; ++z) {
// Only the last row of the last image is unpadded.
- uint32 src_unpadded_row_size =
+ uint32_t src_unpadded_row_size =
(z == depth - 1) ? unpadded_row_size : src_padded_row_size;
CopyRectToBuffer(
pixels, height, src_unpadded_row_size, src_padded_row_size,
buffer_pointer, padded_row_size);
- pixels = reinterpret_cast<const int8*>(pixels) +
- src_padded_row_size * src_height;
- buffer_pointer = reinterpret_cast<int8*>(buffer_pointer) +
- padded_row_size * height;
+ pixels = reinterpret_cast<const int8_t*>(pixels) +
+ src_padded_row_size * src_height;
+ buffer_pointer =
+ reinterpret_cast<int8_t*>(buffer_pointer) + padded_row_size * height;
}
helper_->TexImage3D(
target, level, internalformat, width, height, depth, format, type,
@@ -2592,9 +2595,9 @@ void GLES2Implementation::TexSubImage2D(
return;
}
- uint32 temp_size;
- uint32 unpadded_row_size;
- uint32 padded_row_size;
+ uint32_t temp_size;
+ uint32_t unpadded_row_size;
+ uint32_t padded_row_size;
if (!GLES2Util::ComputeImageDataSizes(
width, height, 1, format, type, unpack_alignment_, &temp_size,
&unpadded_row_size, &padded_row_size)) {
@@ -2619,7 +2622,7 @@ void GLES2Implementation::TexSubImage2D(
}
// compute the advance bytes per row for the src pixels
- uint32 src_padded_row_size;
+ uint32_t src_padded_row_size;
if (unpack_row_length_ > 0) {
if (!GLES2Util::ComputeImagePaddedRowSize(
unpack_row_length_, format, type, unpack_alignment_,
@@ -2633,12 +2636,12 @@ void GLES2Implementation::TexSubImage2D(
}
// advance pixels pointer past the skip rows and skip pixels
- pixels = reinterpret_cast<const int8*>(pixels) +
- unpack_skip_rows_ * src_padded_row_size;
+ pixels = reinterpret_cast<const int8_t*>(pixels) +
+ unpack_skip_rows_ * src_padded_row_size;
if (unpack_skip_pixels_) {
- uint32 group_size = GLES2Util::ComputeImageGroupSize(format, type);
- pixels = reinterpret_cast<const int8*>(pixels) +
- unpack_skip_pixels_ * group_size;
+ uint32_t group_size = GLES2Util::ComputeImageGroupSize(format, type);
+ pixels = reinterpret_cast<const int8_t*>(pixels) +
+ unpack_skip_pixels_ * group_size;
}
ScopedTransferBufferPtr buffer(temp_size, helper_, transfer_buffer_);
@@ -2671,9 +2674,9 @@ void GLES2Implementation::TexSubImage3D(
return;
}
- uint32 temp_size;
- uint32 unpadded_row_size;
- uint32 padded_row_size;
+ uint32_t temp_size;
+ uint32_t unpadded_row_size;
+ uint32_t padded_row_size;
if (!GLES2Util::ComputeImageDataSizes(
width, height, depth, format, type, unpack_alignment_, &temp_size,
&unpadded_row_size, &padded_row_size)) {
@@ -2698,7 +2701,7 @@ void GLES2Implementation::TexSubImage3D(
}
// compute the advance bytes per row for the src pixels
- uint32 src_padded_row_size;
+ uint32_t src_padded_row_size;
if (unpack_row_length_ > 0) {
if (!GLES2Util::ComputeImagePaddedRowSize(
unpack_row_length_, format, type, unpack_alignment_,
@@ -2710,16 +2713,17 @@ void GLES2Implementation::TexSubImage3D(
} else {
src_padded_row_size = padded_row_size;
}
- uint32 src_height = unpack_image_height_ > 0 ? unpack_image_height_ : height;
+ uint32_t src_height =
+ unpack_image_height_ > 0 ? unpack_image_height_ : height;
// advance pixels pointer past the skip images/rows/pixels
- pixels = reinterpret_cast<const int8*>(pixels) +
- unpack_skip_images_ * src_padded_row_size * src_height +
- unpack_skip_rows_ * src_padded_row_size;
+ pixels = reinterpret_cast<const int8_t*>(pixels) +
+ unpack_skip_images_ * src_padded_row_size * src_height +
+ unpack_skip_rows_ * src_padded_row_size;
if (unpack_skip_pixels_) {
- uint32 group_size = GLES2Util::ComputeImageGroupSize(format, type);
- pixels = reinterpret_cast<const int8*>(pixels) +
- unpack_skip_pixels_ * group_size;
+ uint32_t group_size = GLES2Util::ComputeImageGroupSize(format, type);
+ pixels = reinterpret_cast<const int8_t*>(pixels) +
+ unpack_skip_pixels_ * group_size;
}
ScopedTransferBufferPtr buffer(temp_size, helper_, transfer_buffer_);
@@ -2730,9 +2734,10 @@ void GLES2Implementation::TexSubImage3D(
CheckGLError();
}
-static GLint ComputeNumRowsThatFitInBuffer(
- uint32 padded_row_size, uint32 unpadded_row_size,
- unsigned int size, GLsizei remaining_rows) {
+static GLint ComputeNumRowsThatFitInBuffer(uint32_t padded_row_size,
+ uint32_t unpadded_row_size,
+ unsigned int size,
+ GLsizei remaining_rows) {
DCHECK_GE(unpadded_row_size, 0u);
if (padded_row_size == 0) {
return 1;
@@ -2745,17 +2750,26 @@ static GLint ComputeNumRowsThatFitInBuffer(
return num_rows;
}
-void GLES2Implementation::TexSubImage2DImpl(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
- GLsizei height, GLenum format, GLenum type, uint32 unpadded_row_size,
- const void* pixels, uint32 pixels_padded_row_size, GLboolean internal,
- ScopedTransferBufferPtr* buffer, uint32 buffer_padded_row_size) {
+void GLES2Implementation::TexSubImage2DImpl(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ uint32_t unpadded_row_size,
+ const void* pixels,
+ uint32_t pixels_padded_row_size,
+ GLboolean internal,
+ ScopedTransferBufferPtr* buffer,
+ uint32_t buffer_padded_row_size) {
DCHECK(buffer);
DCHECK_GE(level, 0);
DCHECK_GT(height, 0);
DCHECK_GT(width, 0);
- const int8* source = reinterpret_cast<const int8*>(pixels);
+ const int8_t* source = reinterpret_cast<const int8_t*>(pixels);
// Transfer by rows.
while (height) {
unsigned int desired_size =
@@ -2783,18 +2797,28 @@ void GLES2Implementation::TexSubImage2DImpl(
}
}
-void GLES2Implementation::TexSubImage3DImpl(
- GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei zoffset,
- GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
- uint32 unpadded_row_size, const void* pixels, uint32 pixels_padded_row_size,
- GLboolean internal, ScopedTransferBufferPtr* buffer,
- uint32 buffer_padded_row_size) {
+void GLES2Implementation::TexSubImage3DImpl(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type,
+ uint32_t unpadded_row_size,
+ const void* pixels,
+ uint32_t pixels_padded_row_size,
+ GLboolean internal,
+ ScopedTransferBufferPtr* buffer,
+ uint32_t buffer_padded_row_size) {
DCHECK(buffer);
DCHECK_GE(level, 0);
DCHECK_GT(height, 0);
DCHECK_GT(width, 0);
DCHECK_GT(depth, 0);
- const int8* source = reinterpret_cast<const int8*>(pixels);
+ const int8_t* source = reinterpret_cast<const int8_t*>(pixels);
GLsizei total_rows = height * depth;
GLint row_index = 0, depth_index = 0;
while (total_rows) {
@@ -2839,13 +2863,13 @@ void GLES2Implementation::TexSubImage3DImpl(
}
if (num_images > 0) {
- int8* buffer_pointer = reinterpret_cast<int8*>(buffer->address());
- uint32 src_height =
+ int8_t* buffer_pointer = reinterpret_cast<int8_t*>(buffer->address());
+ uint32_t src_height =
unpack_image_height_ > 0 ? unpack_image_height_ : height;
- uint32 image_size_dst = buffer_padded_row_size * height;
- uint32 image_size_src = pixels_padded_row_size * src_height;
+ uint32_t image_size_dst = buffer_padded_row_size * height;
+ uint32_t image_size_src = pixels_padded_row_size * src_height;
for (GLint ii = 0; ii < num_images; ++ii) {
- uint32 my_unpadded_row_size;
+ uint32_t my_unpadded_row_size;
if (total_rows == num_rows && ii + 1 == num_images)
my_unpadded_row_size = unpadded_row_size;
else
@@ -2856,7 +2880,7 @@ void GLES2Implementation::TexSubImage3DImpl(
buffer_padded_row_size);
}
} else {
- uint32 my_unpadded_row_size;
+ uint32_t my_unpadded_row_size;
if (total_rows == num_rows)
my_unpadded_row_size = unpadded_row_size;
else
@@ -2918,7 +2942,7 @@ bool GLES2Implementation::GetActiveAttribHelper(
*type = result->type;
}
if (length || name) {
- std::vector<int8> str;
+ std::vector<int8_t> str;
GetBucketContents(kResultBucketId, &str);
GLsizei max_size = std::min(static_cast<size_t>(bufsize) - 1,
std::max(static_cast<size_t>(0),
@@ -2989,7 +3013,7 @@ bool GLES2Implementation::GetActiveUniformHelper(
*type = result->type;
}
if (length || name) {
- std::vector<int8> str;
+ std::vector<int8_t> str;
GetBucketContents(kResultBucketId, &str);
GLsizei max_size = std::min(static_cast<size_t>(bufsize) - 1,
std::max(static_cast<size_t>(0),
@@ -3059,7 +3083,7 @@ bool GLES2Implementation::GetActiveUniformBlockNameHelper(
*length = 0;
}
} else if (length || name) {
- std::vector<int8> str;
+ std::vector<int8_t> str;
GetBucketContents(kResultBucketId, &str);
DCHECK_GT(str.size(), 0u);
GLsizei max_size =
@@ -3221,7 +3245,7 @@ void GLES2Implementation::GetAttachedShaders(
}
TRACE_EVENT0("gpu", "GLES2::GetAttachedShaders");
typedef cmds::GetAttachedShaders::Result Result;
- uint32 size = Result::ComputeSize(maxcount);
+ uint32_t size = Result::ComputeSize(maxcount);
Result* result = static_cast<Result*>(transfer_buffer_->Alloc(size));
if (!result) {
return;
@@ -3232,14 +3256,14 @@ void GLES2Implementation::GetAttachedShaders(
transfer_buffer_->GetShmId(),
transfer_buffer_->GetOffset(result),
size);
- int32 token = helper_->InsertToken();
+ int32_t token = helper_->InsertToken();
WaitForCmd();
if (count) {
*count = result->GetNumResults();
}
result->CopyResult(shaders);
GPU_CLIENT_LOG_CODE_BLOCK({
- for (int32 i = 0; i < result->GetNumResults(); ++i) {
+ for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
@@ -3372,7 +3396,7 @@ bool GLES2Implementation::GetTransformFeedbackVaryingHelper(
*type = result->type;
}
if (length || name) {
- std::vector<int8> str;
+ std::vector<int8_t> str;
GetBucketContents(kResultBucketId, &str);
GLsizei max_size = std::min(bufsize, static_cast<GLsizei>(str.size()));
if (max_size > 0) {
@@ -3445,7 +3469,7 @@ void GLES2Implementation::GetUniformfv(
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
- for (int32 i = 0; i < result->GetNumResults(); ++i) {
+ for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
@@ -3470,7 +3494,7 @@ void GLES2Implementation::GetUniformiv(
WaitForCmd();
GetResultAs<cmds::GetUniformiv::Result*>()->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
- for (int32 i = 0; i < result->GetNumResults(); ++i) {
+ for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
@@ -3495,7 +3519,7 @@ void GLES2Implementation::GetUniformuiv(
WaitForCmd();
GetResultAs<cmds::GetUniformuiv::Result*>()->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
- for (int32 i = 0; i < result->GetNumResults(); ++i) {
+ for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
@@ -3529,10 +3553,10 @@ void GLES2Implementation::ReadPixels(
TRACE_EVENT0("gpu", "GLES2::ReadPixels");
typedef cmds::ReadPixels::Result Result;
- int8* dest = reinterpret_cast<int8*>(pixels);
- uint32 temp_size;
- uint32 unpadded_row_size;
- uint32 padded_row_size;
+ int8_t* dest = reinterpret_cast<int8_t*>(pixels);
+ uint32_t temp_size;
+ uint32_t unpadded_row_size;
+ uint32_t padded_row_size;
if (!GLES2Util::ComputeImageDataSizes(
width, 2, 1, format, type, pack_alignment_, &temp_size,
&unpadded_row_size, &padded_row_size)) {
@@ -3568,7 +3592,7 @@ void GLES2Implementation::ReadPixels(
}
// compute the advance bytes per row for the dst pixels
- uint32 dst_padded_row_size;
+ uint32_t dst_padded_row_size;
if (pack_row_length_ > 0) {
if (!GLES2Util::ComputeImagePaddedRowSize(
pack_row_length_, format, type, pack_alignment_,
@@ -3584,7 +3608,7 @@ void GLES2Implementation::ReadPixels(
// Advance pixels pointer past the skip rows and skip pixels
dest += pack_skip_rows_ * dst_padded_row_size;
if (pack_skip_pixels_) {
- uint32 group_size = GLES2Util::ComputeImageGroupSize(format, type);
+ uint32_t group_size = GLES2Util::ComputeImageGroupSize(format, type);
dest += pack_skip_pixels_ * group_size;
}
@@ -3616,14 +3640,14 @@ void GLES2Implementation::ReadPixels(
// when doing a y-flip we have to iterate through top-to-bottom chunks
// of the dst. The service side handles reversing the rows within a
// chunk.
- int8* rows_dst;
+ int8_t* rows_dst;
if (pack_reverse_row_order_) {
rows_dst = dest + (height - num_rows) * dst_padded_row_size;
} else {
rows_dst = dest;
}
// We have to copy 1 row at a time to avoid writing pad bytes.
- const int8* src = static_cast<const int8*>(buffer.address());
+ const int8_t* src = static_cast<const int8_t*>(buffer.address());
for (GLint yy = 0; yy < num_rows; ++yy) {
memcpy(rows_dst, src, unpadded_row_size);
rows_dst += dst_padded_row_size;
@@ -4249,7 +4273,7 @@ void GLES2Implementation::GetVertexAttribfv(
<< index << ", "
<< GLES2Util::GetStringVertexAttribute(pname) << ", "
<< static_cast<const void*>(params) << ")");
- uint32 value = 0;
+ uint32_t value = 0;
if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) {
*params = static_cast<GLfloat>(value);
return;
@@ -4266,7 +4290,7 @@ void GLES2Implementation::GetVertexAttribfv(
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
- for (int32 i = 0; i < result->GetNumResults(); ++i) {
+ for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
@@ -4280,7 +4304,7 @@ void GLES2Implementation::GetVertexAttribiv(
<< index << ", "
<< GLES2Util::GetStringVertexAttribute(pname) << ", "
<< static_cast<const void*>(params) << ")");
- uint32 value = 0;
+ uint32_t value = 0;
if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) {
*params = static_cast<GLint>(value);
return;
@@ -4297,7 +4321,7 @@ void GLES2Implementation::GetVertexAttribiv(
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
- for (int32 i = 0; i < result->GetNumResults(); ++i) {
+ for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
@@ -4311,7 +4335,7 @@ void GLES2Implementation::GetVertexAttribIiv(
<< index << ", "
<< GLES2Util::GetStringVertexAttribute(pname) << ", "
<< static_cast<const void*>(params) << ")");
- uint32 value = 0;
+ uint32_t value = 0;
if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) {
*params = static_cast<GLint>(value);
return;
@@ -4328,7 +4352,7 @@ void GLES2Implementation::GetVertexAttribIiv(
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
- for (int32 i = 0; i < result->GetNumResults(); ++i) {
+ for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
@@ -4342,7 +4366,7 @@ void GLES2Implementation::GetVertexAttribIuiv(
<< index << ", "
<< GLES2Util::GetStringVertexAttribute(pname) << ", "
<< static_cast<const void*>(params) << ")");
- uint32 value = 0;
+ uint32_t value = 0;
if (vertex_array_object_manager_->GetVertexAttrib(index, pname, &value)) {
*params = static_cast<GLuint>(value);
return;
@@ -4359,7 +4383,7 @@ void GLES2Implementation::GetVertexAttribIuiv(
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
- for (int32 i = 0; i < result->GetNumResults(); ++i) {
+ for (int32_t i = 0; i < result->GetNumResults(); ++i) {
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
@@ -4516,7 +4540,7 @@ void* GLES2Implementation::MapBufferSubDataCHROMIUM(
return NULL;
}
- int32 shm_id;
+ int32_t shm_id;
unsigned int shm_offset;
void* mem = mapped_memory_->Alloc(size, &shm_id, &shm_offset);
if (!mem) {
@@ -4597,7 +4621,7 @@ void* GLES2Implementation::MapBufferRange(
return nullptr;
}
- int32 shm_id;
+ int32_t shm_id;
unsigned int shm_offset;
void* mem = mapped_memory_->Alloc(size, &shm_id, &shm_offset);
if (!mem) {
@@ -4709,14 +4733,14 @@ void* GLES2Implementation::MapTexSubImage2DCHROMIUM(
GL_INVALID_VALUE, "glMapTexSubImage2DCHROMIUM", "bad dimensions");
return NULL;
}
- uint32 size;
+ uint32_t size;
if (!GLES2Util::ComputeImageDataSizes(
width, height, 1, format, type, unpack_alignment_, &size, NULL, NULL)) {
SetGLError(
GL_INVALID_VALUE, "glMapTexSubImage2DCHROMIUM", "image size too large");
return NULL;
}
- int32 shm_id;
+ int32_t shm_id;
unsigned int shm_offset;
void* mem = mapped_memory_->Alloc(size, &shm_id, &shm_offset);
if (!mem) {
@@ -4831,7 +4855,8 @@ void GLES2Implementation::RequestExtensionCHROMIUM(const char* extension) {
}
void GLES2Implementation::GetProgramInfoCHROMIUMHelper(
- GLuint program, std::vector<int8>* result) {
+ GLuint program,
+ std::vector<int8_t>* result) {
DCHECK(result);
// Clear the bucket so if the command fails nothing will be in it.
helper_->SetBucketSize(kResultBucketId, 0);
@@ -4854,7 +4879,7 @@ void GLES2Implementation::GetProgramInfoCHROMIUM(
// Make sure they've set size to 0 else the value will be undefined on
// lost context.
DCHECK_EQ(0, *size);
- std::vector<int8> result;
+ std::vector<int8_t> result;
GetProgramInfoCHROMIUMHelper(program, &result);
if (result.empty()) {
return;
@@ -4872,7 +4897,8 @@ void GLES2Implementation::GetProgramInfoCHROMIUM(
}
void GLES2Implementation::GetUniformBlocksCHROMIUMHelper(
- GLuint program, std::vector<int8>* result) {
+ GLuint program,
+ std::vector<int8_t>* result) {
DCHECK(result);
// Clear the bucket so if the command fails nothing will be in it.
helper_->SetBucketSize(kResultBucketId, 0);
@@ -4895,7 +4921,7 @@ void GLES2Implementation::GetUniformBlocksCHROMIUM(
// Make sure they've set size to 0 else the value will be undefined on
// lost context.
DCHECK_EQ(0, *size);
- std::vector<int8> result;
+ std::vector<int8_t> result;
GetUniformBlocksCHROMIUMHelper(program, &result);
if (result.empty()) {
return;
@@ -4913,7 +4939,8 @@ void GLES2Implementation::GetUniformBlocksCHROMIUM(
}
void GLES2Implementation::GetUniformsES3CHROMIUMHelper(
- GLuint program, std::vector<int8>* result) {
+ GLuint program,
+ std::vector<int8_t>* result) {
DCHECK(result);
// Clear the bucket so if the command fails nothing will be in it.
helper_->SetBucketSize(kResultBucketId, 0);
@@ -4936,7 +4963,7 @@ void GLES2Implementation::GetUniformsES3CHROMIUM(
// Make sure they've set size to 0 else the value will be undefined on
// lost context.
DCHECK_EQ(0, *size);
- std::vector<int8> result;
+ std::vector<int8_t> result;
GetUniformsES3CHROMIUMHelper(program, &result);
if (result.empty()) {
return;
@@ -4954,7 +4981,8 @@ void GLES2Implementation::GetUniformsES3CHROMIUM(
}
void GLES2Implementation::GetTransformFeedbackVaryingsCHROMIUMHelper(
- GLuint program, std::vector<int8>* result) {
+ GLuint program,
+ std::vector<int8_t>* result) {
DCHECK(result);
// Clear the bucket so if the command fails nothing will be in it.
helper_->SetBucketSize(kResultBucketId, 0);
@@ -4978,7 +5006,7 @@ void GLES2Implementation::GetTransformFeedbackVaryingsCHROMIUM(
// Make sure they've set size to 0 else the value will be undefined on
// lost context.
DCHECK_EQ(0, *size);
- std::vector<int8> result;
+ std::vector<int8_t> result;
GetTransformFeedbackVaryingsCHROMIUMHelper(program, &result);
if (result.empty()) {
return;
@@ -6107,7 +6135,8 @@ void GLES2Implementation::PathCommandsCHROMIUM(GLuint path,
SetGLError(GL_INVALID_VALUE, kFunctionName, "missing coords");
return;
}
- uint32 coord_type_size = GLES2Util::GetGLTypeSizeForPathCoordType(coord_type);
+ uint32_t coord_type_size =
+ GLES2Util::GetGLTypeSizeForPathCoordType(coord_type);
if (coord_type_size == 0) {
SetGLError(GL_INVALID_ENUM, kFunctionName, "invalid coordType");
return;
@@ -6123,13 +6152,13 @@ void GLES2Implementation::PathCommandsCHROMIUM(GLuint path,
return;
}
- uint32 coords_size;
+ uint32_t coords_size;
if (!SafeMultiplyUint32(num_coords, coord_type_size, &coords_size)) {
SetGLError(GL_INVALID_OPERATION, kFunctionName, "overflow");
return;
}
- uint32 required_buffer_size;
+ uint32_t required_buffer_size;
if (!SafeAddUint32(coords_size, num_commands, &required_buffer_size)) {
SetGLError(GL_INVALID_OPERATION, kFunctionName, "overflow");
return;
@@ -6142,8 +6171,8 @@ void GLES2Implementation::PathCommandsCHROMIUM(GLuint path,
return;
}
- uint32 coords_shm_id = 0;
- uint32 coords_shm_offset = 0;
+ uint32_t coords_shm_id = 0;
+ uint32_t coords_shm_offset = 0;
// Copy coords first because they need more strict alignment.
if (coords_size > 0) {
unsigned char* coords_addr = static_cast<unsigned char*>(buffer.address());
@@ -6171,15 +6200,15 @@ bool GLES2Implementation::PrepareInstancedPathCommand(
GLenum transform_type,
const GLfloat* transform_values,
ScopedTransferBufferPtr* buffer,
- uint32* out_paths_shm_id,
+ uint32_t* out_paths_shm_id,
size_t* out_paths_offset,
- uint32* out_transforms_shm_id,
+ uint32_t* out_transforms_shm_id,
size_t* out_transforms_offset) {
if (num_paths < 0) {
SetGLError(GL_INVALID_VALUE, function_name, "numPaths < 0");
return false;
}
- uint32 path_name_size =
+ uint32_t path_name_size =
GLES2Util::GetGLTypeSizeForGLPathNameType(path_name_type);
if (path_name_size == 0) {
@@ -6187,7 +6216,7 @@ bool GLES2Implementation::PrepareInstancedPathCommand(
return false;
}
- uint32 transforms_component_count =
+ uint32_t transforms_component_count =
GLES2Util::GetComponentCountForGLTransformType(transform_type);
if (transform_type != GL_NONE && transforms_component_count == 0) {
@@ -6219,7 +6248,7 @@ bool GLES2Implementation::PrepareInstancedPathCommand(
return false;
}
- uint32 paths_size;
+ uint32_t paths_size;
if (!SafeMultiplyUint32(path_name_size, num_paths, &paths_size)) {
SetGLError(GL_INVALID_OPERATION, function_name, "overflow");
return false;
@@ -6227,15 +6256,15 @@ bool GLES2Implementation::PrepareInstancedPathCommand(
// The multiplication below will not overflow.
DCHECK(transforms_component_count <= 12);
- uint32 one_transform_size = sizeof(GLfloat) * transforms_component_count;
+ uint32_t one_transform_size = sizeof(GLfloat) * transforms_component_count;
- uint32 transforms_size;
+ uint32_t transforms_size;
if (!SafeMultiplyUint32(one_transform_size, num_paths, &transforms_size)) {
SetGLError(GL_INVALID_OPERATION, function_name, "overflow");
return false;
}
- uint32 required_buffer_size;
+ uint32_t required_buffer_size;
if (!SafeAddUint32(transforms_size, paths_size, &required_buffer_size)) {
SetGLError(GL_INVALID_OPERATION, function_name, "overflow");
return false;
@@ -6287,9 +6316,9 @@ void GLES2Implementation::StencilFillPathInstancedCHROMIUM(
<< transform_type << ", " << transform_values << ")");
ScopedTransferBufferPtr buffer(helper_, transfer_buffer_);
- uint32 paths_shm_id = 0;
+ uint32_t paths_shm_id = 0;
size_t paths_offset = 0;
- uint32 transforms_shm_id = 0;
+ uint32_t transforms_shm_id = 0;
size_t transforms_offset = 0;
if (!PrepareInstancedPathCommand(
"glStencilFillPathInstancedCHROMIUM", num_paths, path_name_type,
@@ -6322,9 +6351,9 @@ void GLES2Implementation::StencilStrokePathInstancedCHROMIUM(
<< transform_type << ", " << transform_values << ")");
ScopedTransferBufferPtr buffer(helper_, transfer_buffer_);
- uint32 paths_shm_id = 0;
+ uint32_t paths_shm_id = 0;
size_t paths_offset = 0;
- uint32 transforms_shm_id = 0;
+ uint32_t transforms_shm_id = 0;
size_t transforms_offset = 0;
if (!PrepareInstancedPathCommand(
"glStencilStrokePathInstancedCHROMIUM", num_paths, path_name_type,
@@ -6355,9 +6384,9 @@ void GLES2Implementation::CoverFillPathInstancedCHROMIUM(
<< transform_type << ", " << transform_values << ")");
ScopedTransferBufferPtr buffer(helper_, transfer_buffer_);
- uint32 paths_shm_id = 0;
+ uint32_t paths_shm_id = 0;
size_t paths_offset = 0;
- uint32 transforms_shm_id = 0;
+ uint32_t transforms_shm_id = 0;
size_t transforms_offset = 0;
if (!PrepareInstancedPathCommand(
"glCoverFillPathInstancedCHROMIUM", num_paths, path_name_type, paths,
@@ -6389,9 +6418,9 @@ void GLES2Implementation::CoverStrokePathInstancedCHROMIUM(
<< transform_type << ", " << transform_values << ")");
ScopedTransferBufferPtr buffer(helper_, transfer_buffer_);
- uint32 paths_shm_id = 0;
+ uint32_t paths_shm_id = 0;
size_t paths_offset = 0;
- uint32 transforms_shm_id = 0;
+ uint32_t transforms_shm_id = 0;
size_t transforms_offset = 0;
if (!PrepareInstancedPathCommand(
"glCoverStrokePathInstancedCHROMIUM", num_paths, path_name_type,
@@ -6425,9 +6454,9 @@ void GLES2Implementation::StencilThenCoverFillPathInstancedCHROMIUM(
<< mask << ", " << transform_type << ", " << transform_values << ")");
ScopedTransferBufferPtr buffer(helper_, transfer_buffer_);
- uint32 paths_shm_id = 0;
+ uint32_t paths_shm_id = 0;
size_t paths_offset = 0;
- uint32 transforms_shm_id = 0;
+ uint32_t transforms_shm_id = 0;
size_t transforms_offset = 0;
if (!PrepareInstancedPathCommand(
"glStencilThenCoverFillPathInstancedCHROMIUM", num_paths,
@@ -6464,9 +6493,9 @@ void GLES2Implementation::StencilThenCoverStrokePathInstancedCHROMIUM(
<< transform_values << ")");
ScopedTransferBufferPtr buffer(helper_, transfer_buffer_);
- uint32 paths_shm_id = 0;
+ uint32_t paths_shm_id = 0;
size_t paths_offset = 0;
- uint32 transforms_shm_id = 0;
+ uint32_t transforms_shm_id = 0;
size_t transforms_offset = 0;
if (!PrepareInstancedPathCommand(
"glStencilThenCoverStrokePathInstancedCHROMIUM", num_paths,
@@ -6509,7 +6538,7 @@ void GLES2Implementation::ProgramPathFragmentInputGenCHROMIUM(
<< ", " << gen_mode << ", " << components << ", " << coeffs
<< ")");
- uint32 coeffs_per_component =
+ uint32_t coeffs_per_component =
GLES2Util::GetCoefficientCountForGLPathFragmentInputGenMode(gen_mode);
if (components <= 0 || components > 4 || gen_mode == GL_NONE ||
@@ -6520,7 +6549,7 @@ void GLES2Implementation::ProgramPathFragmentInputGenCHROMIUM(
// The multiplication below will not overflow.
DCHECK(coeffs_per_component > 0 && coeffs_per_component <= 4);
DCHECK(components > 0 && components <= 4);
- uint32 coeffs_size = sizeof(GLfloat) * coeffs_per_component * components;
+ uint32_t coeffs_size = sizeof(GLfloat) * coeffs_per_component * components;
ScopedTransferBufferPtr buffer(coeffs_size, helper_, transfer_buffer_);
if (!buffer.valid() || buffer.size() < coeffs_size) {
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.h ('k') | gpu/command_buffer/client/gles2_implementation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698