private void InitShaders() { if (m_VS == VertexShaderId.NULL) { m_VS = MyShaders.CreateVs(FoliageRenderShader); } if (m_GS[0] == GeometryShaderId.NULL) { m_GS[0] = MyShaders.CreateGs(FoliageRenderShader); } if (m_PS[0] == PixelShaderId.NULL) { m_PS[0] = MyShaders.CreatePs(FoliageRenderShader); } var foliageMacro = new[] { new ShaderMacro("ROCK_FOLIAGE", null) }; if (m_GS[1] == GeometryShaderId.NULL) { m_GS[1] = MyShaders.CreateGs(FoliageRenderShader, foliageMacro); } if (m_PS[1] == PixelShaderId.NULL) { m_PS[1] = MyShaders.CreatePs(FoliageRenderShader, foliageMacro); } if (m_inputLayout == InputLayoutId.NULL) { m_inputLayout = MyShaders.CreateIL(m_VS.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION3, MyVertexInputComponentType.CUSTOM_UNORM4_0)); } }
internal unsafe MyFoliageGeneratingPass() { var soElements = new StreamOutputElement[2]; soElements[0].Stream = 0; soElements[0].SemanticName = "TEXCOORD"; soElements[0].SemanticIndex = 0; soElements[0].ComponentCount = 3; soElements[0].OutputSlot = 0; soElements[1].Stream = 0; soElements[1].SemanticName = "TEXCOORD"; soElements[1].SemanticIndex = 1; soElements[1].ComponentCount = 1; soElements[1].OutputSlot = 0; var soStrides = new int[] { sizeof(Vector3) + sizeof(uint) }; if (m_geometryShader == GeometryShaderId.NULL) { string stageFile = Path.Combine(MyMaterialShaders.PassesFolder, MyMaterialShaders.FOLIAGE_STREAMING_PASS, "GeometryStage.hlsl"); m_geometryShader = MyShaders.CreateGs(stageFile, null, new MyShaderStreamOutputInfo { Elements = soElements, Strides = soStrides, RasterizerStreams = GeometryShader.StreamOutputNoRasterizedStream }); } SetImmediate(true); }
internal unsafe MyFoliageGeneratingPass() { var soElements = new StreamOutputElement[2]; soElements[0].Stream = 0; soElements[0].SemanticName = "TEXCOORD"; soElements[0].SemanticIndex = 0; soElements[0].ComponentCount = 3; soElements[0].OutputSlot = 0; soElements[1].Stream = 0; soElements[1].SemanticName = "TEXCOORD"; soElements[1].SemanticIndex = 1; soElements[1].ComponentCount = 1; soElements[1].OutputSlot = 0; var soStrides = new int[] { sizeof(Vector3) + sizeof(uint) }; if (m_geometryShader == GeometryShaderId.NULL) { m_geometryShader = MyShaders.CreateGs("passes/foliage_streaming/geometry_stage.hlsl", null, new MyShaderStreamOutputInfo { Elements = soElements, Strides = soStrides, RasterizerStreams = GeometryShader.StreamOutputNoRasterizedStream }); } SetImmediate(true); }
internal static void Init() { m_VS = MyShaders.CreateVs("foliage2.hlsl", "vs"); m_GS = MyShaders.CreateGs("foliage2.hlsl", "gs"); m_PS = MyShaders.CreatePs("foliage2.hlsl", "ps"); m_inputLayout = MyShaders.CreateIL(m_VS.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION3, MyVertexInputComponentType.CUSTOM_UNORM4_0)); }
internal static void Init() { m_VS = MyShaders.CreateVs("foliage2.hlsl", "vs"); m_GS[0] = MyShaders.CreateGs("foliage2.hlsl", "gs"); m_PS[0] = MyShaders.CreatePs("foliage2.hlsl", "ps"); m_GS[1] = MyShaders.CreateGs("foliage2.hlsl", "gs", MyShaderHelpers.FormatMacros("ROCK_FOLIAGE")); m_PS[1] = MyShaders.CreatePs("foliage2.hlsl", "ps", MyShaderHelpers.FormatMacros("ROCK_FOLIAGE")); m_inputLayout = MyShaders.CreateIL(m_VS.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION3, MyVertexInputComponentType.CUSTOM_UNORM4_0)); }
internal static unsafe void Init() { var soElements = new StreamOutputElement[2]; soElements[0].Stream = 0; soElements[0].SemanticName = "TEXCOORD"; soElements[0].SemanticIndex = 0; soElements[0].ComponentCount = 3; soElements[0].OutputSlot = 0; soElements[1].Stream = 0; soElements[1].SemanticName = "TEXCOORD"; soElements[1].SemanticIndex = 1; soElements[1].ComponentCount = 1; soElements[1].OutputSlot = 0; var soStrides = new int[] { sizeof(Vector3) + sizeof(uint) }; m_gs = MyShaders.CreateGs("passes/foliage_streaming/geometry_stage.hlsl", "gs", "", new MyShaderStreamOutputInfo { Elements = soElements, Strides = soStrides, RasterizerStreams = GeometryShader.StreamOutputNoRasterizedStream }); m_instance.SetImmediate(true); }