public static void Draw(IRtvBindable renderTarget) { ISrvBindable srvBind = null; if (m_selRtvTexture != null) srvBind = m_selRtvTexture; if (m_selUavTexture != null) srvBind = m_selUavTexture; if (m_selBorrowedRtvTexture != null) srvBind = m_selBorrowedRtvTexture; if (m_selBorrowedUavTexture != null) srvBind = m_selBorrowedUavTexture; if (srvBind == null) // no texture is selected return; if (m_ps == PixelShaderId.NULL) m_ps = MyShaders.CreatePs("Debug/DebugRt.hlsl"); MyRenderContext RC = MyImmediateRC.RC; RC.SetPrimitiveTopology(PrimitiveTopology.TriangleList); RC.SetViewport(0, 0, MyRender11.ViewportResolution.X, MyRender11.ViewportResolution.Y); RC.SetRtv(renderTarget); RC.SetBlendState(null); RC.PixelShader.Set(m_ps); RC.PixelShader.SetSrv(0, srvBind); RC.PixelShader.SetConstantBuffer(MyCommon.FRAME_SLOT, MyCommon.FrameConstants); MyScreenPass.DrawFullscreenQuad(); Deselect(); }
internal static void Init() { m_ps = MyShaders.CreatePs("ForwardPostprocess.hlsl", "apply_skybox"); m_mipmap = MyShaders.CreateCs("EnvPrefiltering.hlsl", "buildMipmap"); m_prefilter = MyShaders.CreateCs("EnvPrefiltering.hlsl", "prefilter"); m_blend = MyShaders.CreateCs("EnvPrefiltering.hlsl", "blend"); }
internal static void Init() { m_buildHistogram = MyShaders.CreateCs("histogram.hlsl", "build_histogram", MyShaderHelpers.FormatMacros("NUMTHREADS 8")); m_drawHistogram = MyShaders.CreatePs("data_visualization.hlsl", "display_histogram"); m_histogram = MyRwTextures.CreateUav1D(512, SharpDX.DXGI.Format.R32_UInt, "histogram"); }
internal static void Init() { //MyRender11.RegisterSettingsChangedListener(new OnSettingsChangedDelegate(RecreateShadersForSettings)); m_screenVertexShader = MyShaders.CreateVs("Debug/DebugBaseColor.hlsl"); m_baseColorShader = MyShaders.CreatePs("Debug/DebugBaseColor.hlsl"); m_albedoShader = MyShaders.CreatePs("Debug/DebugAlbedo.hlsl"); m_normalShader = MyShaders.CreatePs("Debug/DebugNormal.hlsl"); m_normalViewShader = MyShaders.CreatePs("Debug/DebugNormalView.hlsl"); m_glossinessShader = MyShaders.CreatePs("Debug/DebugGlossiness.hlsl"); m_metalnessShader = MyShaders.CreatePs("Debug/DebugMetalness.hlsl"); m_aoShader = MyShaders.CreatePs("Debug/DebugAmbientOcclusion.hlsl"); m_emissiveShader = MyShaders.CreatePs("Debug/DebugEmissive.hlsl"); m_ambientDiffuseShader = MyShaders.CreatePs("Debug/DebugAmbientDiffuse.hlsl"); m_ambientSpecularShader = MyShaders.CreatePs("Debug/DebugAmbientSpecular.hlsl"); m_edgeDebugShader = MyShaders.CreatePs("Debug/DebugEdge.hlsl"); m_shadowsDebugShader = MyShaders.CreatePs("Debug/DebugCascadesShadow.hlsl"); m_NDotLShader = MyShaders.CreatePs("Debug/DebugNDotL.hlsl"); m_LODShader = MyShaders.CreatePs("Debug/DebugLOD.hlsl"); m_depthShader = MyShaders.CreatePs("Debug/DebugDepth.hlsl"); m_stencilShader = MyShaders.CreatePs("Debug/DebugStencil.hlsl"); m_rtShader = MyShaders.CreatePs("Debug/DebugRt.hlsl"); m_blitTextureShader = MyShaders.CreatePs("Debug/DebugBlitTexture.hlsl"); m_blitTexture3DShader = MyShaders.CreatePs("Debug/DebugBlitTexture3D.hlsl"); m_blitTextureArrayShader = MyShaders.CreatePs("Debug/DebugBlitTextureArray.hlsl"); m_inputLayout = MyShaders.CreateIL(m_screenVertexShader.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION2, MyVertexInputComponentType.TEXCOORD0)); m_quadBuffer = MyManagers.Buffers.CreateVertexBuffer( "MyDebugRenderer quad", 6, MyVertexFormatPosition2Texcoord.STRIDE, usage: ResourceUsage.Dynamic); }
internal static void Init() { //MyRender11.RegisterSettingsChangedListener(new OnSettingsChangedDelegate(RecreateShadersForSettings)); m_baseColorShader = MyShaders.CreatePs("debug.hlsl", "base_color"); m_baseColorLinearShader = MyShaders.CreatePs("debug.hlsl", "base_color_linear"); m_normalShader = MyShaders.CreatePs("debug.hlsl", "normal"); m_glossinessShader = MyShaders.CreatePs("debug.hlsl", "glossiness"); m_metalnessShader = MyShaders.CreatePs("debug.hlsl", "metalness"); m_matIDShader = MyShaders.CreatePs("debug.hlsl", "mat_id"); m_aoShader = MyShaders.CreatePs("debug.hlsl", "ambient_occlusion"); m_emissiveShader = MyShaders.CreatePs("debug.hlsl", "emissive"); m_ambientDiffuseShader = MyShaders.CreatePs("debug.hlsl", "debug_ambient_diffuse"); m_ambientSpecularShader = MyShaders.CreatePs("debug.hlsl", "debug_ambient_specular"); m_edgeDebugShader = MyShaders.CreatePs("debug.hlsl", "debug_edge"); m_shadowsDebugShader = MyShaders.CreatePs("debug.hlsl", "cascades_shadow", MyRender11.ShaderCascadesNumberHeader()); m_NDotLShader = MyShaders.CreatePs("debug.hlsl", "NDotL"); m_screenVertexShader = MyShaders.CreateVs("debug.hlsl", "screenVertex"); m_blitTextureShader = MyShaders.CreatePs("debug.hlsl", "blitTexture"); m_blitTexture3DShader = MyShaders.CreatePs("debug.hlsl", "blitTexture3D"); m_blitTextureArrayShader = MyShaders.CreatePs("debug.hlsl", "blitTextureArray"); m_inputLayout = MyShaders.CreateIL(m_screenVertexShader.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION2, MyVertexInputComponentType.TEXCOORD0)); m_quadBuffer = MyHwBuffers.CreateVertexBuffer(6, MyVertexFormatPosition2Texcoord.STRIDE, BindFlags.VertexBuffer, ResourceUsage.Dynamic); }
internal static void Init() { //MyRender11.RegisterSettingsChangedListener(new OnSettingsChangedDelegate(RecreateShadersForSettings)); m_screenVertexShader = MyShaders.CreateVs("Debug/DebugBaseColor.hlsl"); m_baseColorShader = MyShaders.CreatePs("Debug/DebugBaseColor.hlsl"); m_albedoShader = MyShaders.CreatePs("Debug/DebugAlbedo.hlsl"); m_normalShader = MyShaders.CreatePs("Debug/DebugNormal.hlsl"); m_normalViewShader = MyShaders.CreatePs("Debug/DebugNormalView.hlsl"); m_glossinessShader = MyShaders.CreatePs("Debug/DebugGlossiness.hlsl"); m_metalnessShader = MyShaders.CreatePs("Debug/DebugMetalness.hlsl"); m_aoShader = MyShaders.CreatePs("Debug/DebugAmbientOcclusion.hlsl"); m_emissiveShader = MyShaders.CreatePs("Debug/DebugEmissive.hlsl"); m_ambientDiffuseShader = MyShaders.CreatePs("Debug/DebugAmbientDiffuse.hlsl"); m_ambientSpecularShader = MyShaders.CreatePs("Debug/DebugAmbientSpecular.hlsl"); m_edgeDebugShader = MyShaders.CreatePs("Debug/DebugEdge.hlsl"); m_shadowsDebugShader = MyShaders.CreatePs("Debug/DebugCascadesShadow.hlsl"); m_NDotLShader = MyShaders.CreatePs("Debug/DebugNDotL.hlsl"); m_depthShader = MyShaders.CreatePs("Debug/DebugDepth.hlsl"); m_stencilShader = MyShaders.CreatePs("Debug/DebugStencil.hlsl"); m_rtShader = MyShaders.CreatePs("Debug/DebugRt.hlsl"); m_blitTextureShader = MyShaders.CreatePs("Debug/DebugBlitTexture.hlsl"); m_blitTexture3DShader = MyShaders.CreatePs("Debug/DebugBlitTexture3D.hlsl"); m_blitTextureArrayShader = MyShaders.CreatePs("Debug/DebugBlitTextureArray.hlsl"); m_inputLayout = MyShaders.CreateIL(m_screenVertexShader.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION2, MyVertexInputComponentType.TEXCOORD0)); m_quadBuffer = MyHwBuffers.CreateVertexBuffer(6, MyVertexFormatPosition2Texcoord.STRIDE, BindFlags.VertexBuffer, ResourceUsage.Dynamic, null, "MyDebugRenderer quad"); }
internal static void Init() { MyGPUEmitters.Init(); m_resetSystem = true; m_csInitDeadList = MyShaders.CreateCs("Transparent/GPUParticles/InitDeadList.hlsl", null); m_csResetParticles = MyShaders.CreateCs("Transparent/GPUParticles/Reset.hlsl", null); m_csEmit = MyShaders.CreateCs("Transparent/GPUParticles/Emit.hlsl", null); m_csEmitSkipFix = MyShaders.CreateCs("Transparent/GPUParticles/EmitSkipFix.hlsl", null); m_csSimulate = MyShaders.CreateCs("Transparent/GPUParticles/Simulation.hlsl", null); var macrosRender = new[] { new ShaderMacro("STREAKS", null), new ShaderMacro("LIT_PARTICLE", null) }; var macrosRenderOIT = new[] { new ShaderMacro("STREAKS", null), new ShaderMacro("LIT_PARTICLE", null), new ShaderMacro("OIT", null) }; m_vs = MyShaders.CreateVs("Transparent/GPUParticles/Render.hlsl", macrosRender); m_ps = MyShaders.CreatePs("Transparent/GPUParticles/Render.hlsl", macrosRender); m_psOIT = MyShaders.CreatePs("Transparent/GPUParticles/Render.hlsl", macrosRenderOIT); var macroDebug = new[] { new ShaderMacro("DEBUG_UNIFORM_ACCUM", null) }; m_psDebugUniformAccum = MyShaders.CreatePs("Transparent/GPUParticles/Render.hlsl", MyShaders.ConcatenateMacros(macrosRender, macroDebug)); m_psDebugUniformAccumOIT = MyShaders.CreatePs("Transparent/GPUParticles/Render.hlsl", MyShaders.ConcatenateMacros(macrosRenderOIT, macroDebug)); InitDevice(); }
public static void Init() { m_buildHistogram = MyShaders.CreateCs("Debug/Histogram.hlsl", new[] { new ShaderMacro("NUMTHREADS", 8) }); m_drawHistogram = MyShaders.CreatePs("Debug/DataVisualizationHistogram.hlsl"); m_psDisplayHdrIntensity = MyShaders.CreatePs("Debug/DisplayHdrIntensity.hlsl"); }
internal static unsafe void Init() { m_vs = MyShaders.CreateVs("Primitives/OcclusionQuery.hlsl", null); m_ps = MyShaders.CreatePs("Primitives/OcclusionQuery.hlsl", null); m_inputLayout = MyShaders.CreateIL(m_vs.BytecodeId, MyVertexLayouts.GetLayout( new MyVertexInputComponent(MyVertexInputComponentType.CUSTOM4_0, MyVertexInputComponentFreq.PER_INSTANCE))); }
internal static void Init() { //MyRender11.RegisterSettingsChangedListener(new OnSettingsChangedDelegate(RecreateShadersForSettings)); m_screenVertexShader = MyShaders.CreateVs("debug_base_color.hlsl"); m_baseColorShader = MyShaders.CreatePs("debug_base_color.hlsl"); m_baseColorLinearShader = MyShaders.CreatePs("debug_base_color_linear.hlsl"); m_normalShader = MyShaders.CreatePs("debug_normal.hlsl"); m_glossinessShader = MyShaders.CreatePs("debug_glossiness.hlsl"); m_metalnessShader = MyShaders.CreatePs("debug_metalness.hlsl"); m_matIDShader = MyShaders.CreatePs("debug_mat_id.hlsl"); m_aoShader = MyShaders.CreatePs("debug_ambient_occlusion.hlsl"); m_emissiveShader = MyShaders.CreatePs("debug_emissive.hlsl"); m_ambientDiffuseShader = MyShaders.CreatePs("debug_ambient_diffuse.hlsl"); m_ambientSpecularShader = MyShaders.CreatePs("debug_ambient_specular.hlsl"); m_edgeDebugShader = MyShaders.CreatePs("debug_edge.hlsl"); m_shadowsDebugShader = MyShaders.CreatePs("debug_cascades_shadow.hlsl"); m_NDotLShader = MyShaders.CreatePs("debug_NDotL.hlsl"); m_depthShader = MyShaders.CreatePs("debug_Depth.hlsl"); m_stencilShader = MyShaders.CreatePs("debug_Stencil.hlsl"); m_blitTextureShader = MyShaders.CreatePs("debug_blitTexture.hlsl"); m_blitTexture3DShader = MyShaders.CreatePs("debug_blitTexture3D.hlsl"); m_blitTextureArrayShader = MyShaders.CreatePs("debug_blitTextureArray.hlsl"); m_inputLayout = MyShaders.CreateIL(m_screenVertexShader.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION2, MyVertexInputComponentType.TEXCOORD0)); m_quadBuffer = MyHwBuffers.CreateVertexBuffer(6, MyVertexFormatPosition2Texcoord.STRIDE, BindFlags.VertexBuffer, ResourceUsage.Dynamic, null, "MyDebugRenderer quad"); }
internal static void Init() { //MyRender11.RegisterSettingsChangedListener(new OnSettingsChangedDelegate(RecreateShadersForSettings)); m_screenVertexShader = MyShaders.CreateVs("debug_base_color.hlsl"); m_baseColorShader = MyShaders.CreatePs("debug_base_color.hlsl"); m_baseColorLinearShader = MyShaders.CreatePs("debug_base_color_linear.hlsl"); m_normalShader = MyShaders.CreatePs("debug_normal.hlsl"); m_glossinessShader = MyShaders.CreatePs("debug_glossiness.hlsl"); m_metalnessShader = MyShaders.CreatePs("debug_metalness.hlsl"); m_matIDShader = MyShaders.CreatePs("debug_mat_id.hlsl"); m_aoShader = MyShaders.CreatePs("debug_ambient_occlusion.hlsl"); m_emissiveShader = MyShaders.CreatePs("debug_emissive.hlsl"); m_ambientDiffuseShader = MyShaders.CreatePs("debug_ambient_diffuse.hlsl"); m_ambientSpecularShader = MyShaders.CreatePs("debug_ambient_specular.hlsl"); m_edgeDebugShader = MyShaders.CreatePs("debug_edge.hlsl"); m_shadowsDebugShader = MyShaders.CreatePs("debug_cascades_shadow.hlsl"); m_NDotLShader = MyShaders.CreatePs("debug_NDotL.hlsl"); m_stencilShader = MyShaders.CreatePs("debug_Stencil.hlsl"); m_blitTextureShader = MyShaders.CreatePs("debug_blitTexture.hlsl"); m_blitTexture3DShader = MyShaders.CreatePs("debug_blitTexture3D.hlsl"); m_blitTextureArrayShader = MyShaders.CreatePs("debug_blitTextureArray.hlsl"); m_inputLayout = MyShaders.CreateIL(m_screenVertexShader.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION2, MyVertexInputComponentType.TEXCOORD0)); m_quadBuffer = MyHwBuffers.CreateVertexBuffer(6, MyVertexFormatPosition2Texcoord.STRIDE, BindFlags.VertexBuffer, ResourceUsage.Dynamic); }
internal static void Init() { m_vs = MyShaders.CreateVs("decal.hlsl", "vs"); m_ps = MyShaders.CreatePs("decal.hlsl", "ps"); InitIB(); }
internal unsafe static void Init() { //m_spotlightShadowmapPool = new MyShadowmapArray(256, 256, 4, Format.R16_Typeless, Format.D16_UNorm, Format.R16_Float); //m_spotlightShadowmapPool.SetDebugName("spotlight shadowmaps pool"); m_cascadesNum = 4; m_splitDepth = new float[m_cascadesNum + 1]; m_cascadeResolution = 1024; ResizeCascades(); m_csmConstants = MyHwBuffers.CreateConstantsBuffer((sizeof(Matrix) + sizeof(Vector2)) * 8 + 2 * sizeof(Vector4)); m_cascadesBoundingsVertices = MyHwBuffers.CreateVertexBuffer(8 * 4, sizeof(Vector3), BindFlags.VertexBuffer, ResourceUsage.Dynamic); InitIB(); m_cornersCS = new Vector3[8] { new Vector3(-1, -1, 0), new Vector3(-1, 1, 0), new Vector3(1, 1, 0), new Vector3(1, -1, 0), new Vector3(-1, -1, 1), new Vector3(-1, 1, 1), new Vector3(1, 1, 1), new Vector3(1, -1, 1) }; m_markVS = MyShaders.CreateVs("shape.hlsl", "vs"); m_markPS = MyShaders.CreatePs("shape.hlsl", "ps_dummy"); m_inputLayout = MyShaders.CreateIL(m_markVS.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION3)); }
internal unsafe static void Init() { m_cbCustomProjections = MyHwBuffers.CreateConstantsBuffer(sizeof(Matrix) * MAX_CUSTOM_PROJECTIONS_SIZE, "BilloardCustomProjections"); m_vs = MyShaders.CreateVs("Transparent/Billboards.hlsl"); m_vsDepthOnly = MyShaders.CreateVs("Transparent/BillboardsDepthOnly.hlsl"); m_ps = MyShaders.CreatePs("Transparent/Billboards.hlsl"); m_psDepthOnly = MyShaders.CreatePs("Transparent/BillboardsDepthOnly.hlsl"); m_psOIT = MyShaders.CreatePs("Transparent/Billboards.hlsl", new[] { new ShaderMacro("OIT", null) }); m_vsLit = MyShaders.CreateVs("Transparent/Billboards.hlsl", new[] { new ShaderMacro("LIT_PARTICLE", null) }); m_psLit = MyShaders.CreatePs("Transparent/Billboards.hlsl", new[] { new ShaderMacro("LIT_PARTICLE", null) }); m_psLitOIT = MyShaders.CreatePs("Transparent/Billboards.hlsl", new[] { new ShaderMacro("LIT_PARTICLE", null), new ShaderMacro("OIT", null) }); m_psAlphaCutout = MyShaders.CreatePs("Transparent/Billboards.hlsl", new[] { new ShaderMacro("ALPHA_CUTOUT", null) }); m_psAlphaCutoutAndLit = MyShaders.CreatePs("Transparent/Billboards.hlsl", new[] { new ShaderMacro("ALPHA_CUTOUT", null), new ShaderMacro("LIT_PARTICLE", null) }); m_psAlphaCutoutOIT = MyShaders.CreatePs("Transparent/Billboards.hlsl", new[] { new ShaderMacro("ALPHA_CUTOUT", null), new ShaderMacro("OIT", null) }); m_psAlphaCutoutAndLitOIT = MyShaders.CreatePs("Transparent/Billboards.hlsl", new[] { new ShaderMacro("ALPHA_CUTOUT", null), new ShaderMacro("LIT_PARTICLE", null), new ShaderMacro("OIT", null) }); m_psDebugUniformAccum = MyShaders.CreatePs("Transparent/Billboards.hlsl", new[] { new ShaderMacro("DEBUG_UNIFORM_ACCUM", null) }); m_psDebugUniformAccumOIT = MyShaders.CreatePs("Transparent/Billboards.hlsl", new[] { new ShaderMacro("DEBUG_UNIFORM_ACCUM", null), new ShaderMacro("OIT", null) }); m_inputLayout = MyShaders.CreateIL(m_vs.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION3, MyVertexInputComponentType.TEXCOORD0_H)); InitBillboardsIndexBuffer(); m_VB = MyHwBuffers.CreateVertexBuffer(MAX_BILLBOARDS_SIZE * 4, sizeof(MyVertexFormatPositionTextureH), BindFlags.VertexBuffer, ResourceUsage.Dynamic, null, "MyBillboardRenderer"); var stride = sizeof(MyBillboardData); m_SB = MyHwBuffers.CreateStructuredBuffer(MAX_BILLBOARDS_SIZE, stride, true, null, "MyBillboardRenderer"); m_atlas = new MyTextureAtlas("Textures\\Particles\\", "Textures\\Particles\\ParticlesAtlas.tai"); }
private void InitShaders() { if (m_markVS == VertexShaderId.NULL) { m_markVS = MyShaders.CreateVs("shape.hlsl"); } if (m_markPS == PixelShaderId.NULL) { m_markPS = MyShaders.CreatePs("shape.hlsl"); } if (m_inputLayout == InputLayoutId.NULL) { m_inputLayout = MyShaders.CreateIL(m_markVS.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION3)); } if (m_combinePS == PixelShaderId.NULL) { m_combinePS = MyShaders.CreatePs("CombineShadows.hlsl"); } m_gatherCS_LD = MyShaders.CreateCs("shadows.hlsl"); m_gatherCS_MD = MyShaders.CreateCs("shadows.hlsl", new [] { new ShaderMacro("ENABLE_PCF", null) }); m_gatherCS_HD = MyShaders.CreateCs("shadows.hlsl", new[] { new ShaderMacro("ENABLE_PCF", null), new ShaderMacro("ENABLE_DISTORTION", null) }); }
internal static PixelShaderId CreatePs(string file, string func, string header = "") { var bytecode = CreateBytecode(); var id = new PixelShaderId { Index = PixelShaders.Allocate() }; PixelShaders.Data[id.Index] = new MyShaderInfo { Bytecode = bytecode }; MyArrayHelpers.Reserve(ref PsObjects, id.Index + 1); // compile at once Shaders[bytecode] = new MyShaderCompilationInfo { File = X.TEXT(file), Function = X.TEXT(func), Profile = MyShaderProfileEnum.PS_5_0, Header = header, Name = String.Format("ps_[{0}][{1}]{2}", file, func, header != null ? header.Replace(Environment.NewLine, "_") : "") }; PsObjects[id.Index] = null; InitPs(id); PsIndex.Add(id); return(id); }
public static PixelShaderId CreatePs(string file, ShaderMacro[] macros = null) { var bytecode = CreateBytecode(); var id = new PixelShaderId { Index = PixelShaders.Allocate() }; PixelShaders.Data[id.Index] = new MyShaderInfo { Bytecode = bytecode }; MyArrayHelpers.Reserve(ref PsObjects, id.Index + 1); // compile at once Shaders[bytecode] = new MyShaderCompilationInfo { File = X.TEXT_(file), Profile = MyShaderProfile.ps_5_0, Macros = macros }; PsObjects[id.Index] = null; InitPs(id, file); PsIndex.Add(id); return(id); }
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_ps = MyShaders.CreatePs("ForwardPostprocess.hlsl"); m_atmosphere = MyShaders.CreatePs("AtmospherePostprocess.hlsl"); m_mipmap = MyShaders.CreateCs("EnvPrefiltering_mipmap.hlsl"); m_prefilter = MyShaders.CreateCs("EnvPrefiltering.hlsl"); m_blend = MyShaders.CreateCs("EnvPrefiltering_blend.hlsl"); }
internal static void Init() { m_buildHistogram = MyShaders.CreateCs("histogram.hlsl", new[] { new ShaderMacro("NUMTHREADS", 8) }); m_drawHistogram = MyShaders.CreatePs("data_visualization_histogram.hlsl"); m_drawTonemapping = MyShaders.CreatePs("data_visualization_tonemapping.hlsl"); m_histogram = MyRwTextures.CreateUav1D(513, SharpDX.DXGI.Format.R32_UInt, "histogram"); }
internal static void Init() { //m_copyPs = MyShaders.CreatePs("postprocess.hlsl", "copy"); //m_clearAlphaPs = MyShaders.CreatePs("postprocess.hlsl", "clear_alpha"); m_blurH = MyShaders.CreatePs("blur.hlsl", "blur_h", MyShaderHelpers.FormatMacros(MyRender11.ShaderSampleFrequencyDefine())); m_blurV = MyShaders.CreatePs("blur.hlsl", "blur_v"); }
internal static void Init() { m_ps = MyShaders.CreatePs("EnvProbe/ForwardPostprocess.hlsl"); m_atmosphere = MyShaders.CreatePs("EnvProbe/AtmospherePostprocess.hlsl"); m_mipmap = MyShaders.CreateCs("EnvProbe/EnvPrefilteringMipmap.hlsl"); m_prefilter = MyShaders.CreateCs("EnvProbe/EnvPrefiltering.hlsl"); m_blend = MyShaders.CreateCs("EnvProbe/EnvPrefilteringBlend.hlsl"); }
internal unsafe static void Init() { m_vs = MyShaders.CreateVs("line.hlsl"); m_ps = MyShaders.CreatePs("line.hlsl"); m_inputLayout = MyShaders.CreateIL(m_vs.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION3, MyVertexInputComponentType.COLOR4)); m_currentBufferSize = 100000; m_VB = MyHwBuffers.CreateVertexBuffer(m_currentBufferSize, sizeof(MyVertexFormatPositionColor), BindFlags.VertexBuffer, ResourceUsage.Dynamic); }
static void RenderDirectionalEnvironmentLight() { PixelShaderId directionalPixelShader; if (!MyRenderProxy.Settings.EnableShadows) { if (DirectionalEnvironmentLight_NoShadow == PixelShaderId.NULL) { DirectionalEnvironmentLight_NoShadow = MyShaders.CreatePs("light_dir.hlsl", new[] { new ShaderMacro("NO_SHADOWS", null) }); } directionalPixelShader = DirectionalEnvironmentLight_NoShadow; } else { directionalPixelShader = DirectionalEnvironmentLight_Pixel; } MySunlightConstantsLayout constants; constants.Direction = MyEnvironment.DirectionalLightDir; constants.Color = MyEnvironment.DirectionalLightIntensity; var mapping = MyMapping.MapDiscard(m_sunlightConstants); mapping.WriteAndPosition(ref constants); mapping.Unmap(); //context.VertexShader.Set(MyCommon.FullscreenShader.VertexShader); RC.SetPS(directionalPixelShader); RC.SetCB(1, m_sunlightConstants); RC.SetCB(4, MyRender11.DynamicShadows.ShadowCascades.CascadeConstantBuffer); RC.DeviceContext.PixelShader.SetSamplers(0, MyRender11.StandardSamplers); RC.DeviceContext.PixelShader.SetSampler(MyCommon.SHADOW_SAMPLER_SLOT, MyRender11.m_shadowmapSamplerState); RC.DeviceContext.PixelShader.SetShaderResource(MyCommon.SKYBOX_SLOT, MyTextures.GetView(MyTextures.GetTexture(MyEnvironment.DaySkybox, MyTextureEnum.CUBEMAP, true))); RC.DeviceContext.PixelShader.SetShaderResource(MyCommon.SKYBOX_IBL_SLOT, MyRender11.IsIntelBrokenCubemapsWorkaround ? MyTextures.GetView(MyTextures.IntelFallbackCubeTexId) : MyEnvironmentProbe.Instance.cubemapPrefiltered.ShaderView); RC.DeviceContext.PixelShader.SetShaderResource(MyCommon.SKYBOX2_SLOT, MyTextures.GetView(MyTextures.GetTexture(MyEnvironment.NightSkybox, MyTextureEnum.CUBEMAP, true))); RC.DeviceContext.PixelShader.SetShaderResource(MyCommon.SKYBOX2_IBL_SLOT, MyTextures.GetView(MyTextures.GetTexture(MyEnvironment.NightSkyboxPrefiltered, MyTextureEnum.CUBEMAP, true))); RC.DeviceContext.PixelShader.SetShaderResource(MyCommon.CASCADES_SM_SLOT, MyRender11.DynamicShadows.ShadowCascades.CascadeShadowmapArray.ShaderView); RC.DeviceContext.PixelShader.SetShaderResource(MyCommon.SHADOW_SLOT, MyRender11.PostProcessedShadows.ShaderView); RC.DeviceContext.PixelShader.SetShaderResource(MyCommon.AMBIENT_BRDF_LUT_SLOT, MyCommon.GetAmbientBrdfLut()); RC.BindSRV(MyCommon.AO_SLOT, MyScreenDependants.m_ambientOcclusion); MyScreenPass.RunFullscreenPixelFreq(MyGBuffer.Main.Get(MyGbufferSlot.LBuffer)); if (MyRender11.MultisamplingEnabled) { RC.SetPS(DirectionalEnvironmentLight_Sample); MyScreenPass.RunFullscreenSampleFreq(MyGBuffer.Main.Get(MyGbufferSlot.LBuffer)); } }
// inscatter texture // transmittance texture //static RwTexId m_transmittanceLut; //static RwTexId m_inscatterLutR; //static RwTexId m_inscatterLutM; internal static void Init() { m_ps = MyShaders.CreatePs("atmosphere.hlsl"); m_psPerSample = MyShaders.CreatePs("atmosphere.hlsl", MyRender11.ShaderSampleFrequencyDefine()); m_precomputeDensity = MyShaders.CreateCs("AtmospherePrecompute.hlsl"); m_proxyVs = MyShaders.CreateVs("atmosphere.hlsl"); m_proxyIL = MyShaders.CreateIL(m_proxyVs.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION_PACKED)); }
internal static unsafe void Init() { m_ps = MyShaders.CreatePs("EnvProbe/ForwardPostprocess.hlsl"); //m_atmosphere = MyShaders.CreatePs("EnvProbe/AtmospherePostprocess.hlsl"); m_mipmap = MyShaders.CreateCs("EnvProbe/EnvPrefilteringMipmap.hlsl"); m_prefilter = MyShaders.CreateCs("EnvProbe/EnvPrefiltering.hlsl"); m_blend = MyShaders.CreateCs("EnvProbe/EnvPrefilteringBlend.hlsl"); TransformConstants = MyManagers.Buffers.CreateConstantBuffer("TransformConstants", sizeof(Matrix) * 2 + sizeof(Vector4), usage: ResourceUsage.Dynamic); }
//internal static void CreateInputLayout(byte[] bytecode) //{ // m_inputLayout = MyVertexInputLayout.CreateLayout(MyVertexInputLayout.Empty().Append(MyVertexInputComponentType.POSITION3).Append(MyVertexInputComponentType.COLOR4), bytecode); //} internal unsafe static void Init() { m_currentBufferSize = 100000; m_VB = MyHwBuffers.CreateVertexBuffer(m_currentBufferSize, sizeof(MyVertexFormatPositionColor), BindFlags.VertexBuffer, ResourceUsage.Dynamic); m_vs = MyShaders.CreateVs("primitive.hlsl", "vs"); m_ps = MyShaders.CreatePs("primitive.hlsl", "ps"); m_inputLayout = MyShaders.CreateIL(m_vs.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION3, MyVertexInputComponentType.COLOR4)); }
// inscatter texture // transmittance texture //static RwTexId m_transmittanceLut; //static RwTexId m_inscatterLutR; //static RwTexId m_inscatterLutM; internal static void Init() { m_ps = MyShaders.CreatePs("Transparent/Atmosphere/Atmosphere.hlsl"); m_psPerSample = MyShaders.CreatePs("Transparent/Atmosphere/Atmosphere.hlsl", MyRender11.ShaderSampleFrequencyDefine()); m_precomputeDensity = MyShaders.CreateCs("Transparent/Atmosphere/AtmospherePrecompute.hlsl"); m_proxyVs = MyShaders.CreateVs("Transparent/Atmosphere/Atmosphere.hlsl"); m_proxyIL = MyShaders.CreateIL(m_proxyVs.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION_PACKED)); }
internal unsafe static void Init() { m_vs = MyShaders.CreateVs("Primitives/Lines.hlsl"); m_ps = MyShaders.CreatePs("Primitives/Lines.hlsl"); m_inputLayout = MyShaders.CreateIL(m_vs.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION3, MyVertexInputComponentType.COLOR4)); m_currentBufferSize = 100000; m_VB = MyManagers.Buffers.CreateVertexBuffer( "MyLinesRenderer", m_currentBufferSize, sizeof(MyVertexFormatPositionColor), usage: ResourceUsage.Dynamic); }
internal static void Init() { m_vs = MyShaders.CreateVs("decal.hlsl"); var normalMapMacro = new ShaderMacro("USE_NORMALMAP_DECAL", null); var colorMapMacro = new ShaderMacro("USE_COLORMAP_DECAL", null); m_psColorMap = MyShaders.CreatePs("decal.hlsl", new ShaderMacro[] { colorMapMacro, new ShaderMacro("USE_DUAL_SOURCE_BLENDING", null) }); m_psNormalMap = MyShaders.CreatePs("decal.hlsl", new ShaderMacro[] { normalMapMacro }); m_psNormalColorMap = MyShaders.CreatePs("decal.hlsl", new ShaderMacro[] { normalMapMacro, colorMapMacro }); InitIB(); }
internal static void Init() { m_proxyVs = MyShaders.CreateVs("Transparent/Clouds/Clouds.hlsl"); m_cloudPs = MyShaders.CreatePs("Transparent/Clouds/Clouds.hlsl"); m_proxyIL = MyShaders.CreateIL(m_proxyVs.BytecodeId, MyVertexLayouts.GetLayout( new MyVertexInputComponent(MyVertexInputComponentType.POSITION_PACKED, 0), new MyVertexInputComponent(MyVertexInputComponentType.NORMAL, 1), new MyVertexInputComponent(MyVertexInputComponentType.TANGENT_SIGN_OF_BITANGENT, 1), new MyVertexInputComponent(MyVertexInputComponentType.TEXCOORD0_H, 1))); m_fogShader = MyShaders.CreateCs("Transparent/Clouds/Clouds.hlsl", new[] { new ShaderMacro("NUMTHREADS", m_numFogThreads) }); }
private static void InitInternal(Vector2[] vertsForMask) { m_VB = MyHwBuffers.CreateVertexBuffer(vertsForMask.Length, MyVertexFormat2DPosition.STRIDE, BindFlags.VertexBuffer, ResourceUsage.Dynamic, null, "MyStereoStencilMask.VB"); MyMapping mapping = MyMapping.MapDiscard(RC, m_VB.Buffer); mapping.WriteAndPosition(vertsForMask, 0, vertsForMask.Length); mapping.Unmap(); m_vs = MyShaders.CreateVs("Stereo/StereoStencilMask.hlsl"); m_ps = MyShaders.CreatePs("Stereo/StereoStencilMask.hlsl"); m_il = MyShaders.CreateIL(m_vs.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION2)); }
internal static void Init() { MyGPUParticleRenderer.Init(); m_windowsWithDecals = new HashSet<uint>(); if (m_distances == null) m_distances = new float[] { PROXIMITY_DECALS_SQ_TH, 0 }; m_psResolve = MyShaders.CreatePs("Transparent/OIT/Resolve.hlsl"); m_psOverlappingHeatMap = MyShaders.CreatePs("Transparent/ResolveAccumIntoHeatMap.hlsl"); m_psOverlappingHeatMapInGrayscale = MyShaders.CreatePs("Transparent/ResolveAccumIntoHeatMap.hlsl", new ShaderMacro[] { new ShaderMacro("USE_GRAYSCALE", null), }); }
private static void InitInternal(Vector2[] vertsForMask) { m_VB = MyHwBuffers.CreateVertexBuffer(vertsForMask.Length, MyVertexFormat2DPosition.STRIDE, BindFlags.VertexBuffer, ResourceUsage.Dynamic, null, "MyStereoStencilMask.VB"); MyMapping mapping = MyMapping.MapDiscard(RC.DeviceContext, m_VB.Buffer); mapping.WriteAndPosition(vertsForMask, 0, vertsForMask.Length); mapping.Unmap(); m_vs = MyShaders.CreateVs("stereo_stencil_mask.hlsl"); m_ps = MyShaders.CreatePs("stereo_stencil_mask.hlsl"); m_il = MyShaders.CreateIL(m_vs.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION2)); }
static void RenderDirectionalEnvironmentLight(ISrvTexture postProcessedShadows) { PixelShaderId directionalPixelShader; MyShadowsQuality shadowsQuality = MyRender11.RenderSettings.ShadowQuality.GetShadowsQuality(); if (!MyRender11.Settings.EnableShadows || !MyRender11.DebugOverrides.Shadows || shadowsQuality == MyShadowsQuality.DISABLED) { if (DirectionalEnvironmentLight_NoShadow == PixelShaderId.NULL) { DirectionalEnvironmentLight_NoShadow = MyShaders.CreatePs("Lighting/LightDir.hlsl", new[] { new ShaderMacro("NO_SHADOWS", null) }); } directionalPixelShader = DirectionalEnvironmentLight_NoShadow; } else { directionalPixelShader = DirectionalEnvironmentLight_Pixel; } //context.VertexShader.Set(MyCommon.FullscreenShader.VertexShader); RC.PixelShader.Set(directionalPixelShader); RC.AllShaderStages.SetConstantBuffer(4, MyRender11.DynamicShadows.ShadowCascades.CascadeConstantBuffer); RC.PixelShader.SetSampler(MyCommon.SHADOW_SAMPLER_SLOT, MySamplerStateManager.Shadowmap); MyFileTextureManager texManager = MyManagers.FileTextures; RC.PixelShader.SetSrv(MyCommon.SKYBOX_SLOT, texManager.GetTexture(MyRender11.Environment.Data.Skybox, MyFileTextureEnum.CUBEMAP, true)); ISrvBindable skybox = MyRender11.IsIntelBrokenCubemapsWorkaround ? MyGeneratedTextureManager.IntelFallbackCubeTex : (ISrvBindable)MyManagers.EnvironmentProbe.Cubemap; RC.PixelShader.SetSrv(MyCommon.SKYBOX_IBL_SLOT, skybox); RC.PixelShader.SetSrv(MyCommon.CASCADES_SM_SLOT, MyRender11.DynamicShadows.ShadowCascades.CascadeShadowmapArray); RC.PixelShader.SetSrv(MyCommon.SHADOW_SLOT, postProcessedShadows); RC.PixelShader.SetSrv(MyCommon.AMBIENT_BRDF_LUT_SLOT, MyCommon.GetAmbientBrdfLut()); RC.PixelShader.SetSrv(MyCommon.AO_SLOT, MyScreenDependants.m_ambientOcclusion); MyScreenPass.RunFullscreenPixelFreq(MyGBuffer.Main.LBuffer); if (MyRender11.MultisamplingEnabled) { RC.PixelShader.Set(DirectionalEnvironmentLight_Sample); MyScreenPass.RunFullscreenSampleFreq(MyGBuffer.Main.LBuffer); } RC.PixelShader.SetSrv(MyCommon.SHADOW_SLOT, null); }
// inscatter texture // transmittance texture //static RwTexId m_transmittanceLut; //static RwTexId m_inscatterLutR; //static RwTexId m_inscatterLutM; internal static void Init() { m_ps = MyShaders.CreatePs("atmosphere.hlsl", "psAtmosphereInscatter"); m_psT = MyShaders.CreatePs("atmosphere.hlsl", "psAtmosphereTransmittance"); m_psPerSample = MyShaders.CreatePs("atmosphere.hlsl", "psAtmosphereInscatter", MyShaderHelpers.FormatMacros(MyRender11.ShaderSampleFrequencyDefine())); m_psTPerSample = MyShaders.CreatePs("atmosphere.hlsl", "psAtmosphereTransmittance", MyShaderHelpers.FormatMacros(MyRender11.ShaderSampleFrequencyDefine())); m_precomputeDensity = MyShaders.CreateCs("AtmospherePrecompute.hlsl", "precomputeDensity"); m_precomputeInscatter1 = MyShaders.CreateCs("AtmospherePrecompute.hlsl", "precomputeInscatter1"); m_proxyVs = MyShaders.CreateVs("atmosphere.hlsl", "proxyVs"); m_proxyIL = MyShaders.CreateIL(m_proxyVs.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION_PACKED)); //Precompute(); }
private static void InitInternal(Vector2[] vertsForMask) { m_VB = MyManagers.Buffers.CreateVertexBuffer( "MyStereoStencilMask.VB", vertsForMask.Length, MyVertexFormat2DPosition.STRIDE, usage: ResourceUsage.Dynamic); MyMapping mapping = MyMapping.MapDiscard(RC, m_VB); mapping.WriteAndPosition(vertsForMask, vertsForMask.Length); mapping.Unmap(); m_vs = MyShaders.CreateVs("Stereo/StereoStencilMask.hlsl"); m_ps = MyShaders.CreatePs("Stereo/StereoStencilMask.hlsl"); m_il = MyShaders.CreateIL(m_vs.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION2)); }
internal static void Init() { MyGPUParticleRenderer.Init(); m_windowsWithDecals = new HashSet <uint>(); if (m_distances == null) { m_distances = new float[] { PROXIMITY_DECALS_SQ_TH, 0 } } ; m_psResolve = MyShaders.CreatePs("Transparent/OIT/Resolve.hlsl"); m_psOverlappingHeatMap = MyShaders.CreatePs("Transparent/ResolveAccumIntoHeatMap.hlsl"); m_psOverlappingHeatMapInGrayscale = MyShaders.CreatePs("Transparent/ResolveAccumIntoHeatMap.hlsl", new ShaderMacro[] { new ShaderMacro("USE_GRAYSCALE", null), }); }
// inscatter texture // transmittance texture //static RwTexId m_transmittanceLut; //static RwTexId m_inscatterLutR; //static RwTexId m_inscatterLutM; internal static unsafe void Init() { m_ps = MyShaders.CreatePs("Transparent/Atmosphere/AtmosphereGBuffer.hlsl"); m_psPerSample = MyShaders.CreatePs("Transparent/Atmosphere/AtmosphereGBuffer.hlsl", MyRender11.ShaderSampleFrequencyDefine()); m_psEnv = MyShaders.CreatePs("Transparent/Atmosphere/AtmosphereEnv.hlsl"); m_psEnvPerSample = MyShaders.CreatePs("Transparent/Atmosphere/AtmosphereEnv.hlsl", MyRender11.ShaderSampleFrequencyDefine()); m_precomputeDensity = MyShaders.CreateCs("Transparent/Atmosphere/AtmospherePrecompute.hlsl"); m_proxyVs = MyShaders.CreateVs("Transparent/Atmosphere/AtmosphereVS.hlsl"); m_proxyIL = MyShaders.CreateIL(m_proxyVs.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION_PACKED)); m_cb = MyManagers.Buffers.CreateConstantBuffer("CommonObjectCB" + sizeof(AtmosphereConstants), sizeof(AtmosphereConstants), usage: SharpDX.Direct3D11.ResourceUsage.Dynamic); }
internal unsafe static void Init() { m_vs = MyShaders.CreateVs("sprite.hlsl", "vs"); m_ps = MyShaders.CreatePs("sprite.hlsl", "ps"); m_inputLayout = MyShaders.CreateIL(m_vs.BytecodeId, MyVertexLayouts.GetLayout( new MyVertexInputComponent(MyVertexInputComponentType.CUSTOM_HALF4_0, MyVertexInputComponentFreq.PER_INSTANCE), new MyVertexInputComponent(MyVertexInputComponentType.CUSTOM_HALF4_1, MyVertexInputComponentFreq.PER_INSTANCE), new MyVertexInputComponent(MyVertexInputComponentType.CUSTOM_HALF4_2, MyVertexInputComponentFreq.PER_INSTANCE), new MyVertexInputComponent(MyVertexInputComponentType.COLOR4, MyVertexInputComponentFreq.PER_INSTANCE) )); m_currentBufferSize = 100000; m_VB = MyHwBuffers.CreateVertexBuffer(m_currentBufferSize, sizeof(MyVertexFormatSpritePositionTextureRotationColor), BindFlags.VertexBuffer, ResourceUsage.Dynamic); m_contextsStack.Add(new MySpritesContext()); }
unsafe void IManagerDevice.OnDeviceInit() { if (m_markerConstantBuffer == ConstantsBufferId.NULL) m_markerConstantBuffer = MyHwBuffers.CreateConstantsBuffer(sizeof(MyMarkerConstants), "MyPostprocessMarkCascades.MarkerConstantBuffer"); if (m_psMarker == PixelShaderId.NULL) m_psMarker = MyShaders.CreatePs("Shadows\\StencilMarker.hlsl"); if (m_vsMarker == VertexShaderId.NULL) m_vsMarker = MyShaders.CreateVs("Shadows\\StencilMarker.hlsl"); if (m_psDrawCoverage == PixelShaderId.NULL) m_psDrawCoverage = MyShaders.CreatePs("Shadows\\CascadeCoverage.hlsl"); if (m_inputLayout == InputLayoutId.NULL) m_inputLayout = MyShaders.CreateIL(m_vsMarker.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION3)); m_vertexBuffer = CreateVertexBuffer(); m_indexBuffer = CreateIndexBuffer(); }
void IManagerDevice.OnDeviceInit() { if (m_ps == PixelShaderId.NULL) { switch (m_type) { case Type.HARD: m_ps = MyShaders.CreatePs("Shadows\\PostprocessHardShadows.hlsl"); break; case Type.SIMPLE: m_ps = MyShaders.CreatePs("Shadows\\PostprocessSimpleShadows.hlsl"); break; default: MyRenderProxy.Assert(false, "Unknown type of postproces!"); break; } } }
private void InitShaders() { if (m_markVS == VertexShaderId.NULL) m_markVS = MyShaders.CreateVs("ShadowsOld/Shape.hlsl"); if (m_markPS == PixelShaderId.NULL) m_markPS = MyShaders.CreatePs("ShadowsOld/Shape.hlsl"); if (m_inputLayout == InputLayoutId.NULL) m_inputLayout = MyShaders.CreateIL(m_markVS.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION3)); if (m_combinePS == PixelShaderId.NULL) m_combinePS = MyShaders.CreatePs("ShadowsOld/CombineShadows.hlsl"); m_gatherCS_LD = MyShaders.CreateCs("ShadowsOld/Shadows.hlsl"); m_gatherCS_MD = MyShaders.CreateCs("ShadowsOld/Shadows.hlsl", new[] { new ShaderMacro("ENABLE_PCF", null) }); m_gatherCS_HD = MyShaders.CreateCs("ShadowsOld/Shadows.hlsl", new[] { new ShaderMacro("ENABLE_PCF", null), new ShaderMacro("ENABLE_DISTORTION", null) }); }
internal static unsafe void Init() { //MyRender11.RegisterSettingsChangedListener(new OnSettingsChangedDelegate(RecreateShadersForSettings)); DirectionalEnvironmentLight_Pixel = MyShaders.CreatePs("Lighting/LightDir.hlsl"); DirectionalEnvironmentLight_Sample = MyShaders.CreatePs("Lighting/LightDir.hlsl", MyRender11.ShaderSampleFrequencyDefine()); PointlightsTiled_Pixel = MyShaders.CreatePs("Lighting/LightPoint.hlsl"); PointlightsTiled_Sample = MyShaders.CreatePs("Lighting/LightPoint.hlsl", MyRender11.ShaderSampleFrequencyDefine()); m_preparePointLights = MyShaders.CreateCs("Lighting/PrepareLights.hlsl", new[] { new ShaderMacro("NUMTHREADS", TILE_SIZE) }); SpotlightProxyVs = MyShaders.CreateVs("Lighting/LightSpot.hlsl"); SpotlightPs_Pixel = MyShaders.CreatePs("Lighting/LightSpot.hlsl"); SpotlightPs_Sample = MyShaders.CreatePs("Lighting/LightSpot.hlsl", MyRender11.ShaderSampleFrequencyDefine()); SpotlightProxyIL = MyShaders.CreateIL(SpotlightProxyVs.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION_PACKED)); m_pointlightCullHwBuffer = MyHwBuffers.CreateStructuredBuffer(MyRender11Constants.MAX_POINT_LIGHTS, sizeof(MyPointlightConstants), true, null, "MyLightRendering"); }
internal static void Init() { m_proxyVs = MyShaders.CreateVs("clouds.hlsl"); m_cloudPs = MyShaders.CreatePs("clouds.hlsl"); m_proxyIL = MyShaders.CreateIL(m_proxyVs.BytecodeId, MyVertexLayouts.GetLayout( new MyVertexInputComponent(MyVertexInputComponentType.POSITION_PACKED, 0), new MyVertexInputComponent(MyVertexInputComponentType.NORMAL, 1), new MyVertexInputComponent(MyVertexInputComponentType.TANGENT_SIGN_OF_BITANGENT, 1), new MyVertexInputComponent(MyVertexInputComponentType.TEXCOORD0_H, 1))); m_fogShader = MyShaders.CreateCs("clouds.hlsl", new [] {new ShaderMacro("NUMTHREADS", m_numFogThreads)}); SamplerStateDescription description = new SamplerStateDescription { AddressU = TextureAddressMode.Wrap, AddressV = TextureAddressMode.Wrap, AddressW = TextureAddressMode.Wrap, Filter = Filter.MinMagMipLinear, MaximumLod = System.Single.MaxValue }; m_textureSampler = MyPipelineStates.CreateSamplerState(description); }
internal static void RecreateShadersForSettings() { m_ps = MyShaders.CreatePs("Postprocess/SSAO/Ssao.hlsl"); }
internal static void InitPs(PixelShaderId id) { var bytecodeId = PixelShaders.Data[id.Index].Bytecode; Compile(bytecodeId); if (PsObjects[id.Index] != null) { PsObjects[id.Index].Dispose(); PsObjects[id.Index] = null; } try { PsObjects[id.Index] = new PixelShader(MyRender11.Device, GetBytecode(bytecodeId)); } catch (SharpDXException e) { Compile(bytecodeId, true); PsObjects[id.Index] = new PixelShader(MyRender11.Device, GetBytecode(bytecodeId)); } }
internal static PixelShader GetPs(PixelShaderId id) { return PsObjects[id.Index]; }
internal static PixelShaderId CreatePs(string file, string func, string header = "") { var bytecode = CreateBytecode(); var id = new PixelShaderId { Index = PixelShaders.Allocate() }; PixelShaders.Data[id.Index] = new MyShaderInfo { Bytecode = bytecode }; MyArrayHelpers.Reserve(ref PsObjects, id.Index + 1); // compile at once Shaders[bytecode] = new MyShaderCompilationInfo { File = MyStringId.GetOrCompute(file), Function = MyStringId.GetOrCompute(func), Profile = MyShaderProfileEnum.PS_5_0, Header = header, Name = String.Format("ps_[{0}][{1}]{2}", file, func, header != null ? header.Replace(Environment.NewLine, "_") : "") }; PsObjects[id.Index] = null; InitPs(id); PsIndex.Add(id); return id; }
internal unsafe static void Init() { m_vs = MyShaders.CreateVs("billboard.hlsl", "vs"); m_ps = MyShaders.CreatePs("billboard.hlsl", "ps"); m_vsLit = MyShaders.CreateVs("billboard.hlsl", "vs", MyShaderHelpers.FormatMacros("LIT_PARTICLE")); m_psLit = MyShaders.CreatePs("billboard.hlsl", "ps", MyShaderHelpers.FormatMacros("LIT_PARTICLE")); m_inputLayout = MyShaders.CreateIL(m_vs.BytecodeId, MyVertexLayouts.GetLayout(MyVertexInputComponentType.POSITION3, MyVertexInputComponentType.TEXCOORD0_H)); //MyCallbacks.RegisterDeviceResetListener(new OnDeviceResetDelegate(OnDeviceRestart)); InitBillboardsIndexBuffer(MaxBillboards); m_VB = MyHwBuffers.CreateVertexBuffer(MaxBillboards * 4, sizeof(MyVertexFormatPositionTextureH), BindFlags.VertexBuffer, ResourceUsage.Dynamic); var stride = sizeof(MyBillboardData); m_SB = MyHwBuffers.CreateStructuredBuffer(MaxBillboards, stride, true); MyTextureAtlas.ParseAtlasDescription("Textures\\Particles\\", "Textures\\Particles\\ParticlesAtlas.tai", m_atlasedTextures); }
internal static void Init() { m_ps = MyShaders.CreatePs("fxaa.hlsl"); }
internal static void Init() { m_ps = MyShaders.CreatePs("postprocess.hlsl", "copy"); }