Index: gpu/command_buffer/client/cmd_buffer_helper.h |
diff --git a/gpu/command_buffer/client/cmd_buffer_helper.h b/gpu/command_buffer/client/cmd_buffer_helper.h |
index 8739316b5367720b7b5ff4bef922b5727976cbb1..df189224d79cbc35499ca4e466cb0445042a3d1d 100644 |
--- a/gpu/command_buffer/client/cmd_buffer_helper.h |
+++ b/gpu/command_buffer/client/cmd_buffer_helper.h |
@@ -7,9 +7,10 @@ |
#ifndef GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
#define GPU_COMMAND_BUFFER_CLIENT_CMD_BUFFER_HELPER_H_ |
+#include <stddef.h> |
+#include <stdint.h> |
#include <string.h> |
-#include "base/basictypes.h" |
#include "base/logging.h" |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
@@ -42,7 +43,7 @@ const int kAutoFlushBig = 2; // 1/2 of the buffer |
// |
// helper.AddCommand(...); |
// helper.AddCommand(...); |
-// int32 token = helper.InsertToken(); |
+// int32_t token = helper.InsertToken(); |
// helper.AddCommand(...); |
// helper.AddCommand(...); |
// [...] |
@@ -59,7 +60,7 @@ class GPU_EXPORT CommandBufferHelper |
// Parameters: |
// ring_buffer_size: The size of the ring buffer portion of the command |
// buffer. |
- bool Initialize(int32 ring_buffer_size); |
+ bool Initialize(int32_t ring_buffer_size); |
// Sets whether the command buffer should automatically flush periodically |
// to try to increase performance. Defaults to true. |
@@ -87,7 +88,7 @@ class GPU_EXPORT CommandBufferHelper |
// Parameters: |
// count: number of entries needed. This value must be at most |
// the size of the buffer minus one. |
- void WaitForAvailableEntries(int32 count); |
+ void WaitForAvailableEntries(int32_t count); |
// Inserts a new token into the command buffer. This token either has a value |
// different from previously inserted tokens, or ensures that previously |
@@ -96,12 +97,12 @@ class GPU_EXPORT CommandBufferHelper |
// Returns: |
// the value of the new token or -1 if the command buffer reader has |
// shutdown. |
- int32 InsertToken(); |
+ int32_t InsertToken(); |
// Returns true if the token has passed. |
// Parameters: |
// the value of the token to check whether it has passed |
- bool HasTokenPassed(int32 token) const { |
+ bool HasTokenPassed(int32_t token) const { |
if (token > token_) |
return true; // we wrapped |
return last_token_read() >= token; |
@@ -112,11 +113,11 @@ class GPU_EXPORT CommandBufferHelper |
// NOTE: This will call Flush if it needs to block. |
// Parameters: |
// the value of the token to wait for. |
- void WaitForToken(int32 token); |
+ void WaitForToken(int32_t token); |
// Called prior to each command being issued. Waits for a certain amount of |
// space to be available. Returns address of space. |
- void* GetSpace(int32 entries) { |
+ void* GetSpace(int32_t entries) { |
#if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) |
// Allow this command buffer to be pre-empted by another if a "reasonable" |
// amount of work has been done. On highend machines, this reduces the |
@@ -166,7 +167,7 @@ class GPU_EXPORT CommandBufferHelper |
T* GetCmdSpace() { |
static_assert(T::kArgFlags == cmd::kFixed, |
"T::kArgFlags should equal cmd::kFixed"); |
- int32 space_needed = ComputeNumEntries(sizeof(T)); |
+ int32_t space_needed = ComputeNumEntries(sizeof(T)); |
T* data = static_cast<T*>(GetSpace(space_needed)); |
ForceNullCheck(data); |
return data; |
@@ -177,7 +178,7 @@ class GPU_EXPORT CommandBufferHelper |
T* GetImmediateCmdSpace(size_t data_space) { |
static_assert(T::kArgFlags == cmd::kAtLeastN, |
"T::kArgFlags should equal cmd::kAtLeastN"); |
- int32 space_needed = ComputeNumEntries(sizeof(T) + data_space); |
+ int32_t space_needed = ComputeNumEntries(sizeof(T) + data_space); |
T* data = static_cast<T*>(GetSpace(space_needed)); |
ForceNullCheck(data); |
return data; |
@@ -188,22 +189,20 @@ class GPU_EXPORT CommandBufferHelper |
T* GetImmediateCmdSpaceTotalSize(size_t total_space) { |
static_assert(T::kArgFlags == cmd::kAtLeastN, |
"T::kArgFlags should equal cmd::kAtLeastN"); |
- int32 space_needed = ComputeNumEntries(total_space); |
+ int32_t space_needed = ComputeNumEntries(total_space); |
T* data = static_cast<T*>(GetSpace(space_needed)); |
ForceNullCheck(data); |
return data; |
} |
- int32 last_token_read() const { |
- return command_buffer_->GetLastToken(); |
- } |
+ int32_t last_token_read() const { return command_buffer_->GetLastToken(); } |
- int32 get_offset() const { |
+ int32_t get_offset() const { |
return command_buffer_->GetLastState().get_offset; |
} |
// Common Commands |
- void Noop(uint32 skip_count) { |
+ void Noop(uint32_t skip_count) { |
cmd::Noop* cmd = GetImmediateCmdSpace<cmd::Noop>( |
(skip_count - 1) * sizeof(CommandBufferEntry)); |
if (cmd) { |
@@ -211,25 +210,25 @@ class GPU_EXPORT CommandBufferHelper |
} |
} |
- void SetToken(uint32 token) { |
+ void SetToken(uint32_t token) { |
cmd::SetToken* cmd = GetCmdSpace<cmd::SetToken>(); |
if (cmd) { |
cmd->Init(token); |
} |
} |
- void SetBucketSize(uint32 bucket_id, uint32 size) { |
+ void SetBucketSize(uint32_t bucket_id, uint32_t size) { |
cmd::SetBucketSize* cmd = GetCmdSpace<cmd::SetBucketSize>(); |
if (cmd) { |
cmd->Init(bucket_id, size); |
} |
} |
- void SetBucketData(uint32 bucket_id, |
- uint32 offset, |
- uint32 size, |
- uint32 shared_memory_id, |
- uint32 shared_memory_offset) { |
+ void SetBucketData(uint32_t bucket_id, |
+ uint32_t offset, |
+ uint32_t size, |
+ uint32_t shared_memory_id, |
+ uint32_t shared_memory_offset) { |
cmd::SetBucketData* cmd = GetCmdSpace<cmd::SetBucketData>(); |
if (cmd) { |
cmd->Init(bucket_id, |
@@ -240,8 +239,10 @@ class GPU_EXPORT CommandBufferHelper |
} |
} |
- void SetBucketDataImmediate( |
- uint32 bucket_id, uint32 offset, const void* data, uint32 size) { |
+ void SetBucketDataImmediate(uint32_t bucket_id, |
+ uint32_t offset, |
+ const void* data, |
+ uint32_t size) { |
cmd::SetBucketDataImmediate* cmd = |
GetImmediateCmdSpace<cmd::SetBucketDataImmediate>(size); |
if (cmd) { |
@@ -250,12 +251,12 @@ class GPU_EXPORT CommandBufferHelper |
} |
} |
- void GetBucketStart(uint32 bucket_id, |
- uint32 result_memory_id, |
- uint32 result_memory_offset, |
- uint32 data_memory_size, |
- uint32 data_memory_id, |
- uint32 data_memory_offset) { |
+ void GetBucketStart(uint32_t bucket_id, |
+ uint32_t result_memory_id, |
+ uint32_t result_memory_offset, |
+ uint32_t data_memory_size, |
+ uint32_t data_memory_id, |
+ uint32_t data_memory_offset) { |
cmd::GetBucketStart* cmd = GetCmdSpace<cmd::GetBucketStart>(); |
if (cmd) { |
cmd->Init(bucket_id, |
@@ -267,11 +268,11 @@ class GPU_EXPORT CommandBufferHelper |
} |
} |
- void GetBucketData(uint32 bucket_id, |
- uint32 offset, |
- uint32 size, |
- uint32 shared_memory_id, |
- uint32 shared_memory_offset) { |
+ void GetBucketData(uint32_t bucket_id, |
+ uint32_t offset, |
+ uint32_t size, |
+ uint32_t shared_memory_id, |
+ uint32_t shared_memory_offset) { |
cmd::GetBucketData* cmd = GetCmdSpace<cmd::GetBucketData>(); |
if (cmd) { |
cmd->Init(bucket_id, |
@@ -288,7 +289,7 @@ class GPU_EXPORT CommandBufferHelper |
scoped_refptr<Buffer> get_ring_buffer() const { return ring_buffer_; } |
- uint32 flush_generation() const { return flush_generation_; } |
+ uint32_t flush_generation() const { return flush_generation_; } |
void FreeRingBuffer(); |
@@ -312,7 +313,7 @@ class GPU_EXPORT CommandBufferHelper |
private: |
// Returns the number of available entries (they may not be contiguous). |
- int32 AvailableEntries() { |
+ int32_t AvailableEntries() { |
return (get_offset() - put_ - 1 + total_entry_count_) % total_entry_count_; |
} |
@@ -322,26 +323,26 @@ class GPU_EXPORT CommandBufferHelper |
// Waits for the get offset to be in a specific range, inclusive. Returns |
// false if there was an error. |
- bool WaitForGetOffsetInRange(int32 start, int32 end); |
+ bool WaitForGetOffsetInRange(int32_t start, int32_t end); |
#if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) |
// Calls Flush if automatic flush conditions are met. |
void PeriodicFlushCheck(); |
#endif |
- int32 GetTotalFreeEntriesNoWaiting() const; |
+ int32_t GetTotalFreeEntriesNoWaiting() const; |
CommandBuffer* command_buffer_; |
- int32 ring_buffer_id_; |
- int32 ring_buffer_size_; |
+ int32_t ring_buffer_id_; |
+ int32_t ring_buffer_size_; |
scoped_refptr<gpu::Buffer> ring_buffer_; |
CommandBufferEntry* entries_; |
- int32 total_entry_count_; // the total number of entries |
- int32 immediate_entry_count_; |
- int32 token_; |
- int32 put_; |
- int32 last_put_sent_; |
- int32 last_barrier_put_sent_; |
+ int32_t total_entry_count_; // the total number of entries |
+ int32_t immediate_entry_count_; |
+ int32_t token_; |
+ int32_t put_; |
+ int32_t last_put_sent_; |
+ int32_t last_barrier_put_sent_; |
#if defined(CMD_HELPER_PERIODIC_FLUSH_CHECK) |
int commands_issued_; |
@@ -355,7 +356,7 @@ class GPU_EXPORT CommandBufferHelper |
// Incremented every time the helper flushes the command buffer. |
// Can be used to track when prior commands have been flushed. |
- uint32 flush_generation_; |
+ uint32_t flush_generation_; |
friend class CommandBufferHelperTest; |
DISALLOW_COPY_AND_ASSIGN(CommandBufferHelper); |