Browse Source

More fixes for the new shader system. All existing shaders functional.

BearishSun 8 years ago
parent
commit
3ee362972a

+ 4 - 4
Data/Raw/Editor/Includes/SelectionBase.bslinc

@@ -36,15 +36,15 @@ mixin SelectionBase
 mixin 
 #ifdef USE_BLEND_SHAPES
 	#ifdef USE_SKELETON
-	 : SelectionSkinnedMorph
+		SelectionSkinnedMorph
 	#else
-	 : SelectionMorph
+		SelectionMorph
 	#endif
 #else
 	#ifdef USE_SKELETON
-	 : SelectionSkinned
+		SelectionSkinned
 	#else
-	 : Selection
+		Selection
 	#endif
 #endif
 {

+ 1 - 1
Data/Raw/Editor/Shaders/LineHandle.bsl

@@ -13,7 +13,7 @@ technique LineHandle
 	stencil
 	{
 		enabled = true;
-		front = { keep, keep, inc, pass };
+		front = { keep, keep, inc, always };
 	};
 	
 	raster

+ 3 - 3
Data/Raw/Editor/Shaders/Selection.bsl

@@ -19,19 +19,19 @@ technique Selection2
 {
 	mixin SelectionSkinned;
 
-	Tags = { "Skinned" };
+	tags = { "Skinned" };
 };
 
 technique Selection3
 {
 	mixin SelectionMorph;
 
-	Tags = { "Morph" };
+	tags = { "Morph" };
 };
 
 technique Selection4
 {
 	mixin SelectionSkinnedMorph;
 
-	Tags = { "SkinnedMorph" };
+	tags = { "SkinnedMorph" };
 };

+ 2 - 2
Data/Raw/Editor/Shaders/SolidHandle.bsl

@@ -3,7 +3,7 @@
 options
 {
 	priority = 10;
-}
+};
 
 technique SolidGizmo
 {
@@ -18,7 +18,7 @@ technique SolidGizmo
 	stencil
 	{
 		enabled = true;
-		front = { keep, keep, inc, pass };
+		front = { keep, keep, inc, always };
 	};
 	
 	blend

+ 1 - 1
Data/Raw/Editor/Shaders/TextGizmo.bsl

@@ -4,7 +4,7 @@ technique TextGizmo
 	{
 		target 
 		{
-			enabled true;
+			enabled = true;
 			color = { srcA, srcIA, add };
 		};
 	};

+ 0 - 2
Data/Raw/Engine/Includes/PerObjectData.bslinc

@@ -2,7 +2,6 @@ mixin PerObjectData
 {
 	code
 	{
-		[internal]
 		cbuffer PerObject
 		{
 			float4x4 gMatWorld;
@@ -12,7 +11,6 @@ mixin PerObjectData
 			float gWorldDeterminantSign;
 		}	
 
-		[internal]
 		cbuffer PerCall
 		{
 			float4x4 gMatWorldViewProj;

+ 2 - 2
Data/Raw/Engine/Includes/ResolveCommon.bslinc

@@ -38,7 +38,7 @@ technique Resolve
 			int gNumSamples;
 		};
 		
-		[internal] Texture2DMS<float4> gSource;
+		Texture2DMS<float4> gSource;
 		
 		float4 fsmain(VStoFS input) : SV_Target0
 		{
@@ -53,7 +53,7 @@ technique Resolve
 		
 		#else
 		
-		[internal] Texture2D<float4> gSource;
+		Texture2D<float4> gSource;
 	
 		float4 fsmain(VStoFS input) : SV_Target0
 		{

+ 0 - 1
Data/Raw/Engine/Includes/SpriteImage.bslinc

@@ -8,7 +8,6 @@ mixin SpriteImage
 
 	code
 	{
-		[internal]
 		cbuffer GUIParams
 		{
 			float4x4 gWorldTransform;

+ 2 - 9
Source/BansheeEngine/Source/BsSpriteMaterial.cpp

@@ -12,7 +12,7 @@
 namespace bs
 {
 	SpriteMaterial::SpriteMaterial(UINT32 id, const HMaterial& material)
-		:mId(id), mMaterialStored(false)
+		:mId(id), mMaterialStored(false), mParamBufferIdx(-1)
 	{
 		mMaterial = material->getCore();
 		mMaterialStored.store(true, std::memory_order_release);
@@ -40,14 +40,7 @@ namespace bs
 			mSamplerParam = mMaterial->getParamSamplerState("gMainTexSamp");
 		}
 
-		static StringID GUIParamsSemantic = "GUIParams";
-		const Map<String, SHADER_PARAM_BLOCK_DESC>& paramBlockDescs = shader->getParamBlocks();
-
-		for (auto& paramBlockDesc : paramBlockDescs)
-		{
-			if (paramBlockDesc.second.rendererSemantic == GUIParamsSemantic)
-				mParamBufferIdx = mParams->getParamBlockBufferIndex(paramBlockDesc.second.name);
-		}
+		mParamBufferIdx = mParams->getParamBlockBufferIndex("GUIParams");
 
 		if(mParamBufferIdx == -1)
 			LOGERR("Sprite material shader missing \"GUIParams\" block.");

+ 4 - 1
Source/BansheeSL/BsLexerFX.l

@@ -228,7 +228,10 @@ RGBA			{ yylval->intValue = 0xF; return TOKEN_COLORMASK; }
 }
 <CONDITIONAL_IFN>.				{ return yytext[0]; }
 
-#else							{ BEGIN(CONDITIONAL_IGNORE); }
+#else							{ 
+	if(!switchConditional(yyextra))
+		BEGIN(CONDITIONAL_IGNORE); 
+}
 #elif							{ BEGIN(CONDITIONAL_IGNORE); }
 
 #endif							{ popConditional(yyextra); }

+ 3 - 3
Source/BansheeSL/BsParserFX.y

@@ -318,9 +318,6 @@ raster_body
 raster_option
 	: TOKEN_FILLMODE '=' TOKEN_FILLMODEVALUE ';'				{ $$.type = OT_FillMode; $$.value.intValue = $3; }
 	| TOKEN_CULLMODE '=' TOKEN_CULLANDQUEUEVALUE ';'			{ $$.type = OT_CullMode; $$.value.intValue = $3; }
-	| TOKEN_DEPTHBIAS '=' TOKEN_FLOAT ';'						{ $$.type = OT_DepthBias; $$.value.floatValue = $3; }
-	| TOKEN_SDEPTHBIAS '=' TOKEN_FLOAT ';'						{ $$.type = OT_SDepthBias; $$.value.floatValue = $3; }
-	| TOKEN_DEPTHCLIP '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_DepthClip; $$.value.intValue = $3; }
 	| TOKEN_SCISSOR '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_Scissor; $$.value.intValue = $3; }
 	| TOKEN_MULTISAMPLE '=' TOKEN_BOOLEAN ';'					{ $$.type = OT_Multisample; $$.value.intValue = $3; }
 	| TOKEN_AALINE '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_AALine; $$.value.intValue = $3; }
@@ -348,6 +345,9 @@ depth_option
 	: TOKEN_DEPTHREAD '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_DepthRead; $$.value.intValue = $3; }
 	| TOKEN_DEPTHWRITE '=' TOKEN_BOOLEAN ';'					{ $$.type = OT_DepthWrite; $$.value.intValue = $3; }
 	| TOKEN_COMPAREFUNC '=' TOKEN_COMPFUNCVALUE ';'				{ $$.type = OT_CompareFunc; $$.value.intValue = $3; }
+	| TOKEN_DEPTHBIAS '=' TOKEN_FLOAT ';'						{ $$.type = OT_DepthBias; $$.value.floatValue = $3; }
+	| TOKEN_SDEPTHBIAS '=' TOKEN_FLOAT ';'						{ $$.type = OT_SDepthBias; $$.value.floatValue = $3; }
+	| TOKEN_DEPTHCLIP '=' TOKEN_BOOLEAN ';'						{ $$.type = OT_DepthClip; $$.value.intValue = $3; }
 	;
 	
 	/* Stencil state */