Browse Source

Reworked render_system

Reworked render_system to now use two descriptor sets. Set 0 contains all per frame, global data. Set 1 contains per object material textures (for now). In the future, set 1 will also contains other material properties (such as float values for roughness, specular, and bools to toggle the use of roughness and specular maps)
Jef Belmans 2 years ago
parent
commit
4e9ef96fa0

+ 43 - 3
.idea/workspace.xml

@@ -32,7 +32,16 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="e2ea9cb6-a6b7-419f-9266-e5263673b6e6" name="Changes" comment="">
-      <change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/build/debug/CMakeCache.txt" beforeDir="false" afterPath="$PROJECT_DIR$/build/debug/CMakeCache.txt" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/coral_renderer/first_app.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/coral_renderer/first_app.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/coral_renderer/first_app.h" beforeDir="false" afterPath="$PROJECT_DIR$/coral_renderer/first_app.h" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/coral_renderer/render_system.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/coral_renderer/render_system.cpp" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/coral_renderer/render_system.h" beforeDir="false" afterPath="$PROJECT_DIR$/coral_renderer/render_system.h" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/shaders/compiled/simple_shader.frag.spv" beforeDir="false" afterPath="$PROJECT_DIR$/shaders/compiled/simple_shader.frag.spv" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/shaders/compiled/simple_shader.vert.spv" beforeDir="false" afterPath="$PROJECT_DIR$/shaders/compiled/simple_shader.vert.spv" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/shaders/simple_shader.frag" beforeDir="false" afterPath="$PROJECT_DIR$/shaders/simple_shader.frag" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/shaders/simple_shader.vert" beforeDir="false" afterPath="$PROJECT_DIR$/shaders/simple_shader.vert" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -46,6 +55,24 @@
   <component name="Git.Settings">
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
   </component>
+  <component name="GitHubPullRequestSearchHistory">{
+  &quot;lastFilter&quot;: {
+    &quot;state&quot;: &quot;OPEN&quot;,
+    &quot;assignee&quot;: &quot;jefbelmans&quot;
+  }
+}</component>
+  <component name="GithubPullRequestsUISettings">
+    <option name="selectedUrlAndAccountId">
+      <UrlAndAccount>
+        <option name="accountId" value="b1b0be1e-481e-481a-a891-03af18d05b6f" />
+        <option name="url" value="https://github.com/jefbelmans/Coral3D.git" />
+      </UrlAndAccount>
+    </option>
+  </component>
+  <component name="HighlightingSettingsPerFile">
+    <setting file="file://$APPLICATION_HOME_DIR$/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/invoke.h" root0="SKIP_INSPECTION" />
+    <setting file="file://$APPLICATION_HOME_DIR$/bin/mingw/lib/gcc/x86_64-w64-mingw32/13.1.0/include/c++/bits/std_function.h" root0="SKIP_INSPECTION" />
+  </component>
   <component name="MarkdownSettingsMigration">
     <option name="stateVersion" value="1" />
   </component>
@@ -71,6 +98,7 @@
   <component name="PropertiesComponent">{
   &quot;keyToString&quot;: {
     &quot;ASKED_ADD_EXTERNAL_FILES&quot;: &quot;true&quot;,
+    &quot;ASKED_MARK_IGNORED_FILES_AS_EXCLUDED&quot;: &quot;true&quot;,
     &quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
     &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
     &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
@@ -92,9 +120,9 @@
   }
 }</component>
   <component name="RunManager">
-    <configuration default="true" type="CLionExternalRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true">
+    <configuration default="true" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true">
       <method v="2">
-        <option name="CLION.EXTERNAL.BUILD" enabled="true" />
+        <option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
       </method>
     </configuration>
     <configuration name="coral_renderer" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="Coral3D" TARGET_NAME="coral_renderer" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="Coral3D" RUN_TARGET_NAME="coral_renderer">
@@ -120,7 +148,17 @@
       <workItem from="1694254738758" duration="1000" />
       <workItem from="1694254782205" duration="798000" />
       <workItem from="1694256926033" duration="3362000" />
+      <workItem from="1694380372927" duration="6630000" />
+    </task>
+    <task id="LOCAL-00001" summary="Have I forgotten how to git?">
+      <option name="closed" value="true" />
+      <created>1694375851505</created>
+      <option name="number" value="00001" />
+      <option name="presentableId" value="LOCAL-00001" />
+      <option name="project" value="LOCAL" />
+      <updated>1694375851505</updated>
     </task>
+    <option name="localTasksCounter" value="2" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -134,5 +172,7 @@
   </component>
   <component name="VcsManagerConfiguration">
     <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
+    <MESSAGE value="Have I forgotten how to git?" />
+    <option name="LAST_COMMIT_MESSAGE" value="Have I forgotten how to git?" />
   </component>
 </project>

+ 1 - 1
build/debug/CMakeCache.txt

@@ -170,7 +170,7 @@ CMAKE_INSTALL_SYSCONFDIR:PATH=etc
 CMAKE_LINKER:FILEPATH=C:/Program Files/JetBrains/CLion 2023.2/bin/mingw/bin/ld.exe
 
 //make program
-CMAKE_MAKE_PROGRAM:FILEPATH=C:/Program Files/JetBrains/CLion 2023.2/bin/ninja/win/x64/ninja.exe
+CMAKE_MAKE_PROGRAM:FILEPATH=C:/PROGRA~1/JETBRA~1/CLION2~1.2/bin/ninja/win/x64/ninja.exe
 
 //Flags used by the linker during the creation of modules during
 // all build types.

+ 2 - 2
build/debug/CMakeFiles/rules.ninja

@@ -108,7 +108,7 @@ rule RERUN_CMAKE
 # Rule for cleaning all built files.
 
 rule CLEAN
-  command = "C:\Program Files\JetBrains\CLion 2023.2\bin\ninja\win\x64\ninja.exe" $FILE_ARG -t clean $TARGETS
+  command = C:\PROGRA~1\JETBRA~1\CLION2~1.2\bin\ninja\win\x64\ninja.exe $FILE_ARG -t clean $TARGETS
   description = Cleaning all built files...
 
 
@@ -116,6 +116,6 @@ rule CLEAN
 # Rule for printing all primary targets available.
 
 rule HELP
-  command = "C:\Program Files\JetBrains\CLion 2023.2\bin\ninja\win\x64\ninja.exe" -t targets
+  command = C:\PROGRA~1\JETBRA~1\CLION2~1.2\bin\ninja\win\x64\ninja.exe -t targets
   description = All primary targets available:
 

BIN
build/debug/assets/shaders/compiled/simple_shader.frag.spv


BIN
build/debug/assets/shaders/compiled/simple_shader.vert.spv


File diff suppressed because it is too large
+ 4 - 78
build/debug/build.ninja


BIN
build/release/.ninja_deps


+ 82 - 41
build/release/.ninja_log

@@ -1,44 +1,85 @@
 # ninja log v5
 5	217	7160783223296825	E:/Game Development/Visual Studio Solutions/Coral3D/shaders/compiled/PosNormCol.frag.spv	25e4e325e1ba0bc9
 1	223	7160783223379210	E:/Game Development/Visual Studio Solutions/Coral3D/shaders/compiled/PosNormCol.vert.spv	bfdb78465c959f36
-8	230	7160783223459177	E:/Game Development/Visual Studio Solutions/Coral3D/shaders/compiled/simple_shader.vert.spv	3c7e702a8a128f67
-12	235	7160783223533967	E:/Game Development/Visual Studio Solutions/Coral3D/shaders/compiled/simple_shader.frag.spv	f376e2cf516c4f9c
-248	1404	7160783235257375	coral_renderer/CMakeFiles/coral_renderer.dir/coral_window.cpp.obj	25c78bf11845a34f
-254	1527	7160783236521131	coral_renderer/CMakeFiles/coral_renderer.dir/vk_initializers.cpp.obj	63d89f5c35bd3b37
-333	1848	7160783239724981	coral_renderer/CMakeFiles/coral_renderer.dir/coral_camera.cpp.obj	c8dbe8ed3887b6c2
-36	1949	7160783240728481	third_party/GLFW/src/CMakeFiles/glfw.dir/win32_thread.c.obj	1d3576b97de4dcfd
-48	1961	7160783240838833	third_party/GLFW/src/CMakeFiles/glfw.dir/win32_time.c.obj	e692993acf9f94ac
-25	2037	7160783241582799	third_party/GLFW/src/CMakeFiles/glfw.dir/init.c.obj	2200c22e2fbf5f9b
-51	2051	7160783241743442	third_party/GLFW/src/CMakeFiles/glfw.dir/vulkan.c.obj	1d1eab9fa8d7eeed
-78	2069	7160783241939113	third_party/GLFW/src/CMakeFiles/glfw.dir/osmesa_context.c.obj	54773fed0db7e7b1
-56	2086	7160783242094534	third_party/GLFW/src/CMakeFiles/glfw.dir/win32_init.c.obj	6d7558a01a2b92c3
-1407	2109	7160783242349184	coral_renderer/CMakeFiles/coral_renderer.dir/coral_utils.cpp.obj	c806d37e36d92048
-29	2115	7160783242404533	third_party/GLFW/src/CMakeFiles/glfw.dir/context.c.obj	769cf2954fa9296c
-33	2130	7160783242556122	third_party/GLFW/src/CMakeFiles/glfw.dir/egl_context.c.obj	3d2a39fb62cc5d09
-73	2156	7160783242820796	third_party/GLFW/src/CMakeFiles/glfw.dir/win32_monitor.c.obj	149f73e3b2fe6a10
-64	2172	7160783242981196	third_party/GLFW/src/CMakeFiles/glfw.dir/monitor.c.obj	da1b97f86a6f1881
-68	2197	7160783243228144	third_party/GLFW/src/CMakeFiles/glfw.dir/win32_joystick.c.obj	731e24eae4f6c3c0
-59	2205	7160783243321127	third_party/GLFW/src/CMakeFiles/glfw.dir/window.c.obj	a05896c745e87d4a
-44	2223	7160783243480977	third_party/GLFW/src/CMakeFiles/glfw.dir/wgl_context.c.obj	371d8c14a557d0ce
-22	2332	7160783244579136	third_party/GLFW/src/CMakeFiles/glfw.dir/input.c.obj	a690aad864a072ff
-304	2379	7160783245061374	coral_renderer/CMakeFiles/coral_renderer.dir/coral_renderer.cpp.obj	9f1473d3540b8262
-41	2472	7160783245982089	third_party/GLFW/src/CMakeFiles/glfw.dir/win32_window.c.obj	ac8316922cd6d380
-295	2503	7160783246295417	coral_renderer/CMakeFiles/coral_renderer.dir/coral_gameobject.cpp.obj	f879f1e56265ed91
-2472	2556	7160783246822260	third_party/GLFW/src/libglfw3.a	fc48f5f1f632859b
-235	2664	7160783247906395	coral_renderer/CMakeFiles/coral_renderer.dir/main.cpp.obj	388ecbd505d02869
-1961	2703	7160783248302854	coral_renderer/CMakeFiles/coral_renderer.dir/coral_material.cpp.obj	db81d3e22695999f
-314	2723	7160783248493426	coral_renderer/CMakeFiles/coral_renderer.dir/render_system.cpp.obj	3c7e1cb59348fe45
-261	2747	7160783248749370	coral_renderer/CMakeFiles/coral_renderer.dir/coral_pipeline.cpp.obj	f88119a62b258315
-268	3119	7160783252469315	coral_renderer/CMakeFiles/coral_renderer.dir/coral_device.cpp.obj	e43a6c1cdea361b
-1951	3157	7160783252852218	coral_renderer/CMakeFiles/coral_renderer.dir/coral_descriptors.cpp.obj	75aba8421fcdf30a
-1850	3169	7160783252974511	coral_renderer/CMakeFiles/coral_renderer.dir/coral_frame_info.cpp.obj	abd575453ea46e7f
-241	3396	7160783255244381	coral_renderer/CMakeFiles/coral_renderer.dir/first_app.cpp.obj	f0122dd1ef9a73f1
-19	4335	7160783264623974	third_party/CMakeFiles/tinyobjloader.dir/tinyobjloader/tiny_obj_loader.cc.obj	fd1983a21fbb7956
-15	4907	7160783270349672	third_party/CMakeFiles/vkbootstrap.dir/vkbootstrap/VkBootstrap.cpp.obj	f6b337d1309e9955
-1528	5099	7160783272268876	coral_renderer/CMakeFiles/coral_renderer.dir/coral_buffer.cpp.obj	e0c77ecf65d96af7
-286	5337	7160783274639645	coral_renderer/CMakeFiles/coral_renderer.dir/coral_mesh.cpp.obj	87c23e9a6d97084e
-324	5471	7160783275984319	coral_renderer/CMakeFiles/coral_renderer.dir/coral_texture.cpp.obj	814ee76acd962cfb
-8	60	7160783837260240	third_party/libvkbootstrap.a	c71ed427a7b8907
-15	61	7160783837260240	third_party/libtinyobjloader.a	99fa9adb75ddfe5c
-5	1163	7160783848283470	coral_renderer/CMakeFiles/coral_renderer.dir/coral_swapchain.cpp.obj	1558e457cff39707
-1163	1281	7160783849425240	coral_renderer/coral_renderer.exe	366c0e985f1ffd52
+11	51	7160837603841621	third_party/libtinyobjloader.a	99fa9adb75ddfe5c
+4	90	7160839587813290	E:/Game Development/Visual Studio Solutions/Coral3D/shaders/compiled/simple_shader.vert.spv	3c7e702a8a128f67
+4	87	7160870168383103	E:/Game Development/Visual Studio Solutions/Coral3D/shaders/compiled/simple_shader.frag.spv	f376e2cf516c4f9c
+87	1029	7160870177831017	coral_renderer/CMakeFiles/coral_renderer.dir/main.cpp.obj	388ecbd505d02869
+59	2247	7160837440875407	third_party/GLFW/src/CMakeFiles/glfw.dir/win32_thread.c.obj	1d3576b97de4dcfd
+134	811	7160837426513062	coral_renderer/CMakeFiles/coral_renderer.dir/coral_window.cpp.obj	25c78bf11845a34f
+137	830	7160837426698224	coral_renderer/CMakeFiles/coral_renderer.dir/vk_initializers.cpp.obj	63d89f5c35bd3b37
+52	2615	7160837444568591	third_party/GLFW/src/CMakeFiles/glfw.dir/win32_window.c.obj	ac8316922cd6d380
+155	1097	7160837429380531	coral_renderer/CMakeFiles/coral_renderer.dir/coral_camera.cpp.obj	c8dbe8ed3887b6c2
+48	2239	7160837440795336	third_party/GLFW/src/CMakeFiles/glfw.dir/win32_time.c.obj	e692993acf9f94ac
+37	2321	7160837441616044	third_party/GLFW/src/CMakeFiles/glfw.dir/win32_init.c.obj	6d7558a01a2b92c3
+27	2316	7160837441576011	third_party/GLFW/src/CMakeFiles/glfw.dir/init.c.obj	2200c22e2fbf5f9b
+34	2370	7160837442111481	third_party/GLFW/src/CMakeFiles/glfw.dir/win32_monitor.c.obj	149f73e3b2fe6a10
+31	2312	7160837441525968	third_party/GLFW/src/CMakeFiles/glfw.dir/vulkan.c.obj	1d1eab9fa8d7eeed
+1455	2805	7160837446470220	coral_renderer/CMakeFiles/coral_renderer.dir/coral_descriptors.cpp.obj	75aba8421fcdf30a
+67	2287	7160837441270748	third_party/GLFW/src/CMakeFiles/glfw.dir/osmesa_context.c.obj	54773fed0db7e7b1
+1596	1718	7160871699301892	coral_renderer/coral_renderer.exe	366c0e985f1ffd52
+1097	1524	7160837433644194	coral_renderer/CMakeFiles/coral_renderer.dir/coral_utils.cpp.obj	c806d37e36d92048
+24	2362	7160837442031400	third_party/GLFW/src/CMakeFiles/glfw.dir/context.c.obj	769cf2954fa9296c
+55	2372	7160837442131488	third_party/GLFW/src/CMakeFiles/glfw.dir/egl_context.c.obj	3d2a39fb62cc5d09
+41	2384	7160837442256590	third_party/GLFW/src/CMakeFiles/glfw.dir/win32_joystick.c.obj	731e24eae4f6c3c0
+21	2381	7160837442221572	third_party/GLFW/src/CMakeFiles/glfw.dir/monitor.c.obj	da1b97f86a6f1881
+45	2411	7160837442536835	third_party/GLFW/src/CMakeFiles/glfw.dir/window.c.obj	a05896c745e87d4a
+63	2400	7160837442421737	third_party/GLFW/src/CMakeFiles/glfw.dir/wgl_context.c.obj	371d8c14a557d0ce
+18	2514	7160837443562709	third_party/GLFW/src/CMakeFiles/glfw.dir/input.c.obj	a690aad864a072ff
+148	1454	7160837432958620	coral_renderer/CMakeFiles/coral_renderer.dir/coral_renderer.cpp.obj	9f1473d3540b8262
+168	4944	7160837467863521	coral_renderer/CMakeFiles/coral_renderer.dir/coral_texture.cpp.obj	814ee76acd962cfb
+164	1728	7160837435670935	coral_renderer/CMakeFiles/coral_renderer.dir/coral_gameobject.cpp.obj	f879f1e56265ed91
+2615	2679	7160837445214143	third_party/GLFW/src/libglfw3.a	fc48f5f1f632859b
+1524	2394	7160837442361687	coral_renderer/CMakeFiles/coral_renderer.dir/coral_material.cpp.obj	db81d3e22695999f
+152	4774	7160837466162061	coral_renderer/CMakeFiles/coral_renderer.dir/coral_mesh.cpp.obj	87c23e9a6d97084e
+159	2035	7160837438738574	coral_renderer/CMakeFiles/coral_renderer.dir/render_system.cpp.obj	3c7e1cb59348fe45
+127	1985	7160837438243146	coral_renderer/CMakeFiles/coral_renderer.dir/coral_pipeline.cpp.obj	f88119a62b258315
+144	2526	7160837443682815	coral_renderer/CMakeFiles/coral_renderer.dir/coral_device.cpp.obj	e43a6c1cdea361b
+811	2409	7160837442511813	coral_renderer/CMakeFiles/coral_renderer.dir/coral_frame_info.cpp.obj	abd575453ea46e7f
+5	5314	7160837471550973	third_party/CMakeFiles/vkbootstrap.dir/vkbootstrap/VkBootstrap.cpp.obj	f6b337d1309e9955
+4	1596	7160871698115810	coral_renderer/CMakeFiles/coral_renderer.dir/first_app.cpp.obj	f0122dd1ef9a73f1
+8	3820	7160837456616342	third_party/CMakeFiles/tinyobjloader.dir/tinyobjloader/tiny_obj_loader.cc.obj	fd1983a21fbb7956
+830	4528	7160837463698090	coral_renderer/CMakeFiles/coral_renderer.dir/coral_buffer.cpp.obj	e0c77ecf65d96af7
+7	49	7160837603821603	third_party/libvkbootstrap.a	c71ed427a7b8907
+140	2226	7160837440665232	coral_renderer/CMakeFiles/coral_renderer.dir/coral_swapchain.cpp.obj	1558e457cff39707
+15	363	7160837418210930	build.ninja	ba309abf78566697
+0	289	0	coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+0	289	0	E:/Game Development/Visual Studio Solutions/Coral3D/build/release/coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+8	1132	7160892258893183	coral_renderer/CMakeFiles/coral_renderer.dir/render_system.cpp.obj	3c7e1cb59348fe45
+5	1656	7160892264132934	coral_renderer/CMakeFiles/coral_renderer.dir/first_app.cpp.obj	f0122dd1ef9a73f1
+1656	1782	7160892265364694	coral_renderer/coral_renderer.exe	366c0e985f1ffd52
+0	284	0	coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+0	284	0	E:/Game Development/Visual Studio Solutions/Coral3D/build/release/coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+4	92	7160892626948361	E:/Game Development/Visual Studio Solutions/Coral3D/shaders/compiled/simple_shader.frag.spv	f376e2cf516c4f9c
+0	291	0	coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+0	291	0	E:/Game Development/Visual Studio Solutions/Coral3D/build/release/coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+4	1081	7160899594478517	coral_renderer/CMakeFiles/coral_renderer.dir/render_system.cpp.obj	3c7e1cb59348fe45
+1081	1200	7160899595631221	coral_renderer/coral_renderer.exe	366c0e985f1ffd52
+1	277	0	coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+1	277	0	E:/Game Development/Visual Studio Solutions/Coral3D/build/release/coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+7	1219	7160900973157419	coral_renderer/CMakeFiles/coral_renderer.dir/main.cpp.obj	388ecbd505d02869
+10	1370	7160900974662055	coral_renderer/CMakeFiles/coral_renderer.dir/render_system.cpp.obj	3c7e1cb59348fe45
+4	1932	7160900980264359	coral_renderer/CMakeFiles/coral_renderer.dir/first_app.cpp.obj	f0122dd1ef9a73f1
+1932	2065	7160900981562321	coral_renderer/coral_renderer.exe	366c0e985f1ffd52
+1	287	0	coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+1	287	0	E:/Game Development/Visual Studio Solutions/Coral3D/build/release/coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+4	1127	7160902210218773	coral_renderer/CMakeFiles/coral_renderer.dir/render_system.cpp.obj	3c7e1cb59348fe45
+1127	1249	7160902211403430	coral_renderer/coral_renderer.exe	366c0e985f1ffd52
+0	275	0	coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+0	275	0	E:/Game Development/Visual Studio Solutions/Coral3D/build/release/coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+4	1073	7160902348499280	coral_renderer/CMakeFiles/coral_renderer.dir/render_system.cpp.obj	3c7e1cb59348fe45
+1073	1191	7160902349633530	coral_renderer/coral_renderer.exe	366c0e985f1ffd52
+0	288	0	coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+0	288	0	E:/Game Development/Visual Studio Solutions/Coral3D/build/release/coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+4	1588	7160902759909278	coral_renderer/CMakeFiles/coral_renderer.dir/first_app.cpp.obj	f0122dd1ef9a73f1
+1589	1711	7160902761098358	coral_renderer/coral_renderer.exe	366c0e985f1ffd52
+0	289	0	coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+0	289	0	E:/Game Development/Visual Studio Solutions/Coral3D/build/release/coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+4	1140	7160903433016785	coral_renderer/CMakeFiles/coral_renderer.dir/render_system.cpp.obj	3c7e1cb59348fe45
+1140	1262	7160903434195290	coral_renderer/coral_renderer.exe	366c0e985f1ffd52
+1	283	0	coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+1	283	0	E:/Game Development/Visual Studio Solutions/Coral3D/build/release/coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+5	1081	7160903589918392	coral_renderer/CMakeFiles/coral_renderer.dir/render_system.cpp.obj	3c7e1cb59348fe45
+1081	1201	7160903591075848	coral_renderer/coral_renderer.exe	366c0e985f1ffd52
+1	281	0	coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866
+1	281	0	E:/Game Development/Visual Studio Solutions/Coral3D/build/release/coral_renderer/CMakeFiles/copy_assets	66424d61a55ca866

+ 1 - 1
build/release/CMakeCache.txt

@@ -170,7 +170,7 @@ CMAKE_INSTALL_SYSCONFDIR:PATH=etc
 CMAKE_LINKER:FILEPATH=C:/Program Files/JetBrains/CLion 2023.2/bin/mingw/bin/ld.exe
 
 //make program
-CMAKE_MAKE_PROGRAM:FILEPATH=C:/Program Files/JetBrains/CLion 2023.2/bin/ninja/win/x64/ninja.exe
+CMAKE_MAKE_PROGRAM:FILEPATH=C:/PROGRA~1/JETBRA~1/CLION2~1.2/bin/ninja/win/x64/ninja.exe
 
 //Flags used by the linker during the creation of modules during
 // all build types.

+ 2 - 2
build/release/CMakeFiles/rules.ninja

@@ -108,7 +108,7 @@ rule RERUN_CMAKE
 # Rule for cleaning all built files.
 
 rule CLEAN
-  command = "C:\Program Files\JetBrains\CLion 2023.2\bin\ninja\win\x64\ninja.exe" $FILE_ARG -t clean $TARGETS
+  command = C:\PROGRA~1\JETBRA~1\CLION2~1.2\bin\ninja\win\x64\ninja.exe $FILE_ARG -t clean $TARGETS
   description = Cleaning all built files...
 
 
@@ -116,6 +116,6 @@ rule CLEAN
 # Rule for printing all primary targets available.
 
 rule HELP
-  command = "C:\Program Files\JetBrains\CLion 2023.2\bin\ninja\win\x64\ninja.exe" -t targets
+  command = C:\PROGRA~1\JETBRA~1\CLION2~1.2\bin\ninja\win\x64\ninja.exe -t targets
   description = All primary targets available:
 

+ 2 - 2
build/release/Testing/Temporary/LastTest.log

@@ -1,3 +1,3 @@
-Start testing: Sep 10 21:46 Romance Daylight Time
+Start testing: Sep 11 01:05 Romance Daylight Time
 ----------------------------------------------------------
-End testing: Sep 10 21:46 Romance Daylight Time
+End testing: Sep 11 01:05 Romance Daylight Time

File diff suppressed because it is too large
+ 4 - 78
build/release/build.ninja


+ 4 - 25
coral_renderer/first_app.cpp

@@ -22,10 +22,6 @@ struct GlobalUBO
     // GLOBAL LIGHT
     glm::vec4 global_light_direction{ glm::normalize(glm::vec4{ 0.577f, -0.577f, -0.577f, 0.f})}; // w is ignored
     glm::vec4 ambient_light_color{1.f, .82f, .863f, .01f}; // w is intensity
-
-    // POINT LIGHT
-    glm::vec4 light_position{0.f, -0.85f, 0.f, 0.f}; // w is ignored
-    glm::vec4 light_color{1.f}; // w is intensity
 };
 
 first_app::first_app()
@@ -33,7 +29,6 @@ first_app::first_app()
     global_descriptor_pool_ = coral_descriptor_pool::Builder(device_)
         .set_max_sets(coral_swapchain::MAX_FRAMES_IN_FLIGHT)
         .add_pool_size(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, coral_swapchain::MAX_FRAMES_IN_FLIGHT)
-        .add_pool_size(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, coral_swapchain::MAX_FRAMES_IN_FLIGHT)
         .build();
 
 	load_gameobjects();
@@ -53,24 +48,22 @@ void first_app::run()
 	};
     global_ubo.map();
 
+    // Set 0: Global descriptor sets
     auto global_set_layout = coral_descriptor_set_layout::Builder(device_)
 		.add_binding(0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_SHADER_STAGE_ALL_GRAPHICS)
-        .add_binding(1, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_SHADER_STAGE_FRAGMENT_BIT)
-		.build(); 
+        .build();
 
     std::vector<VkDescriptorSet> global_descriptor_sets{coral_swapchain::MAX_FRAMES_IN_FLIGHT};
     for (size_t i = 0; i < global_descriptor_sets.size(); i++)
     {
         auto buffer_info = global_ubo.descriptor_info_index(i);
-        auto image_info = test_texture->get_descriptor_info();
 
         coral_descriptor_writer(*global_set_layout, *global_descriptor_pool_)
             .write_buffer(0, &buffer_info)
-            .write_image(1, &image_info)
             .build(global_descriptor_sets[i]);
     }
 
-	render_system render_system{ device_, renderer_.get_swapchain_render_pass(), global_set_layout->get_descriptor_set_layout() };
+    render_system render_system{ device_, renderer_.get_swapchain_render_pass(), global_set_layout->get_descriptor_set_layout() };
     coral_camera camera{ {0.f, 2.5f, 0.f} };
 
     auto last_time{ std::chrono::high_resolution_clock::now() };
@@ -127,22 +120,8 @@ void first_app::load_gameobjects()
 
     auto sponza{ coral_gameobject::create_gameobject() };
     sponza.mesh_ = flat_mesh;
-    sponza.transform_.translation = { 0, 0.75f, 0.f };
-    sponza.transform_.scale = { 0.2f, 0.2f, 0.2f };
+    sponza.transform_.translation = { 0.f, 0.f, 0.f };
     gameobjects_.emplace(sponza.get_id(), std::move(sponza));
-    
-    std::cout << "\nNumber of instances: " << gameobjects_.size() << std::endl;
-    std::cout << std::setprecision(8) << "Number of vertices: " << flat_mesh->get_vertex_count() * gameobjects_.size() << std::endl;
-    std::cout << std::setprecision(8) << "Number of indices: " << flat_mesh->get_index_count() * gameobjects_.size() << std::endl;
-    std::cout << std::setprecision(8) << "Number of triangles: " << flat_mesh->get_index_count() * gameobjects_.size() /
-                                                                    3.f << std::endl;
-    
-    // LOAD TEXTURES
-    test_texture = coral_texture::create_texture_from_file(
-        device_,
-        "assets/textures/sponza_floor_a_diff.png",
-        VK_FORMAT_R8G8B8A8_SRGB
-    );
 
 #pragma endregion
 }

+ 0 - 1
coral_renderer/first_app.h

@@ -33,7 +33,6 @@ namespace coral_3d
 		coral_device device_{ window_ };
 		coral_renderer renderer_{ window_, device_ };
 
-		std::unique_ptr<coral_texture> test_texture;
 		std::unique_ptr<coral_descriptor_pool> global_descriptor_pool_{};
 		coral_gameobject::Map gameobjects_;
 	};

+ 45 - 7
coral_renderer/render_system.cpp

@@ -5,6 +5,8 @@
 
 using namespace coral_3d;
 
+#define MAX_TEXTURES 8
+
 struct PushConstant
 {
 	glm::mat4 world_matrix;
@@ -13,7 +15,36 @@ struct PushConstant
 
 render_system::render_system(coral_device& device, VkRenderPass render_pass, VkDescriptorSetLayout global_set_layout)
 	: device_{device}
+    , pipeline_layout_ {VK_NULL_HANDLE}
 {
+    // LOAD TEXTURES
+    test_texture_ = coral_texture::create_texture_from_file(
+            device_,
+            "assets/textures/sponza_floor_a_diff.png",
+            VK_FORMAT_R8G8B8A8_SRGB
+    );
+
+    test_texture_2_ = coral_texture::create_texture_from_file(
+            device_,
+            "assets/textures/sponza_curtain_diff.png",
+            VK_FORMAT_R8G8B8A8_SRGB
+    );
+
+    material_descriptor_pool_ = coral_descriptor_pool::Builder(device_)
+            .set_max_sets(MAX_TEXTURES)
+            .add_pool_size(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, MAX_TEXTURES)
+            .build();
+
+    material_set_layout_ = coral_descriptor_set_layout::Builder(device_)
+            .add_binding(0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_SHADER_STAGE_FRAGMENT_BIT) // Binding 0: Diffuse map
+            .build();
+
+    auto image_info = test_texture_->get_descriptor_info();
+
+    coral_descriptor_writer(*material_set_layout_, *material_descriptor_pool_)
+            .write_image(0, &image_info)
+            .build(material_descriptor_set);
+
 	create_pipeline_layout(global_set_layout);
 	create_pipeline(render_pass);
 }
@@ -27,15 +58,23 @@ void render_system::render_gameobjects(FrameInfo& frame_info)
 {
 	pipeline_->bind(frame_info.command_buffer);
 
+    std::vector<VkDescriptorSet> descriptor_sets{frame_info.global_descriptor_set, material_descriptor_set};
+
 	vkCmdBindDescriptorSets(
 		frame_info.command_buffer,
 		VK_PIPELINE_BIND_POINT_GRAPHICS,
 		pipeline_layout_,
-		0, 1,
-		&frame_info.global_descriptor_set,
+		0, descriptor_sets.size(),
+        descriptor_sets.data(),
 		0, nullptr
 	);
 
+    auto image_info = test_texture_2_->get_descriptor_info();
+
+    coral_descriptor_writer(*material_set_layout_, *material_descriptor_pool_)
+            .write_image(0, &image_info)
+            .overwrite(material_descriptor_set);
+
 	coral_mesh* last_mesh{nullptr};
 	for (auto& kv : frame_info.gameobjects)
 	{
@@ -53,10 +92,10 @@ void render_system::render_gameobjects(FrameInfo& frame_info)
 			VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT,
 			0, sizeof(PushConstant), &push);
 
+        // We do not want to bind the same mesh data again if it is already bound from the previous draw call
 		if(obj.mesh_.get() != last_mesh)
 			obj.mesh_->bind(frame_info.command_buffer);
 
-		// obj.mesh_->bind(frame_info.command_buffer);
 		obj.mesh_->draw(frame_info.command_buffer);
 
 		last_mesh = obj.mesh_.get();
@@ -71,7 +110,7 @@ void render_system::create_pipeline_layout(VkDescriptorSetLayout global_set_layo
 	push_constant_range.size = sizeof(PushConstant);
 
 	// Add set layouts here
-	std::vector<VkDescriptorSetLayout> descriptor_set_layouts{global_set_layout};
+	std::vector<VkDescriptorSetLayout> descriptor_set_layouts{global_set_layout, material_set_layout_->get_descriptor_set_layout()};
 
 	VkPipelineLayoutCreateInfo layout_info{ vkinit::pipeline_layout_ci() };
 	layout_info.pushConstantRangeCount = 1;
@@ -80,14 +119,13 @@ void render_system::create_pipeline_layout(VkDescriptorSetLayout global_set_layo
 	layout_info.pSetLayouts = descriptor_set_layouts.data();
 
 	if (vkCreatePipelineLayout(device_.device(), &layout_info, nullptr, &pipeline_layout_) != VK_SUCCESS)
-		throw std::runtime_error("ERROR! first_app::create_pipeline_layout() >> Failed to create pipeline layout!");
+		throw std::runtime_error("ERROR! render_system::create_pipeline_layout() >> Failed to create pipeline layout!");
 }
 
 void render_system::create_pipeline(VkRenderPass render_pass)
 {
-
 	assert(pipeline_layout_ != nullptr &&
-		"ERROR! first_app::create_pipeline() >> Cannot create pipeline before pipeline layout!");
+		"ERROR! render_system::create_pipeline() >> Cannot create pipeline before pipeline layout!");
 
 	PipelineConfigInfo pipeline_config{};
 	coral_pipeline::default_pipeline_config_info(pipeline_config);

+ 8 - 0
coral_renderer/render_system.h

@@ -5,6 +5,8 @@
 #include "coral_pipeline.h"
 #include "coral_gameobject.h"
 #include "coral_frame_info.h"
+#include "coral_descriptors.h"
+#include "coral_texture.h"
 
 // STD
 #include <memory>
@@ -35,5 +37,11 @@ namespace coral_3d
 		std::unique_ptr<coral_pipeline> pipeline_;
 		VkPipelineLayout pipeline_layout_;
 
+        std::unique_ptr<coral_texture> test_texture_;
+        std::unique_ptr<coral_texture> test_texture_2_;
+
+        std::unique_ptr<coral_descriptor_pool> material_descriptor_pool_{};
+        std::unique_ptr<coral_descriptor_set_layout> material_set_layout_{};
+        VkDescriptorSet material_descriptor_set{};
 	};
 }

BIN
shaders/compiled/simple_shader.frag.spv


BIN
shaders/compiled/simple_shader.vert.spv


+ 3 - 12
shaders/simple_shader.frag

@@ -2,7 +2,7 @@
 
 layout (location = 0) in vec3 fragColor;
 layout (location = 1) in vec3 fragPosWorld;
-layout (location = 2) in vec3 fragNormalWorld;
+layout (location = 2) in vec3 fragNormal;
 layout (location = 3) in vec2 fragUV;
 
 layout (location = 0) out vec4 outColor;
@@ -14,13 +14,9 @@ layout (set = 0, binding = 0) uniform GlobalUBO
 	// GLOBAL LIGHT
 	vec4 globalLightDirection;
 	vec4 ambientLightColor;
-
-	// POINT LIGHT
-	vec4 lightPosition;
-	vec4 lightColor;
 } ubo;
 
-layout (binding = 1) uniform sampler2D texSampler;
+layout (set = 1, binding = 0) uniform sampler2D texSampler;
 
 layout (push_constant) uniform Push
 {
@@ -42,14 +38,9 @@ vec3 calculate_diffuse(vec3 col, vec3 norm)
 
 void main()
 {
-	// POINT LIGHT
-	// vec3 directionToLight = ubo.lightPosition.xyz - fragPosWorld;
-	// float attenuation = 1.0f / dot(directionToLight, directionToLight);
-	// vec3 lightColor = ubo.lightColor.xyz * ubo.lightColor.w * attenuation;
-
 	vec3 ambient = ubo.ambientLightColor.xyz * ubo.ambientLightColor.w;
 	vec3 color = texture(texSampler, fragUV).xyz;
-	vec3 diffuse = calculate_diffuse(color, fragNormalWorld);
+	vec3 diffuse = calculate_diffuse(color, fragNormal);
 
 	outColor = vec4(diffuse + ambient, 1.0f);
 }

+ 2 - 6
shaders/simple_shader.vert

@@ -7,7 +7,7 @@ layout (location = 3) in vec3 color;
 
 layout (location = 0) out vec3 fragColor;
 layout (location = 1) out vec3 fragPosWorld;
-layout (location = 2) out vec3 fragNormalWorld;
+layout (location = 2) out vec3 fragNormal;
 layout (location = 3) out vec2 fragUV;
 
 layout (set = 0, binding = 0) uniform GlobalUBO
@@ -17,10 +17,6 @@ layout (set = 0, binding = 0) uniform GlobalUBO
 	// GLOBAL LIGHT
 	vec4 globalLightDirection;
 	vec4 ambientLightColor;
-
-	// POINT LIGHT
-	vec4 lightPosition;
-	vec4 lightColor;
 } ubo;
 
 layout (push_constant) uniform Push
@@ -36,6 +32,6 @@ void main()
 
 	fragColor = color;
 	fragPosWorld = worldPos.xyz;
-	fragNormalWorld = normalize(mat3(push.normalMatrix) * normal);
+	fragNormal = normal;
 	fragUV = uv;
 }

Some files were not shown because too many files changed in this diff