39: Basic env_logger hookup r=msiglreith a=kvark

Not CI tested but fairly simple and nothing bad will happen if it breaks.
Developer can manually enable the feature for local debugging.
This commit is contained in:
bors[bot] 2018-02-28 17:51:52 +00:00
commit c59ea3b5c7
3 changed files with 13 additions and 0 deletions

View file

@ -8,6 +8,7 @@ name = "portability_gfx"
[features] [features]
default = [] default = []
#default = ["env_logger"] # uncomment for debugging
dx12 = ["gfx-backend-dx12"] dx12 = ["gfx-backend-dx12"]
vulkan = ["gfx-backend-vulkan"] vulkan = ["gfx-backend-vulkan"]
@ -15,6 +16,10 @@ vulkan = ["gfx-backend-vulkan"]
lazy_static = "1.0" lazy_static = "1.0"
log = "0.4" log = "0.4"
[dependencies.env_logger]
version = "0.5"
optional = true
[dependencies.gfx-hal] [dependencies.gfx-hal]
git = "https://github.com/gfx-rs/gfx" git = "https://github.com/gfx-rs/gfx"
rev = "070e0cee47ae6f0c395a3402fd6f889c1315ef3e" rev = "070e0cee47ae6f0c395a3402fd6f889c1315ef3e"

View file

@ -48,6 +48,12 @@ pub extern "C" fn gfxCreateInstance(
_pAllocator: *const VkAllocationCallbacks, _pAllocator: *const VkAllocationCallbacks,
pInstance: *mut VkInstance, pInstance: *mut VkInstance,
) -> VkResult { ) -> VkResult {
//Note: is this the best place to enable logging?
#[cfg(feature = "env_logger")]
{
use env_logger;
env_logger::init();
}
let instance = back::Instance::create("portability", 1); let instance = back::Instance::create("portability", 1);
unsafe { *pInstance = Handle::new(instance) }; unsafe { *pInstance = Handle::new(instance) };
VkResult::VK_SUCCESS VkResult::VK_SUCCESS

View file

@ -13,6 +13,8 @@ extern crate gfx_backend_vulkan as back;
extern crate lazy_static; extern crate lazy_static;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
#[cfg(feature = "env_logger")]
extern crate env_logger;
mod conv; mod conv;
mod handle; mod handle;