Skip to content

Commit

Permalink
Merge pull request #422 from OpenSmalltalk/hack_to_restore_b3D_macos3…
Browse files Browse the repository at this point in the history
…2x86

hack to restore B3DAcceleratorPlugin on macos32x86

No objection, it fixes issue #397, without causing any supplementary CI failure (our cog trunk branch status is a tiny bit less red, but still red, as it should never be, but constantly is...).
Let's move to something else.
  • Loading branch information
nicolas-cellier-aka-nice committed Sep 2, 2019
2 parents 4a3b1d4 + 4067ad9 commit a963d2d
Show file tree
Hide file tree
Showing 9 changed files with 1,550 additions and 3 deletions.
5 changes: 5 additions & 0 deletions build.macos32x86/common/Makefile.plugin
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ endif

CROSSDIR:= $(PLATDIR)/Cross/plugins/$(LIBDIR)
OSXDIR:= $(PLATDIR)/iOS/vm/OSX
#quick hack for B3DAcceleratorPlugin: no 32 bit METAL FRAMEWORK
ifeq ($(LIBDIR),B3DAcceleratorPlugin)
OSXPLGDIR:= $(PLATDIR)/iOS/plugins/$(LIBDIR)32
else
OSXPLGDIR:= $(PLATDIR)/iOS/plugins/$(LIBDIR)
endif
UNIXDIR:= $(PLATDIR)/unix/vm
MAKERDIR:= $(PLUGINSRCDIR)/$(LIBDIR)
BUILDDIR:= $(BUILD)/$(LIBDIR)
Expand Down
8 changes: 5 additions & 3 deletions build.macos32x86/common/Makefile.vm
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,12 @@ endif
#
.PHONY: $(OBJDIR)/%.lib $(OBJDIR)/%.bundle $(OBJDIR)/%.dylib

hack-b3d = $(subst B3DAcceleratorPlugin,B3DAcceleratorPlugin32,$(1))

ifeq ($(USEPLUGINASDYLIB),TRUE)
plugin-makefile = $(firstword $(realpath $(OSXPLUGINSDIR)/$(subst lib,,$(1))/Makefile ../common/Makefile.plugin))
plugin-makefile = $(firstword $(realpath $(OSXPLUGINSDIR)/$(subst lib,,$(call hack-b3d,$(1)))/Makefile ../common/Makefile.plugin))
else
plugin-makefile = $(firstword $(realpath $(OSXPLUGINSDIR)/$(1)/Makefile ../common/Makefile.plugin))
plugin-makefile = $(firstword $(realpath $(OSXPLUGINSDIR)/$(call hack-b3d,$(1))/Makefile ../common/Makefile.plugin))
endif

# Internal plugin. Build as lib then link in lib
Expand All @@ -241,7 +243,7 @@ prereqs/%.lib:
@-ls -rlt $(call plugin-makefile,$(*F)) $(wildcard $(*F).ignore) \
$(wildcard $(PLUGINSRCDIR)/$(*F)/*.c) \
$(wildcard $(PLATDIR)/Cross/plugins/$(*F)/*.*) \
$(wildcard $(OSXPLUGINSDIR)/$(*F)/*.*)
$(wildcard $(OSXPLUGINSDIR)/$(call hack-b3d,$(*F))/*.*)

# It would be nice to have this abbreviation but it creates havoc eem 2/2016
#%.lib: $(OBJDIR)/%.lib
Expand Down
14 changes: 14 additions & 0 deletions platforms/iOS/plugins/B3DAcceleratorPlugin32/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# The current version of B3DAcceleratorPlugin (the OpenGL interface) uses lots
# of Carbon code & is hence 32-bit only. So include the Carbon frameworks.
# Until this can be rewritten this implies no 64-bit OpenGL on Mac OS X :-(.

INCDIRS:=$(PLATDIR)/Cross/plugins/FilePlugin \
$(PLATDIR)/unix/vm
INCDIRS:=$(PLATDIR)/unix/vm

EXTRADYFLAGS=-Wl,-U,_getImageName,-U,_getSTWindow,-U,_setWindowChangedHook,-U,_warning \
-Wl,-U,_getMainWindowOpenGLContext,-U,_createOpenGLTextureLayerHandle,-U,_destroyOpenGLTextureLayerHandle,-U,_setOpenGLTextureLayerContent
EXTRALIBS:= -framework CoreFoundation -framework OpenGL -framework Cocoa
#EXTRALIBS:= -framework OpenGL -framework AGL

include ../common/Makefile.plugin
47 changes: 47 additions & 0 deletions platforms/iOS/plugins/B3DAcceleratorPlugin32/sqMacOpenGL.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#ifndef SQ_MAC_OPENGL_H
#define SQ_MAC_OPENGL_H

#define MAX_RENDERER 16

# import <OpenGL/gl.h>
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
# import <OpenGL/OpenGL.h>
#else
# import <OpenGL/Opengl.h>
#endif

typedef struct glRendererFramebuffer {
GLuint handle;
GLuint texture;
GLuint depthStencilBuffer;

GLuint resolveFramebuffer;
GLuint multisampleColorbuffer;
} glRendererFramebuffer;

typedef struct glRenderer {
/* Required by the common implementation */
GLint bufferRect[4];
GLint viewport[4];

int used;

void* theOpenGLContext;
unsigned int layerHandle;

// Multi sampling
int hasMultisampling;
int sampleCount;

// Depth and stencil buffer
int hasStencilBuffer;
GLenum depthStencilFormat;

glRendererFramebuffer framebuffers[2];
unsigned int backBufferIndex;

} glRenderer;

#define GL_RENDERER_DEFINED 1

#endif /* SQ_MAC_OPENGL_H */
Loading

0 comments on commit a963d2d

Please sign in to comment.