blob: 071e508dbc20a7d2fddf12ca7cc24bcb5dc2fce8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_
#define GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_
#include <stdint.h>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "gpu/blink/gpu_blink_export.h"
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/WebKit/public/platform/WebString.h"
namespace gpu {
namespace gles2 {
class GLES2Interface;
class GLES2ImplementationErrorMessageCallback;
struct ContextCreationAttribHelper;
}
}
namespace gpu_blink {
class WebGraphicsContext3DErrorMessageCallback;
class GPU_BLINK_EXPORT WebGraphicsContext3DImpl
: public NON_EXPORTED_BASE(blink::WebGraphicsContext3D) {
public:
~WebGraphicsContext3DImpl() override;
//----------------------------------------------------------------------
// WebGraphicsContext3D methods
bool getActiveAttrib(blink::WebGLId program,
blink::WGC3Duint index,
ActiveInfo&) override;
bool getActiveUniform(blink::WebGLId program,
blink::WGC3Duint index,
ActiveInfo&) override;
blink::WebString getProgramInfoLog(blink::WebGLId program) override;
blink::WebString getShaderInfoLog(blink::WebGLId shader) override;
blink::WebString getShaderSource(blink::WebGLId shader) override;
blink::WebString getTranslatedShaderSourceANGLE(
blink::WebGLId shader) override;
void setContextLostCallback(
WebGraphicsContext3D::WebGraphicsContextLostCallback* callback);
void setErrorMessageCallback(
WebGraphicsContext3D::WebGraphicsErrorMessageCallback* callback) override;
// WebGraphicsContext3D implementation.
::gpu::gles2::GLES2Interface* getGLES2Interface() override;
::gpu::gles2::GLES2Interface* GetGLInterface() {
return gl_;
}
// Convert WebGL context creation attributes into command buffer / EGL size
// requests.
static void ConvertAttributes(
const blink::WebGraphicsContext3D::Attributes& attributes,
::gpu::gles2::ContextCreationAttribHelper* output_attribs);
protected:
friend class WebGraphicsContext3DErrorMessageCallback;
WebGraphicsContext3DImpl();
::gpu::gles2::GLES2ImplementationErrorMessageCallback*
getErrorMessageCallback();
virtual void OnErrorMessage(const std::string& message, int id);
void SetGLInterface(::gpu::gles2::GLES2Interface* gl) { gl_ = gl; }
bool initialized_;
bool initialize_failed_;
WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_;
WebGraphicsContext3D::WebGraphicsErrorMessageCallback*
error_message_callback_;
scoped_ptr<WebGraphicsContext3DErrorMessageCallback>
client_error_message_callback_;
// Errors raised by synthesizeGLError().
std::vector<blink::WGC3Denum> synthetic_errors_;
::gpu::gles2::GLES2Interface* gl_;
bool lose_context_when_out_of_memory_;
};
} // namespace gpu_blink
#endif // GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_
|