diff --git a/WickedEngine/SamplerMapping.h b/WickedEngine/SamplerMapping.h index aa6799cf4..2ef282160 100644 --- a/WickedEngine/SamplerMapping.h +++ b/WickedEngine/SamplerMapping.h @@ -15,9 +15,10 @@ #define SSLOT_ANISO_CLAMP 10 #define SSLOT_ANISO_WRAP 11 #define SSLOT_ANISO_MIRROR 12 -#define SSLOT_SHADOWCOMP 13 +#define SSLOT_CMP_DEPTH 13 #define SSLOT_RESERVED0 14 #define SSLOT_RESERVED1 15 +#define SSLOT_COUNT_PERSISTENT SSLOT_RESERVED1 + 1 - SSLOT_COUNT_ONDEMAND // On demand samplers: // These are bound on demand and alive until another is bound at the same slot @@ -25,6 +26,9 @@ #define SSLOT_ONDEMAND1 1 #define SSLOT_ONDEMAND2 2 #define SSLOT_ONDEMAND3 3 +#define SSLOT_COUNT_ONDEMAND SSLOT_ONDEMAND3 + 1 + +#define SSLOT_COUNT SSLOT_COUNT_PERSISTENT + SSLOT_COUNT_ONDEMAND /////////////////////////// // Helpers: diff --git a/WickedEngine/cubeShadowPS.hlsl b/WickedEngine/cubeShadowPS.hlsl index 2e2a941a2..4c89f8887 100644 --- a/WickedEngine/cubeShadowPS.hlsl +++ b/WickedEngine/cubeShadowPS.hlsl @@ -14,6 +14,6 @@ struct VertextoPixel float main(VertextoPixel PSIn) : SV_DEPTH { [branch]if(g_xMat_hasTex) - clip( xTextureTex.Sample(texSampler,PSIn.tex).a<0.1?-1:1 ); + clip( xTextureTex.Sample(sampler_linear_wrap,PSIn.tex).a<0.1?-1:1 ); return distance(PSIn.pos3D.xyz,lightPos.xyz)/lightEnerdis.y; } \ No newline at end of file diff --git a/WickedEngine/decalPS.hlsl b/WickedEngine/decalPS.hlsl index a0ce2d06f..0b284bc4a 100644 --- a/WickedEngine/decalPS.hlsl +++ b/WickedEngine/decalPS.hlsl @@ -4,7 +4,6 @@ Texture2D xSceneDepthMap:register(t1); Texture2D xTexture:register(t2); Texture2D xNormal:register(t3); -SamplerState texSampler:register(s0); struct VertexToPixel{ float4 pos : SV_POSITION; @@ -48,7 +47,7 @@ PixelOutputType main(VertexToPixel PSIn) if (hasTexNor & 0x0000010){ float3 normal = normalize(cross(ddx(pos3D), ddy(pos3D))); //clip( dot(normal,front)>-0.2?-1:1 ); //clip at oblique angle - float4 nortex=xNormal.Sample(texSampler,projTex.xy); + float4 nortex=xNormal.Sample(sampler_aniso_clamp,projTex.xy); float3 eyevector = normalize( eye - pos3D ); if(nortex.a>0){ float3x3 tangentFrame = compute_tangent_frame(normal, eyevector, -projTex.xy); @@ -60,7 +59,7 @@ PixelOutputType main(VertexToPixel PSIn) Out.nor.xyz=normal; } if(hasTexNor & 0x0000001){ - Out.col=xTexture.Sample(texSampler,projTex.xy); + Out.col=xTexture.Sample(sampler_aniso_clamp,projTex.xy); Out.col.a*=opacity; float3 edgeBlend = clipSpace.xyz; edgeBlend.z = edgeBlend.z * 2 - 1; diff --git a/WickedEngine/deferredPS.hlsl b/WickedEngine/deferredPS.hlsl index 49c62003a..4eef592dc 100644 --- a/WickedEngine/deferredPS.hlsl +++ b/WickedEngine/deferredPS.hlsl @@ -16,9 +16,9 @@ float4 main(VertexToPixelPostProcess PSIn) : SV_TARGET [branch]if(depth xTextureSh[3]:register(t4); -SamplerComparisonState compSampler:register(s1); inline float offset_lookup(Texture2D intex, SamplerComparisonState map, float2 loc, @@ -30,13 +29,13 @@ inline float shadowCascade(float4 shadowPos, float2 ShTex, Texture2D shad for (float y = -range; y <= range; y += 1.0f) for (float x = -range; x <= range; x += 1.0f) { - sum += offset_lookup(shadowTexture, compSampler, ShTex, float2(x, y), scale, realDistance); + sum += offset_lookup(shadowTexture, sampler_cmp_depth, ShTex, float2(x, y), scale, realDistance); samples++; } retVal *= sum / samples; } - else retVal *= offset_lookup(shadowTexture, compSampler, ShTex, float2(0, 0), scale, realDistance); + else retVal *= offset_lookup(shadowTexture, sampler_cmp_depth, ShTex, float2(0, 0), scale, realDistance); return retVal; } diff --git a/WickedEngine/dirLightPS.hlsl b/WickedEngine/dirLightPS.hlsl index 27b2d483e..52703c2c5 100644 --- a/WickedEngine/dirLightPS.hlsl +++ b/WickedEngine/dirLightPS.hlsl @@ -6,20 +6,18 @@ float4 main( VertexToPixel PSIn ) : SV_TARGET { float4 color = float4(g_xDirLight_col.rgb,1); - float2 screenPos; - screenPos.x = PSIn.pos2D.x/PSIn.pos2D.w/2.0f + 0.5f; - screenPos.y = -PSIn.pos2D.y/PSIn.pos2D.w/2.0f + 0.5f; - float depth = depthMap.SampleLevel(Sampler,screenPos,0); + float2 screenPos = float2(1,-1) * PSIn.pos2D.xy / PSIn.pos2D.w / 2.0f + 0.5f; + float depth = depthMap.SampleLevel(sampler_point_clamp,screenPos,0); //clip(depth<1?1:-1); //[branch]if(depth xTextureMat:register(t4); Texture2D xTextureNor:register(t5); Texture2D xTextureSpe:register(t6); -SamplerState texSampler:register(s0); -SamplerState mapSampler:register(s1); - struct PixelOutputType { float4 col : SV_TARGET0; diff --git a/WickedEngine/effectPS.hlsl b/WickedEngine/effectPS.hlsl index 0bafbc835..b225b00bf 100644 --- a/WickedEngine/effectPS.hlsl +++ b/WickedEngine/effectPS.hlsl @@ -25,7 +25,7 @@ PixelOutputType main(PixelInputType PSIn) PSIn.tex *= g_xMat_texMulAdd.xy; PSIn.tex += g_xMat_texMulAdd.zw; [branch]if(g_xMat_hasTex) { - baseColor *= xTextureTex.Sample(texSampler,PSIn.tex); + baseColor *= xTextureTex.Sample(sampler_aniso_wrap,PSIn.tex); } baseColor.rgb *= PSIn.instanceColor; @@ -38,7 +38,7 @@ PixelOutputType main(PixelInputType PSIn) //NORMALMAP float3 bumpColor=0; if(g_xMat_hasNor){ - float4 nortex = xTextureNor.Sample(texSampler,PSIn.tex); + float4 nortex = xTextureNor.Sample(sampler_aniso_wrap,PSIn.tex); if(nortex.a>0){ float3x3 tangentFrame = compute_tangent_frame(normal, eyevector, -PSIn.tex.xy); bumpColor = 2.0f * nortex.rgb - 1.0f; @@ -50,7 +50,7 @@ PixelOutputType main(PixelInputType PSIn) //SPECULAR //if(hasRefNorTexSpe.w){ - spec = lerp(spec,xTextureSpe.Sample(texSampler, PSIn.tex).r, g_xMat_hasSpe); + spec = lerp(spec,xTextureSpe.Sample(sampler_aniso_wrap, PSIn.tex).r, g_xMat_hasSpe); //} @@ -63,7 +63,7 @@ PixelOutputType main(PixelInputType PSIn) enviroTex.GetDimensions(mip,size.x,size.y,mipLevels); float3 ref = normalize(reflect(-eyevector, normal)); - envCol = enviroTex.SampleLevel(texSampler,ref,(1-smoothstep(0,128, g_xMat_specular_power))*mipLevels); + envCol = enviroTex.SampleLevel(sampler_linear_clamp,ref,(1-smoothstep(0,128, g_xMat_specular_power))*mipLevels); baseColor = lerp(baseColor,envCol, g_xMat_metallic*spec); } @@ -74,9 +74,9 @@ PixelOutputType main(PixelInputType PSIn) RefTex.x = PSIn.ReflectionMapSamplingPos.x/PSIn.ReflectionMapSamplingPos.w/2.0f + 0.5f; RefTex.y = -PSIn.ReflectionMapSamplingPos.y/PSIn.ReflectionMapSamplingPos.w/2.0f + 0.5f; float colorMat = 0; - colorMat = xTextureMat.SampleLevel(texSampler,PSIn.tex,0); + colorMat = xTextureMat.SampleLevel(sampler_aniso_wrap,PSIn.tex,0); normal = normalize( lerp(normal,PSIn.nor,pow(abs(colorMat.x),0.02f)) ); - float4 colorReflection = xTextureRef.SampleLevel(mapSampler,RefTex+normal.xz,0); + float4 colorReflection = xTextureRef.SampleLevel(sampler_linear_clamp,RefTex+normal.xz,0); baseColor.rgb=lerp(baseColor.rgb,colorReflection.rgb,colorMat); } diff --git a/WickedEngine/effectPS_blackout.hlsl b/WickedEngine/effectPS_blackout.hlsl index 5b6164982..aeaf9f229 100644 --- a/WickedEngine/effectPS_blackout.hlsl +++ b/WickedEngine/effectPS_blackout.hlsl @@ -10,7 +10,7 @@ float4 main(PixelInputType PSIn) : SV_TARGET //if(mat == matIndex){ if(g_xMat_hasTex) { - baseColor = xTextureTex.Sample(texSampler,PSIn.tex); + baseColor = xTextureTex.Sample(sampler_aniso_wrap,PSIn.tex); /*else if(mat==1) baseColor = xTextureTex1.Sample(texSampler,PSIn.tex); else if(mat==2) baseColor = xTextureTex2.Sample(texSampler,PSIn.tex); else if(mat==3) baseColor = xTextureTex3.Sample(texSampler,PSIn.tex);*/ diff --git a/WickedEngine/effectPS_forwardSimple.hlsl b/WickedEngine/effectPS_forwardSimple.hlsl index 298b21f93..257e3ef4c 100644 --- a/WickedEngine/effectPS_forwardSimple.hlsl +++ b/WickedEngine/effectPS_forwardSimple.hlsl @@ -20,7 +20,7 @@ float4 main(PixelInputType PSIn) : SV_TARGET PSIn.tex += g_xMat_texMulAdd.zw; if (g_xMat_hasTex) { - baseColor *= xTextureTex.Sample(texSampler, PSIn.tex); + baseColor *= xTextureTex.Sample(sampler_aniso_wrap, PSIn.tex); } baseColor.rgb *= PSIn.instanceColor; @@ -36,7 +36,7 @@ float4 main(PixelInputType PSIn) : SV_TARGET //NORMALMAP float3 bumpColor = 0; if (g_xMat_hasNor){ - float4 nortex = xTextureNor.Sample(texSampler, PSIn.tex); + float4 nortex = xTextureNor.Sample(sampler_aniso_wrap, PSIn.tex); if (nortex.a>0){ float3x3 tangentFrame = compute_tangent_frame(normal, eyevector, -PSIn.tex.xy); bumpColor = 2.0f * nortex.rgb - 1.0f; @@ -45,7 +45,7 @@ float4 main(PixelInputType PSIn) : SV_TARGET } } - spec = lerp(spec, xTextureSpe.Sample(texSampler, PSIn.tex).r, g_xMat_hasSpe); + spec = lerp(spec, xTextureSpe.Sample(sampler_aniso_wrap, PSIn.tex).r, g_xMat_hasSpe); //ENVIROMENT MAP float4 envCol = 0; @@ -56,7 +56,7 @@ float4 main(PixelInputType PSIn) : SV_TARGET enviroTex.GetDimensions(mip, size.x, size.y, mipLevels); float3 ref = normalize(reflect(-eyevector, normal)); - envCol = enviroTex.SampleLevel(texSampler, ref, (1 - smoothstep(0, 128, g_xMat_specular_power))*mipLevels); + envCol = enviroTex.SampleLevel(sampler_linear_clamp, ref, (1 - smoothstep(0, 128, g_xMat_specular_power))*mipLevels); baseColor = lerp(baseColor, envCol, g_xMat_metallic*spec); } diff --git a/WickedEngine/effectPS_textureonly.hlsl b/WickedEngine/effectPS_textureonly.hlsl index 3908ed147..7295e2848 100644 --- a/WickedEngine/effectPS_textureonly.hlsl +++ b/WickedEngine/effectPS_textureonly.hlsl @@ -14,7 +14,7 @@ float4 main(PixelInputType PSIn) : SV_TARGET //if(PSIn.mat==matIndex){ if(g_xMat_hasTex) { - baseColor *= xTextureTex.Sample(texSampler,PSIn.tex); + baseColor *= xTextureTex.Sample(sampler_aniso_wrap,PSIn.tex); } baseColor.rgb *= PSIn.instanceColor; //baseColor=pow(baseColor,GAMMA); diff --git a/WickedEngine/effectPS_transparent.hlsl b/WickedEngine/effectPS_transparent.hlsl index 24ea06ff9..471074858 100644 --- a/WickedEngine/effectPS_transparent.hlsl +++ b/WickedEngine/effectPS_transparent.hlsl @@ -18,7 +18,7 @@ float4 main( PixelInputType PSIn) : SV_TARGET PSIn.tex += g_xMat_texMulAdd.zw; [branch]if(g_xMat_hasTex){ - baseColor *= xTextureTex.Sample(texSampler, PSIn.tex); + baseColor *= xTextureTex.Sample(sampler_aniso_wrap, PSIn.tex); //baseColor*=baseColor.a; } baseColor.rgb *= PSIn.instanceColor; @@ -35,7 +35,7 @@ float4 main( PixelInputType PSIn) : SV_TARGET //NORMALMAP float3 bumpColor=0; if(g_xMat_hasNor){ - float4 nortex = xTextureNor.Sample(texSampler,PSIn.tex); + float4 nortex = xTextureNor.Sample(sampler_aniso_wrap,PSIn.tex); if(nortex.a>0){ float3x3 tangentFrame = compute_tangent_frame(normal, eyevector, -PSIn.tex.xy); bumpColor = 2.0f * nortex.rgb - 1.0f; @@ -55,14 +55,14 @@ float4 main( PixelInputType PSIn) : SV_TARGET enviroTex.GetDimensions(mip,size.x,size.y,mipLevels); float3 ref = normalize(reflect(-eyevector, normal)); - envCol = enviroTex.SampleLevel(texSampler,ref,(1-smoothstep(0,128, g_xMat_specular_power))*mipLevels); + envCol = enviroTex.SampleLevel(sampler_linear_clamp,ref,(1-smoothstep(0,128, g_xMat_specular_power))*mipLevels); baseColor = lerp(baseColor,envCol, g_xMat_metallic*spec); } //REFRACTION float2 perturbatedRefrTexCoords = screenPos.xy + (normalize(PSIn.nor2D).rg + bumpColor.rg) * g_xMat_refractionIndex; - float4 refractiveColor = (xTextureRefrac.SampleLevel(mapSampler, perturbatedRefrTexCoords, 0)); + float4 refractiveColor = (xTextureRefrac.SampleLevel(sampler_linear_clamp, perturbatedRefrTexCoords, 0)); baseColor.rgb=lerp(refractiveColor.rgb,baseColor.rgb,baseColor.a); baseColor.rgb=pow(abs(baseColor.rgb),GAMMA); @@ -73,7 +73,7 @@ float4 main( PixelInputType PSIn) : SV_TARGET //SPECULAR if(g_xMat_hasSpe && !g_xMat_shadeless){ - spec = xTextureSpe.Sample(texSampler, PSIn.tex); + spec = xTextureSpe.Sample(sampler_aniso_wrap, PSIn.tex); } /*float3 reflectionVector = reflect(xSun, normal); float specR = dot(normalize(reflectionVector), eyevector); diff --git a/WickedEngine/effectVS10.hlsl b/WickedEngine/effectVS10.hlsl index 0015447e2..5c62c476f 100644 --- a/WickedEngine/effectVS10.hlsl +++ b/WickedEngine/effectVS10.hlsl @@ -2,7 +2,6 @@ #include "effectHF_VS.hlsli" Texture2D noiseTex:register(t0); -SamplerState texSampler:register(s0); PixelInputType main(Input input) { @@ -47,7 +46,7 @@ PixelInputType main(Input input) //VERTEX OFFSET MOTION BLUR //if(xMotionBlur.x){ //float offsetMod = dot(input.nor,vel); - //pos = lerp(pos,posPrev,(offsetMod<0?((1-saturate(offsetMod))*(noiseTex.SampleLevel( texSampler,input.tex.xy,0 ).r)*0.6f):0)); + //pos = lerp(pos,posPrev,(offsetMod<0?((1-saturate(offsetMod))*(noiseTex.SampleLevel( sampler_linear_wrap,input.tex.xy,0 ).r)*0.6f):0)); //} Out.pos = Out.pos2D = mul( pos, g_xCamera_VP ); diff --git a/WickedEngine/fontPS.hlsl b/WickedEngine/fontPS.hlsl index 1c345c325..e0b611d15 100644 --- a/WickedEngine/fontPS.hlsl +++ b/WickedEngine/fontPS.hlsl @@ -1,5 +1,6 @@ +#include "globals.hlsli" + Texture2D xTexture:register (t0); -SamplerState Sampler; struct VertextoPixel { @@ -9,5 +10,5 @@ struct VertextoPixel float4 main(VertextoPixel PSIn) : SV_TARGET { - return xTexture.Sample(Sampler, PSIn.tex); + return xTexture.Sample(sampler_linear_clamp, PSIn.tex); } \ No newline at end of file diff --git a/WickedEngine/globals.hlsli b/WickedEngine/globals.hlsli index b57f29675..fa6be86f1 100644 --- a/WickedEngine/globals.hlsli +++ b/WickedEngine/globals.hlsli @@ -12,7 +12,7 @@ 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 ) +SAMPLERCOMPARISONSTATE( sampler_cmp_depth, SSLOT_CMP_DEPTH ) CBUFFER(WorldCB, CBSLOT_RENDERER_WORLD) { diff --git a/WickedEngine/imageHF.hlsli b/WickedEngine/imageHF.hlsli index 5c2f468aa..8e9393d7a 100644 --- a/WickedEngine/imageHF.hlsli +++ b/WickedEngine/imageHF.hlsli @@ -10,7 +10,7 @@ Texture2D xRefracTexture:register(t4); Texture2D xMaskTex:register(t5); Texture2D xTexture:register(t6); -SamplerState Sampler:register(s0); +SAMPLERSTATE(Sampler, SSLOT_ONDEMAND0); struct VertextoPixel { diff --git a/WickedEngine/lensFlareGS.hlsl b/WickedEngine/lensFlareGS.hlsl index 6b9becf89..3c09ab428 100644 --- a/WickedEngine/lensFlareGS.hlsl +++ b/WickedEngine/lensFlareGS.hlsl @@ -20,7 +20,6 @@ struct VertextoPixel{ Texture2D depth:register(t0); Texture2D flare[7]:register(t1); -SamplerComparisonState compSampler:register(s0); inline void append(inout TriangleStream triStream, VertextoPixel p1, uint selector, float2 posMod, float2 size){ float2 pos = (xSunPos.xy-0.5)*float2(2,-2); @@ -96,7 +95,7 @@ void main(point InVert p[1], inout TriangleStream triStream) for (float y = -range; y <= range; y += 1.0f) for (float x = -range; x <= range; x += 1.0f){ samples+=1.0f; - accdepth += ( depth.SampleCmpLevelZero(compSampler,xSunPos.xy+float2(x,y)/(depthMapSize*xSunPos.z),xSunPos.z).r ) ; + accdepth += ( depth.SampleCmpLevelZero(sampler_cmp_depth,xSunPos.xy+float2(x,y)/(depthMapSize*xSunPos.z),xSunPos.z).r ) ; } accdepth/=samples; diff --git a/WickedEngine/lensFlarePS.hlsl b/WickedEngine/lensFlarePS.hlsl index d9d271947..6367ad1fd 100644 --- a/WickedEngine/lensFlarePS.hlsl +++ b/WickedEngine/lensFlarePS.hlsl @@ -1,3 +1,5 @@ +#include "globals.hlsli" + struct VertextoPixel{ float4 pos : SV_POSITION; float3 texPos : TEXCOORD0; @@ -6,41 +8,33 @@ struct VertextoPixel{ }; Texture2D flare[7]:register(t1); -SamplerState flareSampler:register(s0); float4 main(VertextoPixel PSIn) : SV_TARGET { - //float4 color = flare[0].Sample(flareSampler,PSIn.texPosSel.xy); - //color = lerp(color,flare[1].Sample(flareSampler,PSIn.texPosSel.xy), int(PSIn.texPosSel.w/1)); - //color = lerp(color,flare[2].Sample(flareSampler,PSIn.texPosSel.xy), int(PSIn.texPosSel.w/2)); - //color = lerp(color,flare[3].Sample(flareSampler,PSIn.texPosSel.xy), int(PSIn.texPosSel.w/3)); - //color = lerp(color,flare[4].Sample(flareSampler,PSIn.texPosSel.xy), int(PSIn.texPosSel.w/4)); - //color = lerp(color,flare[5].Sample(flareSampler,PSIn.texPosSel.xy), int(PSIn.texPosSel.w/5)); - //color = lerp(color,flare[6].Sample(flareSampler,PSIn.texPosSel.xy), int(PSIn.texPosSel.w/6)); float4 color=0; [branch] switch(PSIn.sel){ // sad :( case 0: - color=flare[0].SampleLevel(flareSampler,PSIn.texPos.xy,0); + color=flare[0].SampleLevel(sampler_linear_clamp,PSIn.texPos.xy,0); break; case 1: - color=flare[1].SampleLevel(flareSampler,PSIn.texPos.xy,0); + color=flare[1].SampleLevel(sampler_linear_clamp,PSIn.texPos.xy,0); break; case 2: - color=flare[2].SampleLevel(flareSampler,PSIn.texPos.xy,0); + color=flare[2].SampleLevel(sampler_linear_clamp,PSIn.texPos.xy,0); break; case 3: - color=flare[3].SampleLevel(flareSampler,PSIn.texPos.xy,0); + color=flare[3].SampleLevel(sampler_linear_clamp,PSIn.texPos.xy,0); break; case 4: - color=flare[4].SampleLevel(flareSampler,PSIn.texPos.xy,0); + color=flare[4].SampleLevel(sampler_linear_clamp,PSIn.texPos.xy,0); break; case 5: - color=flare[5].SampleLevel(flareSampler,PSIn.texPos.xy,0); + color=flare[5].SampleLevel(sampler_linear_clamp,PSIn.texPos.xy,0); break; case 6: - color=flare[6].SampleLevel(flareSampler,PSIn.texPos.xy,0); + color=flare[6].SampleLevel(sampler_linear_clamp,PSIn.texPos.xy,0); break; default:break; }; diff --git a/WickedEngine/lightHF.hlsli b/WickedEngine/lightHF.hlsli index f1134b4ff..171a4967e 100644 --- a/WickedEngine/lightHF.hlsli +++ b/WickedEngine/lightHF.hlsli @@ -16,7 +16,6 @@ Texture2D depthMap:register(t0); Texture2D normalMap:register(t1); //Texture2D specularMap:register(t2); Texture2D materialMap:register(t2); -SamplerState Sampler:register(s0); static const float specularMaximumIntensity = 1; diff --git a/WickedEngine/pointLightHF.hlsli b/WickedEngine/pointLightHF.hlsli index 780c189a9..8f87761d0 100644 --- a/WickedEngine/pointLightHF.hlsli +++ b/WickedEngine/pointLightHF.hlsli @@ -3,7 +3,6 @@ #include "globals.hlsli" TextureCube xTextureSh:register(t7); -SamplerComparisonState compSampler:register(s1); CBUFFER(PointLightCB, CBSLOT_RENDERER_POINTLIGHT) { @@ -25,7 +24,7 @@ inline float pointLight(in float3 pos3D, in float3 normal, out float3 lightDir, [branch]if(lightEnerdis.w){ const float3 lv = pos3D.xyz-lightPos.xyz; static const float bias = 0.025; - lightint *= xTextureSh.SampleCmpLevelZero(compSampler,lv,length(lv)/lightEnerdis.y-bias ).r; + lightint *= xTextureSh.SampleCmpLevelZero(sampler_cmp_depth,lv,length(lv)/lightEnerdis.y-bias ).r; } return saturate(attenuation*lightint); diff --git a/WickedEngine/pointLightPS.hlsl b/WickedEngine/pointLightPS.hlsl index d828df4b8..45ff56aa7 100644 --- a/WickedEngine/pointLightPS.hlsl +++ b/WickedEngine/pointLightPS.hlsl @@ -5,18 +5,16 @@ float4 main(VertexToPixel PSIn) : SV_TARGET { float4 light = float4(lightColor.rgb,1); - float2 screenPos; - screenPos.x = PSIn.pos2D.x/PSIn.pos2D.w/2.0f + 0.5f; - screenPos.y = -PSIn.pos2D.y/PSIn.pos2D.w/2.0f + 0.5f; - float depth = depthMap.SampleLevel(Sampler,screenPos,0); + float2 screenPos = float2(1,-1) * PSIn.pos2D.xy / PSIn.pos2D.w / 2.0f + 0.5f; + float depth = depthMap.SampleLevel(sampler_point_clamp,screenPos,0); [branch]if(depth depthMap:register(t1); -SamplerState Sampler : register(s0); struct VertextoPixel { @@ -18,16 +17,14 @@ struct VertextoPixel float4 main(VertextoPixel PSIn) : SV_TARGET { - float2 pTex; - pTex.x = PSIn.pp.x/PSIn.pp.w/2.0f +0.5f; - pTex.y = -PSIn.pp.y/PSIn.pp.w/2.0f +0.5f; - float4 depthScene=(depthMap.GatherRed(Sampler,pTex)); + float2 pTex = float2(1,-1) * PSIn.pp.xy / PSIn.pp.w / 2.0f + 0.5f; + float4 depthScene=(depthMap.GatherRed(sampler_linear_clamp,pTex)); float depthFragment=PSIn.pp.z; float fade = saturate(1.0/PSIn.opaAddDarkSiz.w*(max(max(depthScene.x,depthScene.y),max(depthScene.z,depthScene.w))-depthFragment)); //fade = depthScene xTextureTex:register(t0); -SamplerState texSampler:register(s0); struct VertextoPixel { @@ -12,5 +11,5 @@ struct VertextoPixel void main(VertextoPixel PSIn) { [branch]if(g_xMat_hasTex) - clip( xTextureTex.Sample(texSampler,PSIn.tex).a<0.1?-1:1 ); + clip( xTextureTex.Sample(sampler_linear_wrap,PSIn.tex).a<0.1?-1:1 ); } \ No newline at end of file diff --git a/WickedEngine/skyHF.hlsli b/WickedEngine/skyHF.hlsli index f06ee5675..05c366235 100644 --- a/WickedEngine/skyHF.hlsli +++ b/WickedEngine/skyHF.hlsli @@ -9,7 +9,7 @@ inline float4 GetSkyColor(in float3 normal) normal = normalize(normal) * overBright; - float3 col = /*lerp( xHorizon.rgb,*/ enviroTex.SampleLevel(texSampler, normal, 0).rgb/*, saturate(nor.y/0.3f) )*/; + float3 col = /*lerp( xHorizon.rgb,*/ enviroTex.SampleLevel(sampler_linear_clamp, normal, 0).rgb/*, saturate(nor.y/0.3f) )*/; float3 sun = max(pow(abs(dot(g_xWorld_SunDir.xyz, normal)), 256)*g_xWorld_SunColor.rgb, 0); return float4(col + sun, 1); diff --git a/WickedEngine/skyPS.hlsl b/WickedEngine/skyPS.hlsl index 9d77e9309..3e4180a90 100644 --- a/WickedEngine/skyPS.hlsl +++ b/WickedEngine/skyPS.hlsl @@ -16,11 +16,8 @@ struct PSOut{ PSOut main(VSOut PSIn) { - float2 ScreenCoord, ScreenCoordPrev; - ScreenCoord.x = PSIn.pos2D.x / PSIn.pos2D.w / 2.0f + 0.5f; - ScreenCoord.y = -PSIn.pos2D.y / PSIn.pos2D.w / 2.0f + 0.5f; - ScreenCoordPrev.x = PSIn.pos2DPrev.x / PSIn.pos2DPrev.w / 2.0f + 0.5f; - ScreenCoordPrev.y = -PSIn.pos2DPrev.y / PSIn.pos2DPrev.w / 2.0f + 0.5f; + float2 ScreenCoord = float2(1, -1) * PSIn.pos2D.xy / PSIn.pos2D.w / 2.0f + 0.5f; + float2 ScreenCoordPrev = float2(1, -1) * PSIn.pos2DPrev.xy / PSIn.pos2DPrev.w / 2.0f + 0.5f; float2 vel = ScreenCoord - ScreenCoordPrev; PSOut Out = (PSOut)0; diff --git a/WickedEngine/spotLightHF.hlsli b/WickedEngine/spotLightHF.hlsli index 9e040c634..e6ce3d8d0 100644 --- a/WickedEngine/spotLightHF.hlsli +++ b/WickedEngine/spotLightHF.hlsli @@ -1,5 +1,4 @@ Texture2D xTextureSh:register(t4); -SamplerComparisonState compSampler:register(s1); CBUFFER(SpotLightCB, CBSLOT_RENDERER_SPOTLIGHT) @@ -27,7 +26,7 @@ inline float shadowCascade(float4 shadowPos, float2 ShTex, Texture2D shad float sum = 0; float scale = xBiasResSoftshadow.y; float retVal = 1; - retVal *= offset_lookup(shadowTexture, compSampler, ShTex, float2(0, 0), scale, realDistance); + retVal *= offset_lookup(shadowTexture, sampler_cmp_depth, ShTex, float2(0, 0), scale, realDistance); return retVal; } diff --git a/WickedEngine/spotLightPS.hlsl b/WickedEngine/spotLightPS.hlsl index 18e8d8322..894400644 100644 --- a/WickedEngine/spotLightPS.hlsl +++ b/WickedEngine/spotLightPS.hlsl @@ -5,10 +5,8 @@ float4 main(VertexToPixel PSIn) : SV_TARGET { float4 light = float4(lightColor.rgb,1); - float2 screenPos; - screenPos.x = PSIn.pos2D.x/PSIn.pos2D.w/2.0f + 0.5f; - screenPos.y = -PSIn.pos2D.y/PSIn.pos2D.w/2.0f + 0.5f; - float depth = depthMap.SampleLevel(Sampler,screenPos,0); + float2 screenPos = float2(1,-1) * PSIn.pos2D.xy / PSIn.pos2D.w / 2.0f + 0.5f; + float depth = depthMap.SampleLevel(sampler_point_clamp,screenPos,0); //clip(depth<1?1:-1); @@ -16,11 +14,11 @@ float4 main(VertexToPixel PSIn) : SV_TARGET [branch]if(depth xRefracTexture:register(t0); Texture2D xDistortionTexture:register(t1); Texture2D xTexture:register(t2); -SamplerState xSampler:register(s0); struct VertexToPixel{ float4 pos : SV_POSITION; @@ -17,7 +18,7 @@ float4 main(VertexToPixel PSIn) : SV_TARGET float blendOut = 1 - pow(max(co.x,co.y), 2); blendOut *= PSIn.col.a; - float4 tex = xTexture.Sample(xSampler,PSIn.tex); + float4 tex = xTexture.Sample(sampler_linear_mirror,PSIn.tex); tex.a *= blendOut; float4 color = float4(PSIn.col.rgb * blendOut,1); @@ -25,15 +26,15 @@ float4 main(VertexToPixel PSIn) : SV_TARGET float2 distortionCo; distortionCo.x = PSIn.dis.x/PSIn.dis.w/2.0f + 0.5f; distortionCo.y = -PSIn.dis.y/PSIn.dis.w/2.0f + 0.5f; - float2 distort = (xDistortionTexture.Sample(xSampler,PSIn.tex).rg - float2(0.5f, 0.5f))*0.3f * blendOut; + float2 distort = (xDistortionTexture.Sample(sampler_linear_mirror,PSIn.tex).rg - float2(0.5f, 0.5f))*0.3f * blendOut; // Chromatic Aberration float2 dim; xRefracTexture.GetDimensions(dim.x, dim.y); dim = 4.0f / dim * blendOut; - color.r += xRefracTexture.SampleLevel(xSampler, distortionCo + distort + dim * float2(1, 1), 0).r; - color.g += xRefracTexture.SampleLevel(xSampler, distortionCo + distort + dim * float2(-1, 1), 0).g; - color.b += xRefracTexture.SampleLevel(xSampler, distortionCo + distort + dim * float2(0, -1), 0).b; + color.r += xRefracTexture.SampleLevel(sampler_linear_mirror, distortionCo + distort + dim * float2(1, 1), 0).r; + color.g += xRefracTexture.SampleLevel(sampler_linear_mirror, distortionCo + distort + dim * float2(-1, 1), 0).g; + color.b += xRefracTexture.SampleLevel(sampler_linear_mirror, distortionCo + distort + dim * float2(0, -1), 0).b; color.rgb = lerp(color.rgb, tex.rgb, tex.a); diff --git a/WickedEngine/waterPS.hlsl b/WickedEngine/waterPS.hlsl index f76042f50..7ce123189 100644 --- a/WickedEngine/waterPS.hlsl +++ b/WickedEngine/waterPS.hlsl @@ -33,9 +33,9 @@ float4 main( PixelInputType PSIn) : SV_TARGET float3 bumpColor=0; if(g_xMat_hasNor){ float3x3 tangentFrame = compute_tangent_frame(normal, eyevector, -PSIn.tex); - bumpColor0 = 2.0f * xTextureNor.Sample(texSampler,PSIn.tex - g_xMat_texMulAdd.ww).rg - 1.0f; - bumpColor1 = 2.0f * xTextureNor.Sample(texSampler,PSIn.tex + g_xMat_texMulAdd.zw).rg - 1.0f; - bumpColor2 = xRippleMap.Sample(texSampler,screenPos).rg; + bumpColor0 = 2.0f * xTextureNor.Sample(sampler_aniso_wrap,PSIn.tex - g_xMat_texMulAdd.ww).rg - 1.0f; + bumpColor1 = 2.0f * xTextureNor.Sample(sampler_aniso_wrap,PSIn.tex + g_xMat_texMulAdd.zw).rg - 1.0f; + bumpColor2 = xRippleMap.Sample(sampler_aniso_wrap,screenPos).rg; bumpColor= float3( bumpColor0+bumpColor1+bumpColor2,1 ) * g_xMat_refractionIndex; normal = normalize(mul(normalize(bumpColor), tangentFrame)); //normal = (bumpColor.x * PSIn.tan) + (bumpColor.y * PSIn.bin) + (bumpColor.z * PSIn.nor); @@ -51,15 +51,15 @@ float4 main( PixelInputType PSIn) : SV_TARGET float2 RefTex; RefTex.x = PSIn.ReflectionMapSamplingPos.x/PSIn.ReflectionMapSamplingPos.w/2.0f + 0.5f; RefTex.y = -PSIn.ReflectionMapSamplingPos.y/PSIn.ReflectionMapSamplingPos.w/2.0f + 0.5f; - float4 reflectiveColor = xTextureRef.SampleLevel(mapSampler,RefTex+bumpColor.rg,0); + float4 reflectiveColor = xTextureRef.SampleLevel(sampler_linear_mirror,RefTex+bumpColor.rg,0); //reflectiveColor.rgb = lerp(skyColor, reflectiveColor.rgb, reflectiveColor.a); //REFRACTION float2 perturbatedRefrTexCoords = screenPos.xy + bumpColor.rg; float depth = PSIn.pos2D.z; - float refDepth = (xDepthMap.Sample(mapSampler, screenPos)); - float3 refractiveColor = xTextureRefrac.SampleLevel(mapSampler, perturbatedRefrTexCoords, 0).rgb; + float refDepth = (xDepthMap.Sample(sampler_linear_mirror, screenPos)); + float3 refractiveColor = xTextureRefrac.SampleLevel(sampler_linear_mirror, perturbatedRefrTexCoords, 0).rgb; float eyeDot = dot(normal, eyevector); float mod = saturate(0.05*(refDepth-depth)); float3 dullColor = lerp(refractiveColor, g_xMat_diffuseColor.rgb, saturate(eyeDot)); @@ -83,7 +83,7 @@ float4 main( PixelInputType PSIn) : SV_TARGET //SPECULAR if(g_xMat_hasSpe){ - spec = xTextureSpe.Sample(texSampler, PSIn.tex); + spec = xTextureSpe.Sample(sampler_aniso_wrap, PSIn.tex); } /*float3 reflectionVector = reflect(xSun, normal); float specR = dot(normalize(reflectionVector), eyevector); diff --git a/WickedEngine/wiFont.cpp b/WickedEngine/wiFont.cpp index 7efe45048..172d4e40e 100644 --- a/WickedEngine/wiFont.cpp +++ b/WickedEngine/wiFont.cpp @@ -11,7 +11,6 @@ VertexShader wiFont::vertexShader; PixelShader wiFont::pixelShader; BlendState wiFont::blendState; BufferResource wiFont::constantBuffer; -Sampler wiFont::sampleState; RasterizerState wiFont::rasterizerState; DepthStencilState wiFont::depthStencilState; vector wiFont::vertexList; @@ -39,32 +38,12 @@ void wiFont::Initialize() pixelShader=NULL; blendState=NULL; constantBuffer=NULL; - sampleState=NULL; rasterizerState=NULL; depthStencilState=NULL; } void wiFont::SetUpStates() { - D3D11_SAMPLER_DESC samplerDesc; - samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; - samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_MIRROR; - samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_MIRROR; - samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_MIRROR; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 0; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - wiRenderer::graphicsDevice->CreateSamplerState(&samplerDesc, &sampleState); - - - - D3D11_RASTERIZER_DESC rs; rs.FillMode=D3D11_FILL_SOLID; rs.CullMode=D3D11_CULL_BACK; @@ -173,7 +152,6 @@ void wiFont::CleanUpStatic() if(pixelShader) pixelShader->Release(); pixelShader=NULL; if(vertexLayout) vertexLayout->Release(); vertexLayout=NULL; if(constantBuffer) constantBuffer->Release(); constantBuffer=NULL; - if(sampleState) sampleState->Release(); sampleState=NULL; if(rasterizerState) rasterizerState->Release(); rasterizerState=NULL; if(blendState) blendState->Release(); blendState=NULL; if(depthStencilState) depthStencilState->Release(); depthStencilState=NULL; @@ -311,7 +289,6 @@ void wiFont::Draw(DeviceContext context){ wiRenderer::BindIndexBuffer(indexBuffer,context); wiRenderer::BindTexturePS(fontStyles[style].texture,0,context); - wiRenderer::BindSamplerPS(sampleState,0,context); wiRenderer::DrawIndexed(text.length()*6,context); } } diff --git a/WickedEngine/wiFont.h b/WickedEngine/wiFont.h index 1f07cbe35..9eae393a7 100644 --- a/WickedEngine/wiFont.h +++ b/WickedEngine/wiFont.h @@ -60,7 +60,6 @@ protected: static PixelShader pixelShader; static BlendState blendState; static BufferResource constantBuffer; - static Sampler sampleState; static RasterizerState rasterizerState; static DepthStencilState depthStencilState; diff --git a/WickedEngine/wiImage.cpp b/WickedEngine/wiImage.cpp index 526d85185..4d4f542d6 100644 --- a/WickedEngine/wiImage.cpp +++ b/WickedEngine/wiImage.cpp @@ -4,6 +4,7 @@ #include "wiImageEffects.h" #include "wiLoader.h" #include "wiHelper.h" +#include "SamplerMapping.h" #pragma region STATICS BlendState wiImage::blendState, wiImage::blendStateAdd, wiImage::blendStateNoBlend, wiImage::blendStateAvg; @@ -401,28 +402,28 @@ void wiImage::Draw(TextureView texture, const wiImageEffects& effects,DeviceCont wiRenderer::BindBlendState(blendStateAvg,context); if(effects.quality==QUALITY_NEAREST){ - if(effects.sampleFlag==SAMPLEMODE_MIRROR) - wiRenderer::BindSamplerPS(wiRenderer::ssMirrorPoi,0,context); - else if(effects.sampleFlag==SAMPLEMODE_WRAP) - wiRenderer::BindSamplerPS(wiRenderer::ssWrapPoi,0,context); - else if(effects.sampleFlag==SAMPLEMODE_CLAMP) - wiRenderer::BindSamplerPS(wiRenderer::ssClampPoi,0,context); + if (effects.sampleFlag == SAMPLEMODE_MIRROR) + wiRenderer::BindSamplerPS(wiRenderer::samplers[SSLOT_POINT_MIRROR], SSLOT_ONDEMAND0, context); + else if (effects.sampleFlag == SAMPLEMODE_WRAP) + wiRenderer::BindSamplerPS(wiRenderer::samplers[SSLOT_POINT_WRAP], SSLOT_ONDEMAND0, context); + else if (effects.sampleFlag == SAMPLEMODE_CLAMP) + wiRenderer::BindSamplerPS(wiRenderer::samplers[SSLOT_POINT_CLAMP], SSLOT_ONDEMAND0, context); } else if(effects.quality==QUALITY_BILINEAR){ - if(effects.sampleFlag==SAMPLEMODE_MIRROR) - wiRenderer::BindSamplerPS(wiRenderer::ssMirrorLin,0,context); - else if(effects.sampleFlag==SAMPLEMODE_WRAP) - wiRenderer::BindSamplerPS(wiRenderer::ssWrapLin,0,context); - else if(effects.sampleFlag==SAMPLEMODE_CLAMP) - wiRenderer::BindSamplerPS(wiRenderer::ssClampLin,0,context); + if (effects.sampleFlag == SAMPLEMODE_MIRROR) + wiRenderer::BindSamplerPS(wiRenderer::samplers[SSLOT_LINEAR_MIRROR], SSLOT_ONDEMAND0, context); + else if (effects.sampleFlag == SAMPLEMODE_WRAP) + wiRenderer::BindSamplerPS(wiRenderer::samplers[SSLOT_LINEAR_WRAP], SSLOT_ONDEMAND0, context); + else if (effects.sampleFlag == SAMPLEMODE_CLAMP) + wiRenderer::BindSamplerPS(wiRenderer::samplers[SSLOT_LINEAR_CLAMP], SSLOT_ONDEMAND0, context); } else if(effects.quality==QUALITY_ANISOTROPIC){ - if(effects.sampleFlag==SAMPLEMODE_MIRROR) - wiRenderer::BindSamplerPS(wiRenderer::ssMirrorAni,0,context); - else if(effects.sampleFlag==SAMPLEMODE_WRAP) - wiRenderer::BindSamplerPS(wiRenderer::ssWrapAni,0,context); - else if(effects.sampleFlag==SAMPLEMODE_CLAMP) - wiRenderer::BindSamplerPS(wiRenderer::ssClampAni,0,context); + if (effects.sampleFlag == SAMPLEMODE_MIRROR) + wiRenderer::BindSamplerPS(wiRenderer::samplers[SSLOT_ANISO_MIRROR], SSLOT_ONDEMAND0, context); + else if (effects.sampleFlag == SAMPLEMODE_WRAP) + wiRenderer::BindSamplerPS(wiRenderer::samplers[SSLOT_ANISO_WRAP], SSLOT_ONDEMAND0, context); + else if (effects.sampleFlag == SAMPLEMODE_CLAMP) + wiRenderer::BindSamplerPS(wiRenderer::samplers[SSLOT_ANISO_CLAMP], SSLOT_ONDEMAND0, context); } @@ -451,7 +452,7 @@ void wiImage::DrawDeferred(TextureView texture wiRenderer::BindTexturePS(ao,8,context); - wiRenderer::BindSamplerPS(wiRenderer::ssClampLin,0,context); + //wiRenderer::BindSamplerPS(wiRenderer::ssClampLin,0,context); wiRenderer::BindBlendState(blendStateNoBlend,context); diff --git a/WickedEngine/wiLensFlare.cpp b/WickedEngine/wiLensFlare.cpp index 14b1adbc6..7495868a2 100644 --- a/WickedEngine/wiLensFlare.cpp +++ b/WickedEngine/wiLensFlare.cpp @@ -8,7 +8,6 @@ PixelShader wiLensFlare::pixelShader; GeometryShader wiLensFlare::geometryShader; VertexShader wiLensFlare::vertexShader; VertexLayout wiLensFlare::inputLayout; -Sampler wiLensFlare::samplerState; RasterizerState wiLensFlare::rasterizerState; DepthStencilState wiLensFlare::depthStencilState; BlendState wiLensFlare::blendState; @@ -26,7 +25,6 @@ void wiLensFlare::CleanUp(){ if(constantBuffer) constantBuffer->Release(); constantBuffer = NULL; - if(samplerState) samplerState->Release(); samplerState = NULL; if(rasterizerState) rasterizerState->Release(); rasterizerState = NULL; if(blendState) blendState->Release(); blendState = NULL; if(depthStencilState) depthStencilState->Release(); depthStencilState = NULL; @@ -56,9 +54,6 @@ void wiLensFlare::Draw(TextureView depthMap, DeviceContext context, const XMVECT wiRenderer::BindTextureGS(depthMap,0,context); - wiRenderer::BindSamplerPS(wiRenderer::ssClampLin,0,context); - wiRenderer::BindSamplerGS(samplerState,0,context); - int i=0; for(TextureView x : rims){ if(x!=nullptr){ @@ -108,26 +103,6 @@ void wiLensFlare::SetUpCB() } void wiLensFlare::SetUpStates() { - D3D11_SAMPLER_DESC samplerDesc; - ZeroMemory( &samplerDesc, sizeof(D3D11_SAMPLER_DESC) ); - samplerDesc.Filter = D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT; - samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 16; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - wiRenderer::graphicsDevice->CreateSamplerState(&samplerDesc, &samplerState); - - - - D3D11_RASTERIZER_DESC rs; rs.FillMode=D3D11_FILL_SOLID; rs.CullMode=D3D11_CULL_NONE; diff --git a/WickedEngine/wiLensFlare.h b/WickedEngine/wiLensFlare.h index 7b9ac30c5..5c41bbe94 100644 --- a/WickedEngine/wiLensFlare.h +++ b/WickedEngine/wiLensFlare.h @@ -11,7 +11,6 @@ private: static GeometryShader geometryShader; static VertexShader vertexShader; static VertexLayout inputLayout; - static Sampler samplerState; static RasterizerState rasterizerState; static DepthStencilState depthStencilState; static BlendState blendState; diff --git a/WickedEngine/wiRenderer.cpp b/WickedEngine/wiRenderer.cpp index a1e373454..0d36971cf 100644 --- a/WickedEngine/wiRenderer.cpp +++ b/WickedEngine/wiRenderer.cpp @@ -33,8 +33,7 @@ bool wiRenderer::DX11 = false,wiRenderer::VSYNC=true,wiRenderer::DEFERREDCONTEXT DeviceContext wiRenderer::deferredContexts[]; CommandList wiRenderer::commandLists[]; mutex wiRenderer::graphicsMutex; -Sampler wiRenderer::ssClampLin,wiRenderer::ssClampPoi,wiRenderer::ssMirrorLin,wiRenderer::ssMirrorPoi,wiRenderer::ssWrapLin,wiRenderer::ssWrapPoi - ,wiRenderer::ssClampAni,wiRenderer::ssWrapAni,wiRenderer::ssMirrorAni,wiRenderer::ssComp; +Sampler wiRenderer::samplers[SSLOT_COUNT_PERSISTENT]; map wiRenderer::drawCalls; BufferResource wiRenderer::constantBuffers[CBTYPE_LAST]; @@ -53,8 +52,6 @@ bool wiRenderer::HAIRPARTICLEENABLED=true,wiRenderer::EMITTERSENABLED=true; bool wiRenderer::wireRender = false, wiRenderer::debugSpheres = false, wiRenderer::debugBoneLines = false, wiRenderer::debugBoxes = false; BlendState wiRenderer::blendState, wiRenderer::blendStateTransparent, wiRenderer::blendStateAdd; -Sampler wiRenderer::texSampler, wiRenderer::mapSampler, wiRenderer::comparisonSampler, wiRenderer::mirSampler,wiRenderer::pointSampler; -Sampler wiRenderer::skySampler; TextureView wiRenderer::enviroMap,wiRenderer::colorGrading; float wiRenderer::GameSpeed=1,wiRenderer::overrideGameSpeed=1; int wiRenderer::visibleCount; @@ -338,12 +335,6 @@ void wiRenderer::CleanUp() void wiRenderer::SetUpStaticComponents() { - texSampler = NULL; - mapSampler = NULL; - comparisonSampler = NULL; - mirSampler = NULL; - - for (int i = 0; i < CBTYPE_LAST; ++i) { SafeInit(constantBuffers[i]); @@ -380,6 +371,10 @@ void wiRenderer::SetUpStaticComponents() { SafeInit(vertexLayouts[i]); } + for (int i = 0; i < SSLOT_COUNT_PERSISTENT; ++i) + { + SafeInit(samplers[i]); + } //thread t1(LoadBasicShaders); //thread t2(LoadShadowShaders); @@ -460,21 +455,11 @@ void wiRenderer::SetUpStaticComponents() } void wiRenderer::CleanUpStatic() { - - if(texSampler) texSampler->Release(); texSampler=NULL; - if(mapSampler) mapSampler->Release(); mapSampler=NULL; - if(pointSampler) pointSampler->Release(); pointSampler=NULL; - if(comparisonSampler) comparisonSampler->Release(); comparisonSampler=NULL; - if(mirSampler) mirSampler->Release(); mirSampler=NULL; - if(blendState) blendState->Release(); blendState=NULL; if(blendStateTransparent) blendStateTransparent->Release(); blendStateTransparent=NULL; if(blendStateAdd) blendStateAdd->Release(); blendStateAdd=NULL; - if(skySampler) skySampler->Release(); skySampler=NULL; - - wiHairParticle::CleanUpStatic(); wiEmittedParticle::CleanUpStatic(); Cube::CleanUpStatic(); @@ -517,6 +502,10 @@ void wiRenderer::CleanUpStatic() { SafeRelease(vertexLayouts[i]); } + for (int i = 0; i < SSLOT_COUNT_PERSISTENT; ++i) + { + SafeRelease(samplers[i]); + } if (physicsEngine) physicsEngine->CleanUp(); } @@ -1027,175 +1016,56 @@ void wiRenderer::SetUpStates() samplerDesc.BorderColor[3] = 0; samplerDesc.MinLOD = 0; samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &ssMirrorLin); + graphicsDevice->CreateSamplerState(&samplerDesc, &samplers[SSLOT_LINEAR_MIRROR]); + + samplerDesc.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; + samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; + samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; + samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; + graphicsDevice->CreateSamplerState(&samplerDesc, &samplers[SSLOT_LINEAR_CLAMP]); + + samplerDesc.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; + samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; + samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; + samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; + graphicsDevice->CreateSamplerState(&samplerDesc, &samplers[SSLOT_LINEAR_WRAP]); samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_MIRROR; samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_MIRROR; samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_MIRROR; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 0; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &ssMirrorPoi); - - samplerDesc.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; - samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; - samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; - samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 0; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &ssWrapLin); + graphicsDevice->CreateSamplerState(&samplerDesc, &samplers[SSLOT_POINT_MIRROR]); samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 0; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &ssWrapPoi); + graphicsDevice->CreateSamplerState(&samplerDesc, &samplers[SSLOT_POINT_WRAP]); - samplerDesc.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; - samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 0; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &ssClampLin); samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 0; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &ssClampPoi); + graphicsDevice->CreateSamplerState(&samplerDesc, &samplers[SSLOT_POINT_CLAMP]); samplerDesc.Filter = D3D11_FILTER_ANISOTROPIC; samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 4; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &ssClampAni); + graphicsDevice->CreateSamplerState(&samplerDesc, &samplers[SSLOT_ANISO_CLAMP]); samplerDesc.Filter = D3D11_FILTER_ANISOTROPIC; samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 4; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &ssWrapAni); + graphicsDevice->CreateSamplerState(&samplerDesc, &samplers[SSLOT_ANISO_WRAP]); samplerDesc.Filter = D3D11_FILTER_ANISOTROPIC; samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_MIRROR; samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_MIRROR; samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_MIRROR; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 4; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &ssMirrorAni); - - samplerDesc.Filter = D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT; - samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 16; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &ssComp); - - - - samplerDesc.Filter = D3D11_FILTER_ANISOTROPIC; - samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP; - samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP; - samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 16; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &texSampler); - - ZeroMemory( &samplerDesc, sizeof(D3D11_SAMPLER_DESC) ); - samplerDesc.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; - samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 16; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &mapSampler); + graphicsDevice->CreateSamplerState(&samplerDesc, &samplers[SSLOT_ANISO_MIRROR]); ZeroMemory( &samplerDesc, sizeof(D3D11_SAMPLER_DESC) ); samplerDesc.Filter = D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT; @@ -1205,59 +1075,21 @@ void wiRenderer::SetUpStates() samplerDesc.MipLODBias = 0.0f; samplerDesc.MaxAnisotropy = 16; samplerDesc.ComparisonFunc = D3D11_COMPARISON_LESS_EQUAL; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &comparisonSampler); - - samplerDesc.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; - samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_MIRROR; - samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_MIRROR; - samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_MIRROR; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 16; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &mirSampler); - - samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT; - samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 0; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &pointSampler); - - samplerDesc.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; - samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP; - samplerDesc.MipLODBias = 0.0f; - samplerDesc.MaxAnisotropy = 0; - samplerDesc.ComparisonFunc = D3D11_COMPARISON_NEVER; - samplerDesc.BorderColor[0] = 0; - samplerDesc.BorderColor[1] = 0; - samplerDesc.BorderColor[2] = 0; - samplerDesc.BorderColor[3] = 0; - samplerDesc.MinLOD = 0; - samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; - graphicsDevice->CreateSamplerState(&samplerDesc, &skySampler); + graphicsDevice->CreateSamplerState(&samplerDesc, &samplers[SSLOT_CMP_DEPTH]); + Lock(); + { + for (int i = 0; i < SSLOT_COUNT_PERSISTENT; ++i) + { + int slot = i + SSLOT_COUNT_ONDEMAND; + BindSamplerPS(samplers[i], slot, immediateContext); + BindSamplerVS(samplers[i], slot, immediateContext); + BindSamplerGS(samplers[i], slot, immediateContext); + BindSamplerDS(samplers[i], slot, immediateContext); + BindSamplerHS(samplers[i], slot, immediateContext); + } + } + Unlock(); D3D11_RASTERIZER_DESC rs; rs.FillMode=D3D11_FILL_SOLID; @@ -1284,6 +1116,7 @@ void wiRenderer::SetUpStates() rs.MultisampleEnable=false; rs.AntialiasedLineEnable=false; graphicsDevice->CreateRasterizerState(&rs,&rasterizers[RSTYPE_SHADOW]); + rs.FillMode=D3D11_FILL_SOLID; rs.CullMode=D3D11_CULL_NONE; rs.FrontCounterClockwise=true; @@ -1307,7 +1140,6 @@ void wiRenderer::SetUpStates() rs.MultisampleEnable=false; rs.AntialiasedLineEnable=false; graphicsDevice->CreateRasterizerState(&rs,&rasterizers[RSTYPE_WIRE]); - rs.FillMode=D3D11_FILL_SOLID; rs.CullMode=D3D11_CULL_NONE; @@ -1939,7 +1771,6 @@ void wiRenderer::DrawTrails(DeviceContext context, TextureView refracRes){ BindVS(vertexShaders[VSTYPE_TRAIL],context); BindTexturePS(refracRes,0,context); - BindSamplerPS(mirSampler,0,context); for (Object* o : objectsWithTrails) { @@ -2064,8 +1895,6 @@ void wiRenderer::DrawLights(Camera* camera, DeviceContext context BindTexturePS(depth,0,context); BindTexturePS(normal,1,context); BindTexturePS(material,2,context); - BindSamplerPS(pointSampler,0,context); - BindSamplerPS(comparisonSampler,1,context); BindBlendState(blendStateAdd,context); @@ -2329,7 +2158,6 @@ void wiRenderer::DrawForShadowMap(DeviceContext context) BindBlendState(blendState, context); BindPS(pixelShaders[PSTYPE_SHADOW], context); - BindSamplerPS(texSampler, 0, context); BindVS(vertexShaders[VSTYPE_SHADOW], context); @@ -2753,11 +2581,6 @@ void wiRenderer::DrawWorld(Camera* camera, bool DX11Eff, int tessF, DeviceContex else return; - if(DX11Eff && tessF) - BindSamplerDS(texSampler,0,context); - BindSamplerPS(texSampler,0,context); - BindSamplerPS(mapSampler,1,context); - BindBlendState(blendState,context); @@ -2877,8 +2700,6 @@ void wiRenderer::DrawWorldTransparent(Camera* camera, TextureView refracRes, Tex BindVertexLayout(vertexLayouts[VLTYPE_EFFECT],context); BindVS(vertexShaders[VSTYPE_EFFECT10],context); - BindSamplerPS(texSampler,0,context); - BindSamplerPS(mapSampler,1,context); if (!wireRender) { @@ -3014,7 +2835,6 @@ void wiRenderer::DrawSky(DeviceContext context, bool isReflection) } BindTexturePS(enviroMap,0,context); - BindSamplerPS(skySampler,0,context); BindVertexBuffer(nullptr,0,0,context); BindVertexLayout(nullptr, context); @@ -3050,7 +2870,6 @@ void wiRenderer::DrawDecals(Camera* camera, DeviceContext context, TextureView d } BindTexturePS(depth, 1, context); - BindSamplerPS(ssClampAni, 0, context); BindVS(vertexShaders[VSTYPE_DECAL], context); BindPS(pixelShaders[PSTYPE_DECAL], context); BindRasterizerState(rasterizers[RSTYPE_BACK], context); diff --git a/WickedEngine/wiRenderer.h b/WickedEngine/wiRenderer.h index 34c81f89b..5c43632d3 100644 --- a/WickedEngine/wiRenderer.h +++ b/WickedEngine/wiRenderer.h @@ -3,6 +3,7 @@ #include "wiEnums.h" #include "wiGraphicsAPI.h" #include "skinningDEF.h" +#include "SamplerMapping.h" struct Transform; struct Vertex; @@ -80,8 +81,7 @@ public: inline static void Lock(){ graphicsMutex.lock(); } inline static void Unlock(){ graphicsMutex.unlock(); } - static Sampler ssClampLin,ssClampPoi,ssMirrorLin,ssMirrorPoi,ssWrapLin,ssWrapPoi - ,ssClampAni,ssWrapAni,ssMirrorAni,ssComp; + static Sampler samplers[SSLOT_COUNT_PERSISTENT]; static int SCREENWIDTH,SCREENHEIGHT; @@ -294,12 +294,10 @@ protected: - static bool wireRender, debugSpheres, debugBoneLines, debugBoxes; + static bool wireRender, debugSpheres, debugBoneLines, debugBoxes; - static BlendState blendState, blendStateTransparent, blendStateAdd; - static Sampler texSampler, mapSampler, comparisonSampler, mirSampler, pointSampler; - static Sampler skySampler; + static BlendState blendState, blendStateTransparent, blendStateAdd; static TextureView enviroMap,colorGrading; static void LoadBuffers(); static void LoadBasicShaders();