瀏覽代碼

Merge back D3D9 & D3D11 shaders using macros. Removed the "custom" constant buffer slot; rather allow to prevent the default material CB from being defined.

Lasse Öörni 10 年之前
父節點
當前提交
e919935abd

+ 1 - 1
Source/Urho3D/Graphics/Direct3D11/D3D11Graphics.cpp

@@ -245,7 +245,7 @@ Graphics::Graphics(Context* context) :
     maxScratchBufferRequest_(0),
     maxScratchBufferRequest_(0),
     defaultTextureFilterMode_(FILTER_TRILINEAR),
     defaultTextureFilterMode_(FILTER_TRILINEAR),
     shaderProgram_(0),
     shaderProgram_(0),
-    shaderPath_("Shaders/HLSL4/"),
+    shaderPath_("Shaders/HLSL/"),
     shaderExtension_(".hlsl"),
     shaderExtension_(".hlsl"),
     orientations_("LandscapeLeft LandscapeRight"),
     orientations_("LandscapeLeft LandscapeRight"),
     apiName_("D3D11")
     apiName_("D3D11")

+ 0 - 1
Source/Urho3D/Graphics/GraphicsDefs.h

@@ -227,7 +227,6 @@ enum ShaderParameterGroup
     SP_LIGHT,
     SP_LIGHT,
     SP_MATERIAL,
     SP_MATERIAL,
     SP_OBJECT,
     SP_OBJECT,
-    SP_CUSTOM,
     MAX_SHADER_PARAMETER_GROUPS
     MAX_SHADER_PARAMETER_GROUPS
 };
 };
 
 

+ 1 - 1
bin/CoreData/Shaders/GLSL/DeferredLight.glsl

@@ -79,7 +79,7 @@ void PS()
 
 
     #if defined(SPOTLIGHT)
     #if defined(SPOTLIGHT)
         vec4 spotPos = projWorldPos * cLightMatricesPS[0];
         vec4 spotPos = projWorldPos * cLightMatricesPS[0];
-        lightColor = spotPos.w > 0.0 ? texture2DProj(sLightSpotMap, spotPos).rgb * cLightColor.rgb : vec3(0.0);
+        lightColor = spotPos.w > 0.0 ? texture2DProj(sLightSpotMap, spotPos).rrr * cLightColor.rgb : vec3(0.0);
     #elif defined(CUBEMASK)
     #elif defined(CUBEMASK)
         mat3 lightVecRot = mat3(cLightMatricesPS[0][0].xyz, cLightMatricesPS[0][1].xyz, cLightMatricesPS[0][2].xyz);
         mat3 lightVecRot = mat3(cLightMatricesPS[0][0].xyz, cLightMatricesPS[0][1].xyz, cLightMatricesPS[0][2].xyz);
         lightColor = textureCube(sLightCubeMap, (worldPos - cLightPosPS.xyz) * lightVecRot).rgb * cLightColor.rgb;
         lightColor = textureCube(sLightCubeMap, (worldPos - cLightPosPS.xyz) * lightVecRot).rgb * cLightColor.rgb;

+ 1 - 1
bin/CoreData/Shaders/GLSL/LitSolid.glsl

@@ -142,7 +142,7 @@ void PS()
         #endif
         #endif
     
     
         #if defined(SPOTLIGHT)
         #if defined(SPOTLIGHT)
-            lightColor = vSpotPos.w > 0.0 ? texture2DProj(sLightSpotMap, vSpotPos).rgb * cLightColor.rgb : vec3(0.0, 0.0, 0.0);
+            lightColor = vSpotPos.w > 0.0 ? texture2DProj(sLightSpotMap, vSpotPos).rrr * cLightColor.rgb : vec3(0.0, 0.0, 0.0);
         #elif defined(CUBEMASK)
         #elif defined(CUBEMASK)
             lightColor = textureCube(sLightCubeMap, vCubeMaskVec).rgb * cLightColor.rgb;
             lightColor = textureCube(sLightCubeMap, vCubeMaskVec).rgb * cLightColor.rgb;
         #else
         #else

+ 1 - 1
bin/CoreData/Shaders/GLSL/PrepassLight.glsl

@@ -77,7 +77,7 @@ void PS()
     
     
     #if defined(SPOTLIGHT)
     #if defined(SPOTLIGHT)
         vec4 spotPos = projWorldPos * cLightMatricesPS[0];
         vec4 spotPos = projWorldPos * cLightMatricesPS[0];
-        lightColor = spotPos.w > 0.0 ? texture2DProj(sLightSpotMap, spotPos).rgb * cLightColor.rgb : vec3(0.0);
+        lightColor = spotPos.w > 0.0 ? texture2DProj(sLightSpotMap, spotPos).rrr * cLightColor.rgb : vec3(0.0);
     #elif defined(CUBEMASK)
     #elif defined(CUBEMASK)
         mat3 lightVecRot = mat3(cLightMatricesPS[0][0].xyz, cLightMatricesPS[0][1].xyz, cLightMatricesPS[0][2].xyz);
         mat3 lightVecRot = mat3(cLightMatricesPS[0][0].xyz, cLightMatricesPS[0][1].xyz, cLightMatricesPS[0][2].xyz);
         lightColor = textureCube(sLightCubeMap, (worldPos - cLightPosPS.xyz) * lightVecRot).rgb * cLightColor.rgb;
         lightColor = textureCube(sLightCubeMap, (worldPos - cLightPosPS.xyz) * lightVecRot).rgb * cLightColor.rgb;

+ 1 - 1
bin/CoreData/Shaders/GLSL/TerrainBlend.glsl

@@ -137,7 +137,7 @@ void PS()
         #endif
         #endif
     
     
         #if defined(SPOTLIGHT)
         #if defined(SPOTLIGHT)
-            lightColor = vSpotPos.w > 0.0 ? texture2DProj(sLightSpotMap, vSpotPos).rgb * cLightColor.rgb : vec3(0.0, 0.0, 0.0);
+            lightColor = vSpotPos.w > 0.0 ? texture2DProj(sLightSpotMap, vSpotPos).rrr * cLightColor.rgb : vec3(0.0, 0.0, 0.0);
         #elif defined(CUBEMASK)
         #elif defined(CUBEMASK)
             lightColor = textureCube(sLightCubeMap, vCubeMaskVec).rgb * cLightColor.rgb;
             lightColor = textureCube(sLightCubeMap, vCubeMaskVec).rgb * cLightColor.rgb;
         #else
         #else

+ 4 - 4
bin/CoreData/Shaders/HLSL/Basic.hlsl

@@ -23,7 +23,7 @@ void VS(float4 iPos : POSITION,
     #ifdef DIFFMAP
     #ifdef DIFFMAP
         out float2 oTexCoord : TEXCOORD0,
         out float2 oTexCoord : TEXCOORD0,
     #endif
     #endif
-    out float4 oPos : POSITION)
+    out float4 oPos : OUTPOSITION)
 {
 {
     float4x3 modelMatrix = iModelMatrix;
     float4x3 modelMatrix = iModelMatrix;
     float3 worldPos = GetWorldPos(modelMatrix);
     float3 worldPos = GetWorldPos(modelMatrix);
@@ -44,7 +44,7 @@ void PS(
     #if defined(DIFFMAP) || defined(ALPHAMAP)
     #if defined(DIFFMAP) || defined(ALPHAMAP)
         float2 iTexCoord : TEXCOORD0,
         float2 iTexCoord : TEXCOORD0,
     #endif
     #endif
-    out float4 oColor : COLOR0)
+    out float4 oColor : OUTCOLOR0)
 {
 {
     float4 diffColor = cMatDiffColor;
     float4 diffColor = cMatDiffColor;
 
 
@@ -56,7 +56,7 @@ void PS(
         oColor = diffColor;
         oColor = diffColor;
     #endif
     #endif
     #ifdef DIFFMAP
     #ifdef DIFFMAP
-        float4 diffInput = tex2D(sDiffMap, iTexCoord);
+        float4 diffInput = Sample2D(DiffMap, iTexCoord);
         #ifdef ALPHAMASK
         #ifdef ALPHAMASK
             if (diffInput.a < 0.5)
             if (diffInput.a < 0.5)
                 discard;
                 discard;
@@ -64,7 +64,7 @@ void PS(
         oColor = diffColor * diffInput;
         oColor = diffColor * diffInput;
     #endif
     #endif
     #ifdef ALPHAMAP
     #ifdef ALPHAMAP
-        float alphaInput = tex2D(sDiffMap, iTexCoord).a;
+        float alphaInput = Sample2D(DiffMap, iTexCoord).a;
         oColor = float4(diffColor.rgb, diffColor.a * alphaInput);
         oColor = float4(diffColor.rgb, diffColor.a * alphaInput);
     #endif
     #endif
 }
 }

+ 1 - 1
bin/CoreData/Shaders/HLSL/DeferredLight.hlsl

@@ -86,7 +86,7 @@ void PS(
 
 
     #if defined(SPOTLIGHT)
     #if defined(SPOTLIGHT)
         float4 spotPos = mul(projWorldPos, cLightMatricesPS[0]);
         float4 spotPos = mul(projWorldPos, cLightMatricesPS[0]);
-        lightColor = spotPos.w > 0.0 ? tex2Dproj(sLightSpotMap, spotPos).rgb * cLightColor.rgb : 0.0;
+        lightColor = spotPos.w > 0.0 ? tex2Dproj(sLightSpotMap, spotPos).rrr * cLightColor.rgb : 0.0;
     #elif defined(CUBEMASK)
     #elif defined(CUBEMASK)
         lightColor = texCUBE(sLightCubeMap, mul(worldPos - cLightPosPS.xyz, (float3x3)cLightMatricesPS[0])).rgb * cLightColor.rgb;
         lightColor = texCUBE(sLightCubeMap, mul(worldPos - cLightPosPS.xyz, (float3x3)cLightMatricesPS[0])).rgb * cLightColor.rgb;
     #else
     #else

+ 3 - 3
bin/CoreData/Shaders/HLSL/Lighting.hlsl

@@ -97,7 +97,7 @@ float GetDiffuse(float3 normal, float3 worldPos, out float3 lightDir)
         float3 lightVec = (cLightPosPS.xyz - worldPos) * cLightPosPS.w;
         float3 lightVec = (cLightPosPS.xyz - worldPos) * cLightPosPS.w;
         float lightDist = length(lightVec);
         float lightDist = length(lightVec);
         lightDir = lightVec / lightDist;
         lightDir = lightVec / lightDist;
-        return saturate(dot(normal, lightDir)) * tex1D(sLightRampMap, lightDist).r;
+        return saturate(dot(normal, lightDir)) * Sample2D(LightRampMap, float2(lightDist, 0.0)).r;
     #endif
     #endif
 }
 }
 
 
@@ -108,14 +108,14 @@ float GetDiffuseVolumetric(float3 worldPos)
     #else
     #else
         float3 lightVec = (cLightPosPS.xyz - worldPos) * cLightPosPS.w;
         float3 lightVec = (cLightPosPS.xyz - worldPos) * cLightPosPS.w;
         float lightDist = length(lightVec);
         float lightDist = length(lightVec);
-        return tex1D(sLightRampMap, lightDist).r;
+        return Sample2D(LightRampMap, float2(lightDist, 0.0)).r;
     #endif
     #endif
 }
 }
 
 
 float GetSpecular(float3 normal, float3 eyeVec, float3 lightDir, float specularPower)
 float GetSpecular(float3 normal, float3 eyeVec, float3 lightDir, float specularPower)
 {
 {
     float3 halfVec = normalize(normalize(eyeVec) + lightDir);
     float3 halfVec = normalize(normalize(eyeVec) + lightDir);
-    return pow(dot(normal, halfVec), specularPower);
+    return saturate(pow(dot(normal, halfVec), specularPower));
 }
 }
 
 
 float GetIntensity(float3 color)
 float GetIntensity(float3 color)

+ 7 - 5
bin/CoreData/Shaders/HLSL/LitParticle.hlsl

@@ -5,7 +5,9 @@
 #include "Fog.hlsl"
 #include "Fog.hlsl"
 
 
 void VS(float4 iPos : POSITION,
 void VS(float4 iPos : POSITION,
-    float3 iNormal : NORMAL,
+    #ifndef BILLBOARD
+        float3 iNormal : NORMAL,
+    #endif
     float2 iTexCoord : TEXCOORD0,
     float2 iTexCoord : TEXCOORD0,
     #ifdef VERTEXCOLOR
     #ifdef VERTEXCOLOR
         float4 iColor : COLOR0,
         float4 iColor : COLOR0,
@@ -38,7 +40,7 @@ void VS(float4 iPos : POSITION,
     #ifdef VERTEXCOLOR
     #ifdef VERTEXCOLOR
         out float4 oColor : COLOR0,
         out float4 oColor : COLOR0,
     #endif
     #endif
-    out float4 oPos : POSITION)
+    out float4 oPos : OUTPOSITION)
 {
 {
     float4x3 modelMatrix = iModelMatrix;
     float4x3 modelMatrix = iModelMatrix;
     float3 worldPos = GetWorldPos(modelMatrix);
     float3 worldPos = GetWorldPos(modelMatrix);
@@ -96,11 +98,11 @@ void PS(float2 iTexCoord : TEXCOORD0,
     #ifdef VERTEXCOLOR
     #ifdef VERTEXCOLOR
         float4 iColor : COLOR0,
         float4 iColor : COLOR0,
     #endif
     #endif
-    out float4 oColor : COLOR0)
+    out float4 oColor : OUTCOLOR0)
 {
 {
     // Get material diffuse albedo
     // Get material diffuse albedo
     #ifdef DIFFMAP
     #ifdef DIFFMAP
-        float4 diffInput = tex2D(sDiffMap, iTexCoord);
+        float4 diffInput = Sample2D(DiffMap, iTexCoord);
         #ifdef ALPHAMASK
         #ifdef ALPHAMASK
             if (diffInput.a < 0.5)
             if (diffInput.a < 0.5)
                 discard;
                 discard;
@@ -133,7 +135,7 @@ void PS(float2 iTexCoord : TEXCOORD0,
         #endif
         #endif
 
 
         #if defined(SPOTLIGHT)
         #if defined(SPOTLIGHT)
-            lightColor = iSpotPos.w > 0.0 ? tex2Dproj(sLightSpotMap, iSpotPos).rgb * cLightColor.rgb : 0.0;
+            lightColor = iSpotPos.w > 0.0 ? Sample2DProj(LightSpotMap, iSpotPos).rrr * cLightColor.rgb : 0.0;
         #elif defined(CUBEMASK)
         #elif defined(CUBEMASK)
             lightColor = texCUBE(sLightCubeMap, iCubeMaskVec).rgb * cLightColor.rgb;
             lightColor = texCUBE(sLightCubeMap, iCubeMaskVec).rgb * cLightColor.rgb;
         #else
         #else

+ 23 - 21
bin/CoreData/Shaders/HLSL/LitSolid.hlsl

@@ -6,7 +6,9 @@
 #include "Fog.hlsl"
 #include "Fog.hlsl"
 
 
 void VS(float4 iPos : POSITION,
 void VS(float4 iPos : POSITION,
-    float3 iNormal : NORMAL,
+    #ifndef BILLBOARD
+        float3 iNormal : NORMAL,
+    #endif
     float2 iTexCoord : TEXCOORD0,
     float2 iTexCoord : TEXCOORD0,
     #if defined(LIGHTMAP) || defined(AO)
     #if defined(LIGHTMAP) || defined(AO)
         float2 iTexCoord2 : TEXCOORD1,
         float2 iTexCoord2 : TEXCOORD1,
@@ -52,7 +54,7 @@ void VS(float4 iPos : POSITION,
             out float2 oTexCoord2 : TEXCOORD7,
             out float2 oTexCoord2 : TEXCOORD7,
         #endif
         #endif
     #endif
     #endif
-    out float4 oPos : POSITION)
+    out float4 oPos : OUTPOSITION)
 {
 {
     float4x3 modelMatrix = iModelMatrix;
     float4x3 modelMatrix = iModelMatrix;
     float3 worldPos = GetWorldPos(modelMatrix);
     float3 worldPos = GetWorldPos(modelMatrix);
@@ -140,18 +142,18 @@ void PS(
         #endif
         #endif
     #endif
     #endif
     #ifdef PREPASS
     #ifdef PREPASS
-        out float4 oDepth : COLOR1,
+        out float4 oDepth : OUTCOLOR1,
     #endif
     #endif
     #ifdef DEFERRED
     #ifdef DEFERRED
-        out float4 oAlbedo : COLOR1,
-        out float4 oNormal : COLOR2,
-        out float4 oDepth : COLOR3,
+        out float4 oAlbedo : OUTCOLOR1,
+        out float4 oNormal : OUTCOLOR2,
+        out float4 oDepth : OUTCOLOR3,
     #endif
     #endif
-    out float4 oColor : COLOR0)
+    out float4 oColor : OUTCOLOR0)
 {
 {
     // Get material diffuse albedo
     // Get material diffuse albedo
     #ifdef DIFFMAP
     #ifdef DIFFMAP
-        float4 diffInput = tex2D(sDiffMap, iTexCoord.xy);
+        float4 diffInput = Sample2D(DiffMap, iTexCoord.xy);
         #ifdef ALPHAMASK
         #ifdef ALPHAMASK
             if (diffInput.a < 0.5)
             if (diffInput.a < 0.5)
                 discard;
                 discard;
@@ -163,7 +165,7 @@ void PS(
 
 
     // Get material specular albedo
     // Get material specular albedo
     #ifdef SPECMAP
     #ifdef SPECMAP
-        float3 specColor = cMatSpecColor.rgb * tex2D(sSpecMap, iTexCoord.xy).rgb;
+        float3 specColor = cMatSpecColor.rgb * Sample2D(SpecMap, iTexCoord.xy).rgb;
     #else
     #else
         float3 specColor = cMatSpecColor.rgb;
         float3 specColor = cMatSpecColor.rgb;
     #endif
     #endif
@@ -171,7 +173,7 @@ void PS(
     // Get normal
     // Get normal
     #ifdef NORMALMAP
     #ifdef NORMALMAP
         float3x3 tbn = float3x3(iTangent.xyz, float3(iTexCoord.zw, iTangent.w), iNormal);
         float3x3 tbn = float3x3(iTangent.xyz, float3(iTexCoord.zw, iTangent.w), iNormal);
-        float3 normal = normalize(mul(DecodeNormal(tex2D(sNormalMap, iTexCoord.xy)), tbn));
+        float3 normal = normalize(mul(DecodeNormal(Sample2D(NormalMap, iTexCoord.xy)), tbn));
     #else
     #else
         float3 normal = normalize(iNormal);
         float3 normal = normalize(iNormal);
     #endif
     #endif
@@ -196,9 +198,9 @@ void PS(
         #endif
         #endif
 
 
         #if defined(SPOTLIGHT)
         #if defined(SPOTLIGHT)
-            lightColor = iSpotPos.w > 0.0 ? tex2Dproj(sLightSpotMap, iSpotPos).rgb * cLightColor.rgb : 0.0;
+            lightColor = iSpotPos.w > 0.0 ? Sample2DProj(LightSpotMap, iSpotPos).rrr * cLightColor.rgb : 0.0;
         #elif defined(CUBEMASK)
         #elif defined(CUBEMASK)
-            lightColor = texCUBE(sLightCubeMap, iCubeMaskVec).rgb * cLightColor.rgb;
+            lightColor = SampleCube(LightCubeMap, iCubeMaskVec).rgb * cLightColor.rgb;
         #else
         #else
             lightColor = cLightColor.rgb;
             lightColor = cLightColor.rgb;
         #endif
         #endif
@@ -231,16 +233,16 @@ void PS(
         float3 finalColor = iVertexLight * diffColor.rgb;
         float3 finalColor = iVertexLight * diffColor.rgb;
         #ifdef AO
         #ifdef AO
             // If using AO, the vertex light ambient is black, calculate occluded ambient here
             // If using AO, the vertex light ambient is black, calculate occluded ambient here
-            finalColor += tex2D(sEmissiveMap, iTexCoord2).rgb * cAmbientColor * diffColor.rgb;
+            finalColor += Sample2D(EmissiveMap, iTexCoord2).rgb * cAmbientColor * diffColor.rgb;
         #endif
         #endif
         #ifdef ENVCUBEMAP
         #ifdef ENVCUBEMAP
-            finalColor += cMatEnvMapColor * texCUBE(sEnvCubeMap, reflect(iReflectionVec, normal)).rgb;
+            finalColor += cMatEnvMapColor * SampleCube(EnvCubeMap, reflect(iReflectionVec, normal)).rgb;
         #endif
         #endif
         #ifdef LIGHTMAP
         #ifdef LIGHTMAP
-            finalColor += tex2D(sEmissiveMap, iTexCoord2).rgb * diffColor.rgb;
+            finalColor += Sample2D(EmissiveMap, iTexCoord2).rgb * diffColor.rgb;
         #endif
         #endif
         #ifdef EMISSIVEMAP
         #ifdef EMISSIVEMAP
-            finalColor += cMatEmissiveColor * tex2D(sEmissiveMap, iTexCoord.xy).rgb;
+            finalColor += cMatEmissiveColor * Sample2D(EmissiveMap, iTexCoord.xy).rgb;
         #else
         #else
             finalColor += cMatEmissiveColor;
             finalColor += cMatEmissiveColor;
         #endif
         #endif
@@ -254,26 +256,26 @@ void PS(
         float3 finalColor = iVertexLight * diffColor.rgb;
         float3 finalColor = iVertexLight * diffColor.rgb;
         #ifdef AO
         #ifdef AO
             // If using AO, the vertex light ambient is black, calculate occluded ambient here
             // If using AO, the vertex light ambient is black, calculate occluded ambient here
-            finalColor += tex2D(sEmissiveMap, iTexCoord2).rgb * cAmbientColor * diffColor.rgb;
+            finalColor += Sample2D(EmissiveMap, iTexCoord2).rgb * cAmbientColor * diffColor.rgb;
         #endif
         #endif
 
 
         #ifdef MATERIAL
         #ifdef MATERIAL
             // Add light pre-pass accumulation result
             // Add light pre-pass accumulation result
             // Lights are accumulated at half intensity. Bring back to full intensity now
             // Lights are accumulated at half intensity. Bring back to full intensity now
-            float4 lightInput = 2.0 * tex2Dproj(sLightBuffer, iScreenPos);
+            float4 lightInput = 2.0 * Sample2DProj(LightBuffer, iScreenPos);
             float3 lightSpecColor = lightInput.a * (lightInput.rgb / GetIntensity(lightInput.rgb));
             float3 lightSpecColor = lightInput.a * (lightInput.rgb / GetIntensity(lightInput.rgb));
 
 
             finalColor += lightInput.rgb * diffColor.rgb + lightSpecColor * specColor;
             finalColor += lightInput.rgb * diffColor.rgb + lightSpecColor * specColor;
         #endif
         #endif
 
 
         #ifdef ENVCUBEMAP
         #ifdef ENVCUBEMAP
-            finalColor += cMatEnvMapColor * texCUBE(sEnvCubeMap, reflect(iReflectionVec, normal)).rgb;
+            finalColor += cMatEnvMapColor * SampleCube(EnvCubeMap, reflect(iReflectionVec, normal)).rgb;
         #endif
         #endif
         #ifdef LIGHTMAP
         #ifdef LIGHTMAP
-            finalColor += tex2D(sEmissiveMap, iTexCoord2).rgb * diffColor.rgb;
+            finalColor += Sample2D(EmissiveMap, iTexCoord2).rgb * diffColor.rgb;
         #endif
         #endif
         #ifdef EMISSIVEMAP
         #ifdef EMISSIVEMAP
-            finalColor += cMatEmissiveColor * tex2D(sEmissiveMap, iTexCoord.xy).rgb;
+            finalColor += cMatEmissiveColor * Sample2D(EmissiveMap, iTexCoord.xy).rgb;
         #else
         #else
             finalColor += cMatEmissiveColor;
             finalColor += cMatEmissiveColor;
         #endif
         #endif

+ 1 - 1
bin/CoreData/Shaders/HLSL/PrepassLight.hlsl

@@ -85,7 +85,7 @@ void PS(
 
 
     #if defined(SPOTLIGHT)
     #if defined(SPOTLIGHT)
         float4 spotPos = mul(projWorldPos, cLightMatricesPS[0]);
         float4 spotPos = mul(projWorldPos, cLightMatricesPS[0]);
-        lightColor = spotPos.w > 0.0 ? tex2Dproj(sLightSpotMap, spotPos).rgb * cLightColor.rgb : 0.0;
+        lightColor = spotPos.w > 0.0 ? tex2Dproj(sLightSpotMap, spotPos).rrr * cLightColor.rgb : 0.0;
     #elif defined(CUBEMASK)
     #elif defined(CUBEMASK)
         lightColor = texCUBE(sLightCubeMap, mul(worldPos - cLightPosPS.xyz, (float3x3)cLightMatricesPS[0])).rgb * cLightColor.rgb;
         lightColor = texCUBE(sLightCubeMap, mul(worldPos - cLightPosPS.xyz, (float3x3)cLightMatricesPS[0])).rgb * cLightColor.rgb;
     #else
     #else

+ 91 - 33
bin/CoreData/Shaders/HLSL/Samplers.hlsl

@@ -1,44 +1,102 @@
 #ifdef COMPILEPS
 #ifdef COMPILEPS
-sampler2D sDiffMap : register(S0);
-samplerCUBE sDiffCubeMap : register(S0);
-sampler2D sAlbedoBuffer : register(S0);
-sampler2D sNormalMap : register(S1);
-sampler2D sNormalBuffer : register(S1);
-sampler2D sSpecMap : register(S2);
-sampler2D sEmissiveMap : register(S3);
-sampler2D sEnvMap : register(S4);
-sampler3D sVolumeMap : register(S5);
-samplerCUBE sEnvCubeMap : register(S4);
-sampler1D sLightRampMap : register(S8);
-sampler2D sLightSpotMap : register(S9);
-samplerCUBE sLightCubeMap : register(S9);
-sampler2D sShadowMap : register(S10);
-samplerCUBE sFaceSelectCubeMap : register(S11);
-samplerCUBE sIndirectionCubeMap : register(S12);
-sampler2D sDepthBuffer : register(S13);
-sampler2D sLightBuffer : register(S14);
-samplerCUBE sZoneCubeMap : register(S15);
-sampler3D sZoneVolumeMap : register(S15);
-
-float4 Sample(sampler2D map, float2 texCoord)
-{
-    return tex2Dlod(map, float4(texCoord, 0.0, 0.0));
-}
+
+#ifndef D3D11
+
+// D3D9 samplers
+sampler2D sDiffMap : register(s0);
+samplerCUBE sDiffCubeMap : register(s0);
+sampler2D sAlbedoBuffer : register(s0);
+sampler2D sNormalMap : register(s1);
+sampler2D sNormalBuffer : register(s1);
+sampler2D sSpecMap : register(s2);
+sampler2D sEmissiveMap : register(s3);
+sampler2D sEnvMap : register(s4);
+sampler3D sVolumeMap : register(s5);
+samplerCUBE sEnvCubeMap : register(s4);
+sampler2D sLightRampMap : register(s8);
+sampler2D sLightSpotMap : register(s9);
+samplerCUBE sLightCubeMap : register(s9);
+sampler2D sShadowMap : register(s10);
+samplerCUBE sFaceSelectCubeMap : register(s11);
+samplerCUBE sIndirectionCubeMap : register(s12);
+sampler2D sDepthBuffer : register(s13);
+sampler2D sLightBuffer : register(s14);
+samplerCUBE sZoneCubeMap : register(s15);
+sampler3D sZoneVolumeMap : register(s15);
+
+#define Sample2D(tex, uv) tex2D(s##tex, uv)
+#define Sample2DProj(tex, uv) tex2Dproj(s##tex, uv)
+#define Sample2DLod0(tex, uv) tex2Dlod(s##tex, float4(uv, 0.0, 0.0))
+#define SampleCube(tex, uv) texCUBE(S##tex, uv)
+
+#else
+
+// D3D11 textures and samplers
+
+Texture2D tDiffMap : register(t0);
+TextureCube tDiffCubeMap : register(t0);
+Texture2D tAlbedoBuffer : register(t0);
+Texture2D tNormalMap : register(t1);
+Texture2D tNormalBuffer : register(t1);
+Texture2D tSpecMap : register(t2);
+Texture2D tEmissiveMap : register(t3);
+Texture2D tEnvMap : register(t4);
+Texture3D tVolumeMap : register(t5);
+TextureCube tEnvCubeMap : register(t4);
+Texture2D tLightRampMap : register(t8);
+Texture2D tLightSpotMap : register(t9);
+TextureCube tLightCubeMap : register(t9);
+Texture2D tShadowMap : register(t10);
+TextureCube tFaceSelectCubeMap : register(t11);
+TextureCube tIndirectionCubeMap : register(t12);
+Texture2D tDepthBuffer : register(t13);
+Texture2D tLightBuffer : register(t14);
+TextureCube tZoneCubeMap : register(t15);
+Texture3D tZoneVolumeMap : register(t15);
+
+SamplerState sDiffMap : register(s0);
+SamplerState sDiffCubeMap : register(s0);
+SamplerState sAlbedoBuffer : register(s0);
+SamplerState sNormalMap : register(s1);
+SamplerState sNormalBuffer : register(s1);
+SamplerState sSpecMap : register(s2);
+SamplerState sEmissiveMap : register(s3);
+SamplerState sEnvMap : register(s4);
+SamplerState sVolumeMap : register(s5);
+SamplerState sEnvCubeMap : register(s4);
+SamplerState sLightRampMap : register(s8);
+SamplerState sLightSpotMap : register(s9);
+SamplerState sLightCubeMap : register(s9);
+SamplerState sShadowMap : register(s10);
+SamplerState sFaceSelectCubeMap : register(s11);
+SamplerState sIndirectionCubeMap : register(s12);
+SamplerState sDepthBuffer : register(s13);
+SamplerState sLightBuffer : register(s14);
+SamplerState sZoneCubeMap : register(s15);
+SamplerState sZoneVolumeMap : register(s15);
+
+#define Sample2D(tex, uv) t##tex.Sample(s##tex, uv)
+#define Sample2DProj(tex, uv) t##tex.Sample(s##tex, uv.xy / uv.w)
+#define Sample2DLod0(tex, uv) t##tex.Sample(s##tex, uv)
+#define SampleCube(tex, uv) t##tex.Sample(s##tex, uv)
+
+#endif
 
 
 float3 DecodeNormal(float4 normalInput)
 float3 DecodeNormal(float4 normalInput)
 {
 {
-    #ifdef PACKEDNORMAL
-        float3 normal;
-        normal.xy = normalInput.ag * 2.0 - 1.0;
-        normal.z = sqrt(max(1.0 - dot(normal.xy, normal.xy), 0.0));
-        return normal;
-    #else
-        return normalInput.rgb * 2.0 - 1.0;
-    #endif
+#ifdef PACKEDNORMAL
+    float3 normal;
+    normal.xy = normalInput.ag * 2.0 - 1.0;
+    normal.z = sqrt(max(1.0 - dot(normal.xy, normal.xy), 0.0));
+    return normal;
+#else
+    return normalInput.rgb * 2.0 - 1.0;
+#endif
 }
 }
 
 
 float ReconstructDepth(float hwDepth)
 float ReconstructDepth(float hwDepth)
 {
 {
     return dot(float2(hwDepth, cDepthReconstruct.y / (hwDepth - cDepthReconstruct.x)), cDepthReconstruct.zw);
     return dot(float2(hwDepth, cDepthReconstruct.y / (hwDepth - cDepthReconstruct.x)), cDepthReconstruct.zw);
 }
 }
+
 #endif
 #endif

+ 3 - 3
bin/CoreData/Shaders/HLSL/Shadow.hlsl

@@ -12,7 +12,7 @@ void VS(float4 iPos : POSITION,
     #endif
     #endif
     float2 iTexCoord : TEXCOORD0,
     float2 iTexCoord : TEXCOORD0,
     out float2 oTexCoord : TEXCOORD0,
     out float2 oTexCoord : TEXCOORD0,
-    out float4 oPos : POSITION)
+    out float4 oPos : OUTPOSITION)
 {
 {
     float4x3 modelMatrix = iModelMatrix;
     float4x3 modelMatrix = iModelMatrix;
     float3 worldPos = GetWorldPos(modelMatrix);
     float3 worldPos = GetWorldPos(modelMatrix);
@@ -22,10 +22,10 @@ void VS(float4 iPos : POSITION,
 
 
 void PS(
 void PS(
     float2 iTexCoord : TEXCOORD0,
     float2 iTexCoord : TEXCOORD0,
-    out float4 oColor : COLOR0)
+    out float4 oColor : OUTCOLOR0)
 {
 {
     #ifdef ALPHAMASK
     #ifdef ALPHAMASK
-        float alpha = tex2D(sDiffMap, iTexCoord).a;
+        float alpha = Sample2D(sDiffMap, iTexCoord).a;
         if (alpha < 0.5)
         if (alpha < 0.5)
             discard;
             discard;
     #endif
     #endif

+ 2 - 2
bin/CoreData/Shaders/HLSL/Stencil.hlsl

@@ -2,14 +2,14 @@
 #include "Transform.hlsl"
 #include "Transform.hlsl"
 
 
 void VS(float4 iPos : POSITION,
 void VS(float4 iPos : POSITION,
-    out float4 oPos : POSITION)
+    out float4 oPos : OUTPOSITION)
 {
 {
     float4x3 modelMatrix = iModelMatrix;
     float4x3 modelMatrix = iModelMatrix;
     float3 worldPos = GetWorldPos(modelMatrix);
     float3 worldPos = GetWorldPos(modelMatrix);
     oPos = GetClipPos(worldPos);
     oPos = GetClipPos(worldPos);
 }
 }
 
 
-void PS(out float4 oColor : COLOR0)
+void PS(out float4 oColor : OUTCOLOR0)
 {
 {
     oColor = 1.0;
     oColor = 1.0;
 }
 }

+ 42 - 14
bin/CoreData/Shaders/HLSL/TerrainBlend.hlsl

@@ -1,3 +1,5 @@
+#define CUSTOM_MATERIAL_CBUFFER
+
 #include "Uniforms.hlsl"
 #include "Uniforms.hlsl"
 #include "Samplers.hlsl"
 #include "Samplers.hlsl"
 #include "Transform.hlsl"
 #include "Transform.hlsl"
@@ -5,13 +7,39 @@
 #include "Lighting.hlsl"
 #include "Lighting.hlsl"
 #include "Fog.hlsl"
 #include "Fog.hlsl"
 
 
+#ifdef COMPILEPS
+
+#ifndef D3D11
+
 sampler2D sWeightMap0 : register(S0);
 sampler2D sWeightMap0 : register(S0);
 sampler2D sDetailMap1 : register(S1);
 sampler2D sDetailMap1 : register(S1);
 sampler2D sDetailMap2 : register(S2);
 sampler2D sDetailMap2 : register(S2);
 sampler2D sDetailMap3 : register(S3);
 sampler2D sDetailMap3 : register(S3);
-
 uniform float2 cDetailTiling;
 uniform float2 cDetailTiling;
 
 
+#else
+
+Texture2D tWeightMap0 : register(t0);
+Texture2D tDetailMap1 : register(t1);
+Texture2D tDetailMap2 : register(t2);
+Texture2D tDetailMap3 : register(t3);
+SamplerState sWeightMap0 : register(s0);
+SamplerState sDetailMap1 : register(s1);
+SamplerState sDetailMap2 : register(s2);
+SamplerState sDetailMap3 : register(s3);
+
+cbuffer MaterialPS : register(b4)
+{
+    float4 cMatDiffColor;
+    float3 cMatEmissiveColor;
+    float3 cMatEnvMapColor;
+    float4 cMatSpecColor;
+    float2 cDetailTiling;
+}
+
+#endif
+#endif
+
 void VS(float4 iPos : POSITION,
 void VS(float4 iPos : POSITION,
     float3 iNormal : NORMAL,
     float3 iNormal : NORMAL,
     float2 iTexCoord : TEXCOORD0,
     float2 iTexCoord : TEXCOORD0,
@@ -43,7 +71,7 @@ void VS(float4 iPos : POSITION,
         out float3 oVertexLight : TEXCOORD4,
         out float3 oVertexLight : TEXCOORD4,
         out float4 oScreenPos : TEXCOORD5,
         out float4 oScreenPos : TEXCOORD5,
     #endif
     #endif
-    out float4 oPos : POSITION)
+    out float4 oPos : OUTPOSITION)
 {
 {
     float4x3 modelMatrix = iModelMatrix;
     float4x3 modelMatrix = iModelMatrix;
     float3 worldPos = GetWorldPos(modelMatrix);
     float3 worldPos = GetWorldPos(modelMatrix);
@@ -102,23 +130,23 @@ void PS(float2 iTexCoord : TEXCOORD0,
         float4 iScreenPos : TEXCOORD5,
         float4 iScreenPos : TEXCOORD5,
     #endif
     #endif
     #ifdef PREPASS
     #ifdef PREPASS
-        out float4 oDepth : COLOR1,
+        out float4 oDepth : OUTCOLOR1,
     #endif
     #endif
     #ifdef DEFERRED
     #ifdef DEFERRED
-        out float4 oAlbedo : COLOR1,
-        out float4 oNormal : COLOR2,
-        out float4 oDepth : COLOR3,
+        out float4 oAlbedo : OUTCOLOR1,
+        out float4 oNormal : OUTCOLOR2,
+        out float4 oDepth : OUTCOLOR3,
     #endif
     #endif
-    out float4 oColor : COLOR0)
+    out float4 oColor : OUTCOLOR0)
 {
 {
     // Get material diffuse albedo
     // Get material diffuse albedo
-    float3 weights = tex2D(sWeightMap0, iTexCoord).rgb;
+    float3 weights = Sample2D(WeightMap0, iTexCoord).rgb;
     float sumWeights = weights.r + weights.g + weights.b;
     float sumWeights = weights.r + weights.g + weights.b;
     weights /= sumWeights;
     weights /= sumWeights;
     float4 diffColor = cMatDiffColor * (
     float4 diffColor = cMatDiffColor * (
-        weights.r * tex2D(sDetailMap1, iDetailTexCoord) +
-        weights.g * tex2D(sDetailMap2, iDetailTexCoord) +
-        weights.b * tex2D(sDetailMap3, iDetailTexCoord)
+        weights.r * Sample2D(DetailMap1, iDetailTexCoord) +
+        weights.g * Sample2D(DetailMap2, iDetailTexCoord) +
+        weights.b * Sample2D(DetailMap3, iDetailTexCoord)
     );
     );
 
 
     // Get material specular albedo
     // Get material specular albedo
@@ -147,9 +175,9 @@ void PS(float2 iTexCoord : TEXCOORD0,
         #endif
         #endif
     
     
         #if defined(SPOTLIGHT)
         #if defined(SPOTLIGHT)
-            lightColor = iSpotPos.w > 0.0 ? tex2Dproj(sLightSpotMap, iSpotPos).rgb * cLightColor.rgb : 0.0;
+            lightColor = iSpotPos.w > 0.0 ? Sample2DProj(LightSpotMap, iSpotPos).rrr * cLightColor.rgb : 0.0;
         #elif defined(CUBEMASK)
         #elif defined(CUBEMASK)
-            lightColor = texCUBE(sLightCubeMap, iCubeMaskVec).rgb * cLightColor.rgb;
+            lightColor = SampleCube(LightCubeMap, iCubeMaskVec).rgb * cLightColor.rgb;
         #else
         #else
             lightColor = cLightColor.rgb;
             lightColor = cLightColor.rgb;
         #endif
         #endif
@@ -192,7 +220,7 @@ void PS(float2 iTexCoord : TEXCOORD0,
         #ifdef MATERIAL
         #ifdef MATERIAL
             // Add light pre-pass accumulation result
             // Add light pre-pass accumulation result
             // Lights are accumulated at half intensity. Bring back to full intensity now
             // Lights are accumulated at half intensity. Bring back to full intensity now
-            float4 lightInput = 2.0 * tex2Dproj(sLightBuffer, iScreenPos);
+            float4 lightInput = 2.0 * Sample2DProj(LightBuffer, iScreenPos);
             float3 lightSpecColor = lightInput.a * (lightInput.rgb / GetIntensity(lightInput.rgb));
             float3 lightSpecColor = lightInput.a * (lightInput.rgb / GetIntensity(lightInput.rgb));
 
 
             finalColor += lightInput.rgb * diffColor.rgb + lightSpecColor * specColor;
             finalColor += lightInput.rgb * diffColor.rgb + lightSpecColor * specColor;

+ 24 - 0
bin/CoreData/Shaders/HLSL/Transform.hlsl

@@ -1,4 +1,11 @@
 #ifdef COMPILEVS
 #ifdef COMPILEVS
+
+#ifdef D3D11
+#define OUTPOSITION SV_POSITION
+#else
+#define OUTPOSITION POSITION
+#endif
+
 #ifdef SKINNED
 #ifdef SKINNED
 float4x3 GetSkinMatrix(float4 blendWeights, int4 blendIndices)
 float4x3 GetSkinMatrix(float4 blendWeights, int4 blendIndices)
 {
 {
@@ -63,3 +70,20 @@ float3 GetBillboardNormal()
 
 
 #define GetWorldTangent(modelMatrix) normalize(mul(iTangent.xyz, (float3x3)modelMatrix))
 #define GetWorldTangent(modelMatrix) normalize(mul(iTangent.xyz, (float3x3)modelMatrix))
 #endif
 #endif
+
+#ifdef COMPILEPS
+
+#ifdef D3D11
+#define OUTCOLOR0 SV_TARGET
+#define OUTCOLOR1 SV_TARGET1
+#define OUTCOLOR2 SV_TARGET2
+#define OUTCOLOR3 SV_TARGET3
+#else
+#define OUTCOLOR0 COLOR0
+#define OUTCOLOR1 COLOR1
+#define OUTCOLOR2 COLOR2
+#define OUTCOLOR3 COLOR3
+#endif
+
+#endif
+

+ 120 - 0
bin/CoreData/Shaders/HLSL/Uniforms.hlsl

@@ -1,4 +1,9 @@
+#ifndef D3D11
+
+// D3D9 uniforms (no constant buffers)
+
 #ifdef COMPILEVS
 #ifdef COMPILEVS
+
 // Vertex shader uniforms
 // Vertex shader uniforms
 uniform float3 cAmbientStartColor;
 uniform float3 cAmbientStartColor;
 uniform float3 cAmbientEndColor;
 uniform float3 cAmbientEndColor;
@@ -32,6 +37,8 @@ uniform float4x3 cZone;
 #endif
 #endif
 
 
 #ifdef COMPILEPS
 #ifdef COMPILEPS
+
+// Pixel shader uniforms
 uniform float3 cAmbientColor;
 uniform float3 cAmbientColor;
 uniform float3 cCameraPosPS;
 uniform float3 cCameraPosPS;
 uniform float cDeltaTimePS;
 uniform float cDeltaTimePS;
@@ -56,3 +63,116 @@ uniform float2 cShadowMapInvSize;
 uniform float4 cShadowSplits;
 uniform float4 cShadowSplits;
 uniform float4x4 cLightMatricesPS[4];
 uniform float4x4 cLightMatricesPS[4];
 #endif
 #endif
+
+#else
+
+// D3D11 uniforms (using constant buffers)
+
+#ifdef COMPILEVS
+
+// Vertex shader uniforms
+cbuffer FrameVS : register(b0)
+{
+    float cDeltaTime;
+    float cElapsedTime;
+}
+
+cbuffer CameraVS : register(b1)
+{
+    float3 cCameraPos;
+    float3x3 cCameraRot;
+    float cNearClip;
+    float cFarClip;
+    float4 cDepthMode;
+    float3 cFrustumSize;
+    float4 cGBufferOffsets;
+    float4x4 cViewProj;
+}
+
+cbuffer ZoneVS : register(b2)
+{
+    float3 cAmbientStartColor;
+    float3 cAmbientEndColor;
+    float4x3 cZone;
+}
+
+cbuffer LightVS : register(b3)
+{
+    float3 cLightDir;
+    float4 cLightPos;
+#ifdef NUMVERTEXLIGHTS
+    float4 cVertexLights[4 * 3];
+#else
+    float4x4 cLightMatrices[4];
+#endif
+}
+
+cbuffer MaterialVS : register(b4)
+{
+    float4 cUOffset;
+    float4 cVOffset;
+}
+
+cbuffer ObjectVS : register(b5)
+{
+    float4x3 cModel;
+#ifdef BILLBOARD
+    float3x3 cBillboardRot;
+#endif
+#ifdef SKINNED
+    uniform float4x3 cSkinMatrices[64];
+#endif
+}
+#endif
+
+#ifdef COMPILEPS
+
+// Pixel shader uniforms
+cbuffer FramePS : register(b0)
+{
+    float cDeltaTimePS;
+    float cElapsedTimePS;
+}
+
+cbuffer CameraPS : register(b1)
+{
+    float3 cCameraPosPS;
+    float4 cDepthReconstruct;
+    float2 cGBufferInvSize;
+    float cNearClipPS;
+    float cFarClipPS;
+}
+
+cbuffer ZonePS : register(b2)
+{
+    float3 cAmbientColor;
+    float4 cFogParams;
+    float3 cFogColor;
+}
+
+cbuffer LightPS : register(b3)
+{
+    float4 cLightColor;
+    float4 cLightPosPS;
+    float3 cLightDirPS;
+    float4 cShadowCubeAdjust;
+    float4 cShadowDepthFade;
+    float2 cShadowIntensity;
+    float2 cShadowMapInvSize;
+    float4 cShadowSplits;
+    float4x4 cLightMatricesPS[4];
+}
+
+#ifndef CUSTOM_MATERIAL_CBUFFER
+cbuffer MaterialPS : register(b4)
+{
+    float4 cMatDiffColor;
+    float3 cMatEmissiveColor;
+    float3 cMatEnvMapColor;
+    float4 cMatSpecColor;
+}
+#endif
+
+#endif
+
+#endif

+ 7 - 7
bin/CoreData/Shaders/HLSL/Unlit.hlsl

@@ -23,7 +23,7 @@ void VS(float4 iPos : POSITION,
     #ifdef VERTEXCOLOR
     #ifdef VERTEXCOLOR
         out float4 oColor : COLOR0,
         out float4 oColor : COLOR0,
     #endif
     #endif
-    out float4 oPos : POSITION)
+    out float4 oPos : OUTPOSITION)
 {
 {
     float4x3 modelMatrix = iModelMatrix;
     float4x3 modelMatrix = iModelMatrix;
     float3 worldPos = GetWorldPos(modelMatrix);
     float3 worldPos = GetWorldPos(modelMatrix);
@@ -42,18 +42,18 @@ void PS(float2 iTexCoord : TEXCOORD0,
         float4 iColor : COLOR0,
         float4 iColor : COLOR0,
     #endif
     #endif
     #ifdef PREPASS
     #ifdef PREPASS
-        out float4 oDepth : COLOR1,
+        out float4 oDepth : OUTCOLOR1,
     #endif
     #endif
     #ifdef DEFERRED
     #ifdef DEFERRED
-        out float4 oAlbedo : COLOR1,
-        out float4 oNormal : COLOR2,
-        out float4 oDepth : COLOR3,
+        out float4 oAlbedo : OUTCOLOR1,
+        out float4 oNormal : OUTCOLOR2,
+        out float4 oDepth : OUTCOLOR3,
     #endif
     #endif
-    out float4 oColor : COLOR0)
+    out float4 oColor : OUTCOLOR0)
 {
 {
     // Get material diffuse albedo
     // Get material diffuse albedo
     #ifdef DIFFMAP
     #ifdef DIFFMAP
-        float4 diffColor = cMatDiffColor * tex2D(sDiffMap, iTexCoord);
+        float4 diffColor = cMatDiffColor * Sample2D(DiffMap, iTexCoord);
         #ifdef ALPHAMASK
         #ifdef ALPHAMASK
             if (diffColor.a < 0.5)
             if (diffColor.a < 0.5)
                 discard;
                 discard;

+ 3 - 3
bin/CoreData/Shaders/HLSL/Urho2D.hlsl

@@ -7,7 +7,7 @@ void VS(float4 iPos : POSITION,
     float4 iColor : COLOR0,
     float4 iColor : COLOR0,
     out float4 oColor : COLOR0,
     out float4 oColor : COLOR0,
     out float2 oTexCoord : TEXCOORD0,
     out float2 oTexCoord : TEXCOORD0,
-    out float4 oPos : POSITION)
+    out float4 oPos : OUTPOSITION)
 {
 {
     float4x3 modelMatrix = iModelMatrix;
     float4x3 modelMatrix = iModelMatrix;
     float3 worldPos = GetWorldPos(modelMatrix);
     float3 worldPos = GetWorldPos(modelMatrix);
@@ -19,9 +19,9 @@ void VS(float4 iPos : POSITION,
 
 
 void PS(float4 iColor : COLOR0,
 void PS(float4 iColor : COLOR0,
         float2 iTexCoord : TEXCOORD0,
         float2 iTexCoord : TEXCOORD0,
-        out float4 oColor : COLOR0)
+        out float4 oColor : OUTCOLOR0)
 {
 {
     float4 diffColor = cMatDiffColor * iColor;
     float4 diffColor = cMatDiffColor * iColor;
-    float4 diffInput = tex2D(sDiffMap, iTexCoord);
+    float4 diffInput = Sample2D(sDiffMap, iTexCoord);
     oColor = diffColor * diffInput;
     oColor = diffColor * diffInput;
 }
 }