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

Use MTLRenderCommandEncoder setFrontFacingWinding instead of setFrontFacing #1931

Merged
merged 1 commit into from Nov 3, 2019
Merged

Conversation

ghost
Copy link

@ghost ghost commented Nov 3, 2019

The Problem:

macOS 10.15 does not define the MTLRenderCommandEncoder setFrontFacing message. This warning occurs when compiling:

==== Building bgfx-shared-lib (release64) ====
renderer_mtl.mm
In file included from ../../../src/renderer_mtl.mm:10:
../../../src/renderer_mtl.h:431:11: warning: instance method '-setFrontFacing:' not found
      (return type defaults to 'id') [-Wobjc-method-access]
                        [m_obj setFrontFacing:_frontFacing];
                               ^~~~~~~~~~~~~~

The examples crash with this error:

2019-11-02 20:33:51.954 examplesRelease[90366:433716] -[BronzeMtlRenderCmdEncoder setFrontFacing:]: unrecognized selector sent to instance 0x7ff53007f800
2019-11-02 20:33:51.955 examplesRelease[90366:433716] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[BronzeMtlRenderCmdEncoder setFrontFacing:]: unrecognized selector sent to instance 0x7ff53007f800'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff30472d63 __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff661c8bd4 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff304fd206 -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x00007fff3041951b ___forwarding___ + 1427
	4   CoreFoundation                      0x00007fff30418ef8 _CF_forwarding_prep_0 + 120
	5   examplesRelease                     0x0000000109ab7e2b _ZN4bgfx3mtl18RendererContextMtl6submitEPNS_5FrameERNS_9ClearQuadERNS_19TextVideoMemBlitterE + 3643
	6   examplesRelease                     0x0000000109a7f88d _ZN4bgfx7Context11renderFrameEi + 493
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Proposed Solution:

I replaced setFrontFacing with the next closest message setFrontFacingWinding. The examples run as expected with the change. Apple doesn't seem to document that this was changed, so I'm just taking a shot in the dark that this is correct. Let me know what you think. Thanks!

@bkaradzic
Copy link
Owner

cc @attilaz

@attilaz
Copy link
Contributor

attilaz commented Nov 3, 2019

looks good.
@bkaradzic Please accept this. This is a cleaner solution than #1930

Adding setFrontFacing was a mistake, I see no reference to it anywhere in objective-c API.

@bkaradzic bkaradzic merged commit 960390f into bkaradzic:master Nov 3, 2019
@ghost ghost deleted the fix_setFrontFacing branch November 3, 2019 19:19
pigpigyyy added a commit to pigpigyyy/bgfx that referenced this pull request Dec 23, 2019
* master: (107 commits)
  Fix inconsitency between Backends for RGB5A1 (bkaradzic#1932)
  Removing setFrontFacing, using setFrontFacingWinding instead (bkaradzic#1931)
  Fixed issue bkaradzic#1927.
  Updated ImGui.
  Cleanup.
  Updated API version.
  view stats: Make CPU and GPU timestamps available (bkaradzic#1921)
  Updated ImGui.
  Updated spirv-cross.
  Updated spirv-tools.
  Cleanup.
  Support disabling vsync on Vulkan, take 2 (bkaradzic#1925)
  Revert "Support disabling Vsync on Vulkan [couriersud] (bkaradzic#1924)"
  Support disabling Vsync on Vulkan [couriersud] (bkaradzic#1924)
  Cleanup.
  Cleanup.
  Updated README.
  readme: add openblack to projects using bgfx (bkaradzic#1923)
  Updated spirv-cross.
  Updated spirv-tools.
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants