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

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

Issue 1143393007: Teach GPU command buffer whether a context is webgl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
Index: gpu/command_buffer/service/context_group.cc
diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc
index 98ebbdbd033b0e93339a1395fcb08dde3193e89d..bd8af8fd4d59624514e81a72611857875d30c548 100644
--- a/gpu/command_buffer/service/context_group.cc
+++ b/gpu/command_buffer/service/context_group.cc
@@ -35,7 +35,8 @@ ContextGroup::ContextGroup(
const scoped_refptr<SubscriptionRefSet>& subscription_ref_set,
const scoped_refptr<ValueStateMap>& pending_valuebuffer_state,
bool bind_generates_resource)
- : mailbox_manager_(mailbox_manager),
+ : context_type_(kContextTypeUndefined),
+ mailbox_manager_(mailbox_manager),
memory_tracker_(memory_tracker),
shader_translator_cache_(shader_translator_cache),
subscription_ref_set_(subscription_ref_set),
@@ -76,9 +77,38 @@ static void GetIntegerv(GLenum pname, uint32* var) {
*var = value;
}
+// static
+ContextGroup::ContextType ContextGroup::GetContextType(
+ unsigned webgl_version) {
+ switch (webgl_version) {
+ case 0:
+ return kContextTypeOther;
+ case 1:
+ return kContextTypeWebGL1;
+ case 2:
+ return kContextTypeWebGL2;
+ default:
+ return kContextTypeUndefined;
+ }
+}
+
bool ContextGroup::Initialize(
GLES2Decoder* decoder,
+ ContextGroup::ContextType context_type,
const DisallowedFeatures& disallowed_features) {
+ if (context_type == kContextTypeUndefined) {
+ LOG(ERROR) << "ContextGroup::Initialize failed because of unknown "
+ << "context type.";
+ return false;
+ }
+ if (context_type_ == kContextTypeUndefined) {
+ context_type_ = context_type;
+ } else if (context_type_ != context_type) {
+ LOG(ERROR) << "ContextGroup::Initialize failed because the type of "
+ << "the context does not fit with the group.";
+ return false;
+ }
+
// If we've already initialized the group just add the context.
if (HaveContexts()) {
decoders_.push_back(base::AsWeakPtr<GLES2Decoder>(decoder));

Powered by Google App Engine
This is Rietveld 408576698