amethyst / amethyst-starter-2d

Seed project for 2D games
Other
201 stars 42 forks source link

Does only display the clear color on osx with metal #1

Closed Kerollmops closed 5 years ago

Kerollmops commented 5 years ago

Hi,

I tried out to run this starter for 2d games on macos by making care to change the default feature to "metal" and the only thing that it display is the purple color used to clear the screen. According to the code it seems that this program should have displayed variants of the amethyst logo.

Kerollmops commented 5 years ago

I changed the DrawFlat2DTransparentDesc to not be transparent (i.e. DrawFlat2DDesc) and it basically worked.

ctsrc commented 5 years ago

I can confirm that the same thing happened when I compiled and ran the amethyst-starter-2d code on a 2018 model MacBook Air with macOS Mojave 10.14.5, using "metal" as the default feature. Xcode version 10.2.1 (10E1001). Active Rust toolchain: rustc 1.38.0-nightly (4b65a86eb 2019-07-15).

diff --git a/Cargo.toml b/Cargo.toml
index 3e32a92..33b0bff 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,7 +9,7 @@ amethyst = "0.11.0"
 log = { version = "0.4.6", features = ["serde"] }

 [features]
-default = ["vulkan"]
+default = ["metal"]
 empty = ["amethyst/empty"]
 metal = ["amethyst/metal"]
 vulkan = ["amethyst/vulkan"]
Screen Shot 2019-07-16 at 16 40 29

With the change described by @Kerollmops in their comment above, sprites are shown on screen.

Question is, why doesn't it work with transparency?

diff --git a/src/render.rs b/src/render.rs
index ed0f89a..14dd996 100644
--- a/src/render.rs
+++ b/src/render.rs
@@ -1,7 +1,7 @@
 use amethyst::{
     ecs::prelude::{ReadExpect, Resources, SystemData},
     renderer::{
-        pass::DrawFlat2DTransparentDesc,
+        pass::DrawFlat2DDesc,
         rendy::{
             factory::Factory,
             graph::{
@@ -75,8 +75,8 @@ impl GraphCreator<DefaultBackend> for RenderGraph {
         // Add additional draw groups here for things like UI
         let pass = builder.add_node(
             SubpassBuilder::new()
-                // Draw sprites with transparency
-                .with_group(DrawFlat2DTransparentDesc::new().builder())
+                // Draw sprites without transparency
+                .with_group(DrawFlat2DDesc::new().builder())
                 .with_color(color)
                 .with_depth_stencil(depth)
                 .into_pass(),
Screen Shot 2019-07-16 at 16 28 57
happenslol commented 5 years ago

Thanks for your detailed reports!

The images don't contain any transparency - which is probably to be an error on my part. I must've done something stupid, like swapping them out with optimized versions after confirming that they work, and then not re-checking.

However, I've just merged #3, which will make sure that both opaque and transparent sprites are rendered. I'm closing this since it should all be working correctly now. Please just reopen if there are any further issues =)