[OpenSmalltalk/opensmalltalk-vm] Initial port of the B3DAccelerator plugin, plus extra Metal and rendering clean up (#382)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[OpenSmalltalk/opensmalltalk-vm] Initial port of the B3DAccelerator plugin, plus extra Metal and rendering clean up (#382)

David T Lewis
 

This is the branch with the port of the B3DAccelerator plugin to Metal. Most the examples in Balloon3D are working with this new plugin, after forcing it by modifying:

B3DSceneMorph >> accelerationEnabled
"Return true if hardware acceleration is enabled"
"self accelerationSuspended ifTrue:[^false].
^self valueOfProperty: #accelerationEnabled ifAbsent:[false]"
^ true

Shaders are now compiled in runtime, from source code which is embedded in a C-string.

In addition to these changes, in the last commit I did some refactoring of the Metal VM code. I am copying the message of that commit:

  • I introduced a hack to select the type of rendering view in runtime.
  • I am compiling by again the old core graphics based renderer, but this is only used when the -core-graphics option is passed in the command line.
  • I added dummy headless view, that does not render and stubs most of the event.
  • I added the -metal, -opengl, and -core-graphics command line options for selecting the rendering backend.
  • I am testing the Metal implementation by compiling the shader library. If the shader library compilation fails, then Metal will not be used, and instead OpenGL will be used as a fallback, by default.

You can view, comment on, or merge this pull request online at:

  https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382

Commit Summary

  • I am starting to reimplement the B3DAcceleratorPlugin using Metal. So far I managed to get a black screen by using the extra layers mechanism,
  • Creating the depth-stencil buffer, and clearing the screen.
  • I am starting to render a bit.
  • I am starting to implement the lighting model in the metal based B3DAcceleratorPlugin.
  • Add a -1 offset to the B3D indices going to Metal.
  • Merge branch 'Cog' into feature/metal_b3d
  • I implemented the Squeak3D lighting model above metal.
  • Merge branch 'Cog' into feature/metal_b3d
  • Merge branch 'Cog' into feature/metal_b3d
  • I introduced a hack to select the type of rendering view in runtime.

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Initial port of the B3DAccelerator plugin, plus extra Metal and rendering clean up (#382)"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Initial port of the B3DAccelerator plugin, plus extra Metal and rendering clean up (#382)

David T Lewis
 

When I try and compile on 64-bit (build.macos64x64/squeak.cog.spur; macOS High Sierra 10.13.6; clang --version: Apple LLVM version 7.0.0 (clang-700.1.76) Target: x86_64-apple-darwin17.7.0) I get the following error message:

../../platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m:79:17: error: ARC forbids Objective-C objects in struct

that line is the "texture" declaration in

typedef struct ExtraLayer
{
id texture;
int x, y;
int w, h;
} ExtraLayer;


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@eliotmiranda in #382: When I try and compile on 64-bit (build.macos64x64/squeak.cog.spur; macOS High Sierra 10.13.6; clang --version: Apple LLVM version 7.0.0 (clang-700.1.76) Target: x86_64-apple-darwin17.7.0) I get the following error message:\r\n\r\n../../platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m:79:17: error: ARC forbids Objective-C objects in struct\r\n\r\nthat line is the \"texture\" declaration in\r\n\r\ntypedef struct ExtraLayer\r\n{\r\n id\u003cMTLTexture\u003e texture;\r\n int x, y;\r\n int w, h;\r\n} ExtraLayer;\r\n"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-476315521"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-476315521", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-476315521", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Initial port of the B3DAccelerator plugin, plus extra Metal and rendering clean up (#382)

David T Lewis
In reply to this post by David T Lewis
 

Not sure if this fits here, but if I download the latest Pharo 7 VM on macOS High Sierra, the VM seems not to start properly, resulting in a black window and:

2019-03-27 11:48:46.282 Pharo[1041:7933912] Pipeline state creation error: Function screenQuadFragmentShader is using language version 2.1 which is incompatible with this OS.

I looked into this a while ago, and there should be some flags to enable Metal 1 compatibility, then we would get at least down to El Capitan support. Adding Metal as required dependency is a non-backwards-compatible change, this should be handled with care (e.g. do we need non-metal builds, archive old non-metal builds for older OSs?).


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@maenu in #382: Not sure if this fits here, but if I download the latest Pharo 7 VM on macOS High Sierra, the VM seems not to start properly, resulting in a black window and:\r\n\r\n```\r\n2019-03-27 11:48:46.282 Pharo[1041:7933912] Pipeline state creation error: Function screenQuadFragmentShader is using language version 2.1 which is incompatible with this OS.\r\n```\r\n\r\nI looked into this a while ago, and there should be some flags to enable Metal 1 compatibility, then we would get at least down to El Capitan support. Adding Metal as required dependency is a non-backwards-compatible change, this should be handled with care (e.g. do we need non-metal builds, archive old non-metal builds for older OSs?)."}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-477094965"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-477094965", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-477094965", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Initial port of the B3DAccelerator plugin, plus extra Metal and rendering clean up (#382)

David T Lewis
In reply to this post by David T Lewis
 

Merged #382 into Cog.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Merged #382 into Cog."}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#event-2234068494"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#event-2234068494", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#event-2234068494", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Initial port of the B3DAccelerator plugin, plus extra Metal and rendering clean up (#382)

David T Lewis
In reply to this post by David T Lewis
 

Hi @maenu,

can you work with @ronsaldo to look at getting down to El Capitan support?  Right now I'm on High Sierra (10.3) and Metal 2 doesn't even work there-on.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@eliotmiranda in #382: Hi @maenu,\r\n\r\n can you work with @ronsaldo to look at getting down to El Capitan support? Right now I'm on High Sierra (10.3) and Metal 2 doesn't even work there-on."}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-477775045"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-477775045", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-477775045", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Initial port of the B3DAccelerator plugin, plus extra Metal and rendering clean up (#382)

David T Lewis
In reply to this post by David T Lewis
 

I will have a look, maybe @ronsaldo is even at PharoDays next week?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@maenu in #382: I will have a look, maybe @ronsaldo is even at PharoDays next week?"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-477949438"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-477949438", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-477949438", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Initial port of the B3DAccelerator plugin, plus extra Metal and rendering clean up (#382)

David T Lewis
In reply to this post by David T Lewis
 

Sorry to revive the merged thread, but what is the state on this?

I just built the macOS 64bit Pharo Cog VM on HighSierra, Metal seems to be enabled (-DUSE_METAL=1), and the VM runs my image. But downloading a fresh VM from Pharo downloads gives me 2019-03-27 11:48:46.282 Pharo[1041:7933912] Pipeline state creation error: Function screenQuadFragmentShader is using language version 2.1 which is incompatible with this OS. again.

My current hypothesis is, that the downloaded VM is built on a newer macOS, which removes the compatibility for High Sierra. Anybody knows how this happens and how we could trick a newer macOS in building a VM with a High Sierra compatibility?

The only thing I found to control compatibility is the -mmacosx-version-min, which is 10.7 in my local build. It looks like there is nothing other than this flag to achieve compatibility, see also https://github.com/gfx-rs/gfx/blob/master/src/backend/metal/build.rs.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@maenu in #382: Sorry to revive the merged thread, but what is the state on this?\r\n\r\nI just built the macOS 64bit Pharo Cog VM on HighSierra, Metal seems to be enabled (`-DUSE_METAL=1`), and the VM runs my image. But downloading a fresh VM from Pharo downloads gives me `2019-03-27 11:48:46.282 Pharo[1041:7933912] Pipeline state creation error: Function screenQuadFragmentShader is using language version 2.1 which is incompatible with this OS.` again. \r\n\r\nMy current hypothesis is, that the downloaded VM is built on a newer macOS, which removes the compatibility for High Sierra. Anybody knows how this happens and how we could trick a newer macOS in building a VM with a High Sierra compatibility?\r\n\r\nThe only thing I found to control compatibility is the `-mmacosx-version-min`, which is `10.7` in my local build. It looks like there is nothing other than this flag to achieve compatibility, see also https://github.com/gfx-rs/gfx/blob/master/src/backend/metal/build.rs."}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-482096835"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-482096835", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-482096835", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Initial port of the B3DAccelerator plugin, plus extra Metal and rendering clean up (#382)

David T Lewis
In reply to this post by David T Lewis
 

@maenu That is interesting. Did you download that VM from bintray? That also looks like an error from the older version.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@ronsaldo in #382: @maenu That is interesting. Did you download that VM from bintray? That also looks like an error from the older version."}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-482122593"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-482122593", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-482122593", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Initial port of the B3DAccelerator plugin, plus extra Metal and rendering clean up (#382)

David T Lewis
In reply to this post by David T Lewis
 

@ronsaldo I got the VM with curl https://get.pharo.org/64/70+vmLatest | bash. Maybe that is not really the latest VM.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@maenu in #382: @ronsaldo I got the VM with `curl https://get.pharo.org/64/70+vmLatest | bash`. Maybe that is not really the latest VM."}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-482466727"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-482466727", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382#issuecomment-482466727", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>