public VrmacStateBase(GpuResources resources, IRenderDevice device, ref PipelineStateDesc desc, iPipelineStateFactory stateFactory, eShaderMacros macros) { this.resources = resources; shaderMacros = macros; layoutUniforms(stateFactory); stateFactory.setName($"2D state { macros }"); stateFactory.layoutVariable(ShaderType.Vertex, ShaderResourceVariableType.Mutable, varPaletteTexture); stateFactory.layoutVariable(ShaderType.Pixel, ShaderResourceVariableType.Mutable, varPaletteTexture); if (macros.HasFlag(eShaderMacros.TextureAtlas)) { stateFactory.layoutVariable(ShaderType.Pixel, ShaderResourceVariableType.Mutable, varSpriteAtlas); SamplerDesc samplerDesc = new SamplerDesc(false); stateFactory.layoutStaticSampler(ShaderType.Pixel, ref samplerDesc, varSpriteAtlas); resources.context.drawDevice.textureAtlas.resized.add(this, dropResourceBindings); } if (macros.HasFlag(eShaderMacros.TextRendering)) { stateFactory.layoutVariable(ShaderType.Pixel, ShaderResourceVariableType.Mutable, varGrayscaleFontAtlas); SamplerDesc samplerDesc = new SamplerDesc(false); stateFactory.layoutStaticSampler(ShaderType.Pixel, ref samplerDesc, varGrayscaleFontAtlas); stateFactory.layoutVariable(ShaderType.Pixel, ShaderResourceVariableType.Mutable, varCleartypeFontAtlas); resources.initTextCBuffer(); } declareResources(stateFactory); stateFactory.apply(ref desc); setupDepthState(ref desc, macros); pipelineState = device.CreatePipelineState(ref desc); resources.context.swapChainResized.add(this, (CSize s, double d) => dropResourceBindings()); resources.paletteTexture.textureResized.add(this, dropResourceBindings); }
public FewDrawCallsState(GpuResources res, IRenderDevice device, ref PipelineStateDesc desc, iPipelineStateFactory stateFactory, eShaderMacros macros) : base(res, device, ref desc, stateFactory, macros) { constantBuffer = res.fewDrawCalls; pipelineState.GetStaticVariableByName(ShaderType.Vertex, "DrawCallsCBuffer").Set(constantBuffer); }
public StatesCache(GpuResources resources) { this.resources = resources; }