Commit d4c18097 authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Deduplicated a gpu code helper function to avoid jumbo clashes

There are three identical small ToGLuint functions which clashed
in jumbo build experiments. This moves it to gles2_cmd_utils.h and
changes the type to not add a dependency on GL in
command_buffer/common.

Bug: 864986
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Iad7cfc8a2506b765ba7a93c2eb9dc59149e5b8f4
Reviewed-on: https://chromium-review.googlesource.com/1141944Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#577499}
parent 3e94d2df
......@@ -41,6 +41,7 @@
#include "gpu/command_buffer/client/transfer_buffer.h"
#include "gpu/command_buffer/client/vertex_array_object_manager.h"
#include "gpu/command_buffer/common/context_creation_attribs.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/common/id_allocator.h"
#include "gpu/command_buffer/common/swap_buffers_complete_params.h"
#include "gpu/command_buffer/common/sync_token.h"
......@@ -124,11 +125,6 @@ void CopyRectToBuffer(const void* pixels,
}
}
// A 32-bit and 64-bit compatible way of converting a pointer to a GLuint.
GLuint ToGLuint(const void* ptr) {
return static_cast<GLuint>(reinterpret_cast<size_t>(ptr));
}
static base::AtomicSequenceNumber g_flush_id;
uint32_t GenerateNextFlushId() {
......
......@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "gpu/command_buffer/client/gles2_cmd_helper.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
namespace gpu {
namespace gles2 {
......@@ -19,11 +20,6 @@ static GLsizei RoundUpToMultipleOf4(GLsizei size) {
return (size + 3) & ~3;
}
// A 32-bit and 64-bit compatible way of converting a pointer to a GLuint.
static GLuint ToGLuint(const void* ptr) {
return static_cast<GLuint>(reinterpret_cast<size_t>(ptr));
}
// This class tracks VertexAttribPointers and helps emulate client side buffers.
//
// The way client side buffers work is we shadow all the Vertex Attribs so we
......
......@@ -53,6 +53,12 @@ inline bool SafeAddInt32(int32_t a, int32_t b, int32_t* dst) {
return checked.IsValid();
}
// A 32-bit and 64-bit compatible way of converting a pointer to a
// 32-bit usigned integer, suitable to be stored in a GLuint.
inline uint32_t ToGLuint(const void* ptr) {
return static_cast<uint32_t>(reinterpret_cast<size_t>(ptr));
}
// Returns the address of the first byte after a struct.
template <typename T>
const volatile void* AddressAfterStruct(const volatile T& pod) {
......
......@@ -387,11 +387,6 @@ bool SizedFormatAvailable(const FeatureInfo* feature_info,
return feature_info->IsWebGL2OrES3Context();
}
// A 32-bit and 64-bit compatible way of converting a pointer to a GLuint.
GLuint ToGLuint(const void* ptr) {
return static_cast<GLuint>(reinterpret_cast<size_t>(ptr));
}
base::LazyInstance<const FormatTypeValidator>::Leaky g_format_type_validator =
LAZY_INSTANCE_INITIALIZER;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment