ARCore move: move vr_gl_util.h/.cc out of chrome/browser/vr
Step 2/N of moving ARCore device into device/vr. Previous step: https://crrev.com/c/2341811. Changes: - move vr_gl_util.h/.cc out of chrome/browser/vr/ into device/vr/ - it will be needed there once ar_renderer.cc gets moved - move gl_bindings.h out of chrome/browser/vr/ into /device/vr/ - the vr_gl_util.h depends on them - chrome/browser/vr:vr_ui now depends on //device/vr:vr_base for the vr_gl_util.h/.cc files - move vr_gl_mode config & vr_gl_bindings source set from chrome/browser/vr into device/vr - move use_command_buffer into device/vr/buildflags/buildflags.gni Bug: 843374 Change-Id: I4e5c4b50a1ff7e256ccebbf06da74700ad3bc9fe Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2405538 Reviewed-by: Alexander Cooper <alcooper@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Commit-Queue: Piotr Bialecki <bialpio@chromium.org> Cr-Commit-Position: refs/heads/master@{#807082}
This commit is contained in:

committed by
Commit Bot

parent
bf93c9b4e6
commit
cca43ca11b
chrome/browser
android
vr
vr
BUILD.gn
elements
renderers
base_quad_renderer.ccbase_renderer.ccbase_renderer.hexternal_textured_quad_renderer.ccradial_gradient_quad_renderer.cctexture_copy_renderer.cctextured_quad_renderer.cctransparent_quad_renderer.cc
skia_surface_provider.htest
ui_renderer.ccdevice/vr
@ -5,7 +5,7 @@
|
||||
#include "chrome/browser/android/vr/arcore_device/ar_renderer.h"
|
||||
|
||||
#include "base/stl_util.h"
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
|
||||
namespace device {
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "chrome/browser/android/vr/gvr_util.h"
|
||||
#include "chrome/browser/vr/gl_texture_location.h"
|
||||
#include "chrome/browser/vr/vr_geometry_util.h"
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
#include "third_party/skia/include/core/SkImageEncoder.h"
|
||||
#include "third_party/skia/include/core/SkPixmap.h"
|
||||
#include "ui/gfx/geometry/angle_conversions.h"
|
||||
|
@ -22,19 +22,6 @@ buildflag_header("vr_buildflags") {
|
||||
flags = [ "USE_VR_ASSETS_COMPONENT=$use_vr_assets_component" ]
|
||||
}
|
||||
|
||||
use_command_buffer = is_win
|
||||
|
||||
config("vr_gl_mode") {
|
||||
if (use_command_buffer) {
|
||||
defines = [
|
||||
"VR_USE_COMMAND_BUFFER",
|
||||
"GL_GLEXT_PROTOTYPES",
|
||||
]
|
||||
} else {
|
||||
defines = [ "VR_USE_NATIVE_GL" ]
|
||||
}
|
||||
}
|
||||
|
||||
component("vr_ui") {
|
||||
sources = [
|
||||
"animation.cc",
|
||||
@ -190,6 +177,7 @@ component("vr_ui") {
|
||||
"//components/url_formatter",
|
||||
"//components/vector_icons",
|
||||
"//device/base",
|
||||
"//device/vr:vr_base",
|
||||
"//device/vr/buildflags:buildflags",
|
||||
"//media",
|
||||
"//net",
|
||||
@ -329,7 +317,6 @@ component("vr_base") {
|
||||
"content_input_delegate.h",
|
||||
"exit_vr_prompt_choice.h",
|
||||
"fov_rectangle.h",
|
||||
"gl_bindings.h",
|
||||
"gl_texture_location.h",
|
||||
"input_event.cc",
|
||||
"input_event.h",
|
||||
@ -377,8 +364,6 @@ component("vr_base") {
|
||||
"vr_base_export.h",
|
||||
"vr_geometry_util.cc",
|
||||
"vr_geometry_util.h",
|
||||
"vr_gl_util.cc",
|
||||
"vr_gl_util.h",
|
||||
]
|
||||
|
||||
sources += [
|
||||
@ -390,10 +375,10 @@ component("vr_base") {
|
||||
|
||||
public_deps = [
|
||||
":vr_buildflags",
|
||||
":vr_gl_bindings",
|
||||
"//components/omnibox/browser",
|
||||
"//components/strings:components_strings_grit",
|
||||
"//content/public/common",
|
||||
"//device/vr:vr_gl_bindings",
|
||||
"//device/vr/public/cpp",
|
||||
"//ui/base",
|
||||
]
|
||||
@ -418,16 +403,6 @@ component("vr_base") {
|
||||
}
|
||||
}
|
||||
|
||||
source_set("vr_gl_bindings") {
|
||||
sources = [ "gl_bindings.h" ]
|
||||
public_configs = [ ":vr_gl_mode" ]
|
||||
if (use_command_buffer) {
|
||||
public_deps = [ "//gpu/command_buffer/client:gles2_c_lib" ]
|
||||
} else {
|
||||
public_deps = [ "//ui/gl" ]
|
||||
}
|
||||
}
|
||||
|
||||
test("vr_common_unittests") {
|
||||
sources = [
|
||||
"animation_unittest.cc",
|
||||
@ -592,8 +567,8 @@ source_set("vr_gl_test_support") {
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
":vr_gl_bindings",
|
||||
"//base/test:test_support",
|
||||
"//device/vr:vr_gl_bindings",
|
||||
"//skia",
|
||||
"//testing/gtest",
|
||||
]
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "cc/animation/keyframed_animation_curve.h"
|
||||
#include "chrome/browser/vr/ui_element_renderer.h"
|
||||
#include "chrome/browser/vr/ui_scene_constants.h"
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
|
||||
namespace vr {
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "chrome/browser/vr/model/assets.h"
|
||||
#include "chrome/browser/vr/skia_surface_provider.h"
|
||||
#include "chrome/browser/vr/ui_element_renderer.h"
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "third_party/skia/include/core/SkCanvas.h"
|
||||
#include "third_party/skia/include/core/SkSurface.h"
|
||||
|
@ -6,8 +6,8 @@
|
||||
#define CHROME_BROWSER_VR_ELEMENTS_ENVIRONMENT_BACKGROUND_H_
|
||||
|
||||
#include "chrome/browser/vr/elements/ui_element.h"
|
||||
#include "chrome/browser/vr/gl_bindings.h"
|
||||
#include "chrome/browser/vr/renderers/base_quad_renderer.h"
|
||||
#include "device/vr/gl_bindings.h"
|
||||
#include "third_party/skia/include/core/SkRefCnt.h"
|
||||
|
||||
class SkBitmap;
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "chrome/browser/vr/target_property.h"
|
||||
#include "chrome/browser/vr/ui_element_renderer.h"
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
|
||||
namespace vr {
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "base/stl_util.h"
|
||||
#include "chrome/browser/vr/ui_element_renderer.h"
|
||||
#include "chrome/browser/vr/ui_scene_constants.h"
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
#include "ui/gfx/animation/tween.h"
|
||||
|
||||
namespace vr {
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "chrome/browser/vr/model/model.h"
|
||||
#include "chrome/browser/vr/ui_element_renderer.h"
|
||||
#include "chrome/browser/vr/ui_scene_constants.h"
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
|
||||
namespace vr {
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "chrome/browser/vr/ui_scene.h"
|
||||
#include "chrome/browser/vr/ui_scene_constants.h"
|
||||
#include "chrome/browser/vr/vector_icons/vector_icons.h"
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
|
||||
namespace vr {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "base/numerics/ranges.h"
|
||||
#include "chrome/browser/vr/ui_element_renderer.h"
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
#include "ui/gfx/animation/tween.h"
|
||||
|
||||
namespace vr {
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "chrome/browser/vr/elements/ui_element.h"
|
||||
#include "chrome/browser/vr/gl_bindings.h"
|
||||
#include "chrome/browser/vr/vr_ui_export.h"
|
||||
#include "device/vr/gl_bindings.h"
|
||||
#include "third_party/skia/include/core/SkRefCnt.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "base/time/time.h"
|
||||
#include "chrome/browser/vr/input_event.h"
|
||||
#include "chrome/browser/vr/model/camera_model.h"
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
#include "third_party/skia/include/core/SkRRect.h"
|
||||
#include "third_party/skia/include/core/SkRect.h"
|
||||
#include "ui/gfx/geometry/angle_conversions.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "chrome/browser/vr/renderers/base_quad_renderer.h"
|
||||
|
||||
#include "base/stl_util.h"
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
#include "ui/gfx/transform.h"
|
||||
|
||||
namespace vr {
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <ostream>
|
||||
|
||||
#include "base/check.h"
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
|
||||
namespace vr {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define CHROME_BROWSER_VR_RENDERERS_BASE_RENDERER_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "chrome/browser/vr/gl_bindings.h"
|
||||
#include "device/vr/gl_bindings.h"
|
||||
|
||||
namespace vr {
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "chrome/browser/vr/renderers/external_textured_quad_renderer.h"
|
||||
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
#include "ui/gfx/transform.h"
|
||||
|
||||
namespace vr {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "chrome/browser/vr/elements/corner_radii.h"
|
||||
#include "chrome/browser/vr/renderers/textured_quad_renderer.h"
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
#include "ui/gfx/geometry/rect_f.h"
|
||||
#include "ui/gfx/geometry/size_f.h"
|
||||
#include "ui/gfx/transform.h"
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "chrome/browser/vr/renderers/texture_copy_renderer.h"
|
||||
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
|
||||
namespace vr {
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "chrome/browser/vr/renderers/textured_quad_renderer.h"
|
||||
|
||||
#include "base/stl_util.h"
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
#include "ui/gfx/transform.h"
|
||||
|
||||
namespace vr {
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "chrome/browser/vr/renderers/transparent_quad_renderer.h"
|
||||
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
#include "ui/gfx/transform.h"
|
||||
|
||||
namespace vr {
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef CHROME_BROWSER_VR_SKIA_SURFACE_PROVIDER_H_
|
||||
#define CHROME_BROWSER_VR_SKIA_SURFACE_PROVIDER_H_
|
||||
|
||||
#include "chrome/browser/vr/gl_bindings.h"
|
||||
#include "device/vr/gl_bindings.h"
|
||||
#include "third_party/skia/include/core/SkRefCnt.h"
|
||||
#include "third_party/skia/include/gpu/GrContext.h"
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "chrome/browser/vr/gl_bindings.h"
|
||||
#include "device/vr/gl_bindings.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
|
||||
namespace gl {
|
||||
|
@ -6,10 +6,10 @@
|
||||
|
||||
#include "base/trace_event/trace_event.h"
|
||||
#include "chrome/browser/vr/elements/ui_element.h"
|
||||
#include "chrome/browser/vr/gl_bindings.h"
|
||||
#include "chrome/browser/vr/render_info.h"
|
||||
#include "chrome/browser/vr/ui_element_renderer.h"
|
||||
#include "chrome/browser/vr/ui_scene.h"
|
||||
#include "device/vr/gl_bindings.h"
|
||||
|
||||
namespace vr {
|
||||
|
||||
|
@ -8,12 +8,33 @@ if (is_android) {
|
||||
import("//build/config/android/rules.gni") # For generate_jni().
|
||||
}
|
||||
|
||||
config("vr_gl_mode") {
|
||||
if (use_command_buffer) {
|
||||
defines = [
|
||||
"VR_USE_COMMAND_BUFFER",
|
||||
"GL_GLEXT_PROTOTYPES",
|
||||
]
|
||||
} else {
|
||||
defines = [ "VR_USE_NATIVE_GL" ]
|
||||
}
|
||||
}
|
||||
|
||||
source_set("vr_gl_bindings") {
|
||||
sources = [ "gl_bindings.h" ]
|
||||
public_configs = [ ":vr_gl_mode" ]
|
||||
if (use_command_buffer) {
|
||||
public_deps = [ "//gpu/command_buffer/client:gles2_c_lib" ]
|
||||
} else {
|
||||
public_deps = [ "//ui/gl" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (enable_vr) {
|
||||
# TODO(https://crbug.com/1073113): Flesh out and cleanup this target.
|
||||
component("vr_base") {
|
||||
visibility = [
|
||||
# TODO(https://crbug.com/843374): Move arcore_device
|
||||
"//chrome/browser/android/vr/*",
|
||||
"//chrome/browser/*",
|
||||
"//content/services/isolated_xr_device/*",
|
||||
"//device/vr/*",
|
||||
]
|
||||
@ -25,9 +46,13 @@ if (enable_vr) {
|
||||
"vr_device.h",
|
||||
"vr_device_base.cc",
|
||||
"vr_device_base.h",
|
||||
"vr_gl_util.cc",
|
||||
"vr_gl_util.h",
|
||||
]
|
||||
|
||||
public_configs = [ ":vr_gl_mode" ]
|
||||
public_deps = [
|
||||
":vr_gl_bindings",
|
||||
"//device/vr/public/cpp",
|
||||
"//device/vr/public/mojom",
|
||||
]
|
||||
|
@ -9,6 +9,8 @@ include_rules = [
|
||||
"+third_party/gvr-android-sdk/src",
|
||||
"+third_party/libovr/src",
|
||||
"+third_party/openvr/src/headers/openvr.h",
|
||||
"+third_party/skia/include/core/SkColor.h",
|
||||
"+ui/display",
|
||||
"+ui/gfx",
|
||||
"+ui/gl/gl_bindings.h",
|
||||
]
|
||||
|
@ -14,6 +14,8 @@ declare_args() {
|
||||
|
||||
enable_windows_mr = is_win
|
||||
|
||||
use_command_buffer = is_win
|
||||
|
||||
# To build with OpenXR support, the OpenXR Loader needs to be pulled to
|
||||
# third_party/openxr.
|
||||
enable_openxr = checkout_openxr && is_win
|
||||
|
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CHROME_BROWSER_VR_GL_BINDINGS_H_
|
||||
#define CHROME_BROWSER_VR_GL_BINDINGS_H_
|
||||
#ifndef DEVICE_VR_GL_BINDINGS_H_
|
||||
#define DEVICE_VR_GL_BINDINGS_H_
|
||||
|
||||
#if defined(VR_USE_COMMAND_BUFFER)
|
||||
|
||||
@ -23,4 +23,4 @@
|
||||
|
||||
#endif // defined(VR_USE_COMMAND_BUFFER)
|
||||
|
||||
#endif // CHROME_BROWSER_VR_GL_BINDINGS_H_
|
||||
#endif // DEVICE_VR_GL_BINDINGS_H_
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "chrome/browser/vr/vr_gl_util.h"
|
||||
#include "device/vr/vr_gl_util.h"
|
||||
|
||||
#include "ui/gfx/transform.h"
|
||||
|
@ -2,14 +2,14 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CHROME_BROWSER_VR_VR_GL_UTIL_H_
|
||||
#define CHROME_BROWSER_VR_VR_GL_UTIL_H_
|
||||
#ifndef DEVICE_VR_VR_GL_UTIL_H_
|
||||
#define DEVICE_VR_VR_GL_UTIL_H_
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
#include "chrome/browser/vr/gl_bindings.h"
|
||||
#include "chrome/browser/vr/vr_base_export.h"
|
||||
#include "base/component_export.h"
|
||||
#include "device/vr/gl_bindings.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
|
||||
#define SHADER(Src) "#version 100\n" #Src
|
||||
@ -23,31 +23,34 @@ class Transform;
|
||||
|
||||
namespace vr {
|
||||
|
||||
VR_BASE_EXPORT std::array<float, 16> MatrixToGLArray(
|
||||
const gfx::Transform& matrix);
|
||||
COMPONENT_EXPORT(DEVICE_VR_BASE)
|
||||
std::array<float, 16> MatrixToGLArray(const gfx::Transform& matrix);
|
||||
|
||||
// Compile a shader. This is intended for browser-internal shaders only,
|
||||
// don't use this for user-supplied arbitrary shaders since data is handed
|
||||
// directly to the GL driver without further sanity checks.
|
||||
VR_BASE_EXPORT GLuint CompileShader(GLenum shader_type,
|
||||
const std::string& shader_source,
|
||||
std::string& error);
|
||||
COMPONENT_EXPORT(DEVICE_VR_BASE)
|
||||
GLuint CompileShader(GLenum shader_type,
|
||||
const std::string& shader_source,
|
||||
std::string& error);
|
||||
|
||||
// Compile and link a program.
|
||||
VR_BASE_EXPORT GLuint CreateAndLinkProgram(GLuint vertex_shader_handle,
|
||||
GLuint fragment_shader_handle,
|
||||
std::string& error);
|
||||
COMPONENT_EXPORT(DEVICE_VR_BASE)
|
||||
GLuint CreateAndLinkProgram(GLuint vertex_shader_handle,
|
||||
GLuint fragment_shader_handle,
|
||||
std::string& error);
|
||||
|
||||
// Sets default texture parameters given a texture type.
|
||||
VR_BASE_EXPORT void SetTexParameters(GLenum texture_type);
|
||||
COMPONENT_EXPORT(DEVICE_VR_BASE) void SetTexParameters(GLenum texture_type);
|
||||
|
||||
// Sets color uniforms given an SkColor.
|
||||
VR_BASE_EXPORT void SetColorUniform(GLuint handle, SkColor c);
|
||||
COMPONENT_EXPORT(DEVICE_VR_BASE) void SetColorUniform(GLuint handle, SkColor c);
|
||||
|
||||
// Sets color uniforms (but not alpha) given an SkColor. The alpha is assumed to
|
||||
// be 1.0 in this case.
|
||||
VR_BASE_EXPORT void SetOpaqueColorUniform(GLuint handle, SkColor c);
|
||||
COMPONENT_EXPORT(DEVICE_VR_BASE)
|
||||
void SetOpaqueColorUniform(GLuint handle, SkColor c);
|
||||
|
||||
} // namespace vr
|
||||
|
||||
#endif // CHROME_BROWSER_VR_VR_GL_UTIL_H_
|
||||
#endif // DEVICE_VR_VR_GL_UTIL_H_
|
Reference in New Issue
Block a user