webatintel / aquarium

BSD 3-Clause "New" or "Revised" License
23 stars 7 forks source link

Create backend contexts via helpers #168

Closed hujiajie closed 3 years ago

hujiajie commented 3 years ago

This is a preparation for deprecating the usage of dawn_bindings, and a following patch will implement the complexity of window system binding. Depending on the backend, ContextDawn will be sub-classed in a .cpp or .mm file, and instantiated with the factory pattern.

hujiajie commented 3 years ago

Dawn provides GN args like dawn_enable_d3d12 to control if a certain backend will be compiled, and AGNLE has similar flexibility. Note these variables are meant to be customized by users since they are in the declare_args() block, so it sounds like an Aquarium bug if the following won't work:

gn gen out --args="dawn_enable_d3d12=false"
ninja -C out

I'm not worried about the readability / maintenance burden at the moment, but @gyagp has a different opinion. Thoughts? @Jiawei-Shao @shaoboyan

gyagp commented 3 years ago

The benefit of this can be binary size, which is not a big concern of Aquarium. But the price is readability, maintenance and testability. I don't think we ever tested all these combinations, and I don't think we will have bandwidth to do this in near future. ANGLE and Dawn have many other GN args we don't need to bring into Aquarium.

gyagp commented 3 years ago

This PR LGTM, so let me merge it to unblock your work at hand. We can continue to discuss GN args.