Browse Source

no message

Hongtae Kim 7 years ago
parent
commit
fa34711af5

+ 1
- 1
.gitignore View File

@@ -59,7 +59,7 @@ __pycache__/
59 59
 docs/_build/
60 60
 
61 61
 # project settings
62
-Build/**
62
+Build/
63 63
 
64 64
 # Visual Studio 2015 and later
65 65
 *.VC.db

BIN
Data/triangle.frag.spv View File


BIN
Data/triangle.vert.spv View File


+ 36
- 12
TestApp1/TestApp1.cpp View File

@@ -12,15 +12,37 @@ class TestApp1 : public DKApplication
12 12
 {
13 13
 	DKObject<DKWindow> window;
14 14
 	DKObject<DKThread> renderThread;
15
+	DKResourcePool resourcePool;
15 16
 
16 17
 	DKAtomicNumber32 runningRenderThread;
17 18
 public:
18 19
 	void RenderThread(void)
19 20
 	{
21
+		DKObject<DKData> vertData = resourcePool.LoadResourceData("triangle.vert.spv");
22
+		DKObject<DKData> fragData = resourcePool.LoadResourceData("triangle.frag.spv");
23
+		DKShader vertShader(vertData, DKShader::StageType::Vertex);
24
+		DKShader fragShader(fragData, DKShader::StageType::Fragment);
25
+
20 26
 		DKObject<DKGraphicsDevice> device = DKGraphicsDevice::SharedInstance();
27
+		DKObject<DKShaderModule> vertShaderModule = device->CreateShaderModule(&vertShader);
28
+		DKObject<DKShaderModule> fragShaderModule = device->CreateShaderModule(&fragShader);
29
+
30
+		DKObject<DKShaderFunction> vertShaderFunction = vertShaderModule->CreateFunction(vertShaderModule->FunctionNames().Value(0));
31
+		DKObject<DKShaderFunction> fragShaderFunction = fragShaderModule->CreateFunction(fragShaderModule->FunctionNames().Value(0));
32
+
21 33
 		DKObject<DKCommandQueue> queue = device->CreateCommandQueue();
22 34
 		DKObject<DKSwapChain> swapChain = queue->CreateSwapChain(window);
23 35
 
36
+
37
+		DKRenderPipelineDescriptor pipelineDescriptor;
38
+		pipelineDescriptor.vertexFunction = vertShaderFunction;
39
+		pipelineDescriptor.fragmentFunction = fragShaderFunction;
40
+		pipelineDescriptor.colorAttachments.Resize(1);
41
+		pipelineDescriptor.colorAttachments.Value(0).pixelFormat = swapChain->ColorPixelFormat();
42
+
43
+
44
+		DKObject<DKRenderPipelineState> pipelineState = device->CreateRenderPipeline(pipelineDescriptor, NULL);
45
+
24 46
 		DKTimer timer;
25 47
 		timer.Reset();
26 48
 
@@ -54,14 +76,16 @@ public:
54 76
 
55 77
 	void OnInitialize(void) override
56 78
 	{
57
-		DKLog("%s", DKGL_FUNCTION_NAME);
58
-		try {
59
-			window = DKWindow::Create("DefaultWindow");
60
-		}
61
-		catch (DKError& e)
62
-		{
63
-			DKLog("error? :%ls", (const wchar_t*)e.Description());
64
-		}
79
+		DKLogD("%s", DKGL_FUNCTION_NAME);
80
+
81
+		DKString resPath = DefaultPath(SystemPath::AppResource);
82
+		resPath = resPath.FilePathStringByAppendingPath("Data");
83
+		DKLog("resPath: %ls", (const wchar_t*)resPath);
84
+		resourcePool.AddLocatorForPath(resPath);
85
+
86
+		window = DKWindow::Create("DefaultWindow");
87
+		window->SetOrigin({ 0, 0 });
88
+		window->Resize({ 320, 240 });
65 89
 		window->Activate();
66 90
 
67 91
 		window->AddEventHandler(this,
@@ -76,14 +100,14 @@ public:
76 100
 	}
77 101
 	void OnTerminate(void) override
78 102
 	{
79
-		DKLog("%s", DKGL_FUNCTION_NAME);
103
+		DKLogD("%s", DKGL_FUNCTION_NAME);
80 104
 
81 105
 		runningRenderThread = 0;
82 106
 		renderThread->WaitTerminate();
83 107
 		renderThread = NULL;
84 108
 		window = NULL;
85 109
 
86
-		DKLog("Memory Pool Statistics");
110
+		DKLogI("Memory Pool Statistics");
87 111
 		size_t numBuckets = DKMemoryPoolNumberOfBuckets();
88 112
 		DKMemoryPoolBucketStatus* buckets = new DKMemoryPoolBucketStatus[numBuckets];
89 113
 		DKMemoryPoolQueryAllocationStatus(buckets, numBuckets);
@@ -92,7 +116,7 @@ public:
92 116
 		{
93 117
 			if (buckets[i].totalChunks > 0)
94 118
 			{
95
-				DKLog("--> %5lu:  %5lu/%5lu, usage: %.1f%%, used: %.1fKB, total: %.1fKB",
119
+				DKLogI("--> %5lu:  %5lu/%5lu, usage: %.1f%%, used: %.1fKB, total: %.1fKB",
96 120
 					buckets[i].chunkSize,
97 121
 					buckets[i].usedChunks, buckets[i].totalChunks,
98 122
 					double(buckets[i].usedChunks) / double(buckets[i].totalChunks) * 100.0,
@@ -102,7 +126,7 @@ public:
102 126
 				usedBytes += buckets[i].chunkSize * buckets[i].usedChunks;
103 127
 			}
104 128
 		}
105
-		DKLog("MemoryPool Usage: %.1fMB / %.1fMB", double(usedBytes) / (1024 * 1024), double(DKMemoryPoolSize()) / (1024 * 1024));
129
+		DKLogI("MemoryPool Usage: %.1fMB / %.1fMB", double(usedBytes) / (1024 * 1024), double(DKMemoryPoolSize()) / (1024 * 1024));
106 130
 		delete[] buckets;
107 131
 	}
108 132
 };

+ 21
- 1
TestApp1/TestApp1.vcxproj View File

@@ -22,7 +22,7 @@
22 22
     <ProjectGuid>{AE0AF61D-F069-4AFA-AE24-A75C6A233B37}</ProjectGuid>
23 23
     <Keyword>Win32Proj</Keyword>
24 24
     <RootNamespace>TestApp1</RootNamespace>
25
-    <WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
25
+    <WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
26 26
   </PropertyGroup>
27 27
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
28 28
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -104,6 +104,11 @@
104 104
     <Manifest>
105 105
       <EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness>
106 106
     </Manifest>
107
+    <PostBuildEvent>
108
+      <Command>echo Copying Resource Files...
109
+xcopy /Y /D /R /Q /E "$(SolutionDir)Data" "$(OutDir)Data\"
110
+</Command>
111
+    </PostBuildEvent>
107 112
   </ItemDefinitionGroup>
108 113
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
109 114
     <ClCompile>
@@ -120,6 +125,11 @@
120 125
     <Manifest>
121 126
       <EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness>
122 127
     </Manifest>
128
+    <PostBuildEvent>
129
+      <Command>echo Copying Resource Files...
130
+xcopy /Y /D /R /Q /E "$(SolutionDir)Data" "$(OutDir)Data\"
131
+</Command>
132
+    </PostBuildEvent>
123 133
   </ItemDefinitionGroup>
124 134
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
125 135
     <ClCompile>
@@ -140,6 +150,11 @@
140 150
     <Manifest>
141 151
       <EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness>
142 152
     </Manifest>
153
+    <PostBuildEvent>
154
+      <Command>echo Copying Resource Files...
155
+xcopy /Y /D /R /Q /E "$(SolutionDir)Data" "$(OutDir)Data\"
156
+</Command>
157
+    </PostBuildEvent>
143 158
   </ItemDefinitionGroup>
144 159
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
145 160
     <ClCompile>
@@ -160,6 +175,11 @@
160 175
     <Manifest>
161 176
       <EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness>
162 177
     </Manifest>
178
+    <PostBuildEvent>
179
+      <Command>echo Copying Resource Files...
180
+xcopy /Y /D /R /Q /E "$(SolutionDir)Data" "$(OutDir)Data\"
181
+</Command>
182
+    </PostBuildEvent>
163 183
   </ItemDefinitionGroup>
164 184
   <ItemGroup>
165 185
     <ClInclude Include="Win32\Resource.h" />

+ 8
- 16
TestApp1/TestApp1.xcodeproj/project.pbxproj View File

@@ -9,21 +9,19 @@
9 9
 /* Begin PBXBuildFile section */
10 10
 		66DA89941DD3117F00338015 /* TestApp1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 844A9A801DD0C080007DCC89 /* TestApp1.cpp */; };
11 11
 		66DA89971DD3118000338015 /* TestApp1.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 844A9A801DD0C080007DCC89 /* TestApp1.cpp */; };
12
-		66DA899B1DD3164E00338015 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66DA899A1DD3164E00338015 /* AppKit.framework */; };
13 12
 		840D5D3B1DDA07B2009DA369 /* DK.xcodeproj in Resources */ = {isa = PBXBuildFile; fileRef = 840D5D3A1DDA07B2009DA369 /* DK.xcodeproj */; };
14 13
 		840D5D921DDA08C2009DA369 /* libDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 840D5D891DDA0890009DA369 /* libDK.a */; };
15 14
 		840D5D931DDA08CA009DA369 /* libDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 840D5D871DDA0890009DA369 /* libDK.a */; };
16 15
 		841948EB1DDCBE6000E039F0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 841948E91DDCBE5000E039F0 /* AppDelegate.m */; };
17 16
 		841948EF1DDCBE7B00E039F0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 841948ED1DDCBE7500E039F0 /* AppDelegate.m */; };
17
+		8420EE201EE5BA6500A20933 /* Data in Resources */ = {isa = PBXBuildFile; fileRef = 8420EE1F1EE5BA6500A20933 /* Data */; };
18
+		8420EE211EE5BA6500A20933 /* Data in Resources */ = {isa = PBXBuildFile; fileRef = 8420EE1F1EE5BA6500A20933 /* Data */; };
18 19
 		844A9A851DD0C080007DCC89 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 844A9A781DD0C080007DCC89 /* Assets.xcassets */; };
19 20
 		844A9A871DD0C080007DCC89 /* small.ico in Resources */ = {isa = PBXBuildFile; fileRef = 844A9A7C1DD0C080007DCC89 /* small.ico */; };
20 21
 		844A9A881DD0C080007DCC89 /* TestApp1.ico in Resources */ = {isa = PBXBuildFile; fileRef = 844A9A7E1DD0C080007DCC89 /* TestApp1.ico */; };
21 22
 		844A9A891DD0C080007DCC89 /* TestApp1.rc in Resources */ = {isa = PBXBuildFile; fileRef = 844A9A7F1DD0C080007DCC89 /* TestApp1.rc */; };
22 23
 		844A9A8B1DD0C08F007DCC89 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 844A9A741DD0C080007DCC89 /* Assets.xcassets */; };
23 24
 		844A9A8D1DD0C08F007DCC89 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 844A9A761DD0C080007DCC89 /* LaunchScreen.storyboard */; };
24
-		84D883561E3A6A9200478725 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D883551E3A6A9200478725 /* OpenAL.framework */; };
25
-		84D883601E3A6B0000478725 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84D8835F1E3A6B0000478725 /* OpenAL.framework */; };
26
-		84F6F3401E142A110096F558 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84F6F33F1E142A110096F558 /* UIKit.framework */; };
27 25
 /* End PBXBuildFile section */
28 26
 
29 27
 /* Begin PBXContainerItemProxy section */
@@ -72,12 +70,12 @@
72 70
 /* End PBXContainerItemProxy section */
73 71
 
74 72
 /* Begin PBXFileReference section */
75
-		66DA899A1DD3164E00338015 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
76 73
 		840D5D3A1DDA07B2009DA369 /* DK.xcodeproj */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "wrapper.pb-project"; name = DK.xcodeproj; path = ../DK/DK.xcodeproj; sourceTree = "<group>"; };
77 74
 		841948E81DDCBE5000E039F0 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
78 75
 		841948E91DDCBE5000E039F0 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
79 76
 		841948EC1DDCBE7500E039F0 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
80 77
 		841948ED1DDCBE7500E039F0 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
78
+		8420EE1F1EE5BA6500A20933 /* Data */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Data; path = ../Data; sourceTree = "<group>"; };
81 79
 		844A9A441DD0BCFD007DCC89 /* TestApp1_macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestApp1_macOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
82 80
 		844A9A5C1DD0BEDD007DCC89 /* TestApp1_iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestApp1_iOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
83 81
 		844A9A741DD0C080007DCC89 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -91,9 +89,6 @@
91 89
 		844A9A7E1DD0C080007DCC89 /* TestApp1.ico */ = {isa = PBXFileReference; lastKnownFileType = image.ico; path = TestApp1.ico; sourceTree = "<group>"; };
92 90
 		844A9A7F1DD0C080007DCC89 /* TestApp1.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TestApp1.rc; sourceTree = "<group>"; };
93 91
 		844A9A801DD0C080007DCC89 /* TestApp1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestApp1.cpp; sourceTree = "<group>"; };
94
-		84D883551E3A6A9200478725 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
95
-		84D8835F1E3A6B0000478725 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/OpenAL.framework; sourceTree = DEVELOPER_DIR; };
96
-		84F6F33F1E142A110096F558 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
97 92
 /* End PBXFileReference section */
98 93
 
99 94
 /* Begin PBXFrameworksBuildPhase section */
@@ -101,8 +96,6 @@
101 96
 			isa = PBXFrameworksBuildPhase;
102 97
 			buildActionMask = 2147483647;
103 98
 			files = (
104
-				84D883561E3A6A9200478725 /* OpenAL.framework in Frameworks */,
105
-				66DA899B1DD3164E00338015 /* AppKit.framework in Frameworks */,
106 99
 				840D5D931DDA08CA009DA369 /* libDK.a in Frameworks */,
107 100
 			);
108 101
 			runOnlyForDeploymentPostprocessing = 0;
@@ -111,8 +104,6 @@
111 104
 			isa = PBXFrameworksBuildPhase;
112 105
 			buildActionMask = 2147483647;
113 106
 			files = (
114
-				84D883601E3A6B0000478725 /* OpenAL.framework in Frameworks */,
115
-				84F6F3401E142A110096F558 /* UIKit.framework in Frameworks */,
116 107
 				840D5D921DDA08C2009DA369 /* libDK.a in Frameworks */,
117 108
 			);
118 109
 			runOnlyForDeploymentPostprocessing = 0;
@@ -123,10 +114,6 @@
123 114
 		66DA89141DD1887A00338015 /* Frameworks */ = {
124 115
 			isa = PBXGroup;
125 116
 			children = (
126
-				84D8835F1E3A6B0000478725 /* OpenAL.framework */,
127
-				84D883551E3A6A9200478725 /* OpenAL.framework */,
128
-				84F6F33F1E142A110096F558 /* UIKit.framework */,
129
-				66DA899A1DD3164E00338015 /* AppKit.framework */,
130 117
 			);
131 118
 			name = Frameworks;
132 119
 			sourceTree = "<group>";
@@ -164,6 +151,7 @@
164 151
 		844A9A461DD0BCFD007DCC89 /* TestApp1 */ = {
165 152
 			isa = PBXGroup;
166 153
 			children = (
154
+				8420EE1F1EE5BA6500A20933 /* Data */,
167 155
 				844A9A731DD0C080007DCC89 /* iOS */,
168 156
 				844A9A771DD0C080007DCC89 /* macOS */,
169 157
 				844A9A7A1DD0C080007DCC89 /* Win32 */,
@@ -329,6 +317,7 @@
329 317
 			files = (
330 318
 				844A9A891DD0C080007DCC89 /* TestApp1.rc in Resources */,
331 319
 				844A9A871DD0C080007DCC89 /* small.ico in Resources */,
320
+				8420EE201EE5BA6500A20933 /* Data in Resources */,
332 321
 				844A9A851DD0C080007DCC89 /* Assets.xcassets in Resources */,
333 322
 				844A9A881DD0C080007DCC89 /* TestApp1.ico in Resources */,
334 323
 				840D5D3B1DDA07B2009DA369 /* DK.xcodeproj in Resources */,
@@ -341,6 +330,7 @@
341 330
 			files = (
342 331
 				844A9A8D1DD0C08F007DCC89 /* LaunchScreen.storyboard in Resources */,
343 332
 				844A9A8B1DD0C08F007DCC89 /* Assets.xcassets in Resources */,
333
+				8420EE211EE5BA6500A20933 /* Data in Resources */,
344 334
 			);
345 335
 			runOnlyForDeploymentPostprocessing = 0;
346 336
 		};
@@ -512,6 +502,7 @@
512 502
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
513 503
 				PRODUCT_BUNDLE_IDENTIFIER = "com.icondb.TestApp1-iOS";
514 504
 				PRODUCT_NAME = "$(TARGET_NAME)";
505
+				PROVISIONING_PROFILE_SPECIFIER = "";
515 506
 				SDKROOT = iphoneos;
516 507
 				TARGETED_DEVICE_FAMILY = "1,2";
517 508
 			};
@@ -529,6 +520,7 @@
529 520
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
530 521
 				PRODUCT_BUNDLE_IDENTIFIER = "com.icondb.TestApp1-iOS";
531 522
 				PRODUCT_NAME = "$(TARGET_NAME)";
523
+				PROVISIONING_PROFILE_SPECIFIER = "";
532 524
 				SDKROOT = iphoneos;
533 525
 				TARGETED_DEVICE_FAMILY = "1,2";
534 526
 				VALIDATE_PRODUCT = YES;