Enable gpu when debugging (#8)
* add: enable GPU for debugging and update installation instructions * update: modify Makefile to use variable for binary path in install target --------- Co-authored-by: not-elm <elmgameinfo@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
### Features
|
||||
|
||||
- Added `PreloadScripts` component for specifying JavaScript to be executed when the page is initialized.
|
||||
- Enables GPU when debugging.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
||||
15
Makefile
15
Makefile
@@ -1,6 +1,19 @@
|
||||
.PHONY: fix install
|
||||
|
||||
BIN := bevy_cef_debug_render_process
|
||||
CEF_LIB := $(HOME)/.local/share/cef/Chromium Embedded Framework.framework/Libraries
|
||||
|
||||
|
||||
.PHONY: fix install
|
||||
|
||||
BIN := bevy_cef_debug_render_process
|
||||
CEF_LIB := $(HOME)/.local/share/cef/Chromium Embedded Framework.framework/Libraries
|
||||
CARGO_BIN := $(HOME)/.cargo/bin
|
||||
|
||||
fix:
|
||||
cargo clippy --fix --allow-dirty --allow-staged --workspace --all --all-features
|
||||
cargo fmt --all
|
||||
|
||||
install:
|
||||
cargo install --path ./crates/bevy_cef_debug_render_process --force
|
||||
cargo install --path ./crates/bevy_cef_debug_render_process --force
|
||||
mv "$(CARGO_BIN)/$(BIN)" "$(CEF_LIB)/$(BIN)"
|
||||
@@ -53,12 +53,6 @@ impl ImplApp for BrowserProcessAppBuilder {
|
||||
return;
|
||||
};
|
||||
command_line.append_switch(Some(&"use-mock-keychain".into()));
|
||||
#[cfg(feature = "debug")]
|
||||
{
|
||||
command_line.append_switch(Some(&"disable-gpu".into()));
|
||||
command_line.append_switch(Some(&"disable-gpu-compositing".into()));
|
||||
command_line.append_switch(Some(&"disable-software-rasterizer".into()));
|
||||
}
|
||||
}
|
||||
|
||||
fn browser_process_handler(&self) -> Option<BrowserProcessHandler> {
|
||||
|
||||
@@ -18,6 +18,12 @@ impl HeadersResponser {
|
||||
};
|
||||
self.headers.clear();
|
||||
self.response_length = obtain_response_length(&cef_response.data, range);
|
||||
self.headers
|
||||
.push(("Access-Control-Allow-Origin".to_string(), "*".to_string()));
|
||||
self.headers
|
||||
.push(("Access-Control-Allow-Methods".to_string(), "*".to_string()));
|
||||
self.headers
|
||||
.push(("Access-Control-Allow-Headers".to_string(), "*".to_string()));
|
||||
if let Some(content_range) = content_range_header_value(&cef_response.data, range) {
|
||||
self.headers
|
||||
.push(("Content-Range".to_string(), content_range));
|
||||
|
||||
@@ -12,8 +12,8 @@ use cef::{
|
||||
};
|
||||
use cef_dll_sys::_cef_string_utf16_t;
|
||||
use cef_dll_sys::cef_scheme_options_t::{
|
||||
CEF_SCHEME_OPTION_CORS_ENABLED, CEF_SCHEME_OPTION_LOCAL, CEF_SCHEME_OPTION_SECURE,
|
||||
CEF_SCHEME_OPTION_STANDARD,
|
||||
CEF_SCHEME_OPTION_CORS_ENABLED, CEF_SCHEME_OPTION_FETCH_ENABLED, CEF_SCHEME_OPTION_LOCAL,
|
||||
CEF_SCHEME_OPTION_SECURE, CEF_SCHEME_OPTION_STANDARD,
|
||||
};
|
||||
use std::env::home_dir;
|
||||
use std::path::PathBuf;
|
||||
@@ -27,6 +27,7 @@ pub fn cef_scheme_flags() -> u32 {
|
||||
| CEF_SCHEME_OPTION_SECURE as u32
|
||||
| CEF_SCHEME_OPTION_LOCAL as u32
|
||||
| CEF_SCHEME_OPTION_CORS_ENABLED as u32
|
||||
| CEF_SCHEME_OPTION_FETCH_ENABLED as u32
|
||||
}
|
||||
|
||||
pub fn debug_chromium_libraries_path() -> PathBuf {
|
||||
@@ -42,11 +43,7 @@ pub fn debug_cef_path() -> PathBuf {
|
||||
}
|
||||
|
||||
pub fn debug_render_process_path() -> PathBuf {
|
||||
cargo_bin_path().join("bevy_cef_debug_render_process")
|
||||
}
|
||||
|
||||
pub fn cargo_bin_path() -> PathBuf {
|
||||
home_dir().unwrap().join(".cargo").join("bin")
|
||||
debug_chromium_libraries_path().join("bevy_cef_debug_render_process")
|
||||
}
|
||||
|
||||
pub trait IntoString {
|
||||
|
||||
Reference in New Issue
Block a user