| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // Vertex buffer resources are allocated on the service side (into GPU-friendly | 47 // Vertex buffer resources are allocated on the service side (into GPU-friendly |
| 48 // memory), but the client side cannot map it. So instead, data updates go | 48 // memory), but the client side cannot map it. So instead, data updates go |
| 49 // through a buffer in the transfer shared memory when Lock and Unlock are | 49 // through a buffer in the transfer shared memory when Lock and Unlock are |
| 50 // called. | 50 // called. |
| 51 class VertexBufferCB : public VertexBuffer { | 51 class VertexBufferCB : public VertexBuffer { |
| 52 public: | 52 public: |
| 53 VertexBufferCB(ServiceLocator* service_locator, RendererCB *renderer); | 53 VertexBufferCB(ServiceLocator* service_locator, RendererCB *renderer); |
| 54 ~VertexBufferCB(); | 54 ~VertexBufferCB(); |
| 55 | 55 |
| 56 // Returns the resource ID for this vertex buffer. | 56 // Returns the resource ID for this vertex buffer. |
| 57 command_buffer::ResourceID resource_id() const { return resource_id_; } | 57 command_buffer::ResourceId resource_id() const { return resource_id_; } |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 // Allocates a vertex buffer resource. | 60 // Allocates a vertex buffer resource. |
| 61 // Parameters: | 61 // Parameters: |
| 62 // size_in_bytes: the memory size of the vertex buffer. | 62 // size_in_bytes: the memory size of the vertex buffer. |
| 63 // Returns: | 63 // Returns: |
| 64 // true if successful. | 64 // true if successful. |
| 65 virtual bool ConcreteAllocate(size_t size_in_bytes); | 65 virtual bool ConcreteAllocate(size_t size_in_bytes); |
| 66 | 66 |
| 67 // The concrete version of Free | 67 // The concrete version of Free |
| (...skipping 20 matching lines...) Expand all Loading... |
| 88 private: | 88 private: |
| 89 // The pointer to the region in the transfer shared memory buffer when the | 89 // The pointer to the region in the transfer shared memory buffer when the |
| 90 // vertex buffer is locked, or NULL if it is not locked. | 90 // vertex buffer is locked, or NULL if it is not locked. |
| 91 void *lock_pointer_; | 91 void *lock_pointer_; |
| 92 | 92 |
| 93 // Whether or not data was entered into the vertex buffer, to avoid copying | 93 // Whether or not data was entered into the vertex buffer, to avoid copying |
| 94 // back undefined pixels. | 94 // back undefined pixels. |
| 95 bool has_data_; | 95 bool has_data_; |
| 96 | 96 |
| 97 // The command buffer resource ID for the vertex buffer. | 97 // The command buffer resource ID for the vertex buffer. |
| 98 command_buffer::ResourceID resource_id_; | 98 command_buffer::ResourceId resource_id_; |
| 99 | 99 |
| 100 // The renderer that created this vertex buffer. | 100 // The renderer that created this vertex buffer. |
| 101 RendererCB *renderer_; | 101 RendererCB *renderer_; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 // Command-buffer version of IndexBuffer. This class manages the resources for | 104 // Command-buffer version of IndexBuffer. This class manages the resources for |
| 105 // index buffers and the transfer of data. | 105 // index buffers and the transfer of data. |
| 106 // Index buffer resources are allocated on the service side (into GPU-friendly | 106 // Index buffer resources are allocated on the service side (into GPU-friendly |
| 107 // memory), but the client side cannot map it. So instead, data updates go | 107 // memory), but the client side cannot map it. So instead, data updates go |
| 108 // through a buffer in the transfer shared memory when Lock and Unlock are | 108 // through a buffer in the transfer shared memory when Lock and Unlock are |
| 109 // called. | 109 // called. |
| 110 class IndexBufferCB : public IndexBuffer { | 110 class IndexBufferCB : public IndexBuffer { |
| 111 public: | 111 public: |
| 112 IndexBufferCB(ServiceLocator* service_locator, RendererCB *renderer); | 112 IndexBufferCB(ServiceLocator* service_locator, RendererCB *renderer); |
| 113 ~IndexBufferCB(); | 113 ~IndexBufferCB(); |
| 114 | 114 |
| 115 // Returns the resource ID for this vertex buffer. | 115 // Returns the resource ID for this vertex buffer. |
| 116 command_buffer::ResourceID resource_id() const { return resource_id_; } | 116 command_buffer::ResourceId resource_id() const { return resource_id_; } |
| 117 | 117 |
| 118 protected: | 118 protected: |
| 119 // Allocates an index buffer resource. | 119 // Allocates an index buffer resource. |
| 120 // Parameters: | 120 // Parameters: |
| 121 // size_in_bytes: the memory size of the index buffer. | 121 // size_in_bytes: the memory size of the index buffer. |
| 122 // Returns: | 122 // Returns: |
| 123 // true if successful. | 123 // true if successful. |
| 124 virtual bool ConcreteAllocate(size_t size_in_bytes); | 124 virtual bool ConcreteAllocate(size_t size_in_bytes); |
| 125 | 125 |
| 126 // The concrete version of Free | 126 // The concrete version of Free |
| (...skipping 23 matching lines...) Expand all Loading... |
| 150 | 150 |
| 151 // The pointer to the region in the transfer shared memory buffer when the | 151 // The pointer to the region in the transfer shared memory buffer when the |
| 152 // index buffer is locked, or NULL if it is not locked. | 152 // index buffer is locked, or NULL if it is not locked. |
| 153 void *lock_pointer_; | 153 void *lock_pointer_; |
| 154 | 154 |
| 155 // Whether or not data was entered into the index buffer, to avoid copying | 155 // Whether or not data was entered into the index buffer, to avoid copying |
| 156 // back undefined pixels. | 156 // back undefined pixels. |
| 157 bool has_data_; | 157 bool has_data_; |
| 158 | 158 |
| 159 // The command buffer resource ID for the index buffer. | 159 // The command buffer resource ID for the index buffer. |
| 160 command_buffer::ResourceID resource_id_; | 160 command_buffer::ResourceId resource_id_; |
| 161 | 161 |
| 162 // The renderer that created this index buffer. | 162 // The renderer that created this index buffer. |
| 163 RendererCB *renderer_; | 163 RendererCB *renderer_; |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 } // namespace o3d | 166 } // namespace o3d |
| 167 | 167 |
| 168 #endif // O3D_CORE_CROSS_COMMAND_BUFFER_BUFFER_CB_H_ | 168 #endif // O3D_CORE_CROSS_COMMAND_BUFFER_BUFFER_CB_H_ |
| OLD | NEW |