public void Dispose() { if (texture != null) { texture.Dispose(); texture = null; } if (texture2 != null) { texture2.Dispose(); texture2 = null; } if (constantBuffer != null) { constantBuffer.Dispose(); constantBuffer = null; } if (vertexBuffer != null) { vertexBuffer.Dispose(); vertexBuffer = null; } if (renderState != null) { renderState.Dispose(); renderState = null; } if (shaderEffect != null) { shaderEffect.Dispose(); shaderEffect = null; } if (renderPass != null) { renderPass.Dispose(); renderPass = null; } if (commandList != null) { commandList.Dispose(); commandList = null; } if (device != null) { device.Dispose(); device = null; } if (instance != null) { instance.Dispose(); instance = null; } }