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

Ronie Salgado notifications at github.com
Mon Mar 25 04:12:47 UTC 2019


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 --

    M .clang_complete (3)
    M build.macos32x86/common/Makefile.app (4)
    M build.macos32x86/common/Makefile.flags (2)
    M build.macos64x64/common/Makefile.flags (2)
    M build.macos64x64/common/Makefile.vm (2)
    M platforms/Cross/plugins/B3DAcceleratorPlugin/B3DAcceleratorPlugin.h (90)
    A platforms/iOS/plugins/B3DAcceleratorPlugin/B3DMetalShaders.metal (230)
    M platforms/iOS/plugins/B3DAcceleratorPlugin/Makefile (12)
    M platforms/iOS/plugins/B3DAcceleratorPlugin/sqMacOpenGL.m (5)
    A platforms/iOS/plugins/B3DAcceleratorPlugin/sqMetalRenderer.h (131)
    A platforms/iOS/plugins/B3DAcceleratorPlugin/sqMetalRenderer.m (1179)
    A platforms/iOS/plugins/B3DAcceleratorPlugin/sqMetalStructures.h (121)
    M platforms/iOS/vm/Common/main.m (22)
    M platforms/iOS/vm/English.lproj/MainMenu.xib (6)
    M platforms/iOS/vm/OSX/SqViewBitmapConversion.m (263)
    A platforms/iOS/vm/OSX/SqViewBitmapConversion.m.inc (271)
    M platforms/iOS/vm/OSX/SqViewClut.m (115)
    A platforms/iOS/vm/OSX/SqViewClut.m.inc (91)
    M platforms/iOS/vm/OSX/SqueakMainShaders.metal (32)
    D platforms/iOS/vm/OSX/SqueakMainShaders.metal.inc (822)
    M platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m (12)
    M platforms/iOS/vm/OSX/sqSqueakOSXApplication.m (34)
    M platforms/iOS/vm/OSX/sqSqueakOSXCGView.h (4)
    A platforms/iOS/vm/OSX/sqSqueakOSXHeadlessView.h (69)
    A platforms/iOS/vm/OSX/sqSqueakOSXHeadlessView.m (350)
    M platforms/iOS/vm/OSX/sqSqueakOSXMetalView.h (9)
    M platforms/iOS/vm/OSX/sqSqueakOSXMetalView.m (206)
    M platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.h (2)
    M platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m (4)
    A platforms/iOS/vm/OSX/sqSqueakOSXViewFactory.h (22)
    A platforms/iOS/vm/OSX/sqSqueakOSXViewFactory.m (72)
    D scripts/build-metal-shaders.sh (29)

-- Patch Links --

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

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/382
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20190324/2c67c0d8/attachment.html>


More information about the Vm-dev mailing list