Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3408)

Unified Diff: gpu/command_buffer/tests/gl_readback_unittest.cc

Issue 1542513002: Switch to standard integer types in gpu/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/tests/gl_query_unittest.cc ('k') | gpu/command_buffer/tests/gl_stream_draw_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/tests/gl_readback_unittest.cc
diff --git a/gpu/command_buffer/tests/gl_readback_unittest.cc b/gpu/command_buffer/tests/gl_readback_unittest.cc
index b4a88ee6726ba87a7d21435505db51c7c011e93a..d6295649822086637b2a4c55e5f3df3534f89f6b 100644
--- a/gpu/command_buffer/tests/gl_readback_unittest.cc
+++ b/gpu/command_buffer/tests/gl_readback_unittest.cc
@@ -5,10 +5,11 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES2/gl2extchromium.h>
+#include <stddef.h>
+#include <stdint.h>
#include <cmath>
-#include "base/basictypes.h"
#include "base/bind.h"
#include "base/location.h"
#include "base/run_loop.h"
@@ -86,14 +87,14 @@ TEST_F(GLReadbackTest, ReadPixelsWithPBOAndQuery) {
GLTestHelper::CheckGLError("no errors", __LINE__);
}
-static float HalfToFloat32(uint16 value) {
- int32 s = (value >> 15) & 0x00000001;
- int32 e = (value >> 10) & 0x0000001f;
- int32 m = value & 0x000003ff;
+static float HalfToFloat32(uint16_t value) {
+ int32_t s = (value >> 15) & 0x00000001;
+ int32_t e = (value >> 10) & 0x0000001f;
+ int32_t m = value & 0x000003ff;
if (e == 0) {
if (m == 0) {
- uint32 result = s << 31;
+ uint32_t result = s << 31;
return bit_cast<float>(result);
} else {
while (!(m & 0x00000400)) {
@@ -106,10 +107,10 @@ static float HalfToFloat32(uint16 value) {
}
} else if (e == 31) {
if (m == 0) {
- uint32 result = (s << 31) | 0x7f800000;
+ uint32_t result = (s << 31) | 0x7f800000;
return bit_cast<float>(result);
} else {
- uint32 result = (s << 31) | 0x7f800000 | (m << 13);
+ uint32_t result = (s << 31) | 0x7f800000 | (m << 13);
return bit_cast<float>(result);
}
}
@@ -117,7 +118,7 @@ static float HalfToFloat32(uint16 value) {
e = e + (127 - 15);
m = m << 13;
- uint32 result = (s << 31) | (e << 23) | m;
+ uint32_t result = (s << 31) | (e << 23) | m;
return bit_cast<float>(result);
}
@@ -146,7 +147,7 @@ TEST_F(GLReadbackTest, ReadPixelsFloat) {
struct TestFormat {
GLint format;
GLint type;
- uint32 comp_count;
+ uint32_t comp_count;
};
TestFormat test_formats[4];
size_t test_count = 0;
@@ -260,7 +261,7 @@ TEST_F(GLReadbackTest, ReadPixelsFloat) {
glClear(GL_COLOR_BUFFER_BIT);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
- uint32 read_comp_count = 0;
+ uint32_t read_comp_count = 0;
switch (read_format) {
case GL_RGB:
read_comp_count = 3;
@@ -278,8 +279,8 @@ TEST_F(GLReadbackTest, ReadPixelsFloat) {
0, 0, kTextureSize, kTextureSize, read_format, read_type,
buf.get());
EXPECT_EQ(glGetError(), GLenum(GL_NO_ERROR));
- for (uint32 jj = 0; jj < kTextureSize * kTextureSize; ++jj) {
- for (uint32 kk = 0; kk < test_formats[ii].comp_count; ++kk) {
+ for (uint32_t jj = 0; jj < kTextureSize * kTextureSize; ++jj) {
+ for (uint32_t kk = 0; kk < test_formats[ii].comp_count; ++kk) {
EXPECT_LE(
std::abs(HalfToFloat32(buf[jj * read_comp_count + kk]) -
kDrawColor[kk]),
@@ -295,8 +296,8 @@ TEST_F(GLReadbackTest, ReadPixelsFloat) {
0, 0, kTextureSize, kTextureSize, read_format, read_type,
buf.get());
EXPECT_EQ(glGetError(), GLenum(GL_NO_ERROR));
- for (uint32 jj = 0; jj < kTextureSize * kTextureSize; ++jj) {
- for (uint32 kk = 0; kk < test_formats[ii].comp_count; ++kk) {
+ for (uint32_t jj = 0; jj < kTextureSize * kTextureSize; ++jj) {
+ for (uint32_t kk = 0; kk < test_formats[ii].comp_count; ++kk) {
EXPECT_LE(
std::abs(buf[jj * read_comp_count + kk] - kDrawColor[kk]),
std::abs(kDrawColor[kk] * kEpsilon));
« no previous file with comments | « gpu/command_buffer/tests/gl_query_unittest.cc ('k') | gpu/command_buffer/tests/gl_stream_draw_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698