Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define scope and philosophy #108

Closed
brendanzab opened this issue Jul 16, 2014 · 9 comments
Closed

Define scope and philosophy #108

brendanzab opened this issue Jul 16, 2014 · 9 comments

Comments

@brendanzab
Copy link
Contributor

What should gfx-rs handle?

What should gfx-rs defer to the client, or higher level libraries/frameworks/engines?

@emberian
Copy link
Contributor

The separation between device and render seems a bit hodge-podge, just shoving things into where they need to go. Additionally, what we have today can't work if we want to have a bindless backend, without introducing a lot of inefficiency. I think we should have a structure like the following:

trait Renderer {
    fn iter_errors(&mut self) -> ...;
    fn should_finish(&self) -> bool;
    fn clear(&mut self, Frame, ClearData);
    fn draw(&mut self, ...);
    fn create_program(&mut self, ...);
    /* ... */
}

struct BindlessDevice<Backend> {
    ...;
}

impl<B: BindlessBackend> Renderer for BindlessDevice<B> {
    ...;
}

struct BindingDevice<Backend> {
    ...;
}

impl<B: BindingBackend> Renderer for BindingDevice<B> {
    ...;
}

// BindingBackend would look a lot like todays `Renderer` struct, with the `device` crate etc, I
// think

I think all of the usual types can live in render (which could actually be merged entirely with gfx in this design, making render not exist). Then, each backend would implement the respective trait (BindingBackend/BindlessBackend), which would have associated types, avoiding the mess we have today where some types are in render or some types in device, depending on if the device needs them or not.

I think we can continue with today's design, though. My suggestion would be mostly a small code shuffling.

@kvark
Copy link
Member

kvark commented Jul 21, 2014

@cmr I can see how this is going to work. Do you think it requires associated types, or we can start putting this in slowly even now?

@emberian
Copy link
Contributor

To have multiple implementations of the trait or to split it fully into
separate crates we will need associated types. With only one backend like
today it would be fine I think.

On Mon, Jul 21, 2014 at 6:42 AM, ----- notifications@github.com
wrote:

@cmr https://github.com/cmr I can see how this is going to work. Do you
think it requires associated types, or we can start putting this in slowly
even now?


Reply to this email directly or view it on GitHub
#108 (comment).

http://octayn.net/

@emberian
Copy link
Contributor

I think what we have today is good, both in terms of scope and implementation. Still some changes to make, such as my sketch above, but they are completely transparent I think.

@brendanzab
Copy link
Contributor Author

@aturon Any idea on the time-frame for associated types? This is a big pain point for us :(

@brendanzab
Copy link
Contributor Author

How about:

Goals

gfx-rs aims to be:

  • a type-safe, memory-safe, and thread-safe API that encourages best practices
  • blind to the actual semantics of the information it is recieving
  • the default API for Rust graphics: for one-off applications, or higher level libraries or engines

Non-goals

gfx-rs will not handle:

  • visibility determination
  • draw call reordering
  • de-serializing of scene data formats
  • lighting and shadows
  • abstractions for platform-specific shaders
  • material abstractions

@kvark
Copy link
Member

kvark commented Jul 31, 2014

@bjz thanks, this is a great addition. Please file a PR that changes our README according to these notes (or adds goals.md with them that is referred from README), and we can close this.

@aturon
Copy link

aturon commented Jul 31, 2014

@bjz I'm currently working on a design for associated items, which will turn into an RFC soon. It's not clear whether this will make it for 1.0, but I'd like to try!

brendanzab added a commit to brendanzab/gfx-rs that referenced this issue Aug 7, 2014
brendanzab added a commit to brendanzab/gfx-rs that referenced this issue Aug 7, 2014
brendanzab added a commit to brendanzab/gfx-rs that referenced this issue Aug 7, 2014
brendanzab added a commit to brendanzab/gfx-rs that referenced this issue Aug 7, 2014
brendanzab added a commit to brendanzab/gfx-rs that referenced this issue Aug 7, 2014
brendanzab added a commit to brendanzab/gfx-rs that referenced this issue Aug 7, 2014
brendanzab added a commit to brendanzab/gfx-rs that referenced this issue Aug 7, 2014
brendanzab added a commit to brendanzab/gfx-rs that referenced this issue Aug 7, 2014
brendanzab added a commit to brendanzab/gfx-rs that referenced this issue Aug 7, 2014
brendanzab added a commit to brendanzab/gfx-rs that referenced this issue Aug 7, 2014
brendanzab added a commit to brendanzab/gfx-rs that referenced this issue Aug 7, 2014
brendanzab added a commit to brendanzab/gfx-rs that referenced this issue Aug 7, 2014
brendanzab added a commit to brendanzab/gfx-rs that referenced this issue Aug 7, 2014
@kvark
Copy link
Member

kvark commented Aug 7, 2014

I think this is resolved.

@kvark kvark closed this as completed Aug 7, 2014
adamnemecek pushed a commit to adamnemecek/gfx that referenced this issue Apr 1, 2021
108: Enable windows in Travis r=travis a=kvark

Fixes gfx-rs#97 

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants