Branimir Karadžić 7 年之前
父節點
當前提交
5d2f256dc4
共有 22 個文件被更改,包括 23 次插入23 次删除
  1. 0 0
      examples/37-gpudrivenrendering/cs_gdr_downscale_hi_z.sc
  2. 0 0
      examples/37-gpudrivenrendering/cs_gdr_occlude_props.sc
  3. 0 0
      examples/37-gpudrivenrendering/cs_gdr_stream_compaction.sc
  4. 0 0
      examples/37-gpudrivenrendering/fs_gdr_instanced_indirect_rendering.sc
  5. 0 0
      examples/37-gpudrivenrendering/fs_gdr_render_occlusion.sc
  6. 23 23
      examples/37-gpudrivenrendering/gpudrivenrendering.cpp
  7. 0 0
      examples/37-gpudrivenrendering/vs_gdr_instanced_indirect_rendering.sc
  8. 0 0
      examples/37-gpudrivenrendering/vs_gdr_render_occlusion.sc
  9. 0 0
      examples/runtime/shaders/dx11/cs_gdr_downscale_hi_z.bin
  10. 0 0
      examples/runtime/shaders/dx11/cs_gdr_occlude_props.bin
  11. 0 0
      examples/runtime/shaders/dx11/cs_gdr_stream_compaction.bin
  12. 0 0
      examples/runtime/shaders/dx11/fs_gdr_instanced_indirect_rendering.bin
  13. 0 0
      examples/runtime/shaders/dx11/fs_gdr_render_occlusion.bin
  14. 0 0
      examples/runtime/shaders/dx11/vs_gdr_instanced_indirect_rendering.bin
  15. 0 0
      examples/runtime/shaders/dx11/vs_gdr_render_occlusion.bin
  16. 0 0
      examples/runtime/shaders/glsl/cs_gdr_downscale_hi_z.bin
  17. 0 0
      examples/runtime/shaders/glsl/cs_gdr_occlude_props.bin
  18. 0 0
      examples/runtime/shaders/glsl/cs_gdr_stream_compaction.bin
  19. 0 0
      examples/runtime/shaders/glsl/fs_gdr_instanced_indirect_rendering.bin
  20. 0 0
      examples/runtime/shaders/glsl/fs_gdr_render_occlusion.bin
  21. 0 0
      examples/runtime/shaders/glsl/vs_gdr_instanced_indirect_rendering.bin
  22. 0 0
      examples/runtime/shaders/glsl/vs_gdr_render_occlusion.bin

+ 0 - 0
examples/37-gpudrivenrendering/cs_downscaleHiZ.sc → examples/37-gpudrivenrendering/cs_gdr_downscale_hi_z.sc


+ 0 - 0
examples/37-gpudrivenrendering/cs_occludeProps.sc → examples/37-gpudrivenrendering/cs_gdr_occlude_props.sc


+ 0 - 0
examples/37-gpudrivenrendering/cs_streamCompaction.sc → examples/37-gpudrivenrendering/cs_gdr_stream_compaction.sc


+ 0 - 0
examples/37-gpudrivenrendering/fs_instancedIndirectRendering.sc → examples/37-gpudrivenrendering/fs_gdr_instanced_indirect_rendering.sc


+ 0 - 0
examples/37-gpudrivenrendering/fs_renderOcclusion.sc → examples/37-gpudrivenrendering/fs_gdr_render_occlusion.sc


+ 23 - 23
examples/37-gpudrivenrendering/gpudrivenrendering.cpp

@@ -588,7 +588,8 @@ public:
 				| BGFX_TEXTURE_MAG_POINT
 				| BGFX_TEXTURE_MAG_POINT
 				| BGFX_TEXTURE_MIP_POINT
 				| BGFX_TEXTURE_MIP_POINT
 				| BGFX_TEXTURE_U_CLAMP
 				| BGFX_TEXTURE_U_CLAMP
-				| BGFX_TEXTURE_V_CLAMP;
+				| BGFX_TEXTURE_V_CLAMP
+				;
 
 
 			// Create buffers for the HiZ pass
 			// Create buffers for the HiZ pass
 			m_hiZDepthBuffer = bgfx::createFrameBuffer(uint16_t(m_hiZwidth), uint16_t(m_hiZheight), bgfx::TextureFormat::D32, samplerFlags);
 			m_hiZDepthBuffer = bgfx::createFrameBuffer(uint16_t(m_hiZwidth), uint16_t(m_hiZheight), bgfx::TextureFormat::D32, samplerFlags);
@@ -684,10 +685,10 @@ public:
 			m_indirectBuffer = bgfx::createIndirectBuffer(m_noofProps);
 			m_indirectBuffer = bgfx::createIndirectBuffer(m_noofProps);
 
 
 			// Create programs from shaders for occlusion pass.
 			// Create programs from shaders for occlusion pass.
-			m_programOcclusionPass = loadProgram("vs_renderOcclusion", "fs_renderOcclusion");
-			m_programDownscaleHiZ = loadProgram("cs_downscaleHiZ", nullptr);
-			m_programOccludeProps = loadProgram("cs_occludeProps", nullptr);
-			m_programStreamCompaction = loadProgram("cs_streamCompaction", nullptr);
+			m_programOcclusionPass    = loadProgram("vs_gdr_render_occlusion", "fs_gdr_render_occlusion");
+			m_programDownscaleHiZ     = loadProgram("cs_gdr_downscale_hi_z", NULL);
+			m_programOccludeProps     = loadProgram("cs_gdr_occlude_props", NULL);
+			m_programStreamCompaction = loadProgram("cs_gdr_stream_compaction", NULL);
 
 
 			// Set view RENDER_PASS_HIZ_ID clear state.
 			// Set view RENDER_PASS_HIZ_ID clear state.
 			bgfx::setViewClear(RENDER_PASS_HIZ_ID
 			bgfx::setViewClear(RENDER_PASS_HIZ_ID
@@ -709,7 +710,7 @@ public:
 			);
 			);
 
 
 			// Create program from shaders.
 			// Create program from shaders.
-			m_programMainPass = loadProgram("vs_instancedIndirectRendering", "fs_instancedIndirectRendering");
+			m_programMainPass = loadProgram("vs_gdr_instanced_indirect_rendering", "fs_gdr_instanced_indirect_rendering");
 		}
 		}
 
 
 		// Create static vertex buffer for all props.
 		// Create static vertex buffer for all props.
@@ -725,7 +726,7 @@ public:
 			totalNoofIndices += prop.m_noofIndices;
 			totalNoofIndices += prop.m_noofIndices;
 		}
 		}
 
 
-		//CPU data to fill the master buffers
+		// CPU data to fill the master buffers
 		m_allPropVerticesDataCPU = new PosVertex[totalNoofVertices];
 		m_allPropVerticesDataCPU = new PosVertex[totalNoofVertices];
 		m_allPropIndicesDataCPU = new uint16_t[totalNoofIndices];
 		m_allPropIndicesDataCPU = new uint16_t[totalNoofIndices];
 		m_indirectBufferDataCPU = new uint32_t[m_noofProps * 3];
 		m_indirectBufferDataCPU = new uint32_t[m_noofProps * 3];
@@ -891,7 +892,7 @@ public:
 		}
 		}
 	}
 	}
 
 
-	//downscale the occluder depth buffer to create a mipmap chain
+	// downscale the occluder depth buffer to create a mipmap chain
 	void renderDownscalePass()
 	void renderDownscalePass()
 	{
 	{
 		uint32_t width = m_hiZwidth;
 		uint32_t width = m_hiZwidth;
@@ -906,7 +907,7 @@ public:
 
 
 			if (i > 0)
 			if (i > 0)
 			{
 			{
-				//down scale mip 1 onwards
+				// down scale mip 1 onwards
 				width /= 2;
 				width /= 2;
 				height /= 2;
 				height /= 2;
 
 
@@ -915,8 +916,8 @@ public:
 			}
 			}
 			else
 			else
 			{
 			{
-				//copy mip zero over to the hi Z buffer.
-				//We can't currently use blit as it requires same format and CopyResource is not exposed.
+				// copy mip zero over to the hi Z buffer.
+				// We can't currently use blit as it requires same format and CopyResource is not exposed.
 				bgfx::setImage(0, getTexture(m_hiZDepthBuffer, 0), 0, bgfx::Access::Read);
 				bgfx::setImage(0, getTexture(m_hiZDepthBuffer, 0), 0, bgfx::Access::Read);
 				bgfx::setImage(1, getTexture(m_hiZBuffer, 0), 0, bgfx::Access::Write);
 				bgfx::setImage(1, getTexture(m_hiZBuffer, 0), 0, bgfx::Access::Write);
 			}
 			}
@@ -925,10 +926,10 @@ public:
 		}
 		}
 	}
 	}
 
 
-	//perform the occlusion using the mip chain
+	// perform the occlusion using the mip chain
 	void renderOccludePropsPass()
 	void renderOccludePropsPass()
 	{
 	{
-		//run the computer shader to determine visibility of each instance
+		// run the computer shader to determine visibility of each instance
 		bgfx::setTexture(0, s_texOcclusionDepthIn, bgfx::getTexture(m_hiZBuffer));
 		bgfx::setTexture(0, s_texOcclusionDepthIn, bgfx::getTexture(m_hiZBuffer));
 
 
 		bgfx::setBuffer(1, m_instanceBoundingBoxes, bgfx::Access::Read);
 		bgfx::setBuffer(1, m_instanceBoundingBoxes, bgfx::Access::Read);
@@ -938,7 +939,7 @@ public:
 		float inputRendertargetSize[4] = { (float)m_hiZwidth, (float)m_hiZheight, 1.0f/ m_hiZwidth, 1.0f/ m_hiZheight };
 		float inputRendertargetSize[4] = { (float)m_hiZwidth, (float)m_hiZheight, 1.0f/ m_hiZwidth, 1.0f/ m_hiZheight };
 		bgfx::setUniform(u_inputRTSize, inputRendertargetSize);
 		bgfx::setUniform(u_inputRTSize, inputRendertargetSize);
 
 
-		//store a rounded-up, power of two instance count for the stream compaction step
+		// store a rounded-up, power of two instance count for the stream compaction step
 		float noofInstancesPowOf2 = bx::pow(2.0f, bx::floor(bx::log(m_totalInstancesCount) / bx::log(2.0f) ) + 1.0f);
 		float noofInstancesPowOf2 = bx::pow(2.0f, bx::floor(bx::log(m_totalInstancesCount) / bx::log(2.0f) ) + 1.0f);
 
 
 		float cullingConfig[4] = { (float)m_totalInstancesCount, noofInstancesPowOf2 , (float)m_noofHiZMips, (float)m_noofProps };
 		float cullingConfig[4] = { (float)m_totalInstancesCount, noofInstancesPowOf2 , (float)m_noofHiZMips, (float)m_noofProps };
@@ -951,20 +952,20 @@ public:
 
 
 		bgfx::dispatch(RENDER_PASS_OCCLUDE_PROPS_ID, m_programOccludeProps, groupX, 1, 1);
 		bgfx::dispatch(RENDER_PASS_OCCLUDE_PROPS_ID, m_programOccludeProps, groupX, 1, 1);
 
 
-		//perform stream compaction to remove occluded instances
+		// perform stream compaction to remove occluded instances
 
 
-		//the per drawcall data that is constant (noof indices/vertices and offsets to vertex/index buffers)
+		// the per drawcall data that is constant (noof indices/vertices and offsets to vertex/index buffers)
 	 	bgfx::setBuffer(0, m_indirectBufferData, bgfx::Access::Read);
 	 	bgfx::setBuffer(0, m_indirectBufferData, bgfx::Access::Read);
-		//instance data for all instances (pre culling)
+		// instance data for all instances (pre culling)
 		bgfx::setBuffer(1, m_instanceBuffer, bgfx::Access::Read);
 		bgfx::setBuffer(1, m_instanceBuffer, bgfx::Access::Read);
-		//per instance visibility (output of culling pass)
+		// per instance visibility (output of culling pass)
 		bgfx::setBuffer(2, m_instancePredicates, bgfx::Access::Read);
 		bgfx::setBuffer(2, m_instancePredicates, bgfx::Access::Read);
 
 
-		//how many instances per drawcall
+		// how many instances per drawcall
 		bgfx::setBuffer(3, m_drawcallInstanceCounts, bgfx::Access::ReadWrite);
 		bgfx::setBuffer(3, m_drawcallInstanceCounts, bgfx::Access::ReadWrite);
-		//drawcall data that will drive drawIndirect
+		// drawcall data that will drive drawIndirect
 		bgfx::setBuffer(4, m_indirectBuffer, bgfx::Access::ReadWrite);
 		bgfx::setBuffer(4, m_indirectBuffer, bgfx::Access::ReadWrite);
-		//culled instance data
+		// culled instance data
 		bgfx::setBuffer(5, m_culledInstanceBuffer, bgfx::Access::Write);
 		bgfx::setBuffer(5, m_culledInstanceBuffer, bgfx::Access::Write);
 
 
 		bgfx::setUniform(u_cullingConfig, cullingConfig);
 		bgfx::setUniform(u_cullingConfig, cullingConfig);
@@ -973,7 +974,7 @@ public:
 
 
 	}
 	}
 
 
-	//render the unoccluded props to the screen
+	// render the unoccluded props to the screen
 	void renderMainPass()
 	void renderMainPass()
 	{
 	{
 		// Set view and projection matrix for view 0.
 		// Set view and projection matrix for view 0.
@@ -1222,7 +1223,6 @@ public:
 
 
 	Camera m_camera;
 	Camera m_camera;
 	Mouse m_mouse;
 	Mouse m_mouse;
-
 };
 };
 
 
 } // namespace
 } // namespace

+ 0 - 0
examples/37-gpudrivenrendering/vs_instancedIndirectRendering.sc → examples/37-gpudrivenrendering/vs_gdr_instanced_indirect_rendering.sc


+ 0 - 0
examples/37-gpudrivenrendering/vs_renderOcclusion.sc → examples/37-gpudrivenrendering/vs_gdr_render_occlusion.sc


+ 0 - 0
examples/runtime/shaders/dx11/cs_downscaleHiZ.bin → examples/runtime/shaders/dx11/cs_gdr_downscale_hi_z.bin


+ 0 - 0
examples/runtime/shaders/dx11/cs_occludeProps.bin → examples/runtime/shaders/dx11/cs_gdr_occlude_props.bin


+ 0 - 0
examples/runtime/shaders/dx11/cs_streamCompaction.bin → examples/runtime/shaders/dx11/cs_gdr_stream_compaction.bin


+ 0 - 0
examples/runtime/shaders/dx11/fs_instancedIndirectRendering.bin → examples/runtime/shaders/dx11/fs_gdr_instanced_indirect_rendering.bin


+ 0 - 0
examples/runtime/shaders/dx11/fs_renderOcclusion.bin → examples/runtime/shaders/dx11/fs_gdr_render_occlusion.bin


+ 0 - 0
examples/runtime/shaders/dx11/vs_instancedIndirectRendering.bin → examples/runtime/shaders/dx11/vs_gdr_instanced_indirect_rendering.bin


+ 0 - 0
examples/runtime/shaders/dx11/vs_renderOcclusion.bin → examples/runtime/shaders/dx11/vs_gdr_render_occlusion.bin


+ 0 - 0
examples/runtime/shaders/glsl/cs_downscaleHiZ.bin → examples/runtime/shaders/glsl/cs_gdr_downscale_hi_z.bin


+ 0 - 0
examples/runtime/shaders/glsl/cs_occludeProps.bin → examples/runtime/shaders/glsl/cs_gdr_occlude_props.bin


+ 0 - 0
examples/runtime/shaders/glsl/cs_streamCompaction.bin → examples/runtime/shaders/glsl/cs_gdr_stream_compaction.bin


+ 0 - 0
examples/runtime/shaders/glsl/fs_instancedIndirectRendering.bin → examples/runtime/shaders/glsl/fs_gdr_instanced_indirect_rendering.bin


+ 0 - 0
examples/runtime/shaders/glsl/fs_renderOcclusion.bin → examples/runtime/shaders/glsl/fs_gdr_render_occlusion.bin


+ 0 - 0
examples/runtime/shaders/glsl/vs_instancedIndirectRendering.bin → examples/runtime/shaders/glsl/vs_gdr_instanced_indirect_rendering.bin


+ 0 - 0
examples/runtime/shaders/glsl/vs_renderOcclusion.bin → examples/runtime/shaders/glsl/vs_gdr_render_occlusion.bin