Skip to content

Commit

Permalink
opengl3 multisampling adaptation
Browse files Browse the repository at this point in the history
  • Loading branch information
Stepan Kopylov committed Oct 8, 2019
1 parent 98e2544 commit 50377dc
Show file tree
Hide file tree
Showing 15 changed files with 691 additions and 19 deletions.
6 changes: 5 additions & 1 deletion Classes/SKAntialiasedAsyncGLViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ - (void)drawGL:(CGRect)rect

glFlush();

glResolveMultisampleFramebufferAPPLE();
if(self.api == kEAGLRenderingAPIOpenGLES2){
glResolveMultisampleFramebufferAPPLE();
}else{
glBlitFramebuffer(0,0,rect.size.width,rect.size.height, 0,0,rect.size.width,rect.size.height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
}

const GLenum discards[] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTACHMENT };
glDiscardFramebufferEXT(GL_READ_FRAMEBUFFER_APPLE, 2, discards);
Expand Down
2 changes: 2 additions & 0 deletions Classes/SKAsyncGLView.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

#import "SKAsyncGLView.h"
#import <OpenGLES/ES3/gl.h>
#import <OpenGLES/ES3/glext.h>

@interface SKAsyncGLView ()
@property (nonatomic) BOOL contextsCreated;
Expand Down
2 changes: 2 additions & 0 deletions Classes/SKBaseAsyncGLViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

@property (nonatomic) BOOL paused;

@property (nonatomic) EAGLRenderingAPI api;

- (void)setupGL:(CGRect)rect;

- (void)drawGL:(CGRect)rect;
Expand Down
2 changes: 2 additions & 0 deletions Classes/SKBaseAsyncGLViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ @implementation SKBaseAsyncGLViewController

- (void)loadView
{
self.api = [self getApi];

self.view = [SKAsyncGLView new];
self.view.delegate = self;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
6A71C2B71CD21489004320A9 /* BasicViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A71C2B61CD21489004320A9 /* BasicViewController.m */; };
7916229A1E80144400D14255 /* SKAntialiasedAsyncGLViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 791622991E80144400D14255 /* SKAntialiasedAsyncGLViewController.m */; };
7958C68C1F3E0CC0002AC1D0 /* SKAsyncGLViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7958C68B1F3E0CC0002AC1D0 /* SKAsyncGLViewController.m */; };
79C6BA6B234CC54B00C4C502 /* MultipleInstancesGL3ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 79C6BA6A234CC54B00C4C502 /* MultipleInstancesGL3ViewController.m */; };
79C6BA6E234CC58700C4C502 /* CubeGL3ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 79C6BA6D234CC58700C4C502 /* CubeGL3ViewController.m */; };
79C6BA71234CC7E300C4C502 /* Shader.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 79C6BA6F234CC7E300C4C502 /* Shader.vsh */; };
79C6BA72234CC7E300C4C502 /* Shader.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 79C6BA70234CC7E300C4C502 /* Shader.fsh */; };
79C6BA74234CC8E500C4C502 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 79C6BA73234CC8E500C4C502 /* OpenGLES.framework */; };
C3987DB84930E9B72C7DEEFE /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BF55AAE6227749C3F5551629 /* libPods.a */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -64,6 +69,13 @@
791622991E80144400D14255 /* SKAntialiasedAsyncGLViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKAntialiasedAsyncGLViewController.m; sourceTree = "<group>"; };
7958C68A1F3E0CC0002AC1D0 /* SKAsyncGLViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKAsyncGLViewController.h; sourceTree = "<group>"; };
7958C68B1F3E0CC0002AC1D0 /* SKAsyncGLViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKAsyncGLViewController.m; sourceTree = "<group>"; };
79C6BA69234CC54B00C4C502 /* MultipleInstancesGL3ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MultipleInstancesGL3ViewController.h; sourceTree = "<group>"; };
79C6BA6A234CC54B00C4C502 /* MultipleInstancesGL3ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MultipleInstancesGL3ViewController.m; sourceTree = "<group>"; };
79C6BA6C234CC58700C4C502 /* CubeGL3ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CubeGL3ViewController.h; sourceTree = "<group>"; };
79C6BA6D234CC58700C4C502 /* CubeGL3ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CubeGL3ViewController.m; sourceTree = "<group>"; };
79C6BA6F234CC7E300C4C502 /* Shader.vsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = Shader.vsh; sourceTree = "<group>"; };
79C6BA70234CC7E300C4C502 /* Shader.fsh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = Shader.fsh; sourceTree = "<group>"; };
79C6BA73234CC8E500C4C502 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
BF55AAE6227749C3F5551629 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
D67F41E571512E67556CC63B /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand All @@ -73,6 +85,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
79C6BA74234CC8E500C4C502 /* OpenGLES.framework in Frameworks */,
C3987DB84930E9B72C7DEEFE /* libPods.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -83,6 +96,7 @@
1D86BCC062DC133D8491B025 /* Frameworks */ = {
isa = PBXGroup;
children = (
79C6BA73234CC8E500C4C502 /* OpenGLES.framework */,
BF55AAE6227749C3F5551629 /* libPods.a */,
);
name = Frameworks;
Expand Down Expand Up @@ -134,6 +148,8 @@
6A71C2981CD13972004320A9 /* Shaders */ = {
isa = PBXGroup;
children = (
79C6BA70234CC7E300C4C502 /* Shader.fsh */,
79C6BA6F234CC7E300C4C502 /* Shader.vsh */,
6A71C2991CD13980004320A9 /* SimpleVertex.glsl */,
6A71C29B1CD13A4F004320A9 /* SimpleFragment.glsl */,
6A71C29F1CD13E9B004320A9 /* CC3Foundation.h */,
Expand Down Expand Up @@ -173,8 +189,12 @@
6A71C2B61CD21489004320A9 /* BasicViewController.m */,
6A00F0131CD0C26700DF53D2 /* CubeGL2ViewController.h */,
6A00F0141CD0C26700DF53D2 /* CubeGL2ViewController.m */,
79C6BA6C234CC58700C4C502 /* CubeGL3ViewController.h */,
79C6BA6D234CC58700C4C502 /* CubeGL3ViewController.m */,
6A00F02F1CD1201300DF53D2 /* MultipleInstancesGL2ViewController.h */,
6A00F0301CD1201300DF53D2 /* MultipleInstancesGL2ViewController.m */,
79C6BA69234CC54B00C4C502 /* MultipleInstancesGL3ViewController.h */,
79C6BA6A234CC54B00C4C502 /* MultipleInstancesGL3ViewController.m */,
);
name = ViewControllers;
sourceTree = "<group>";
Expand Down Expand Up @@ -252,8 +272,10 @@
files = (
6A00F01D1CD0C26700DF53D2 /* LaunchScreen.storyboard in Resources */,
6A71C29A1CD13980004320A9 /* SimpleVertex.glsl in Resources */,
79C6BA71234CC7E300C4C502 /* Shader.vsh in Resources */,
6A00F01A1CD0C26700DF53D2 /* Assets.xcassets in Resources */,
6A00F0181CD0C26700DF53D2 /* Main.storyboard in Resources */,
79C6BA72234CC7E300C4C502 /* Shader.fsh in Resources */,
6A71C29C1CD13A4F004320A9 /* SimpleFragment.glsl in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -317,11 +339,13 @@
6A00F0311CD1201300DF53D2 /* MultipleInstancesGL2ViewController.m in Sources */,
6A71C2B31CD21039004320A9 /* SKBaseAsyncGLViewController.m in Sources */,
6A71C2B21CD21039004320A9 /* SKAsyncGLView.m in Sources */,
79C6BA6B234CC54B00C4C502 /* MultipleInstancesGL3ViewController.m in Sources */,
7916229A1E80144400D14255 /* SKAntialiasedAsyncGLViewController.m in Sources */,
6A00F0151CD0C26700DF53D2 /* CubeGL2ViewController.m in Sources */,
6A00F0121CD0C26700DF53D2 /* AppDelegate.m in Sources */,
6A71C2A91CD13E9B004320A9 /* CC3Foundation.m in Sources */,
6A00F00F1CD0C26700DF53D2 /* main.m in Sources */,
79C6BA6E234CC58700C4C502 /* CubeGL3ViewController.m in Sources */,
7958C68C1F3E0CC0002AC1D0 /* SKAsyncGLViewController.m in Sources */,
6A71C2AA1CD13E9B004320A9 /* CC3GLMatrix.m in Sources */,
6A71C2B71CD21489004320A9 /* BasicViewController.m in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "B115197B-6211-4632-9669-ED111193F737"
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "E1184650-D01A-4221-A6F4-CCB2DC3908E2"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SKAsyncGLViewController/CubeGL3ViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "126"
endingLineNumber = "126"
landmarkName = "-clearGL"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "89113F04-B4C6-4499-9A20-17ADB818C251"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SKAsyncGLViewController/CubeGL3ViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "279"
endingLineNumber = "279"
landmarkName = "-validateProgram:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "524EE7C1-B6C5-40FA-98AC-BB83BA2BE3F9"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SKAsyncGLViewController/CubeGL3ViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "276"
endingLineNumber = "276"
landmarkName = "-validateProgram:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "27CE52B8-1C8C-44D1-81DA-775E2667630B"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SKAsyncGLViewController/CubeGL3ViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "282"
endingLineNumber = "282"
landmarkName = "-validateProgram:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "A95B0E08-0ABC-4400-9AD5-1E62DEC2A678"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SKAsyncGLViewController/CubeGL3ViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "284"
endingLineNumber = "284"
landmarkName = "-validateProgram:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "0210360F-E227-4184-9993-EFCF83D1EA45"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "SKAsyncGLViewController/CubeGL3ViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "270"
endingLineNumber = "270"
landmarkName = "-validateProgram:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.OpenGLErrorBreakpoint">
<BreakpointContent
uuid = "CCD96C64-F466-4A49-BFA5-80CEE43AB505"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
breakpointStackSelectionBehavior = "1"
symbolName = "__GPUTOOLS_HAS_DETECTED_AN_OPENGL_ERROR__"
moduleName = "libglInterpose.dylib">
<Actions>
<BreakpointActionProxy
ActionExtensionID = "Xcode.BreakpointAction.OpenGLError">
<ActionContent>
</ActionContent>
</BreakpointActionProxy>
</Actions>
<Locations>
</Locations>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Loading

0 comments on commit 50377dc

Please sign in to comment.