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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/OESVertexArrayObject.cpp

Issue 1387743002: Fixed expando-loss.html test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 { 57 {
58 WebGLExtensionScopedContext scoped(this); 58 WebGLExtensionScopedContext scoped(this);
59 if (scoped.isLost()) 59 if (scoped.isLost())
60 return nullptr; 60 return nullptr;
61 61
62 WebGLVertexArrayObjectOES* o = WebGLVertexArrayObjectOES::create(scoped.cont ext(), WebGLVertexArrayObjectOES::VaoTypeUser); 62 WebGLVertexArrayObjectOES* o = WebGLVertexArrayObjectOES::create(scoped.cont ext(), WebGLVertexArrayObjectOES::VaoTypeUser);
63 scoped.context()->addContextObject(o); 63 scoped.context()->addContextObject(o);
64 return o; 64 return o;
65 } 65 }
66 66
67 void OESVertexArrayObject::deleteVertexArrayOES(WebGLVertexArrayObjectOES* array Object) 67 void OESVertexArrayObject::deleteVertexArrayOES(ScriptState* scriptState, WebGLV ertexArrayObjectOES* arrayObject)
68 { 68 {
69 WebGLExtensionScopedContext scoped(this); 69 WebGLExtensionScopedContext scoped(this);
70 if (!arrayObject || scoped.isLost()) 70 if (!arrayObject || scoped.isLost())
71 return; 71 return;
72 72
73 if (!arrayObject->isDefaultObject() && arrayObject == scoped.context()->m_bo undVertexArrayObject) 73 if (!arrayObject->isDefaultObject() && arrayObject == scoped.context()->m_bo undVertexArrayObject)
74 scoped.context()->setBoundVertexArrayObject(nullptr); 74 scoped.context()->setBoundVertexArrayObject(scriptState, nullptr);
75 75
76 arrayObject->deleteObject(scoped.context()->webContext()); 76 arrayObject->deleteObject(scoped.context()->webContext());
77 } 77 }
78 78
79 GLboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* arra yObject) 79 GLboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* arra yObject)
80 { 80 {
81 WebGLExtensionScopedContext scoped(this); 81 WebGLExtensionScopedContext scoped(this);
82 if (!arrayObject || scoped.isLost()) 82 if (!arrayObject || scoped.isLost())
83 return 0; 83 return 0;
84 84
85 if (!arrayObject->hasEverBeenBound()) 85 if (!arrayObject->hasEverBeenBound())
86 return 0; 86 return 0;
87 87
88 return scoped.context()->webContext()->isVertexArrayOES(arrayObject->object( )); 88 return scoped.context()->webContext()->isVertexArrayOES(arrayObject->object( ));
89 } 89 }
90 90
91 void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayOb ject) 91 void OESVertexArrayObject::bindVertexArrayOES(ScriptState* scriptState, WebGLVer texArrayObjectOES* arrayObject)
92 { 92 {
93 WebGLExtensionScopedContext scoped(this); 93 WebGLExtensionScopedContext scoped(this);
94 if (scoped.isLost()) 94 if (scoped.isLost())
95 return; 95 return;
96 96
97 if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, sc oped.context()))) { 97 if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, sc oped.context()))) {
98 scoped.context()->webContext()->synthesizeGLError(GL_INVALID_OPERATION); 98 scoped.context()->webContext()->synthesizeGLError(GL_INVALID_OPERATION);
99 return; 99 return;
100 } 100 }
101 101
102 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) { 102 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) {
103 scoped.context()->webContext()->bindVertexArrayOES(arrayObject->object() ); 103 scoped.context()->webContext()->bindVertexArrayOES(arrayObject->object() );
104 104
105 arrayObject->setHasEverBeenBound(); 105 arrayObject->setHasEverBeenBound();
106 scoped.context()->setBoundVertexArrayObject(arrayObject); 106 scoped.context()->setBoundVertexArrayObject(scriptState, arrayObject);
107 } else { 107 } else {
108 scoped.context()->webContext()->bindVertexArrayOES(0); 108 scoped.context()->webContext()->bindVertexArrayOES(0);
109 scoped.context()->setBoundVertexArrayObject(nullptr); 109 scoped.context()->setBoundVertexArrayObject(scriptState, nullptr);
110 } 110 }
111 } 111 }
112 112
113 bool OESVertexArrayObject::supported(WebGLRenderingContextBase* context) 113 bool OESVertexArrayObject::supported(WebGLRenderingContextBase* context)
114 { 114 {
115 return context->extensionsUtil()->supportsExtension("GL_OES_vertex_array_obj ect"); 115 return context->extensionsUtil()->supportsExtension("GL_OES_vertex_array_obj ect");
116 } 116 }
117 117
118 const char* OESVertexArrayObject::extensionName() 118 const char* OESVertexArrayObject::extensionName()
119 { 119 {
120 return "OES_vertex_array_object"; 120 return "OES_vertex_array_object";
121 } 121 }
122 122
123 } // namespace blink 123 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698