summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-10 22:42:00 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-10 22:42:00 +0000
commitc3d7d609d78dbe9bb2ce6558c1207782c9bc3905 (patch)
treefb1d2b5587293b3bf046442ed095495835b587a9 /gpu
parent8426e611ccc00cd7e018e2f16305d721f033de46 (diff)
downloadchromium_src-c3d7d609d78dbe9bb2ce6558c1207782c9bc3905.zip
chromium_src-c3d7d609d78dbe9bb2ce6558c1207782c9bc3905.tar.gz
chromium_src-c3d7d609d78dbe9bb2ce6558c1207782c9bc3905.tar.bz2
First batch of GCC fixes for GPU code.
This patch addresses signed/unsigned and 64-bit errors. The remaining fixes are more involved requiring changes/ifdefs to get around HWND. There's also a ton of "unused variable" warnings in the auto-generated code. BUG=n/a TEST=n/a Review URL: http://codereview.chromium.org/492009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34296 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc11
-rw-r--r--gpu/command_buffer/service/cmd_parser.cc2
-rw-r--r--gpu/command_buffer/service/command_buffer_service.cc6
-rw-r--r--gpu/command_buffer/service/gl_utils.h2
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.h5
-rw-r--r--gpu/command_buffer/service/x_utils.cc4
-rw-r--r--gpu/command_buffer/service/x_utils.h2
-rw-r--r--gpu/gpu.gyp4
8 files changed, 21 insertions, 15 deletions
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 1208a57..0280d94 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -12,6 +12,11 @@
namespace command_buffer {
namespace gles2 {
+// 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));
+}
+
GLES2Implementation::GLES2Implementation(
GLES2CmdHelper* helper,
size_t transfer_buffer_size,
@@ -50,7 +55,7 @@ void GLES2Implementation::WaitForCmd() {
void GLES2Implementation::DrawElements(
GLenum mode, GLsizei count, GLenum type, const void* indices) {
- helper_->DrawElements(mode, count, type, reinterpret_cast<GLuint>(indices));
+ helper_->DrawElements(mode, count, type, ToGLuint(indices));
}
GLint GLES2Implementation::GetAttribLocation(
@@ -88,7 +93,7 @@ void GLES2Implementation::VertexAttribPointer(
GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride,
const void* ptr) {
helper_->VertexAttribPointer(index, size, type, normalized, stride,
- reinterpret_cast<GLuint>(ptr));
+ ToGLuint(ptr));
}
void GLES2Implementation::ShaderSource(
@@ -249,5 +254,3 @@ void GLES2Implementation::TexSubImage2D(
} // namespace gles2
} // namespace command_buffer
-
-
diff --git a/gpu/command_buffer/service/cmd_parser.cc b/gpu/command_buffer/service/cmd_parser.cc
index 019e7b2..1341732 100644
--- a/gpu/command_buffer/service/cmd_parser.cc
+++ b/gpu/command_buffer/service/cmd_parser.cc
@@ -74,7 +74,7 @@ parse_error::ParseError CommandParser::ProcessCommand() {
return parse_error::kParseInvalidSize;
}
- if (header.size + get > entry_count_) {
+ if (static_cast<size_t>(header.size + get) > entry_count_) {
DLOG(INFO) << "Error: get offset out of bounds";
return parse_error::kParseOutOfBounds;
}
diff --git a/gpu/command_buffer/service/command_buffer_service.cc b/gpu/command_buffer/service/command_buffer_service.cc
index 1ab2a9b..94d2148 100644
--- a/gpu/command_buffer/service/command_buffer_service.cc
+++ b/gpu/command_buffer/service/command_buffer_service.cc
@@ -4,6 +4,8 @@
#include "gpu/command_buffer/service/command_buffer_service.h"
+#include <limits>
+
using ::base::SharedMemory;
namespace command_buffer {
@@ -82,10 +84,10 @@ int32 CommandBufferService::CreateTransferBuffer(size_t size) {
if (unused_registered_object_elements_.empty()) {
// Check we haven't exceeded the range that fits in a 32-bit integer.
- int32 handle = static_cast<int32>(registered_objects_.size());
- if (handle != registered_objects_.size())
+ if (registered_objects_.size() > std::numeric_limits<uint32>::max())
return -1;
+ int32 handle = static_cast<int32>(registered_objects_.size());
registered_objects_.push_back(buffer);
return handle;
}
diff --git a/gpu/command_buffer/service/gl_utils.h b/gpu/command_buffer/service/gl_utils.h
index b9c10f5..e4a5abb 100644
--- a/gpu/command_buffer/service/gl_utils.h
+++ b/gpu/command_buffer/service/gl_utils.h
@@ -42,7 +42,7 @@
#endif
#include <build/build_config.h>
-#define GL_GLEXT_PROTOTYPES
+#define GL_GLEXT_PROTOTYPES 1
// Define this for extra GL error debugging (slower).
// #define GL_ERROR_DEBUGGING
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h
index 1442577..a131e50 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.h
@@ -8,7 +8,9 @@
#define O3D_COMMAND_BUFFER_SERVICE_CROSS_GLES2_CMD_DECODER_H
#include <build/build_config.h>
-#ifdef OS_WIN
+#if defined(OS_LINUX)
+#include "gpu/command_buffer/service/x_utils.h"
+#elif defined(OS_WIN)
#include <windows.h>
#endif
#include "gpu/command_buffer/service/common_decoder.h"
@@ -81,4 +83,3 @@ class GLES2Decoder : public CommonDecoder {
} // namespace command_buffer
#endif // O3D_COMMAND_BUFFER_SERVICE_CROSS_GLES2_CMD_DECODER_H
-
diff --git a/gpu/command_buffer/service/x_utils.cc b/gpu/command_buffer/service/x_utils.cc
index b9eb9d9..3e1776b 100644
--- a/gpu/command_buffer/service/x_utils.cc
+++ b/gpu/command_buffer/service/x_utils.cc
@@ -33,8 +33,8 @@
// This class implements the XWindowWrapper class.
#include "gpu/command_buffer/service/precompile.h"
-#include "gpu/command_buffer/common/cross/logging.h"
-#include "gpu/command_buffer/service/linux/x_utils.h"
+#include "gpu/command_buffer/common/logging.h"
+#include "gpu/command_buffer/service/x_utils.h"
namespace command_buffer {
diff --git a/gpu/command_buffer/service/x_utils.h b/gpu/command_buffer/service/x_utils.h
index 0d8c26a..bd2dd53 100644
--- a/gpu/command_buffer/service/x_utils.h
+++ b/gpu/command_buffer/service/x_utils.h
@@ -37,7 +37,7 @@
#include <GL/glx.h>
#include "base/basictypes.h"
-#include "gpu/command_buffer/common/cross/logging.h"
+#include "gpu/command_buffer/common/logging.h"
namespace command_buffer {
diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp
index 2fa660e7..c43e37d 100644
--- a/gpu/gpu.gyp
+++ b/gpu/gpu.gyp
@@ -243,8 +243,8 @@
['OS == "linux"',
{
'sources': [
- 'command_buffer/service/linux/x_utils.cc',
- 'command_buffer/service/linux/x_utils.h',
+ 'command_buffer/service/x_utils.cc',
+ 'command_buffer/service/x_utils.h',
],
},
],