From a4905ffaa0185235cc638098dae277f8abc0a56c Mon Sep 17 00:00:00 2001 From: "SND\\MaddTheSane_cp" Date: Mon, 17 Sep 2012 01:15:40 +0000 Subject: Updating projects to build on Xcode 4.4 Added OpenGL shader support to the Mac software renderer. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@79892 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- .../DFCdrom/DFCdrom.xcodeproj/project.pbxproj | 8 +- .../DFInput/DFInput.xcodeproj/project.pbxproj | 8 +- .../plugins/DFNet/DFNet.xcodeproj/project.pbxproj | 8 +- .../DFSound/PeopsSPU.xcodeproj/project.pbxproj | 22 +- .../English.lproj/NetSfPeopsSoftGPUConfig.xib | 955 ++++++++++++++++----- .../PeopsSoftGPU.xcodeproj/project.pbxproj | 18 +- macosx/plugins/DFXVideo/gpuPeteOGL2.slf | 35 + macosx/plugins/DFXVideo/gpuPeteOGL2.slv | 26 + .../DFXVideo/macsrc/PluginConfigController.h | 13 +- .../DFXVideo/macsrc/PluginConfigController.m | 95 +- macosx/plugins/DFXVideo/macsrc/PluginGLView.h | 8 + macosx/plugins/DFXVideo/macsrc/PluginGLView.m | 253 +++++- macosx/plugins/DFXVideo/macsrc/SGPUPreferences.h | 18 + .../PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj | 8 +- 14 files changed, 1219 insertions(+), 256 deletions(-) create mode 100755 macosx/plugins/DFXVideo/gpuPeteOGL2.slf create mode 100755 macosx/plugins/DFXVideo/gpuPeteOGL2.slv create mode 100644 macosx/plugins/DFXVideo/macsrc/SGPUPreferences.h (limited to 'macosx/plugins') diff --git a/macosx/plugins/DFCdrom/DFCdrom.xcodeproj/project.pbxproj b/macosx/plugins/DFCdrom/DFCdrom.xcodeproj/project.pbxproj index 070d6d0e..1f8edab9 100644 --- a/macosx/plugins/DFCdrom/DFCdrom.xcodeproj/project.pbxproj +++ b/macosx/plugins/DFCdrom/DFCdrom.xcodeproj/project.pbxproj @@ -172,7 +172,7 @@ 089C1669FE841209C02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0420; + LastUpgradeCheck = 0440; }; buildConfigurationList = 7107359E0FDEED75004AD098 /* Build configuration list for PBXProject "DFCdrom" */; compatibilityVersion = "Xcode 3.2"; @@ -271,6 +271,7 @@ 7107359A0FDEED75004AD098 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -295,6 +296,7 @@ 7107359B0FDEED75004AD098 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; @@ -330,7 +332,7 @@ ); MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx10.6; + SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = NO; SYMROOT = ../../build; VALID_ARCHS = "i386 x86_64"; @@ -349,7 +351,7 @@ ../../../plugins/dfcdrom, ); MACOSX_DEPLOYMENT_TARGET = 10.6; - SDKROOT = macosx10.6; + SDKROOT = macosx; SYMROOT = ../../build; VALID_ARCHS = "i386 x86_64"; }; diff --git a/macosx/plugins/DFInput/DFInput.xcodeproj/project.pbxproj b/macosx/plugins/DFInput/DFInput.xcodeproj/project.pbxproj index 677e6b41..1485ebc5 100644 --- a/macosx/plugins/DFInput/DFInput.xcodeproj/project.pbxproj +++ b/macosx/plugins/DFInput/DFInput.xcodeproj/project.pbxproj @@ -410,7 +410,7 @@ 089C1669FE841209C02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0420; + LastUpgradeCheck = 0440; }; buildConfigurationList = 71155B110FDFA2DE00EC0BC5 /* Build configuration list for PBXProject "DFInput" */; compatibilityVersion = "Xcode 3.2"; @@ -524,6 +524,7 @@ 71155B0D0FDFA2DE00EC0BC5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -552,6 +553,7 @@ 71155B0E0FDFA2DE00EC0BC5 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; @@ -595,7 +597,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ""; - SDKROOT = macosx10.6; + SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = NO; SYMROOT = ../../build; VALID_ARCHS = "i386 x86_64"; @@ -619,7 +621,7 @@ ); MACOSX_DEPLOYMENT_TARGET = 10.6; OTHER_CFLAGS = ""; - SDKROOT = macosx10.6; + SDKROOT = macosx; SYMROOT = ../../build; VALID_ARCHS = "i386 x86_64"; }; diff --git a/macosx/plugins/DFNet/DFNet.xcodeproj/project.pbxproj b/macosx/plugins/DFNet/DFNet.xcodeproj/project.pbxproj index c163889c..d5d6b8e3 100755 --- a/macosx/plugins/DFNet/DFNet.xcodeproj/project.pbxproj +++ b/macosx/plugins/DFNet/DFNet.xcodeproj/project.pbxproj @@ -173,7 +173,7 @@ 089C1669FE841209C02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0420; + LastUpgradeCheck = 0440; }; buildConfigurationList = 7107359E0FDEED75004AD098 /* Build configuration list for PBXProject "DFNet" */; compatibilityVersion = "Xcode 3.2"; @@ -283,6 +283,7 @@ 7107359A0FDEED75004AD098 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -305,6 +306,7 @@ 7107359B0FDEED75004AD098 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; @@ -337,7 +339,7 @@ ); MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx10.6; + SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = NO; VALID_ARCHS = "i386 x86_64"; }; @@ -354,7 +356,7 @@ ../../../plugins/dfnet, ); MACOSX_DEPLOYMENT_TARGET = 10.6; - SDKROOT = macosx10.6; + SDKROOT = macosx; VALID_ARCHS = "i386 x86_64"; }; name = Release; diff --git a/macosx/plugins/DFSound/PeopsSPU.xcodeproj/project.pbxproj b/macosx/plugins/DFSound/PeopsSPU.xcodeproj/project.pbxproj index 2a95f368..671d6e36 100644 --- a/macosx/plugins/DFSound/PeopsSPU.xcodeproj/project.pbxproj +++ b/macosx/plugins/DFSound/PeopsSPU.xcodeproj/project.pbxproj @@ -77,7 +77,7 @@ 5506639914AB9E0300C7C565 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/NetSfPeopsSpuALPluginMain.xib; sourceTree = ""; }; 5517C065136217DE00706CCF /* externals.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = externals.c; path = ../../../plugins/dfsound/externals.c; sourceTree = SOURCE_ROOT; }; 5599692713AFCCC600B0216B /* openal.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = openal.c; path = ../../../plugins/dfsound/openal.c; sourceTree = SOURCE_ROOT; }; - 5599695E13AFCD2900B0216B /* PeopsAL.psxplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = PeopsAL.psxplugin; path = PeopsSpuAL.psxplugin; sourceTree = BUILT_PRODUCTS_DIR; }; + 5599695E13AFCD2900B0216B /* PeopsSpuAL.psxplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PeopsSpuAL.psxplugin; sourceTree = BUILT_PRODUCTS_DIR; }; 5599696E13AFCE1D00B0216B /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; }; 55C8AB0C146DCD0E005ACCCB /* Info-AL.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-AL.plist"; sourceTree = ""; }; 55F36E4B146CA0A900718DE6 /* maccfg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = maccfg.h; path = macsrc/maccfg.h; sourceTree = ""; }; @@ -146,7 +146,7 @@ 71E4E7A6109DC529003BB7AC /* stdafx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stdafx.h; path = ../../../plugins/dfsound/stdafx.h; sourceTree = SOURCE_ROOT; }; 71E4E7A7109DC529003BB7AC /* xa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = xa.c; path = ../../../plugins/dfsound/xa.c; sourceTree = SOURCE_ROOT; }; 71E4E7A8109DC529003BB7AC /* xa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xa.h; path = ../../../plugins/dfsound/xa.h; sourceTree = SOURCE_ROOT; }; - 8D576316048677EA00EA77CD /* PeopsSPU.psxplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = PeopsSPU.psxplugin; path = PeopsSpuSDL.psxplugin; sourceTree = BUILT_PRODUCTS_DIR; }; + 8D576316048677EA00EA77CD /* PeopsSpuSDL.psxplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PeopsSpuSDL.psxplugin; sourceTree = BUILT_PRODUCTS_DIR; }; 8D576317048677EA00EA77CD /* Info-SDL.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-SDL.plist"; sourceTree = ""; }; A1A2073D13816B1D005EE84C /* externals.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = externals.c; path = ../../../plugins/dfsound/externals.c; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ @@ -251,8 +251,8 @@ 19C28FB6FE9D52B211CA2CBB /* Products */ = { isa = PBXGroup; children = ( - 8D576316048677EA00EA77CD /* PeopsSPU.psxplugin */, - 5599695E13AFCD2900B0216B /* PeopsAL.psxplugin */, + 8D576316048677EA00EA77CD /* PeopsSpuSDL.psxplugin */, + 5599695E13AFCD2900B0216B /* PeopsSpuAL.psxplugin */, ); name = Products; sourceTree = ""; @@ -430,7 +430,7 @@ name = PeopsSpuAL; productInstallPath = "$(HOME)/Library/Bundles"; productName = "PSX Plugin"; - productReference = 5599695E13AFCD2900B0216B /* PeopsAL.psxplugin */; + productReference = 5599695E13AFCD2900B0216B /* PeopsSpuAL.psxplugin */; productType = "com.apple.product-type.bundle"; }; 8D57630D048677EA00EA77CD /* PeopsSpuSDL */ = { @@ -448,7 +448,7 @@ name = PeopsSpuSDL; productInstallPath = "$(HOME)/Library/Bundles"; productName = "PSX Plugin"; - productReference = 8D576316048677EA00EA77CD /* PeopsSPU.psxplugin */; + productReference = 8D576316048677EA00EA77CD /* PeopsSpuSDL.psxplugin */; productType = "com.apple.product-type.bundle"; }; /* End PBXNativeTarget section */ @@ -457,7 +457,7 @@ 089C1669FE841209C02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0420; + LastUpgradeCheck = 0440; }; buildConfigurationList = 71155B2B0FDFA2EB00EC0BC5 /* Build configuration list for PBXProject "PeopsSPU" */; compatibilityVersion = "Xcode 3.2"; @@ -625,6 +625,7 @@ 5599695C13AFCD2900B0216B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -649,6 +650,7 @@ 5599695D13AFCD2900B0216B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_OPTIMIZATION_LEVEL = s; @@ -672,6 +674,7 @@ 71155B270FDFA2EB00EC0BC5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -698,6 +701,7 @@ 71155B290FDFA2EB00EC0BC5 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_OPTIMIZATION_LEVEL = s; @@ -728,7 +732,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx10.6; + SDKROOT = macosx; SYMROOT = ../../build; VALID_ARCHS = "i386 x86_64"; }; @@ -740,7 +744,7 @@ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; MACOSX_DEPLOYMENT_TARGET = 10.6; - SDKROOT = macosx10.6; + SDKROOT = macosx; SYMROOT = ../../build; VALID_ARCHS = "i386 x86_64"; }; diff --git a/macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.xib b/macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.xib index 51a38238..0e8ab649 100644 --- a/macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.xib +++ b/macosx/plugins/DFXVideo/English.lproj/NetSfPeopsSoftGPUConfig.xib @@ -2,27 +2,27 @@ 1060 - 11C74 - 1938 - 1138.23 - 567.00 + 12B19 + 2549 + 1187 + 624.00 com.apple.InterfaceBuilder.CocoaPlugin - 1938 + 2549 - NSPopUpButton + NSBox NSButton - NSMenu - NSTextFieldCell NSButtonCell - NSMenuItem - NSBox NSCustomObject + NSMenu + NSMenuItem + NSPopUpButton + NSPopUpButtonCell + NSTextField + NSTextFieldCell NSView NSWindowTemplate - NSTextField - NSPopUpButtonCell com.apple.InterfaceBuilder.CocoaPlugin @@ -44,7 +44,7 @@ 1 2 - {{411, 163}, {466, 393}} + {{411, 163}, {466, 492}} 1886912512 GPU Configuration NSWindow @@ -60,12 +60,13 @@ 256 - {{208, 12}, {122, 32}} + {{208, 13}, {122, 32}} + YES - 67239424 + 67108864 134217728 Cancel @@ -74,7 +75,7 @@ 1044 - -2038284033 + -2038284288 1 @@ -82,21 +83,23 @@ 200 25 + NO 256 - {{330, 12}, {122, 32}} + {{330, 13}, {122, 32}} + YES - 67239424 + 67108864 134217728 OK - -2038284033 + -2038284288 1 @@ -104,21 +107,23 @@ 200 25 + NO 256 - {{14, 12}, {122, 32}} + {{14, 13}, {122, 32}} + YES - 67239424 + 67108864 134217728 Reset - -2038284033 + -2038284288 1 @@ -126,6 +131,7 @@ 200 25 + NO @@ -141,10 +147,11 @@ {{17, 23}, {144, 18}} + 6 YES - 67239424 + 67108864 131072 Use PC FPS calculation @@ -154,7 +161,7 @@ 6 - 1211912703 + 1211912448 2 NSSwitch @@ -164,6 +171,7 @@ 200 25 + NO @@ -171,16 +179,17 @@ {{17, 83}, {135, 18}} + 2 YES - 67239424 + 67108864 131072 Expand screen width 2 - 1211912703 + 1211912448 2 @@ -188,6 +197,7 @@ 200 25 + NO @@ -195,16 +205,17 @@ {{219, 83}, {159, 18}} + 8 YES - 67239424 + 67108864 131072 Use old frame skipping 8 - 1211912703 + 1211912448 2 @@ -212,6 +223,7 @@ 200 25 + NO @@ -219,16 +231,17 @@ {{219, 103}, {132, 18}} + 7 YES - 67239424 + 67108864 131072 Lazy screen updates 7 - 1211912703 + 1211912448 2 @@ -236,6 +249,7 @@ 200 25 + NO @@ -243,16 +257,17 @@ {{17, 43}, {135, 18}} + 4 YES - 67239424 + 67108864 131072 Disable coord check 4 - 1211912703 + 1211912448 2 @@ -260,6 +275,7 @@ 200 25 + NO @@ -267,16 +283,17 @@ {{17, 63}, {180, 18}} + 3 YES - 67239424 + 67108864 131072 Ignore black brightness color 3 - 1211912703 + 1211912448 2 @@ -284,6 +301,7 @@ 200 25 + NO @@ -291,9 +309,10 @@ {{17, 127}, {362, 28}} + YES - 67239424 + 67108864 4325376 T25seSBlbmFibGUgYSBoYWNrIHRvIGZpeCBhIHNwZWNpZmljIHByb2JsZW0gaW4gYSBnYW1lLgpIb2xk IHRoZSBtb3VzZSBvdmVyIGEgY2hlY2tib3ggdG8gZ2V0IG1vcmUgaW5mb3JtYXRpb24gYWJvdXQgaXQu @@ -319,6 +338,7 @@ A + NO @@ -326,16 +346,17 @@ A {{17, 103}, {130, 18}} + 1 YES - 67239424 + 67108864 131072 Odd/even bit hack 1 - 1211912703 + 1211912448 2 @@ -343,6 +364,7 @@ A 200 25 + NO @@ -350,16 +372,17 @@ A {{219, 43}, {189, 18}} + 10 YES - 67239424 + 67108864 131072 Draw tex-quads as triangles 10 - 1211912703 + 1211912448 2 @@ -367,6 +390,7 @@ A 200 25 + NO @@ -374,16 +398,17 @@ A {{219, 63}, {195, 18}} + 9 YES - 67239424 + 67108864 131072 Repeated flat tex triangles 9 - 1211912703 + 1211912448 2 @@ -391,6 +416,7 @@ A 200 25 + NO @@ -398,16 +424,17 @@ A {{219, 23}, {189, 18}} + 11 YES - 67239424 + 67108864 131072 Fake 'gpu busy' states 11 - 1211912703 + 1211912448 2 @@ -415,19 +442,22 @@ A 200 25 + NO {{2, 2}, {428, 175}} + - {{17, 56}, {432, 192}} + {{17, 155}, {432, 192}} + {0, 0} - 67239424 + 67108864 0 Hacks @@ -465,14 +495,15 @@ A {{18, 16}, {189, 18}} + YES - 67239424 + 67108864 0 Sync to Monitor Refresh - 1211912703 + 1211912448 2 @@ -480,6 +511,7 @@ A 200 25 + NO @@ -487,14 +519,15 @@ A {{18, 60}, {147, 18}} + YES - 67239424 + 67108864 0 Use Frame Skipping - 1211912703 + 1211912448 2 @@ -502,6 +535,7 @@ A 200 25 + NO @@ -509,14 +543,15 @@ A {{18, 82}, {148, 18}} + YES - 67239424 + 67108864 0 Display FPS Counter - 1211912703 + 1211912448 2 @@ -524,6 +559,7 @@ A 200 25 + NO @@ -531,14 +567,15 @@ A {{18, 38}, {125, 18}} + YES - 67239424 + 67108864 0 Auto Full Screen - 1211912703 + 1211912448 2 @@ -546,19 +583,22 @@ A 200 25 + NO {{2, 2}, {207, 118}} + - {{17, 252}, {211, 135}} + {{17, 351}, {211, 135}} + {0, 0} - 67239424 + 67108864 0 Display Settings @@ -585,12 +625,13 @@ A 256 - {{15, 81}, {144, 17}} + {{15, 95}, {144, 17}} + YES - 67239424 + 67108864 4194304 Dither Graphics: @@ -598,20 +639,22 @@ A + NO 256 - {{15, 49}, {174, 26}} + {{15, 63}, {174, 26}} + YES - -2076049856 + -2076180416 1024 - 109199615 + 109199360 1 LucidaGrande @@ -681,41 +724,76 @@ A YES 1 + NO 256 - {{16, 17}, {131, 18}} + {{16, 36}, {131, 18}} + YES - 67239424 + 67108864 0 Enable Hacks - 1211912703 + 1211912448 + 2 + + + + 200 + 25 + + NO + + + + 268 + {{16, 16}, {118, 18}} + + + + _NS:9 + YES + + 67108864 + 268435456 + Enable Shaders + + _NS:9 + + 1211912448 2 + + NSImage + NSSwitch + 200 25 + NO {{2, 2}, {206, 118}} + - {{239, 252}, {210, 135}} + {{239, 351}, {210, 135}} + {0, 0} - 67239424 + 67108864 0 Rendering @@ -731,12 +809,188 @@ A 2 NO + + + 12 + + + + 274 + + + + 268 + {{333, 40}, {89, 32}} + + + + _NS:9 + 1 + YES + + 67108864 + 134217728 + Select... + + _NS:9 + + -2038284288 + 129 + + + 200 + 25 + + NO + + + + 268 + {{333, 7}, {89, 32}} + + + + _NS:9 + 2 + YES + + 67108864 + 134217728 + Select... + + _NS:9 + + -2038284288 + 129 + + + 200 + 25 + + NO + + + + 268 + {{85, 49}, {249, 17}} + + + + _NS:1535 + YES + + 68157504 + 272630784 + Label + + _NS:1535 + + + + + NO + + + + 268 + {{85, 19}, {249, 17}} + + + + _NS:1535 + YES + + 68157504 + 272630784 + Label + + _NS:1535 + + + + + NO + + + + 268 + {{15, 49}, {50, 17}} + + + + _NS:1535 + YES + + 68157504 + 272630784 + Vertex: + + _NS:1535 + + + + + NO + + + + 268 + {{15, 19}, {68, 17}} + + + + _NS:1535 + YES + + 68157504 + 272630784 + Fragment: + + _NS:1535 + + + + + NO + + + {{1, 1}, {430, 78}} + + + + _NS:11 + + + {{17, 57}, {432, 94}} + + + + _NS:9 + {0, 0} + + 67108864 + 0 + Shaders + + + + 3 + MCAwLjgwMDAwMDAxMTkAA + + + + 1 + 0 + 2 + NO + - {466, 393} + {466, 492} + - {{0, 0}, {1024, 746}} + {{0, 0}, {1920, 1058}} {283.34100000000001, 129} {10000000000000, 10000000000000} YES @@ -840,6 +1094,70 @@ A 146 + + + fragmentShaderViewablePath + + + + 198 + + + + vertexShaderViewablePath + + + + 199 + + + + fragmentChooser + + + + 201 + + + + vertexChooser + + + + 203 + + + + selectShader: + + + + 205 + + + + shaders + + + + 193 + + + + toggleShader: + + + + 200 + + + + shadersView + + + + 206 + delegate @@ -898,12 +1216,13 @@ A 6 - - - + + + + @@ -964,9 +1283,10 @@ A 107 + + - @@ -991,84 +1311,6 @@ A Application - - 75 - - - - - - - - 163 - - - - - 80 - - - - - - - - 166 - - - - - 79 - - - - - - - - 165 - - - - - 82 - - - - - - - - 167 - - - - - 78 - - - - - - - - 164 - - - - - 73 - - - - - - - - 161 - - - 74 @@ -1082,58 +1324,6 @@ A - - 147 - - - - - - - - 168 - - - - - 148 - - - - - - - - 169 - - - - - 149 - - - - - - - - 170 - - - - - 150 - - - - - - - - 171 - - - 93 @@ -1253,6 +1443,240 @@ A + + 179 + + + + + + + + + + + + + 182 + + + + + + + + 183 + + + + + 184 + + + + + + + + 185 + + + + + 186 + + + + + + + + 187 + + + + + 188 + + + + + + + + 189 + + + + + 194 + + + + + + + + 195 + + + + + 196 + + + + + + + + 197 + + + + + 180 + + + + + + + + 181 + + + + + 82 + + + + + + + + 167 + + + + + 147 + + + + + + + + 168 + + + + + 79 + + + + + + + + 165 + + + + + 80 + + + + + + + + 166 + + + + + 149 + + + + + + + + 170 + + + + + 73 + + + + + + + + 161 + + + + + 148 + + + + + + + + 169 + + + + + 78 + + + + + + + + 164 + + + + + 150 + + + + + + + + 171 + + + + + 75 + + + + + + + + 163 + + + @@ -1349,6 +1773,21 @@ A com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1451,13 +1890,116 @@ A - 178 + 218 NetSfPeopsSoftGPUPluginConfigController NSWindowController + + id + id + id + id + id + id + + + + cancel: + id + + + hackToggle: + id + + + ok: + id + + + reset: + id + + + selectShader: + id + + + toggleShader: + id + + + + NSControl + NSPopUpButton + NSControl + NSControl + NSTextField + NSControl + NSControl + NSView + NSControl + NSView + NSControl + NSControl + NSTextField + + + + autoFullScreen + NSControl + + + ditherMode + NSPopUpButton + + + fpsCounter + NSControl + + + fragmentChooser + NSControl + + + fragmentShaderViewablePath + NSTextField + + + frameSkipping + NSControl + + + hackEnable + NSControl + + + hacksView + NSView + + + shaders + NSControl + + + shadersView + NSView + + + vSync + NSControl + + + vertexChooser + NSControl + + + vertexShaderViewablePath + NSTextField + + IBProjectSource ./Classes/NetSfPeopsSoftGPUPluginConfigController.h @@ -1471,15 +2013,12 @@ A com.apple.InterfaceBuilder.CocoaPlugin.macosx - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - YES 3 - {9, 8} - {7, 2} + {11, 11} + {10, 3} + {15, 15} diff --git a/macosx/plugins/DFXVideo/PeopsSoftGPU.xcodeproj/project.pbxproj b/macosx/plugins/DFXVideo/PeopsSoftGPU.xcodeproj/project.pbxproj index cd7c3444..42bf192a 100644 --- a/macosx/plugins/DFXVideo/PeopsSoftGPU.xcodeproj/project.pbxproj +++ b/macosx/plugins/DFXVideo/PeopsSoftGPU.xcodeproj/project.pbxproj @@ -19,6 +19,8 @@ 2BD2E769077AF53E00657C69 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2BD2E767077AF53E00657C69 /* Credits.rtf */; }; 2BD7C777076E1FAB000F05ED /* GLUT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2B51949E06B3D2D200744730 /* GLUT.framework */; }; 552E4CAE1474730B00FB231F /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 552E4CB01474730B00FB231F /* Localizable.strings */; }; + 5555E0C41606839300C0A310 /* gpuPeteOGL2.slf in Resources */ = {isa = PBXBuildFile; fileRef = 5555E0C21606839300C0A310 /* gpuPeteOGL2.slf */; }; + 5555E0C51606839300C0A310 /* gpuPeteOGL2.slv in Resources */ = {isa = PBXBuildFile; fileRef = 5555E0C31606839300C0A310 /* gpuPeteOGL2.slv */; }; 71E9EC06109F24E700E98D1D /* fps.c in Sources */ = {isa = PBXBuildFile; fileRef = 71E9EBF4109F24E600E98D1D /* fps.c */; }; 71E9EC08109F24E700E98D1D /* gpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 71E9EBF6109F24E600E98D1D /* gpu.c */; }; 71E9EC0B109F24E700E98D1D /* key.c in Sources */ = {isa = PBXBuildFile; fileRef = 71E9EBF9109F24E600E98D1D /* key.c */; }; @@ -48,6 +50,9 @@ 2BB260A70777462E00F6854C /* PluginConfigController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PluginConfigController.m; path = macsrc/PluginConfigController.m; sourceTree = SOURCE_ROOT; }; 2BD2E768077AF53E00657C69 /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; sourceTree = ""; }; 552E4CAF1474730B00FB231F /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = ""; }; + 5555E0C21606839300C0A310 /* gpuPeteOGL2.slf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = gpuPeteOGL2.slf; sourceTree = ""; }; + 5555E0C31606839300C0A310 /* gpuPeteOGL2.slv */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = gpuPeteOGL2.slv; sourceTree = ""; }; + 5555E0CA160695BF00C0A310 /* SGPUPreferences.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SGPUPreferences.h; path = macsrc/SGPUPreferences.h; sourceTree = ""; }; 71E9EBF1109F24E600E98D1D /* cfg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cfg.h; path = ../../../plugins/dfxvideo/cfg.h; sourceTree = SOURCE_ROOT; }; 71E9EBF2109F24E600E98D1D /* draw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = draw.h; path = ../../../plugins/dfxvideo/draw.h; sourceTree = SOURCE_ROOT; }; 71E9EBF3109F24E600E98D1D /* externals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = externals.h; path = ../../../plugins/dfxvideo/externals.h; sourceTree = SOURCE_ROOT; }; @@ -123,6 +128,7 @@ 2BAF4FCA0632967A00DB9A16 /* PluginGLView.m */, 2B3E5D64062B2CC1001D796E /* drawgl.m */, 2B57868106BE7B3700BBA288 /* ExtendedKeys.h */, + 5555E0CA160695BF00C0A310 /* SGPUPreferences.h */, ); name = macsrc; sourceTree = ""; @@ -130,6 +136,8 @@ 2BD2E818077AFB9F00657C69 /* Resources */ = { isa = PBXGroup; children = ( + 5555E0C21606839300C0A310 /* gpuPeteOGL2.slf */, + 5555E0C31606839300C0A310 /* gpuPeteOGL2.slv */, 28586CC714651E9B0082B8EC /* NetSfPeopsSoftGPUConfig.xib */, 28586CCA14651EAB0082B8EC /* NetSfPeopsSoftGPUInterface.xib */, 2BD2E767077AF53E00657C69 /* Credits.rtf */, @@ -190,7 +198,7 @@ 2B3E5A03062AAC1A001D796E /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0420; + LastUpgradeCheck = 0440; }; buildConfigurationList = 717084310FDFD328004F3EB4 /* Build configuration list for PBXProject "PeopsSoftGPU" */; compatibilityVersion = "Xcode 3.2"; @@ -222,6 +230,8 @@ 28586CC914651E9B0082B8EC /* NetSfPeopsSoftGPUConfig.xib in Resources */, 28586CCB14651EAB0082B8EC /* NetSfPeopsSoftGPUInterface.xib in Resources */, 552E4CAE1474730B00FB231F /* Localizable.strings in Resources */, + 5555E0C41606839300C0A310 /* gpuPeteOGL2.slf in Resources */, + 5555E0C51606839300C0A310 /* gpuPeteOGL2.slv in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -288,6 +298,7 @@ 7170842D0FDFD328004F3EB4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -321,6 +332,7 @@ 7170842E0FDFD328004F3EB4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; @@ -362,7 +374,7 @@ ); MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx10.6; + SDKROOT = macosx; SYMROOT = ../../build; VALID_ARCHS = "i386 x86_64"; }; @@ -378,7 +390,7 @@ ../../../libpcsxcore, ); MACOSX_DEPLOYMENT_TARGET = 10.6; - SDKROOT = macosx10.6; + SDKROOT = macosx; SYMROOT = ../../build; VALID_ARCHS = "i386 x86_64"; }; diff --git a/macosx/plugins/DFXVideo/gpuPeteOGL2.slf b/macosx/plugins/DFXVideo/gpuPeteOGL2.slf new file mode 100755 index 00000000..08e77b18 --- /dev/null +++ b/macosx/plugins/DFXVideo/gpuPeteOGL2.slf @@ -0,0 +1,35 @@ +// ColoredStorybook shader +// by guest(r) +// License: GNU-GPL + +uniform sampler2D OGL2Texture; +uniform sampler2D OGL2TMU1; + +void main() +{ + vec3 paper = texture2D(OGL2TMU1, gl_TexCoord[6].zw).xyz; + vec3 c00 = texture2D(OGL2Texture, gl_TexCoord[5].xy).xyz; + vec3 c10 = texture2D(OGL2Texture, gl_TexCoord[1].xy).xyz; + vec3 c20 = texture2D(OGL2Texture, gl_TexCoord[2].zw).xyz; + vec3 c01 = texture2D(OGL2Texture, gl_TexCoord[3].xy).xyz; + vec3 c11 = texture2D(OGL2Texture, gl_TexCoord[0].xy).xyz; + vec3 c21 = texture2D(OGL2Texture, gl_TexCoord[4].xy).xyz; + vec3 c02 = texture2D(OGL2Texture, gl_TexCoord[1].zw).xyz; + vec3 c12 = texture2D(OGL2Texture, gl_TexCoord[2].xy).xyz; + vec3 c22 = texture2D(OGL2Texture, gl_TexCoord[6].xy).xyz; + vec3 dt = vec3(1.0,1.0,1.0); + + c11 = 0.25*(c11+0.5*(c10+c01+c12+c21)+0.25*(c02+c20+c00+c22)); + + float d1=dot(abs(c00-c22),dt); + float d2=dot(abs(c20-c02),dt); + float hl=dot(abs(c01-c21),dt); + float vl=dot(abs(c10-c12),dt); + + float d = 0.60*(d1+d2+hl+vl)/(dot(c11,dt)+0.5); + + d = 0.5*pow(d,0.5) + d; + c11 = (1.0-0.6*d)*c11; + + gl_FragColor.xyz = mix(paper, c11, pow(max(min(d,1.1)-0.1,0.0),0.5)); +} diff --git a/macosx/plugins/DFXVideo/gpuPeteOGL2.slv b/macosx/plugins/DFXVideo/gpuPeteOGL2.slv new file mode 100755 index 00000000..639eb41c --- /dev/null +++ b/macosx/plugins/DFXVideo/gpuPeteOGL2.slv @@ -0,0 +1,26 @@ +// by guest(r) - guest.r@gmail.com +// license: GNU-GPL + +uniform vec4 OGL2Param; +uniform vec4 OGL2Size; + +void main() +{ +float x = (OGL2Size.x/2048.0)*OGL2Param.x; +float y = (OGL2Size.y/1024.0)*OGL2Param.y; +vec2 dg1 = vec2( x,y); +vec2 dg2 = vec2(-x,y); +vec2 dx = vec2(x,0.0); +vec2 dy = vec2(0.0,y); +gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; +gl_TexCoord[0] = gl_MultiTexCoord0; +gl_TexCoord[6].zw= gl_MultiTexCoord1.xy; +gl_TexCoord[1].xy = gl_TexCoord[0].xy - dy; +gl_TexCoord[2].xy = gl_TexCoord[0].xy + dy; +gl_TexCoord[3].xy = gl_TexCoord[0].xy - dx; +gl_TexCoord[4].xy = gl_TexCoord[0].xy + dx; +gl_TexCoord[5].xy = gl_TexCoord[0].xy - dg1; +gl_TexCoord[6].xy = gl_TexCoord[0].xy + dg1; +gl_TexCoord[1].zw = gl_TexCoord[0].xy - dg2; +gl_TexCoord[2].zw = gl_TexCoord[0].xy + dg2; +} diff --git a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.h b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.h index 0e734411..ec9c0203 100644 --- a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.h +++ b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.h @@ -4,7 +4,7 @@ #import -@interface PluginConfigController : NSWindowController +@interface NetSfPeopsSoftGPUPluginConfigController : NSWindowController { IBOutlet NSControl *autoFullScreen; IBOutlet NSPopUpButton *ditherMode; @@ -13,6 +13,15 @@ IBOutlet NSControl *hackEnable; IBOutlet NSView *hacksView; IBOutlet NSControl *vSync; + IBOutlet NSControl *shaders; + IBOutlet NSTextField *vertexShaderViewablePath; + IBOutlet NSTextField *fragmentShaderViewablePath; + IBOutlet NSControl *vertexChooser; + IBOutlet NSControl *fragmentChooser; + IBOutlet NSView *shadersView; + + NSURL *vertexPath; + NSURL *fragmentPath; NSMutableDictionary *keyValues; } @@ -20,6 +29,8 @@ - (IBAction)ok:(id)sender; - (IBAction)reset:(id)sender; - (IBAction)hackToggle:(id)sender; +- (IBAction)toggleShader:(id)sender; +- (IBAction)selectShader:(id)sender; - (void)loadValues; diff --git a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m index c765ce5d..b22167ca 100644 --- a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m +++ b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m @@ -3,6 +3,7 @@ #include "cfg.h" #include "menu.h" #include "externals.h" +#include "SGPUPreferences.h" #ifdef ENABLE_NLS #include @@ -89,9 +90,32 @@ void SoftDlgProc() [window makeKeyAndOrderFront:nil]; } +BOOL isShaderEnabled() +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSDictionary *keyValues = [defaults dictionaryForKey:PrefsKey]; + return [[keyValues objectForKey:@"UseShader"] boolValue]; +} + +NSURL *PSXVertexShader() +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSDictionary *keyValues = [defaults dictionaryForKey:PrefsKey]; + return [keyValues objectForKey:@"VertexShader"]; +} + +NSURL *PSXFragmentShader() +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSDictionary *keyValues = [defaults dictionaryForKey:PrefsKey]; + return [keyValues objectForKey:@"FragmentShader"]; +} + + void ReadConfig(void) { NSDictionary *keyValues; + NSBundle *selfBundle = [NSBundle bundleWithIdentifier:APP_ID]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: [NSMutableDictionary dictionaryWithObjectsAndKeys: @@ -103,6 +127,9 @@ void ReadConfig(void) [NSNumber numberWithBool:NO], @"Enable Hacks", [NSNumber numberWithInt:1], @"Dither Mode", [NSNumber numberWithLong:0], @"Hacks", + [[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slv"] fileReferenceURL], @"VertexShader", + [[selfBundle URLForResource:@"gpuPeteOGL2" withExtension:@"slf"] fileReferenceURL], @"FragmentShader", + [NSNumber numberWithBool:NO], @"UseShader", nil], PrefsKey, nil]]; @@ -143,7 +170,7 @@ void ReadConfig(void) BuildDispMenu(0); } -@implementation PluginConfigController +@implementation NetSfPeopsSoftGPUPluginConfigController - (IBAction)cancel:(id)sender { @@ -161,20 +188,22 @@ void ReadConfig(void) //[writeDic setObject:[NSNumber numberWithInt:[frameLimit intValue]] forKey:@"Frame Limit"]; [writeDic setObject:[NSNumber numberWithInt:[vSync intValue]] forKey:@"VSync"]; [writeDic setObject:[NSNumber numberWithInt:[hackEnable intValue]] forKey:@"Enable Hacks"]; + [writeDic setObject:[NSNumber numberWithInt:[shaders intValue]] forKey:@"UseShader"]; [writeDic setObject:[NSNumber numberWithInt:[ditherMode indexOfSelectedItem]] forKey:@"Dither Mode"]; unsigned long hackValues = 0; - int i; NSArray *views = [hacksView subviews]; - for (i=0; i<[views count]; i++) { - NSView *control = [views objectAtIndex:i]; + for (NSView *control in views) { if ([control isKindOfClass:[NSButton class]]) { hackValues |= [(NSControl *)control intValue] << ([control tag] - 1); } } - [writeDic setObject:[NSNumber numberWithLong:hackValues] forKey:@"Hacks"]; + [writeDic setObject:[NSNumber numberWithUnsignedLong:hackValues] forKey:@"Hacks"]; + + [writeDic setObject:[vertexPath fileReferenceURL] forKey:@"VertexShader"]; + [writeDic setObject:[fragmentPath fileReferenceURL] forKey:@"FragmentShader"]; // write to defaults [defaults setObject:writeDic forKey:PrefsKey]; @@ -196,17 +225,49 @@ void ReadConfig(void) - (IBAction)hackToggle:(id)sender { BOOL enable = [sender intValue] ? YES : NO; - int i; NSArray *views = [hacksView subviews]; - for (i=0; i<[views count]; i++) { - NSView *control = [views objectAtIndex:i]; + for (NSView *control in views) { if ([control isKindOfClass:[NSButton class]]) { [(NSControl *)control setEnabled:enable]; } } } +- (IBAction)toggleShader:(id)sender { + BOOL enable = [sender intValue] ? YES : NO; + NSArray *views = [shadersView subviews]; + + for (NSView *control in views) { + [(NSControl *)control setEnabled:enable]; + } +} + +- (IBAction)selectShader:(id)sender { + NSOpenPanel *openPanel = [[NSOpenPanel openPanel] retain]; + [openPanel setAllowsMultipleSelection:NO]; + [openPanel setCanChooseDirectories:NO]; + [openPanel setCanChooseFiles:YES]; + if ([openPanel runModal] == NSFileHandlingPanelOKButton) + { + if ([sender tag] == 1) { + [vertexPath release]; + vertexPath = [[openPanel URL] copy]; + [vertexShaderViewablePath setTitleWithMnemonic:[vertexPath path]]; + + } else { + [fragmentPath release]; + fragmentPath = [[openPanel URL] copy]; + [fragmentShaderViewablePath setTitleWithMnemonic:[fragmentPath path]]; + + } + } + + + + [openPanel release]; +} + - (void)loadValues { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; @@ -225,12 +286,14 @@ void ReadConfig(void) [ditherMode selectItemAtIndex:[[keyValues objectForKey:@"Dither Mode"] intValue]]; + vertexPath = [[keyValues objectForKey:@"VertexShader"] copy]; + fragmentPath = [[keyValues objectForKey:@"FragmentShader"] copy]; + [vertexShaderViewablePath setTitleWithMnemonic:[vertexPath path]]; + [fragmentShaderViewablePath setTitleWithMnemonic:[fragmentPath path]]; unsigned long hackValues = [[keyValues objectForKey:@"Hacks"] longValue]; - int i; NSArray *views = [hacksView subviews]; - for (i=0; i<[views count]; i++) { - NSView *control = [views objectAtIndex:i]; + for (NSView *control in views) { if ([control isKindOfClass:[NSButton class]]) { [(NSControl *)control setIntValue:(hackValues >> ([control tag] - 1)) & 1]; } @@ -241,7 +304,17 @@ void ReadConfig(void) - (void)awakeFromNib { + //I don't know why we need to do this... hacksView = [[hacksView subviews] objectAtIndex:0]; + shadersView = [[shadersView subviews] objectAtIndex:0]; +} + +- (void)dealloc +{ + [vertexPath release]; + [fragmentPath release]; + + [super dealloc]; } @end diff --git a/macosx/plugins/DFXVideo/macsrc/PluginGLView.h b/macosx/plugins/DFXVideo/macsrc/PluginGLView.h index fea3b89a..fe2e5f78 100644 --- a/macosx/plugins/DFXVideo/macsrc/PluginGLView.h +++ b/macosx/plugins/DFXVideo/macsrc/PluginGLView.h @@ -29,7 +29,12 @@ GLubyte *image_base; GLubyte *image[IMAGE_COUNT]; + GLboolean useShader; + float shaderQuality; GLint buffers; + GLuint vertexShader; + GLuint fragmentShader; + GLuint program; //GLint frame_rate; GLenum texture_hint; @@ -59,5 +64,8 @@ - (void)swapBuffer; - (void)clearBuffer:(BOOL)display; - (void)loadTextures: (GLboolean)first; +- (GLuint)loadShader:(GLenum)type location:(NSURL*)filename; +- (char*)loadSource:(NSURL *)filename; +void printProgramInfoLog(GLuint obj); @end diff --git a/macosx/plugins/DFXVideo/macsrc/PluginGLView.m b/macosx/plugins/DFXVideo/macsrc/PluginGLView.m index 6046fe79..2c79436b 100644 --- a/macosx/plugins/DFXVideo/macsrc/PluginGLView.m +++ b/macosx/plugins/DFXVideo/macsrc/PluginGLView.m @@ -20,8 +20,8 @@ #import #import #import -#import #import "PluginGLView.h" +#import "SGPUPreferences.h" #include "externals.h" #undef BOOL #include "gpu.h" @@ -141,7 +141,8 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) texture_range = gluCheckExtension ((const unsigned char *)"GL_APPLE_texture_range", strExt) ? GL_TRUE : GL_FALSE; texture_hint = GL_STORAGE_SHARED_APPLE ; client_storage = gluCheckExtension ((const unsigned char *)"GL_APPLE_client_storage", strExt) ? GL_TRUE : GL_FALSE; - rect_texture = gluCheckExtension((const unsigned char *)"GL_EXT_texture_rectangle", strExt) ? GL_TRUE : GL_FALSE; + //rect_texture = gluCheckExtension((const unsigned char *)"GL_EXT_texture_rectangle", strExt) ? GL_TRUE : GL_FALSE; + rect_texture = GL_FALSE; // Setup some basic OpenGL stuff glPixelStorei(GL_UNPACK_ALIGNMENT, 1); @@ -149,7 +150,27 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); - + + // Loads the shaders + + if(isShaderEnabled()){ + // --- Params --- + shaderQuality = 4.0; + //vertexShader = LoadShader(GL_VERTEX_SHADER,"/Users/you/shader/gpuPeteOGL2.slv"); + vertexShader = [self loadShader:GL_VERTEX_SHADER location:PSXVertexShader()]; + //fragmentShader = LoadShader(GL_FRAGMENT_SHADER,"/Users/you/shader/gpuPeteOGL2.slf"); + fragmentShader = [self loadShader:GL_FRAGMENT_SHADER location:PSXFragmentShader()]; + + //--- shader loading --- + program = glCreateProgram(); + glAttachShader(program, vertexShader); + glAttachShader(program, fragmentShader); + glLinkProgram(program); + glUseProgram(program); + } + + + [NSOpenGLContext clearCurrentContext]; [glLock unlock]; @@ -292,19 +313,36 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) - (void)renderScreen { int bufferIndex = whichImage; - + if (1/*[glLock tryLock]*/) { // Make this context current [[self openGLContext] makeCurrentContext]; + + // Loads the shaders + //shader=LoadShader(GL_VERTEX_SHADER,"/Users/alexandremathieu/vertex.c"); + //program=glCreateProgram(); + //glAttachShader(program, shader); + //glLinkProgram(program); + //if(program == 0){ + // printf("Program invalide bourdel\n"); + //} + if (PSXDisplay.Disabled) { glClear(GL_COLOR_BUFFER_BIT); } else { // Bind, update and draw new image - if(rect_texture) + if(rect_texture && isShaderEnabled() == NO) // cant go in there if we use shaders { + //printf("Texture Rectangle\n"); + //glActiveTexture(bufferIndex+1); + glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_RECTANGLE_EXT, bufferIndex+1); - + + + glTexSubImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, image_width, image_height, GL_BGRA, image_type, image[bufferIndex]); + + glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex2f(-1.0f, 1.0f); @@ -321,9 +359,45 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) } else { + NSRect rect = [[[self openGLContext] view] bounds]; + //printf("Texture 2D normale de taille : %d, %d sur un ecran : %f x %f \n",image_width,image_height,rect.size.width,rect.size.height); + //glActiveTexture(whichImage+1); glBindTexture(GL_TEXTURE_2D, whichImage+1); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, image_width2, image_height2, GL_BGRA, image_type, image[bufferIndex]); + + + if(isShaderEnabled()){ + glUseProgram(program); + + int loc=glGetUniformLocation(program, "OGL2Texture"); + glUniform1i(loc,0); + int loc2=glGetUniformLocation(program, "OGL2Param"); + float param[4]; + param[2]=shaderQuality; + param[0]=param[2]/image_width; + param[1]=param[2]/image_height; + //param[2]=2.0; + param[3]=0.0; + int loc3=glGetUniformLocation(program, "OGL2Size"); + float size[4]; + //NSRect rect = [[[self openGLContext] view] bounds]; + size[0]=image_width; + size[1]=image_height; + size[2]=rect.size.width; + size[3]=rect.size.height; + int loc4=glGetUniformLocation(program, "OGL2InvSize"); + float invSize[4]; + invSize[0]=1.0/size[0]; + invSize[1]=1.0/size[1]; + invSize[2]=1.0/size[2]; + invSize[3]=1.0/size[3]; + //invSize[4]=1.0/size[4]; //Did we goof here? + glUniform4fv(loc2,1,param); + glUniform4fv(loc3,1,size); + glUniform4fv(loc4,1,invSize); + } + glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex2f(-1.0f, 1.0f); @@ -351,8 +425,9 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) else { szDebugText[0]=0; - - strncat(szDispBuf, szMenuBuf, 63 - strlen(szDispBuf)); + if (szMenuBuf) { + strncat(szDispBuf, szMenuBuf, 63 - strlen(szDispBuf)); + } } NSRect rect = [[[self openGLContext] view] bounds]; @@ -381,6 +456,8 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) glPopMatrix(); } + //printProgramInfoLog(program); + //printf("\n\n\n"); [[self openGLContext] flushBuffer]; [NSOpenGLContext clearCurrentContext]; //[glLock unlock]; @@ -390,7 +467,7 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) - (void)loadTextures:(GLboolean)first { GLint i; - + printf("Loading texture\n"); //[glLock lock]; [[self openGLContext] makeCurrentContext]; @@ -464,9 +541,11 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) } glDisable(GL_TEXTURE_2D); + glActiveTexture(GL_TEXTURE0); glEnable(GL_TEXTURE_RECTANGLE_EXT); glBindTexture(GL_TEXTURE_RECTANGLE_EXT, i+1); - + + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_STORAGE_HINT_APPLE , texture_hint); glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, client_storage); glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR); @@ -504,7 +583,7 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) //if(texture_range) glTextureRangeAPPLE(GL_TEXTURE_2D, IMAGE_COUNT * image_width2 * image_height2 * (image_depth >> 3), image_base); //else glTextureRangeAPPLE(GL_TEXTURE_2D, 0, NULL); - + glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_STORAGE_HINT_APPLE , texture_hint); glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, client_storage); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); @@ -581,7 +660,7 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) GLuint lu2 = *((GLuint *)pD+1); GLuint lu3 = *((GLuint *)pD+2); GLuint *dst = ((GLuint *)((surf)+(column*lPitch)+(row<<2))); -#ifdef __BIG_ENDIAN__ +#ifdef __POWERPC__ *(dst)= (((lu1>>24)&0xff)<<16)|(((lu1>>16)&0xff)<<8)|(((lu1>>8)&0xff)); *(dst+1)= @@ -688,4 +767,154 @@ void BlitScreen16NS(unsigned char * surf,long x,long y) lastTime = time; }*/ +- (GLuint)loadShader:(GLenum)type location:(NSURL*)filename +{ + GLuint myShader = 0; + GLsizei logsize = 0; + GLint compile_status = GL_TRUE; + char *log = NULL; + char *src = NULL; + + /* creation d'un shader de sommet */ + myShader = glCreateShader(type); + if(myShader == 0) + { + fprintf(stderr, "impossible de creer le shader\n"); + return 0; + } + + /* chargement du code source */ + src = [self loadSource:filename]; + if(src == NULL) + { + /* theoriquement, la fonction LoadSource a deja affiche un message + d'erreur, nous nous contenterons de supprimer notre shader + et de retourner 0 */ + + glDeleteShader(myShader); + return 0; + } + + /* assignation du code source */ + glShaderSource(myShader, 1, (const GLchar**)&src, NULL); + + /* compilation du shader */ + glCompileShader(myShader); + + /* liberation de la memoire du code source */ + free(src); + src = NULL; + + /* verification du succes de la compilation */ + glGetShaderiv(myShader, GL_COMPILE_STATUS, &compile_status); + if(compile_status != GL_TRUE) + { + /* erreur a la compilation recuperation du log d'erreur */ + + /* on recupere la taille du message d'erreur */ + glGetShaderiv(myShader, GL_INFO_LOG_LENGTH, &logsize); + + /* on alloue un espace memoire dans lequel OpenGL ecrira le message */ + log = malloc(logsize + 1); + if(log == NULL) + { + fprintf(stderr, "impossible d'allouer de la memoire !\n"); + return 0; + } + /* initialisation du contenu */ + memset(log, '\0', logsize + 1); + + glGetShaderInfoLog(myShader, logsize, &logsize, log); + fprintf(stderr, "impossible de compiler le shader '%s' :\n%s", + [[filename path] UTF8String], log); + + /* ne pas oublier de liberer la memoire et notre shader */ + free(log); + glDeleteShader(myShader); + + return 0; + } + + return myShader; +} + +- (char*)loadSource:(NSURL *)filename +{ + /*char *src = NULL; + FILE *fp = NULL; + long size; + long i; + + + // Open the file + fp = fopen(filename, "r"); + // Check if its OK + if(fp == NULL) + { + fprintf(stderr, "Impossible to open the file '%s'\n", filename); + return NULL; + } + + // Get the file size + fseek(fp, 0, SEEK_END); + size = ftell(fp); + + // Go back to the beginning + rewind(fp); + + // Allocate memory + src = malloc(size+1); // +1 for '\0' + if(src == NULL) + { + fclose(fp); + fprintf(stderr, "Memory allocation error!\n"); + return NULL; + } + + // The the file + for(i=0; i 0) + { + infoLog = (char *)malloc(infologLength); + glGetProgramInfoLog(obj, infologLength, &charsWritten, infoLog); + printf("%s\n",infoLog); + free(infoLog); + } +} + @end diff --git a/macosx/plugins/DFXVideo/macsrc/SGPUPreferences.h b/macosx/plugins/DFXVideo/macsrc/SGPUPreferences.h new file mode 100644 index 00000000..a4cb1054 --- /dev/null +++ b/macosx/plugins/DFXVideo/macsrc/SGPUPreferences.h @@ -0,0 +1,18 @@ +// +// SGPUPreferences.h +// PeopsSoftGPU +// +// Created by C.W. Betts on 9/16/12. +// +// + +#ifndef PeopsSoftGPU_SGPUPreferences_h +#define PeopsSoftGPU_SGPUPreferences_h + +#import + +BOOL isShaderEnabled(); +NSURL *PSXFragmentShader(); +NSURL *PSXVertexShader(); + +#endif diff --git a/macosx/plugins/PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj b/macosx/plugins/PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj index 037ea76d..5357a69b 100644 --- a/macosx/plugins/PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj +++ b/macosx/plugins/PeopsXgl/PeopsXGL.xcodeproj/project.pbxproj @@ -200,7 +200,7 @@ 2B3E5A03062AAC1A001D796E /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0420; + LastUpgradeCheck = 0440; }; buildConfigurationList = 717084310FDFD328004F3EB4 /* Build configuration list for PBXProject "PeopsXGL" */; compatibilityVersion = "Xcode 3.2"; @@ -301,6 +301,7 @@ 7170842D0FDFD328004F3EB4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -334,6 +335,7 @@ 7170842E0FDFD328004F3EB4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; GCC_DYNAMIC_NO_PIC = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; @@ -375,7 +377,7 @@ ); MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx10.6; + SDKROOT = macosx; SYMROOT = ../../build; VALID_ARCHS = "i386 x86_64"; WARNING_CFLAGS = "-Wall"; @@ -398,7 +400,7 @@ ); MACOSX_DEPLOYMENT_TARGET = 10.6; OTHER_CFLAGS = "-fomit-frame-pointer"; - SDKROOT = macosx10.6; + SDKROOT = macosx; SYMROOT = ../../build; VALID_ARCHS = "i386 x86_64"; WARNING_CFLAGS = "-Wall"; -- cgit v1.2.3