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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 14402003: Add OES_texture_half_float extension support in Chromium for desktop GL implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove support for glReadPixels and update test cases Created 7 years, 8 months 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 | « no previous file | gpu/command_buffer/tests/gl_oes_texture_half_float_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 6121a58da44ff4784a8c609b3c3e305337fbc57d..f6f414aa4cc0ebf7cadc076d05c0d26bc3954fd4 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -307,6 +307,14 @@ static inline GLenum GetTexInternalFormat(GLenum internal_format,
return gl_internal_format;
}
+static inline GLenum GetTexType(GLenum type) {
+ if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) {
+ if (type == GL_HALF_FLOAT_OES)
+ return GL_HALF_FLOAT_ARB;
+ }
+ return type;
+}
+
static void WrappedTexImage2D(
GLenum target,
GLint level,
@@ -319,7 +327,22 @@ static void WrappedTexImage2D(
const void* pixels) {
glTexImage2D(
target, level, GetTexInternalFormat(internal_format, format, type),
- width, height, border, format, type, pixels);
+ width, height, border, format, GetTexType(type), pixels);
+}
+
+static void WrappedTexSubImage2D(
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const void * data) {
+ glTexSubImage2D(
+ target, level, xoffset, yoffset, width, height, format,
+ GetTexType(type), data);
}
// Wrapper for glEnable/glDisable that doesn't suck.
@@ -7885,7 +7908,8 @@ void GLES2DecoderImpl::DoTexImage2D(
}
if (!teximage2d_faster_than_texsubimage2d_ && level_is_same && pixels) {
- glTexSubImage2D(target, level, 0, 0, width, height, format, type, pixels);
+ WrappedTexSubImage2D(target, level, 0, 0, width, height, format,
+ type, pixels);
texture_manager()->SetLevelCleared(texture, target, level, true);
tex_image_2d_failed_ = false;
return;
@@ -8375,7 +8399,7 @@ error::Error GLES2DecoderImpl::DoTexSubImage2D(
return error::kNoError;
}
ScopedTextureUploadTimer timer(this);
- glTexSubImage2D(
+ WrappedTexSubImage2D(
target, level, xoffset, yoffset, width, height, format, type, data);
return error::kNoError;
}
@@ -8388,7 +8412,7 @@ error::Error GLES2DecoderImpl::DoTexSubImage2D(
target, level, format, width, height, 0, format, type, data);
} else {
ScopedTextureUploadTimer timer(this);
- glTexSubImage2D(
+ WrappedTexSubImage2D(
target, level, xoffset, yoffset, width, height, format, type, data);
}
texture_manager()->SetLevelCleared(texture, target, level, true);
@@ -10270,8 +10294,10 @@ error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM(
// Setup the parameters.
GLenum gl_internal_format =
GetTexInternalFormat(internal_format, format, type);
+ GLenum gl_type = GetTexType(type);
greggman 2013/05/03 06:26:21 Hey Jun, Sorry about this but I just remembered th
gfx::AsyncTexImage2DParams tex_params = {target, level, gl_internal_format,
- width, height, border, format, type};
+ width, height, border, format,
+ gl_type};
gfx::AsyncMemoryParams mem_params = {shared_memory, shm_size,
shm_data_offset, shm_data_size};
@@ -10360,8 +10386,9 @@ error::Error GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM(
uint32 shm_data_size = data_size;
// Setup the parameters.
+ GLenum gl_type = GetTexType(type);
gfx::AsyncTexSubImage2DParams tex_params = {target, level, xoffset, yoffset,
- width, height, format, type};
+ width, height, format, gl_type};
gfx::AsyncMemoryParams mem_params = {shared_memory, shm_size,
shm_data_offset, shm_data_size};
if (!texture->GetAsyncTransferState()) {
@@ -10374,6 +10401,13 @@ error::Error GLES2DecoderImpl::HandleAsyncTexSubImage2DCHROMIUM(
&define_params.height);
texture->GetLevelType(target, level, &define_params.type,
&define_params.internal_format);
+
+ // Update the internal_format and type for PixelTransferState if needed.
+ define_params.internal_format =
+ GetTexInternalFormat(define_params.internal_format,
+ define_params.internal_format, type);
+ define_params.type = GetTexType(define_params.type);
+
// Set up the async state if needed, and make the texture
// immutable so the async state stays valid.
texture->SetAsyncTransferState(
« no previous file with comments | « no previous file | gpu/command_buffer/tests/gl_oes_texture_half_float_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698