void LegacyConverter::visit(FunctionCall &call)
{
- if(call.name=="texture" && !call.declaration && !supports_unified_sampling_functions())
+ if(call.name=="texture")
{
+ string sampler_type;
+ type = string();
NodeArray<Expression>::iterator i = call.arguments.begin();
if(i!=call.arguments.end())
{
(*i)->visit(*this);
- if(type=="sampler1D")
+ sampler_type = type;
+
+ for(; i!=call.arguments.end(); ++i)
+ (*i)->visit(*this);
+ }
+
+ if(!supports_unified_sampling_functions())
+ {
+ if(sampler_type=="sampler1D")
call.name = "texture1D";
- else if(type=="sampler2D")
+ else if(sampler_type=="sampler2D")
call.name = "texture2D";
- else if(type=="sampler3D")
+ else if(sampler_type=="sampler3D")
call.name = "texture3D";
- else if(type=="samplerCube")
+ else if(sampler_type=="samplerCube")
call.name = "textureCube";
- else if(type=="sampler1DShadow")
+ else if(sampler_type=="sampler1DShadow")
call.name = "shadow1D";
- else if(type=="sampler2DShadow")
+ else if(sampler_type=="sampler2DShadow")
call.name = "shadow2D";
- else if(type=="sampler1DArray")
+ else if(sampler_type=="sampler1DArray")
{
check_extension(EXT_texture_array);
call.name = "texture1DArray";
}
- else if(type=="sampler2DArray")
+ else if(sampler_type=="sampler2DArray")
{
check_extension(EXT_texture_array);
call.name = "texture2DArray";
}
- else if(type=="sampler1DArrayShadow")
+ else if(sampler_type=="sampler1DArrayShadow")
{
check_extension(EXT_texture_array);
call.name = "shadow1DArray";
}
- else if(type=="sampler2DArrayShadow")
+ else if(sampler_type=="sampler2DArrayShadow")
{
check_extension(EXT_texture_array);
call.name = "shadow2DArray";
}
-
- for(; i!=call.arguments.end(); ++i)
- (*i)->visit(*this);
}
}
else