X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fgpu%2Fcommand_buffer%2Fcommon%2Fgles2_cmd_format.h;h=79baf9774dfc663d0a352019219be5d0222f6f78;hb=004985e17e624662a4c85c76a7654039dc83f028;hp=736c15bd73c9e4f4a3c0376b07255fb3713d41c5;hpb=2f108dbacb161091e42a3479f4e171339b7e7623;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/gpu/command_buffer/common/gles2_cmd_format.h b/src/gpu/command_buffer/common/gles2_cmd_format.h index 736c15b..79baf97 100644 --- a/src/gpu/command_buffer/common/gles2_cmd_format.h +++ b/src/gpu/command_buffer/common/gles2_cmd_format.h @@ -10,13 +10,14 @@ #include +#include #include #include "base/atomicops.h" +#include "base/macros.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 "gpu/command_buffer/common/types.h" // GL types are forward declared to avoid including the GL headers. The problem // is determining which GL headers to include from code that is common to the @@ -83,19 +84,19 @@ struct SizedResult { // Returns the total size in bytes of the SizedResult for a given number of // results including the size field. static size_t ComputeSize(size_t num_results) { - return sizeof(T) * num_results + sizeof(uint32); // NOLINT + return sizeof(T) * num_results + sizeof(uint32_t); // NOLINT } // Returns the total size in bytes of the SizedResult for a given size of // results. static size_t ComputeSizeFromBytes(size_t size_of_result_in_bytes) { - return size_of_result_in_bytes + sizeof(uint32); // NOLINT + return size_of_result_in_bytes + sizeof(uint32_t); // NOLINT } // Returns the maximum number of results for a given buffer size. - static uint32 ComputeMaxResults(size_t size_of_buffer) { - return (size_of_buffer >= sizeof(uint32)) ? - ((size_of_buffer - sizeof(uint32)) / sizeof(T)) : 0; // NOLINT + static uint32_t ComputeMaxResults(size_t size_of_buffer) { + return (size_of_buffer >= sizeof(uint32_t)) ? + ((size_of_buffer - sizeof(uint32_t)) / sizeof(T)) : 0; // NOLINT } // Set the size for a given number of results. @@ -104,7 +105,7 @@ struct SizedResult { } // Get the number of elements in the result - int32 GetNumResults() const { + int32_t GetNumResults() const { return size / sizeof(T); // NOLINT } @@ -113,31 +114,31 @@ struct SizedResult { memcpy(dst, &data, size); } - uint32 size; // in bytes. - int32 data; // this is just here to get an offset. + uint32_t size; // in bytes. + int32_t data; // this is just here to get an offset. }; -COMPILE_ASSERT(sizeof(SizedResult) == 8, SizedResult_size_not_8); -COMPILE_ASSERT(offsetof(SizedResult, size) == 0, +COMPILE_ASSERT(sizeof(SizedResult) == 8, SizedResult_size_not_8); +COMPILE_ASSERT(offsetof(SizedResult, size) == 0, OffsetOf_SizedResult_size_not_0); -COMPILE_ASSERT(offsetof(SizedResult, data) == 4, +COMPILE_ASSERT(offsetof(SizedResult, data) == 4, OffsetOf_SizedResult_data_not_4); // The data for one attrib or uniform from GetProgramInfoCHROMIUM. struct ProgramInput { - uint32 type; // The type (GL_VEC3, GL_MAT3, GL_SAMPLER_2D, etc. - int32 size; // The size (how big the array is for uniforms) - uint32 location_offset; // offset from ProgramInfoHeader to 'size' locations - // for uniforms, 1 for attribs. - uint32 name_offset; // offset from ProgrmaInfoHeader to start of name. - uint32 name_length; // length of the name. + uint32_t type; // The type (GL_VEC3, GL_MAT3, GL_SAMPLER_2D, etc. + int32_t size; // The size (how big the array is for uniforms) + uint32_t location_offset; // offset from ProgramInfoHeader to 'size' + // locations for uniforms, 1 for attribs. + uint32_t name_offset; // offset from ProgrmaInfoHeader to start of name. + uint32_t name_length; // length of the name. }; // The format of the bucket filled out by GetProgramInfoCHROMIUM struct ProgramInfoHeader { - uint32 link_status; - uint32 num_attribs; - uint32 num_uniforms; + uint32_t link_status; + uint32_t num_attribs; + uint32_t num_uniforms; // ProgramInput inputs[num_attribs + num_uniforms]; }; @@ -149,7 +150,26 @@ struct QuerySync { } base::subtle::Atomic32 process_count; - uint64 result; + uint64_t result; +}; + +struct AsyncUploadSync { + void Reset() { + base::subtle::Release_Store(&async_upload_token, 0); + } + + void SetAsyncUploadToken(uint32_t token) { + DCHECK_NE(token, 0u); + base::subtle::Release_Store(&async_upload_token, token); + } + + bool HasAsyncUploadTokenPassed(uint32_t token) { + DCHECK_NE(token, 0u); + uint32_t current_token = base::subtle::Acquire_Load(&async_upload_token); + return (current_token - token < 0x80000000); + } + + base::subtle::Atomic32 async_upload_token; }; COMPILE_ASSERT(sizeof(ProgramInput) == 20, ProgramInput_size_not_20);