テクスチャ.RasterizerState = new SharpDX.Direct3D11.RasterizerState( dr.D3DDevice, RSDesc );
//----------------
#endregion
+ #region " サンプラーステート "
+ //----------------
+ var descSampler = new SharpDX.Direct3D11.SamplerStateDescription() {
+ Filter = SharpDX.Direct3D11.Filter.Anisotropic,
+ AddressU = SharpDX.Direct3D11.TextureAddressMode.Wrap,
+ AddressV = SharpDX.Direct3D11.TextureAddressMode.Wrap,
+ AddressW = SharpDX.Direct3D11.TextureAddressMode.Wrap,
+ MipLodBias = 0.0f,
+ MaximumAnisotropy = 2,
+ ComparisonFunction = SharpDX.Direct3D11.Comparison.Never,
+ BorderColor = new SharpDX.Mathematics.Interop.RawColor4( 0f, 0f, 0f, 0f ),
+ MinimumLod = float.MinValue,
+ MaximumLod = float.MaxValue,
+ };
+ テクスチャ.SamplerState = new SharpDX.Direct3D11.SamplerState( dr.D3DDevice, descSampler );
+ //----------------
+ #endregion
}
public static void 共有リソースを解放する()
{
+ テクスチャ.SamplerState?.Dispose();
テクスチャ.RasterizerState?.Dispose();
テクスチャ.BlendState?.Dispose();
テクスチャ.PixelShader?.Dispose();
protected static SharpDX.Direct3D11.PixelShader PixelShader = null;
protected static SharpDX.Direct3D11.BlendState BlendState = null;
protected static SharpDX.Direct3D11.RasterizerState RasterizerState = null;
+ protected static SharpDX.Direct3D11.SamplerState SamplerState = null;
// 個別項目
d3dContext.PixelShader.Set( テクスチャ.PixelShader );
d3dContext.PixelShader.SetConstantBuffers( 0, this.ConstantBuffer );
d3dContext.PixelShader.SetShaderResources( 0, 1, dr.ShaderResourceView );
- d3dContext.PixelShader.SetSamplers( 0, 1, dr.SamplerState );
+ d3dContext.PixelShader.SetSamplers( 0, 1, テクスチャ.SamplerState );
// 出力マージャ
d3dContext.OutputMerger.SetTargets( dr.DepthStencilView, dr.RenderTargetView );
public SharpDX.Direct3D11.DepthStencilView DepthStencilView => this.bs_DepthStencilView;
public SharpDX.Direct3D11.DepthStencilState DepthStencilState => this.bs_DepthStencilState;
public SharpDX.Direct3D11.ShaderResourceView ShaderResourceView => this.bs_ShaderResourceView;
- public SharpDX.Direct3D11.SamplerState SamplerState => this.bs_SamplerState;
protected SharpDX.Size2F ShaderResourceViewSize;
public void すべてのリソースを作成する( System.Drawing.Size バックバッファサイズ, IntPtr ウィンドウハンドル )
//D3DX11CreateShaderResourceViewFromFile( g_pD3DDevice, L"texture.png", NULL, NULL, &g_pTextureSRV, &hr );
//----------------
#endregion
- #region " サンプラー "
- //----------------
- var descSampler = new SharpDX.Direct3D11.SamplerStateDescription() {
- Filter = SharpDX.Direct3D11.Filter.Anisotropic,
- AddressU = SharpDX.Direct3D11.TextureAddressMode.Wrap,
- AddressV = SharpDX.Direct3D11.TextureAddressMode.Wrap,
- AddressW = SharpDX.Direct3D11.TextureAddressMode.Wrap,
- MipLodBias = 0.0f,
- MaximumAnisotropy = 2,
- ComparisonFunction = SharpDX.Direct3D11.Comparison.Never,
- BorderColor = new SharpDX.Mathematics.Interop.RawColor4( 0f, 0f, 0f, 0f ),
- MinimumLod = float.MinValue,
- MaximumLod = float.MaxValue,
- };
- this.bs_SamplerState = new SharpDX.Direct3D11.SamplerState( this.bs_D3DDevice, descSampler );
- //----------------
- #endregion
this.サイズに依存するリソースを作成する();
}
// 取得したインターフェイスの開放
this.bs_DepthStencilState?.Dispose();
- this.bs_SamplerState?.Dispose();
this.bs_ShaderResourceView?.Dispose();
this.bs_SwapChain?.Dispose();
this.bs_D3DDevice?.Dispose();
private SharpDX.Mathematics.Interop.RawViewportF[] bs_ViewPort = new SharpDX.Mathematics.Interop.RawViewportF[ 1 ];
private SharpDX.Direct3D11.DepthStencilState bs_DepthStencilState = null;
private SharpDX.Direct3D11.ShaderResourceView bs_ShaderResourceView = null;
- private SharpDX.Direct3D11.SamplerState bs_SamplerState = null;
private SharpDX.Direct3D11.RenderTargetView bs_RenderTargetView = null;
private SharpDX.Direct3D11.Texture2D bs_DepthStencil = null;
private SharpDX.Direct3D11.DepthStencilView bs_DepthStencilView = null;