diff --git a/WickedEngine/ConstantBufferMapping.h b/WickedEngine/ConstantBufferMapping.h
index b544da817..1321e421c 100644
--- a/WickedEngine/ConstantBufferMapping.h
+++ b/WickedEngine/ConstantBufferMapping.h
@@ -23,7 +23,7 @@
// On demand buffers:
-// These are bound on demand and alive for undefined time
+// These are bound on demand and alive until another is bound at the same slot
#define CBSLOT_RENDERER_CUBEMAPRENDER 11
#define CBSLOT_RENDERER_POINTLIGHT 12
#define CBSLOT_RENDERER_SPOTLIGHT 13
@@ -56,7 +56,7 @@
// Shader:
//////////
-// Automatically binds constantbuffers in the shader side:
+// Automatically binds constantbuffers on the shader side:
// Needs macro expansion
#define CBUFFER_X(name, slot) cbuffer name : register(b ## slot)
#define CBUFFER(name, slot) CBUFFER_X(name, slot)
diff --git a/WickedEngine/SamplerMapping.h b/WickedEngine/SamplerMapping.h
new file mode 100644
index 000000000..aa6799cf4
--- /dev/null
+++ b/WickedEngine/SamplerMapping.h
@@ -0,0 +1,43 @@
+#ifndef _SAMPLER_MAPPING_H_
+#define _SAMPLER_MAPPING_H_
+
+// Slot matchings:
+////////////////////////////////////////////////////
+
+// Persistent samplers
+// These are bound once and are alive forever
+#define SSLOT_LINEAR_CLAMP 4
+#define SSLOT_LINEAR_WRAP 5
+#define SSLOT_LINEAR_MIRROR 6
+#define SSLOT_POINT_CLAMP 7
+#define SSLOT_POINT_WRAP 8
+#define SSLOT_POINT_MIRROR 9
+#define SSLOT_ANISO_CLAMP 10
+#define SSLOT_ANISO_WRAP 11
+#define SSLOT_ANISO_MIRROR 12
+#define SSLOT_SHADOWCOMP 13
+#define SSLOT_RESERVED0 14
+#define SSLOT_RESERVED1 15
+
+// On demand samplers:
+// These are bound on demand and alive until another is bound at the same slot
+#define SSLOT_ONDEMAND0 0
+#define SSLOT_ONDEMAND1 1
+#define SSLOT_ONDEMAND2 2
+#define SSLOT_ONDEMAND3 3
+
+///////////////////////////
+// Helpers:
+///////////////////////////
+
+// Shader:
+//////////
+
+// Automatically binds samplers on the shader side:
+// Needs macro expansion
+#define SAMPLERSTATE_X(name, slot) SamplerState name : register(s ## slot);
+#define SAMPLERSTATE(name, slot) SAMPLERSTATE_X(name, slot)
+#define SAMPLERCOMPARISONSTATE_X(name, slot) SamplerComparisonState name : register(s ## slot);
+#define SAMPLERCOMPARISONSTATE(name, slot) SAMPLERCOMPARISONSTATE_X(name, slot)
+
+#endif // _SAMPLER_MAPPING_H_
diff --git a/WickedEngine/WickedEngine.vcxproj b/WickedEngine/WickedEngine.vcxproj
index 4872199d1..f3b50b122 100644
--- a/WickedEngine/WickedEngine.vcxproj
+++ b/WickedEngine/WickedEngine.vcxproj
@@ -502,6 +502,7 @@
+
@@ -858,7 +859,6 @@
-
diff --git a/WickedEngine/WickedEngine.vcxproj.filters b/WickedEngine/WickedEngine.vcxproj.filters
index a06bc6d06..6ce4ee597 100644
--- a/WickedEngine/WickedEngine.vcxproj.filters
+++ b/WickedEngine/WickedEngine.vcxproj.filters
@@ -1789,6 +1789,9 @@
Header Files
+
+ Header Files
+
@@ -1870,9 +1873,6 @@
shaders\headers
-
- shaders\headers
-
shaders\headers
diff --git a/WickedEngine/globals.hlsli b/WickedEngine/globals.hlsli
index 4889610cf..b57f29675 100644
--- a/WickedEngine/globals.hlsli
+++ b/WickedEngine/globals.hlsli
@@ -1,6 +1,18 @@
#ifndef _SHADERDEF_CONSTANTBUFFERS_
#define _SHADERDEF_CONSTANTBUFFERS_
#include "ConstantBufferMapping.h"
+#include "SamplerMapping.h"
+
+SAMPLERSTATE( sampler_linear_clamp, SSLOT_LINEAR_CLAMP )
+SAMPLERSTATE( sampler_linear_wrap, SSLOT_LINEAR_WRAP )
+SAMPLERSTATE( sampler_linear_mirror, SSLOT_LINEAR_MIRROR )
+SAMPLERSTATE( sampler_point_clamp, SSLOT_POINT_CLAMP )
+SAMPLERSTATE( sampler_point_wrap, SSLOT_POINT_WRAP )
+SAMPLERSTATE( sampler_point_mirror, SSLOT_POINT_MIRROR )
+SAMPLERSTATE( sampler_aniso_clamp, SSLOT_ANISO_CLAMP )
+SAMPLERSTATE( sampler_aniso_wrap, SSLOT_ANISO_WRAP )
+SAMPLERSTATE( sampler_aniso_mirror, SSLOT_ANISO_MIRROR )
+SAMPLERCOMPARISONSTATE( sampler_shadow_cmp, SSLOT_SHADOWCOMP )
CBUFFER(WorldCB, CBSLOT_RENDERER_WORLD)
{
diff --git a/WickedEngine/samplersHF.hlsli b/WickedEngine/samplersHF.hlsli
deleted file mode 100644
index 17a1c6ff2..000000000
--- a/WickedEngine/samplersHF.hlsli
+++ /dev/null
@@ -1,10 +0,0 @@
-SamplerState sampler_linear_clamp :register(s0);
-SamplerState sampler_linear_wrap :register(s1);
-SamplerState sampler_linear_mirror :register(s2);
-SamplerState sampler_point_clamp :register(s3);
-SamplerState sampler_point_wrap :register(s4);
-SamplerState sampler_point_mirror :register(s5);
-SamplerState sampler_aniso_clamp :register(s6);
-SamplerState sampler_aniso_wrap :register(s7);
-SamplerState sampler_aniso_mirror :register(s8);
-SamplerState sampler_cmp :register(s9);
\ No newline at end of file
diff --git a/WickedEngine/wiRenderer.h b/WickedEngine/wiRenderer.h
index 2d205d0d8..34c81f89b 100644
--- a/WickedEngine/wiRenderer.h
+++ b/WickedEngine/wiRenderer.h
@@ -661,11 +661,6 @@ public:
resource = nullptr;
}
- //static void UpdatePerWorldCB(DeviceContext context);
- //static void UpdatePerFrameCB(DeviceContext context);
- //static void UpdatePerRenderCB(DeviceContext context, int tessF);
- //static void UpdatePerViewCB(DeviceContext context, Camera* camera, Camera* refCamera, const XMFLOAT4& newClipPlane = XMFLOAT4(0,0,0,0));
- //static void UpdatePerEffectCB(DeviceContext context, const XMFLOAT4& blackoutBlackWhiteInvCol, const XMFLOAT4 colorMask);
static void UpdateWorldCB(DeviceContext context);
static void UpdateFrameCB(DeviceContext context);
static void UpdateCameraCB(DeviceContext context);
@@ -675,7 +670,6 @@ public:
static void DrawSun(DeviceContext context);
static void DrawWorld(Camera* camera, bool DX11Eff, int tessF, DeviceContext context
, bool BlackOut, bool isReflection, SHADERTYPE shaded, TextureView refRes, bool grass, GRAPHICSTHREAD thread);
- //static void DrawForSO(DeviceContext context);
static void ClearShadowMaps(DeviceContext context);
static void DrawForShadowMap(DeviceContext context);
static void DrawWorldTransparent(Camera* camera, TextureView refracRes, TextureView refRes
@@ -736,7 +730,6 @@ public:
string DIRECTORY;
-
struct Picked
{
Object* object;