Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
a413ef0b
E
engine
项目概览
liujiuri
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a413ef0b
编写于
8月 10, 2016
作者:
C
Chinmay Garde
提交者:
GitHub
8月 10, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
If GrGLContext setup fails, log OpenGL platform specific information. (#2897)
上级
1761ed15
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
274 addition
and
0 deletion
+274
-0
flow/BUILD.gn
flow/BUILD.gn
+2
-0
flow/gl_connection.cc
flow/gl_connection.cc
+183
-0
flow/gl_connection.h
flow/gl_connection.h
+72
-0
sky/shell/gpu/direct/ganesh_canvas.cc
sky/shell/gpu/direct/ganesh_canvas.cc
+17
-0
未找到文件。
flow/BUILD.gn
浏览文件 @
a413ef0b
...
...
@@ -6,6 +6,8 @@ source_set("flow") {
sources = [
"compositor_context.cc",
"compositor_context.h",
"gl_connection.cc",
"gl_connection.h",
"instrumentation.cc",
"instrumentation.h",
"layers/backdrop_filter_layer.cc",
...
...
flow/gl_connection.cc
0 → 100644
浏览文件 @
a413ef0b
// Copyright 2016 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.
#include "gl_connection.h"
#include <sstream>
#include <vector>
#include <algorithm>
#include <iomanip>
namespace
flow
{
static
std
::
string
GLGetString
(
GLenum
name
)
{
auto
string
=
reinterpret_cast
<
const
char
*>
(
glGetString
(
name
));
return
string
!=
nullptr
?
string
:
""
;
}
static
GLConnection
::
Version
GLGetVersion
(
GLenum
name
)
{
GLConnection
::
Version
version
;
auto
versionString
=
GLGetString
(
name
);
if
(
versionString
.
length
()
==
0
)
{
return
version
;
}
{
// Check for the GLSL ES prefix.
const
std
::
string
glslesPrefix
(
"OpenGL ES GLSL ES "
);
if
(
versionString
.
compare
(
0
,
glslesPrefix
.
length
(),
glslesPrefix
)
==
0
)
{
version
.
isES
=
true
;
versionString
=
versionString
.
substr
(
glslesPrefix
.
length
());
}
}
{
// Check for the GL ES prefix.
const
std
::
string
glesPrefix
(
"OpenGL ES "
);
if
(
versionString
.
compare
(
0
,
glesPrefix
.
length
(),
glesPrefix
)
==
0
)
{
version
.
isES
=
true
;
versionString
=
versionString
.
substr
(
glesPrefix
.
length
());
}
}
std
::
istringstream
stream
(
versionString
);
for
(
size_t
i
=
0
;
i
<
3
;
i
++
)
{
size_t
item
=
0
;
if
(
stream
>>
item
)
{
version
.
items
[
i
]
=
item
;
if
(
stream
.
peek
()
==
' '
)
{
stream
.
ignore
(
1
);
// space
stream
>>
version
.
vendorString
;
break
;
}
else
{
stream
.
ignore
(
1
);
// dot
}
}
else
{
break
;
}
}
return
version
;
}
static
std
::
string
VersionToString
(
GLConnection
::
Version
version
)
{
if
(
version
.
major
==
0
&&
version
.
minor
==
0
&&
version
.
release
==
0
)
{
return
"Unknown"
;
}
std
::
stringstream
stream
;
stream
<<
version
.
major
<<
"."
<<
version
.
minor
;
if
(
version
.
release
!=
0
)
{
stream
<<
"."
<<
version
.
release
;
}
if
(
version
.
vendorString
.
size
()
!=
0
)
{
stream
<<
" "
<<
version
.
vendorString
;
}
if
(
version
.
isES
)
{
stream
<<
" ES"
;
}
return
stream
.
str
();
}
GLConnection
::
GLConnection
()
:
vendor_
(
GLGetString
(
GL_VENDOR
)),
renderer_
(
GLGetString
(
GL_RENDERER
)),
version_
(
GLGetVersion
(
GL_VERSION
)),
shading_language_version_
(
GLGetVersion
(
GL_SHADING_LANGUAGE_VERSION
))
{
std
::
istringstream
extensionsStream
(
GLGetString
(
GL_EXTENSIONS
));
extensionsStream
>>
std
::
skipws
;
std
::
string
extension
;
while
(
extensionsStream
>>
extension
)
{
extensions_
.
emplace
(
std
::
move
(
extension
));
}
}
GLConnection
::~
GLConnection
()
=
default
;
const
std
::
string
&
GLConnection
::
Vendor
()
const
{
return
vendor_
;
}
const
std
::
string
&
GLConnection
::
Renderer
()
const
{
return
renderer_
;
}
const
GLConnection
::
Version
&
GLConnection
::
GLVersion
()
const
{
return
version_
;
}
std
::
string
GLConnection
::
VersionString
()
const
{
return
VersionToString
(
version_
);
}
const
GLConnection
::
Version
&
GLConnection
::
ShadingLanguageVersion
()
const
{
return
shading_language_version_
;
}
std
::
string
GLConnection
::
ShadingLanguageVersionString
()
const
{
return
VersionToString
(
shading_language_version_
);
}
std
::
string
GLConnection
::
Platform
()
const
{
std
::
stringstream
stream
;
stream
<<
Vendor
()
<<
": "
<<
Renderer
();
return
stream
.
str
();
}
const
std
::
set
<
std
::
string
>&
GLConnection
::
Extensions
()
const
{
return
extensions_
;
}
std
::
string
GLConnection
::
Description
()
const
{
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>
items
;
items
.
emplace_back
(
"Vendor"
,
Vendor
());
items
.
emplace_back
(
"Renderer"
,
Renderer
());
items
.
emplace_back
(
"Version"
,
VersionString
());
items
.
emplace_back
(
"Shader Version"
,
ShadingLanguageVersionString
());
std
::
string
extensionsLabel
(
"Extensions"
);
size_t
padding
=
extensionsLabel
.
size
();
for
(
const
auto
&
item
:
items
)
{
padding
=
std
::
max
(
padding
,
item
.
first
.
size
());
}
padding
+=
1
;
std
::
stringstream
stream
;
stream
<<
std
::
endl
;
for
(
const
auto
&
item
:
items
)
{
stream
<<
std
::
setw
(
padding
)
<<
item
.
first
<<
std
::
setw
(
0
)
<<
": "
<<
item
.
second
<<
std
::
endl
;
}
if
(
extensions_
.
size
()
!=
0
)
{
std
::
string
paddingString
;
paddingString
.
resize
(
padding
+
2
,
' '
);
stream
<<
std
::
setw
(
padding
)
<<
extensionsLabel
<<
std
::
setw
(
0
)
<<
": "
<<
extensions_
.
size
()
<<
" Available"
<<
std
::
endl
;
for
(
const
auto
&
extension
:
extensions_
)
{
stream
<<
paddingString
<<
extension
<<
std
::
endl
;
}
}
return
stream
.
str
();
}
}
// namespace flow
flow/gl_connection.h
0 → 100644
浏览文件 @
a413ef0b
// Copyright 2016 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 FLOW_GL_CONNECTION_H_
#define FLOW_GL_CONNECTION_H_
#include "lib/ftl/macros.h"
#include "open_gl.h"
#include <string>
#include <set>
namespace
flow
{
class
GLConnection
{
public:
struct
Version
{
union
{
struct
{
size_t
major
;
size_t
minor
;
size_t
release
;
};
size_t
items
[
3
];
};
std
::
string
vendorString
;
bool
isES
;
Version
()
:
major
(
0
),
minor
(
0
),
release
(
0
),
isES
(
false
)
{}
Version
(
size_t
theMajor
,
size_t
theMinor
,
size_t
theRelease
)
:
major
(
theMajor
),
minor
(
theMinor
),
release
(
theRelease
),
isES
(
false
)
{}
};
GLConnection
();
~
GLConnection
();
const
std
::
string
&
Vendor
()
const
;
const
std
::
string
&
Renderer
()
const
;
std
::
string
Platform
()
const
;
const
Version
&
GLVersion
()
const
;
std
::
string
VersionString
()
const
;
const
Version
&
ShadingLanguageVersion
()
const
;
std
::
string
ShadingLanguageVersionString
()
const
;
const
std
::
set
<
std
::
string
>&
Extensions
()
const
;
std
::
string
Description
()
const
;
private:
std
::
string
vendor_
;
std
::
string
renderer_
;
Version
version_
;
Version
shading_language_version_
;
std
::
set
<
std
::
string
>
extensions_
;
FTL_DISALLOW_COPY_AND_ASSIGN
(
GLConnection
);
};
}
// namespace flow
#endif // FLOW_GL_CONNECTION_H_
\ No newline at end of file
sky/shell/gpu/direct/ganesh_canvas.cc
浏览文件 @
a413ef0b
...
...
@@ -7,6 +7,7 @@
#include "lib/ftl/arraysize.h"
#include "lib/ftl/logging.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
#include "flutter/flow/gl_connection.h"
namespace
sky
{
namespace
shell
{
...
...
@@ -32,6 +33,22 @@ bool GaneshCanvas::SetupGrGLInterface() {
kOpenGL_GrBackend
,
reinterpret_cast
<
GrBackendContext
>
(
GrGLCreateNativeInterface
())));
#ifndef NDEBUG
// In debug mode, always log the GL connection description.
{
flow
::
GLConnection
connection
;
FTL_LOG
(
INFO
)
<<
connection
.
Description
();
}
#else
// In release mode, log the GL connection description in case of gr_context
// setup failure.
if
(
gr_context_
==
nullptr
)
{
flow
::
GLConnection
connection
;
FTL_LOG
(
INFO
)
<<
"Failed to setup GL context. Aborting."
;
FTL_LOG
(
INFO
)
<<
connection
.
Description
();
}
#endif
if
(
!
gr_context_
)
return
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录