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

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

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/error_state.cc ('k') | gpu/command_buffer/service/image_factory.h » ('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 baa51b8c1772f2454557165959e3c72fa5fcdba2..5b5b9083daa14d2e1e46e8c2a299dd96bf851306 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -682,6 +682,7 @@ class GLES2DecoderImpl : public GLES2Decoder,
void OnTextureRefDetachedFromFramebuffer(TextureRef* texture) override;
// Overriden from ErrorStateClient.
+ void OnContextLostError() override;
void OnOutOfMemoryError() override;
// Ensure Renderbuffer corresponding to last DoBindRenderbuffer() is bound.
@@ -2642,6 +2643,7 @@ bool GLES2DecoderImpl::Initialize(
has_robustness_extension_ =
context->HasExtension("GL_ARB_robustness") ||
+ context->HasExtension("GL_KHR_robustness") ||
context->HasExtension("GL_EXT_robustness");
if (!InitializeShaderTranslator()) {
@@ -6480,21 +6482,22 @@ bool GLES2DecoderImpl::SimulateFixedAttribs(
if (attrib_info &&
attrib->CanAccess(max_accessed) &&
attrib->type() == GL_FIXED) {
- int num_elements = attrib->size() * kSizeOfFloat;
- int size = num_elements * num_vertices;
- scoped_ptr<float[]> data(new float[size]);
+ int num_elements = attrib->size() * num_vertices;
+ const int src_size = num_elements * sizeof(int32);
+ const int dst_size = num_elements * sizeof(float);
+ scoped_ptr<float[]> data(new float[num_elements]);
const int32* src = reinterpret_cast<const int32 *>(
- attrib->buffer()->GetRange(attrib->offset(), size));
+ attrib->buffer()->GetRange(attrib->offset(), src_size));
const int32* end = src + num_elements;
float* dst = data.get();
while (src != end) {
*dst++ = static_cast<float>(*src++) / 65536.0f;
}
- glBufferSubData(GL_ARRAY_BUFFER, offset, size, data.get());
+ glBufferSubData(GL_ARRAY_BUFFER, offset, dst_size, data.get());
glVertexAttribPointer(
attrib->index(), attrib->size(), GL_FLOAT, false, 0,
reinterpret_cast<GLvoid*>(offset));
- offset += size;
+ offset += dst_size;
}
}
*simulated = true;
@@ -9733,6 +9736,23 @@ void GLES2DecoderImpl::LoseContext(uint32 reset_status) {
return;
}
+ if (workarounds().use_virtualized_gl_contexts) {
+ // If the context is virtual, the real context being guilty does not ensure
+ // that the virtual context is guilty.
+ if (reset_status == GL_GUILTY_CONTEXT_RESET_ARB) {
+ reset_status = GL_UNKNOWN_CONTEXT_RESET_ARB;
+ }
+ } else if (reset_status == GL_UNKNOWN_CONTEXT_RESET_ARB &&
+ has_robustness_extension_) {
+ // If the reason for the call was a GL error, we can try to determine the
+ // reset status more accurately.
+ GLenum driver_status = glGetGraphicsResetStatusARB();
+ if (driver_status == GL_GUILTY_CONTEXT_RESET_ARB ||
+ driver_status == GL_INNOCENT_CONTEXT_RESET_ARB) {
+ reset_status = driver_status;
+ }
+ }
+
// Marks this context as lost.
reset_status_ = reset_status;
current_decoder_error_ = error::kLostContext;
@@ -11224,10 +11244,13 @@ void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer(
DoDidUseTexImageIfNeeded(texture, texture->target());
}
+void GLES2DecoderImpl::OnContextLostError() {
+ group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB);
+}
+
void GLES2DecoderImpl::OnOutOfMemoryError() {
if (lose_context_when_out_of_memory_) {
group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB);
- LoseContext(GL_GUILTY_CONTEXT_RESET_ARB);
}
}
« no previous file with comments | « gpu/command_buffer/service/error_state.cc ('k') | gpu/command_buffer/service/image_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698