Skip to content

Commit

Permalink
Rearrange GLES2 files so they are easier to use
Browse files Browse the repository at this point in the history
from native client and pepper.

TEST=none
BUG=none

Review URL: http://codereview.chromium.org/668205

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40956 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
gman@chromium.org committed Mar 8, 2010
1 parent 3fb28ba commit 9f42732
Show file tree
Hide file tree
Showing 35 changed files with 226 additions and 676 deletions.
4 changes: 4 additions & 0 deletions gpu/DEPS
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
include_rules = [
"+webkit/glue/plugins",
"+third_party/npapi",
"+../command_buffer",
"+../client",
"+../common",
"+../service",

# For gfx::PluginWindowHandle
"+app/gfx",
Expand Down
2 changes: 1 addition & 1 deletion gpu/command_buffer/common/GLES2/gl2.h → gpu/GLES2/gl2.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// macros.

#if defined(__cplusplus) && defined(GLES2_INLINE_OPTIMIZATION)
#include "gpu/command_buffer/command_buffer/client/gles2_lib.h"
#include "../command_buffer/client/gles2_lib.h"
#define GLES2_USE_CPP_BINDINGS
#endif

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions gpu/command_buffer/client/cmd_buffer_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

// This file contains the implementation of the command buffer helper class.

#include "gpu/command_buffer/client/cmd_buffer_helper.h"
#include "gpu/command_buffer/common/command_buffer.h"
#include "../client/cmd_buffer_helper.h"
#include "../common/command_buffer.h"

namespace gpu {

Expand Down
8 changes: 4 additions & 4 deletions gpu/command_buffer/client/cmd_buffer_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_
#define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_

#include "gpu/command_buffer/common/logging.h"
#include "gpu/command_buffer/common/constants.h"
#include "gpu/command_buffer/common/cmd_buffer_common.h"
#include "gpu/command_buffer/common/command_buffer.h"
#include "../common/logging.h"
#include "../common/constants.h"
#include "../common/cmd_buffer_common.h"
#include "../common/command_buffer.h"

namespace gpu {

Expand Down
4 changes: 2 additions & 2 deletions gpu/command_buffer/client/fenced_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

// This file contains the implementation of the FencedAllocator class.

#include "gpu/command_buffer/client/fenced_allocator.h"
#include "../client/fenced_allocator.h"
#include <algorithm>
#include "gpu/command_buffer/client/cmd_buffer_helper.h"
#include "../client/cmd_buffer_helper.h"

namespace gpu {

Expand Down
3 changes: 1 addition & 2 deletions gpu/command_buffer/client/fenced_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#define GPU_COMMAND_BUFFER_CLIENT_FENCED_ALLOCATOR_H_

#include <vector>
#include "base/basictypes.h"
#include "gpu/command_buffer/common/logging.h"
#include "../common/logging.h"

namespace gpu {
class CommandBufferHelper;
Expand Down
4 changes: 2 additions & 2 deletions gpu/command_buffer/client/gles2_c_lib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

// These functions emluate GLES2 over command buffers for C.

#include "gpu/command_buffer/client/gles2_lib.h"
#include "../client/gles2_lib.h"

extern "C" {
// Include the auto-generated part of this file. We split this because it means
// we can easily edit the non-auto generated parts right here in this file
// instead of having to edit some template or the code generator.
#include "gpu/command_buffer/client/gles2_c_lib_autogen.h"
#include "../client/gles2_c_lib_autogen.h"
} // extern "C"


2 changes: 1 addition & 1 deletion gpu/command_buffer/client/gles2_cmd_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "gpu/command_buffer/client/gles2_cmd_helper.h"
#include "../client/gles2_cmd_helper.h"

namespace gpu {

Expand Down
6 changes: 3 additions & 3 deletions gpu/command_buffer/client/gles2_cmd_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H_
#define GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_H_

#include "gpu/command_buffer/client/cmd_buffer_helper.h"
#include "gpu/command_buffer/common/gles2_cmd_format.h"
#include "../client/cmd_buffer_helper.h"
#include "../common/gles2_cmd_format.h"

namespace gpu {
namespace gles2 {
Expand All @@ -23,7 +23,7 @@ class GLES2CmdHelper : public CommandBufferHelper {
// Include the auto-generated part of this class. We split this because it
// means we can easily edit the non-auto generated parts right here in this
// file instead of having to edit some template or the code generator.
#include "gpu/command_buffer/client/gles2_cmd_helper_autogen.h"
#include "../client/gles2_cmd_helper_autogen.h"

// Helpers that could not be auto-generated.
// TODO(gman): Auto generate these.
Expand Down
7 changes: 5 additions & 2 deletions gpu/command_buffer/client/gles2_demo_cc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
#include "gpu/command_buffer/common/logging.h"

#include <math.h>
#include <GLES2/gl2.h>

#include <string>

// This is here so we have at least some idea that the inline path is working.
#define GLES2_INLINE_OPTIMIZATION
#include <GLES2/gl2.h>
#include "gpu/command_buffer/common/logging.h"

namespace {

GLuint g_texture = 0;
Expand Down
4 changes: 2 additions & 2 deletions gpu/command_buffer/client/gles2_implementation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

// A class to emluate GLES2 over command buffers.

#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "../client/gles2_implementation.h"
#include "../common/gles2_cmd_utils.h"

namespace gpu {
namespace gles2 {
Expand Down
10 changes: 5 additions & 5 deletions gpu/command_buffer/client/gles2_implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#include <map>
#include <string>
#include <vector>
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/client/gles2_cmd_helper.h"
#include "gpu/command_buffer/client/id_allocator.h"
#include "gpu/command_buffer/client/fenced_allocator.h"
#include "../common/gles2_cmd_utils.h"
#include "../client/gles2_cmd_helper.h"
#include "../client/id_allocator.h"
#include "../client/fenced_allocator.h"

namespace gpu {
namespace gles2 {
Expand Down Expand Up @@ -41,7 +41,7 @@ class GLES2Implementation {
// Include the auto-generated part of this class. We split this because
// it means we can easily edit the non-auto generated parts right here in
// this file instead of having to edit some template or the code generator.
#include "gpu/command_buffer/client/gles2_implementation_autogen.h"
#include "../client/gles2_implementation_autogen.h"

private:
// Makes a set of Ids for glGen___ functions.
Expand Down
4 changes: 2 additions & 2 deletions gpu/command_buffer/client/gles2_lib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "gpu/command_buffer/client/gles2_lib.h"
#include "gpu/command_buffer/common/thread_local.h"
#include "../client/gles2_lib.h"
#include "../common/thread_local.h"

namespace gles2 {
namespace {
Expand Down
2 changes: 1 addition & 1 deletion gpu/command_buffer/client/gles2_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_LIB_H_
#define GPU_COMMAND_BUFFER_CLIENT_GLES2_LIB_H_

#include "gpu/command_buffer/client/gles2_implementation.h"
#include "../client/gles2_implementation.h"

namespace gles2 {

Expand Down
3 changes: 2 additions & 1 deletion gpu/command_buffer/client/id_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

// This file contains the implementation of IdAllocator.

#include "gpu/command_buffer/client/id_allocator.h"
#include "../client/id_allocator.h"
#include "../common/logging.h"

namespace gpu {

Expand Down
9 changes: 6 additions & 3 deletions gpu/command_buffer/client/id_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
#define GPU_COMMAND_BUFFER_CLIENT_ID_ALLOCATOR_H_

#include <vector>
#include "base/basictypes.h"
#include "gpu/command_buffer/common/types.h"
#include "gpu/command_buffer/common/resource.h"
#include "../common/types.h"

namespace gpu {

// A resource ID, key to the resource maps.
typedef uint32 ResourceId;
// Invalid resource ID.
static const ResourceId kInvalidResource = 0xffffffffU;

// A class to manage the allocation of resource IDs. It uses a bitfield stored
// into a vector of unsigned ints.
class IdAllocator {
Expand Down
2 changes: 1 addition & 1 deletion gpu/command_buffer/common/cmd_buffer_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// This file contains the binary format definition of the command buffer and
// command buffer commands.

#include "gpu/command_buffer/common/cmd_buffer_common.h"
#include "../common/cmd_buffer_common.h"

namespace gpu {
#if !defined(OS_WIN)
Expand Down
7 changes: 3 additions & 4 deletions gpu/command_buffer/common/cmd_buffer_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
#ifndef GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_
#define GPU_COMMAND_BUFFER_COMMON_CMD_BUFFER_COMMON_H_

#include "base/basictypes.h"
#include "gpu/command_buffer/common/types.h"
#include "gpu/command_buffer/common/bitfield_helpers.h"
#include "gpu/command_buffer/common/logging.h"
#include "../common/types.h"
#include "../common/bitfield_helpers.h"
#include "../common/logging.h"

namespace gpu {

Expand Down
5 changes: 2 additions & 3 deletions gpu/command_buffer/common/command_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
#ifndef GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_
#define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_H_

#include "base/basictypes.h"
#include "gpu/command_buffer/common/buffer.h"
#include "gpu/command_buffer/common/constants.h"
#include "../common/buffer.h"
#include "../common/constants.h"

namespace gpu {

Expand Down
2 changes: 1 addition & 1 deletion gpu/command_buffer/common/command_buffer_mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_
#define GPU_COMMAND_BUFFER_COMMON_COMMAND_BUFFER_MOCK_H_

#include "gpu/command_buffer/common/command_buffer.h"
#include "../common/command_buffer.h"
#include "testing/gmock/include/gmock/gmock.h"

namespace gpu {
Expand Down
2 changes: 1 addition & 1 deletion gpu/command_buffer/common/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_
#define GPU_COMMAND_BUFFER_COMMON_CONSTANTS_H_

#include "base/basictypes.h"
#include "../common/types.h"

namespace gpu {

Expand Down
4 changes: 2 additions & 2 deletions gpu/command_buffer/common/gles2_cmd_format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

// We explicitly do NOT include gles2_cmd_format.h here because client side
// and service side have different requirements.
#include "gpu/command_buffer/common/cmd_buffer_common.h"
#include "../common/cmd_buffer_common.h"

namespace gpu {
namespace gles2 {

#include "gpu/command_buffer/common/gles2_cmd_ids_autogen.h"
#include "../common/gles2_cmd_ids_autogen.h"

const char* GetCommandName(CommandId id) {
static const char* const names[] = {
Expand Down
13 changes: 6 additions & 7 deletions gpu/command_buffer/common/gles2_cmd_format.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// the GL headers where as client side code includes the Chrome version. Also
// the unit test code must include a mock GL header.
#if defined(UNIT_TEST)
#include "gpu/command_buffer/service/gl_mock.h"
#include "../service/gl_mock.h"
#elif defined(GLES2_GPU_SERVICE)
#include <GL/glew.h> // NOLINT
#if defined(OS_WIN)
Expand All @@ -21,11 +21,10 @@
#include <GLES2/gl2types.h> // NOLINT
#endif

#include "base/basictypes.h"
#include "gpu/command_buffer/common/types.h"
#include "gpu/command_buffer/common/bitfield_helpers.h"
#include "gpu/command_buffer/common/cmd_buffer_common.h"
#include "gpu/command_buffer/common/gles2_cmd_ids.h"
#include "../common/types.h"
#include "../common/bitfield_helpers.h"
#include "../common/cmd_buffer_common.h"
#include "../common/gles2_cmd_ids.h"

namespace gpu {
namespace gles2 {
Expand Down Expand Up @@ -83,7 +82,7 @@ COMPILE_ASSERT(offsetof(SizedResult<int8>, size) == 0,
COMPILE_ASSERT(offsetof(SizedResult<int8>, data) == 4,
OffsetOf_SizedResult_data_not_4);

#include "gpu/command_buffer/common/gles2_cmd_format_autogen.h"
#include "../common/gles2_cmd_format_autogen.h"

// These are hand written commands.
// TODO(gman): Attempt to make these auto-generated.
Expand Down
4 changes: 2 additions & 2 deletions gpu/command_buffer/common/gles2_cmd_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
#ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_IDS_H_
#define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_IDS_H_

#include "gpu/command_buffer/common/cmd_buffer_common.h"
#include "../common/cmd_buffer_common.h"

namespace gpu {
namespace gles2 {

#include "gpu/command_buffer/common/gles2_cmd_ids_autogen.h"
#include "../common/gles2_cmd_ids_autogen.h"

const char* GetCommandName(CommandId command_id);

Expand Down
4 changes: 2 additions & 2 deletions gpu/command_buffer/common/gles2_cmd_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// This file is here so other GLES2 related files can have a common set of
// includes where appropriate.

#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/common/gles2_cmd_format.h"
#include "../common/gles2_cmd_utils.h"
#include "../common/gles2_cmd_format.h"

namespace gpu {
namespace gles2 {
Expand Down
3 changes: 1 addition & 2 deletions gpu/command_buffer/common/gles2_cmd_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#ifndef GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_
#define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_

#include "base/basictypes.h"
#include "gpu/command_buffer/common/types.h"
#include "../common/types.h"

namespace gpu {
namespace gles2 {
Expand Down
Loading

0 comments on commit 9f42732

Please sign in to comment.