Explorar o código

Uniforms in a uniform block marked as internal will also be internal

BearishSun %!s(int64=8) %!d(string=hai) anos
pai
achega
1a0c155623

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

@@ -32,7 +32,6 @@ technique Resolve
 
 
 		#ifdef ENABLE_MSAA
 		#ifdef ENABLE_MSAA
 		
 		
-		[internal]
 		cbuffer FragParams
 		cbuffer FragParams
 		{
 		{
 			int gNumSamples;
 			int gNumSamples;

+ 26 - 9
Source/BansheeSL/Source/BsSLFXCompiler.cpp

@@ -486,20 +486,37 @@ namespace bs
 			}
 			}
 			case Xsc::Reflection::UniformType::Variable: 
 			case Xsc::Reflection::UniformType::Variable: 
 			{
 			{
-				GpuParamDataType type = ReflTypeToDataType((Xsc::Reflection::DataType)entry.baseType);
-				if((entry.flags & Xsc::Reflection::Uniform::Flags::Color) != 0 && 
-				   (entry.baseType == GPDT_FLOAT3 || entry.baseType == GPDT_FLOAT4))
+				bool isBlockInternal = false;
+				if(entry.uniformBlock != -1)
 				{
 				{
-					type = GPDT_COLOR;
+					std::string blockName = reflData.constantBuffers[entry.uniformBlock].ident;
+					for (auto& uniform : reflData.uniforms)
+					{
+						if (uniform.type == Xsc::Reflection::UniformType::UniformBuffer && uniform.ident == blockName)
+						{
+							isBlockInternal = (uniform.flags & Xsc::Reflection::Uniform::Flags::Internal) != 0;
+							break;
+						}
+					}
 				}
 				}
 
 
-				if (entry.defaultValue == -1)
-					desc.addParameter(ident, ident, type);
-				else
+				if (!isBlockInternal)
 				{
 				{
-					const Xsc::Reflection::DefaultValue& defVal = reflData.defaultValues[entry.defaultValue];
+					GpuParamDataType type = ReflTypeToDataType((Xsc::Reflection::DataType)entry.baseType);
+					if ((entry.flags & Xsc::Reflection::Uniform::Flags::Color) != 0 &&
+						(entry.baseType == GPDT_FLOAT3 || entry.baseType == GPDT_FLOAT4))
+					{
+						type = GPDT_COLOR;
+					}
 
 
-					desc.addParameter(ident, ident, type, StringID::NONE, 1, 0, (UINT8*)defVal.matrix);
+					if (entry.defaultValue == -1)
+						desc.addParameter(ident, ident, type);
+					else
+					{
+						const Xsc::Reflection::DefaultValue& defVal = reflData.defaultValues[entry.defaultValue];
+
+						desc.addParameter(ident, ident, type, StringID::NONE, 1, 0, (UINT8*)defVal.matrix);
+					}
 				}
 				}
 			}
 			}
 				break;
 				break;