summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-30 10:38:21 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-30 10:38:21 +0000
commitd670e70e583e3e43d497c758f972f32b12846d77 (patch)
tree1deb5e2227903407cdc9f68ebf8735a72243c30a /gpu
parent307655cecbfdb3e4856bb9d978e935c4547d654a (diff)
downloadchromium_src-d670e70e583e3e43d497c758f972f32b12846d77.zip
chromium_src-d670e70e583e3e43d497c758f972f32b12846d77.tar.gz
chromium_src-d670e70e583e3e43d497c758f972f32b12846d77.tar.bz2
Fix GL resource sharing
There were 2 bugs. 1) content_gl_context.cc should have been setting bind_generates_resource to false. It should be false for everything but pepper. 2) bind_generates_resource was not getting propogated to the GPU process. TEST=ran in debugger to see that bind_generates_resource is correctly set to false in GPU process BUG=none R=apatrick@chromium.org Review URL: http://codereview.chromium.org/9932002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129822 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils.cc91
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils.h20
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc95
3 files changed, 111 insertions, 95 deletions
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc
index 19d5f6c..aa4abe1 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.cc
+++ b/gpu/command_buffer/common/gles2_cmd_utils.cc
@@ -626,6 +626,97 @@ std::string GLES2Util::GetQualifiedEnumString(
return GetStringEnum(value);
}
+ContextCreationAttribParser::ContextCreationAttribParser()
+ : alpha_size_(-1),
+ blue_size_(-1),
+ green_size_(-1),
+ red_size_(-1),
+ depth_size_(-1),
+ stencil_size_(-1),
+ samples_(-1),
+ sample_buffers_(-1),
+ buffer_preserved_(true),
+ share_resources_(false),
+ bind_generates_resource_(true) {
+}
+
+bool ContextCreationAttribParser::Parse(const std::vector<int32>& attribs) {
+ // From <EGL/egl.h>.
+ const int32 EGL_ALPHA_SIZE = 0x3021;
+ const int32 EGL_BLUE_SIZE = 0x3022;
+ const int32 EGL_GREEN_SIZE = 0x3023;
+ const int32 EGL_RED_SIZE = 0x3024;
+ const int32 EGL_DEPTH_SIZE = 0x3025;
+ const int32 EGL_STENCIL_SIZE = 0x3026;
+ const int32 EGL_SAMPLES = 0x3031;
+ const int32 EGL_SAMPLE_BUFFERS = 0x3032;
+ const int32 EGL_NONE = 0x3038;
+ const int32 EGL_SWAP_BEHAVIOR = 0x3093;
+ const int32 EGL_BUFFER_PRESERVED = 0x3094;
+
+ // Chromium only.
+ const int32 SHARE_RESOURCES = 0x10000;
+ const int32 BIND_GENERATES_RESOURCES = 0x10001;
+
+ for (size_t i = 0; i < attribs.size(); i += 2) {
+ const int32 attrib = attribs[i];
+ if (i + 1 >= attribs.size()) {
+ if (attrib == EGL_NONE) {
+ return true;
+ }
+
+ GPU_DLOG(ERROR) << "Missing value after context creation attribute: "
+ << attrib;
+ return false;
+ }
+
+ const int32 value = attribs[i+1];
+ switch (attrib) {
+ case EGL_ALPHA_SIZE:
+ alpha_size_ = value;
+ break;
+ case EGL_BLUE_SIZE:
+ blue_size_ = value;
+ break;
+ case EGL_GREEN_SIZE:
+ green_size_ = value;
+ break;
+ case EGL_RED_SIZE:
+ red_size_ = value;
+ break;
+ case EGL_DEPTH_SIZE:
+ depth_size_ = value;
+ break;
+ case EGL_STENCIL_SIZE:
+ stencil_size_ = value;
+ break;
+ case EGL_SAMPLES:
+ samples_ = value;
+ break;
+ case EGL_SAMPLE_BUFFERS:
+ sample_buffers_ = value;
+ break;
+ case EGL_SWAP_BEHAVIOR:
+ buffer_preserved_ = value == EGL_BUFFER_PRESERVED;
+ break;
+ case SHARE_RESOURCES:
+ share_resources_ = value != 0;
+ break;
+ case BIND_GENERATES_RESOURCES:
+ bind_generates_resource_ = value != 0;
+ break;
+ case EGL_NONE:
+ // Terminate list, even if more attributes.
+ return true;
+ default:
+ GPU_DLOG(ERROR) << "Invalid context creation attribute: " << attrib;
+ return false;
+ }
+ }
+
+ return true;
+}
+
#include "../common/gles2_cmd_utils_implementation_autogen.h"
} // namespace gles2
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.h b/gpu/command_buffer/common/gles2_cmd_utils.h
index f6bb501..fd014a1 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.h
+++ b/gpu/command_buffer/common/gles2_cmd_utils.h
@@ -9,6 +9,7 @@
#define GPU_COMMAND_BUFFER_COMMON_GLES2_CMD_UTILS_H_
#include <string>
+#include <vector>
#include "../common/types.h"
#include "gpu/command_buffer/common/gles2_utils_export.h"
@@ -147,6 +148,25 @@ class GLES2_UTILS_EXPORT GLES2Util {
int num_shader_binary_formats_;
};
+class GLES2_UTILS_EXPORT ContextCreationAttribParser {
+ public:
+ ContextCreationAttribParser();
+ bool Parse(const std::vector<int32>& attribs);
+
+ // -1 if invalid or unspecified.
+ int32 alpha_size_;
+ int32 blue_size_;
+ int32 green_size_;
+ int32 red_size_;
+ int32 depth_size_;
+ int32 stencil_size_;
+ int32 samples_;
+ int32 sample_buffers_;
+ bool buffer_preserved_;
+ bool share_resources_;
+ bool bind_generates_resource_;
+};
+
} // namespace gles2
} // namespace gpu
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 8c03173..90fc797 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -421,101 +421,6 @@ class FrameBuffer {
DISALLOW_COPY_AND_ASSIGN(FrameBuffer);
};
-class ContextCreationAttribParser {
- public:
- ContextCreationAttribParser();
- bool Parse(const std::vector<int32>& attribs);
-
- // -1 if invalid or unspecified.
- int32 alpha_size_;
- int32 blue_size_;
- int32 green_size_;
- int32 red_size_;
- int32 depth_size_;
- int32 stencil_size_;
- int32 samples_;
- int32 sample_buffers_;
- bool buffer_preserved_;
-};
-
-ContextCreationAttribParser::ContextCreationAttribParser()
- : alpha_size_(-1),
- blue_size_(-1),
- green_size_(-1),
- red_size_(-1),
- depth_size_(-1),
- stencil_size_(-1),
- samples_(-1),
- sample_buffers_(-1),
- buffer_preserved_(true) {
-}
-
-bool ContextCreationAttribParser::Parse(const std::vector<int32>& attribs) {
- // From <EGL/egl.h>.
- const int32 EGL_ALPHA_SIZE = 0x3021;
- const int32 EGL_BLUE_SIZE = 0x3022;
- const int32 EGL_GREEN_SIZE = 0x3023;
- const int32 EGL_RED_SIZE = 0x3024;
- const int32 EGL_DEPTH_SIZE = 0x3025;
- const int32 EGL_STENCIL_SIZE = 0x3026;
- const int32 EGL_SAMPLES = 0x3031;
- const int32 EGL_SAMPLE_BUFFERS = 0x3032;
- const int32 EGL_NONE = 0x3038;
- const int32 EGL_SWAP_BEHAVIOR = 0x3093;
- const int32 EGL_BUFFER_PRESERVED = 0x3094;
-
- for (size_t i = 0; i < attribs.size(); i += 2) {
- const int32 attrib = attribs[i];
- if (i + 1 >= attribs.size()) {
- if (attrib == EGL_NONE)
- return true;
-
- DLOG(ERROR) << "Missing value after context creation attribute: "
- << attrib;
- return false;
- }
-
- const int32 value = attribs[i+1];
- switch (attrib) {
- case EGL_ALPHA_SIZE:
- alpha_size_ = value;
- break;
- case EGL_BLUE_SIZE:
- blue_size_ = value;
- break;
- case EGL_GREEN_SIZE:
- green_size_ = value;
- break;
- case EGL_RED_SIZE:
- red_size_ = value;
- break;
- case EGL_DEPTH_SIZE:
- depth_size_ = value;
- break;
- case EGL_STENCIL_SIZE:
- stencil_size_ = value;
- break;
- case EGL_SAMPLES:
- samples_ = value;
- break;
- case EGL_SAMPLE_BUFFERS:
- sample_buffers_ = value;
- break;
- case EGL_SWAP_BEHAVIOR:
- buffer_preserved_ = value == EGL_BUFFER_PRESERVED;
- break;
- case EGL_NONE:
- // Terminate list, even if more attributes.
- return true;
- default:
- DLOG(ERROR) << "Invalid context creation attribute: " << attrib;
- return false;
- }
- }
-
- return true;
-}
-
// } // anonymous namespace.
bool GLES2Decoder::GetServiceTextureId(uint32 client_texture_id,