Hi,
I am working through the learning_gfx_tutorial and trying to use more current crates since the original cargo.toml does not allow complete compilation.
With the newer versions of gfx_backend_dx12 I have in a library file(hal_state.rs)
pub mod Halstate
use gfx_hal:: long list
use log etc
use gfx_backend_dx12 as back;
The problem is that the compilation process finds gfx_hal and log well enough but fails with gfx_backend_dx12 with can't find crate gfx_backend_dx12
I used the original Cargo.toml from the original git project(listed below) with a few updates to versions but no luck . Any ideas??? Is the problem that not enough information has been created in my project dependencies for the compilation process to make the connection? I suspect this but really don't know
gfx-backend-dx12 is configured as an optional dependency, so it won't compile by default. The following two lines
default = []
dx12 = ["gfx-backend-dx12"]
state that by default no features are enabled, and that for your workspace a feature named dx12 will enable the feature gfx-backend-dx12. The config is set up this way to make it easy to compile for multiple backends. If that's not needed though and you always want to use dx12 then you can change default to
Hi , thanks for hint. I had been doing that with the features.
I think my problem is in part that I have put some of the major types from learning_gfx_hal into the lib directory as pub mod modules. I have not sorted out the Cargo.html for the lib directory correctly. I have tried some examples that I have in documentation and some other sites but I not quite getting it yet.
I trying to create individual pub modules for hal_state and winit_state if you are familiar with the learning_gfx_hal tutorials.
As a simplified example I have in lib/winit_state.rs
pub mod winit_state
{
use winit::{ dpi:PhyscialSize, error:OsError
etc.
the lib/Cargo.toml has winit listed as a dependency
[package]
name = "fd_gfx_hal"
version = "0.1.0"
authors = ["FrankieD frank.deming@gmail.com"]
edition = "2018"
Compiling winit_state.rs gives me a compiler error of "maybe a missing crate" about winit. I tried extern crate winit; but that errors as the crate is not found. In the top Cargo.toml winit is listed as a dependency.
I guess I just don't understand all the scoping rules in play at this point.
By the way i have backed off of dealing with gfx_backend_dx12 until I understand this problem.
Thanks,
Frank
I have gotten the problem fixed except for the problem with gfx_backend_dx12. I put in the appropriate lib targets in the project Cargo.toml and the one in the lib.
Is gfx_backend_dx12 broken right now? The documentation page on crates.io certainly is.
I figured out my problem. I am learning rust(from Programming Rust, Blandy) while entering code from online tutorials such as learning_gfx_hal. Somehow I got a
//#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
before a
pub struct HalState {
etc.
I got an error that was not obviously tied to the #[derive statement. As I learning more from the book I suddenly saw it. A chapter on utility traits ringed the bell.
I like Rust's goals but it is not easy after a number of years of not programming.