summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/client
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-17 14:47:16 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-17 14:47:16 +0000
commitb6140d086d71667131111b1c85090e7023311942 (patch)
tree16a2889f424d11ef6f15cdb4eded7cad5923761b /gpu/command_buffer/client
parent1e0887fb4c08fbfb9421aede24a627e7bb903276 (diff)
downloadchromium_src-b6140d086d71667131111b1c85090e7023311942.zip
chromium_src-b6140d086d71667131111b1c85090e7023311942.tar.gz
chromium_src-b6140d086d71667131111b1c85090e7023311942.tar.bz2
Adds support for compressed textures. DXT1 only.
This is a temporary implementation. The real implementation will require *) glGetString to return "GL_EXT_texture_compression_dxt1" *) CommandBufferEnable("GL_EXT_texture_compression_dxt1") to dynamically modify the validation after it has made sure the "GL_EXT_texture_compression_dxt1" is returned from the system level GL TEST=none BUG=none Review URL: http://codereview.chromium.org/2136003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47417 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/client')
-rw-r--r--gpu/command_buffer/client/gles2_cmd_helper_autogen.h16
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc36
2 files changed, 30 insertions, 22 deletions
diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
index 1cbc45f..25394d0 100644
--- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
+++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
@@ -175,6 +175,14 @@
c.Init(target, level, internalformat, width, height, border, imageSize);
}
+ void CompressedTexImage2DBucket(
+ GLenum target, GLint level, GLenum internalformat, GLsizei width,
+ GLsizei height, GLint border, GLuint bucket_id) {
+ gles2::CompressedTexImage2DBucket& c =
+ GetCmdSpace<gles2::CompressedTexImage2DBucket>();
+ c.Init(target, level, internalformat, width, height, border, bucket_id);
+ }
+
void CompressedTexSubImage2D(
GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
GLsizei height, GLenum format, GLsizei imageSize, uint32 data_shm_id,
@@ -196,6 +204,14 @@
c.Init(target, level, xoffset, yoffset, width, height, format, imageSize);
}
+ void CompressedTexSubImage2DBucket(
+ GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
+ GLsizei height, GLenum format, GLuint bucket_id) {
+ gles2::CompressedTexSubImage2DBucket& c =
+ GetCmdSpace<gles2::CompressedTexSubImage2DBucket>();
+ c.Init(target, level, xoffset, yoffset, width, height, format, bucket_id);
+ }
+
void CopyTexImage2D(
GLenum target, GLint level, GLenum internalformat, GLint x, GLint y,
GLsizei width, GLsizei height, GLint border) {
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index f460329..a74d2982 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -892,17 +892,13 @@ void GLES2Implementation::CompressedTexImage2D(
if (height == 0 || width == 0) {
return;
}
- // TODO(gman): Switch to use buckets always or at least if no room in shared
- // memory.
- DCHECK_LE(image_size,
- static_cast<GLsizei>(
- transfer_buffer_.GetLargestFreeOrPendingSize()));
- void* buffer = transfer_buffer_.Alloc(image_size);
- memcpy(buffer, data, image_size);
- helper_->CompressedTexImage2D(
- target, level, internalformat, width, height, border, image_size,
- transfer_buffer_id_, transfer_buffer_.GetOffset(buffer));
- transfer_buffer_.FreePendingToken(buffer, helper_->InsertToken());
+ SetBucketContents(kResultBucketId, data, image_size);
+ helper_->CompressedTexImage2DBucket(
+ target, level, internalformat, width, height, border, kResultBucketId);
+ // Free the bucket. This is not required but it does free up the memory.
+ // and we don't have to wait for the result so from the client's perspective
+ // it's cheap.
+ helper_->SetBucketSize(kResultBucketId, 0);
}
void GLES2Implementation::CompressedTexSubImage2D(
@@ -912,17 +908,13 @@ void GLES2Implementation::CompressedTexSubImage2D(
SetGLError(GL_INVALID_VALUE, "glCompressedTexSubImage2D dimension < 0");
return;
}
- // TODO(gman): Switch to use buckets always or at least if no room in shared
- // memory.
- DCHECK_LE(image_size,
- static_cast<GLsizei>(
- transfer_buffer_.GetLargestFreeOrPendingSize()));
- void* buffer = transfer_buffer_.Alloc(image_size);
- memcpy(buffer, data, image_size);
- helper_->CompressedTexSubImage2D(
- target, level, xoffset, yoffset, width, height, format, image_size,
- transfer_buffer_id_, transfer_buffer_.GetOffset(buffer));
- transfer_buffer_.FreePendingToken(buffer, helper_->InsertToken());
+ SetBucketContents(kResultBucketId, data, image_size);
+ helper_->CompressedTexSubImage2DBucket(
+ target, level, xoffset, yoffset, width, height, format, kResultBucketId);
+ // Free the bucket. This is not required but it does free up the memory.
+ // and we don't have to wait for the result so from the client's perspective
+ // it's cheap.
+ helper_->SetBucketSize(kResultBucketId, 0);
}
void GLES2Implementation::TexImage2D(