瀏覽代碼

* implemented some more unit tests

master
Bergmann89 10 年之前
父節點
當前提交
6235280062
共有 26 個文件被更改,包括 304 次插入40 次删除
  1. +0
    -17
      tests/ShaderFileTests.lpi
  2. +0
    -0
      tests/testfiles/code_IfElseElifEnd.shdr
  3. +15
    -0
      tests/testfiles/code_InlineFuncMultiReturn.shdr
  4. +12
    -0
      tests/testfiles/code_InlineFuncSingleReturn.shdr
  5. +0
    -0
      tests/testfiles/code_InlineIf.shdr
  6. +15
    -0
      tests/testfiles/code_InlineProc.shdr
  7. +14
    -0
      tests/testfiles/code_SimpleFunc.shdr
  8. +8
    -0
      tests/testfiles/code_SimpleInclude.shdr
  9. +15
    -0
      tests/testfiles/code_SimpleInclude_include.shdr
  10. +10
    -0
      tests/testfiles/code_SimpleMain.shdr
  11. +0
    -0
      tests/testfiles/result_IfElseElifEnd_0.shdr
  12. +0
    -0
      tests/testfiles/result_IfElseElifEnd_1.shdr
  13. +0
    -0
      tests/testfiles/result_IfElseElifEnd_2.shdr
  14. +15
    -0
      tests/testfiles/result_InlineFuncMultiReturn.shdr
  15. +10
    -0
      tests/testfiles/result_InlineFuncSingleReturn.shdr
  16. +0
    -0
      tests/testfiles/result_InlineIf_0.shdr
  17. +0
    -0
      tests/testfiles/result_InlineIf_1.shdr
  18. +13
    -0
      tests/testfiles/result_InlineProc.shdr
  19. +15
    -0
      tests/testfiles/result_SimpleFunc_0.shdr
  20. +6
    -0
      tests/testfiles/result_SimpleFunc_1.shdr
  21. +16
    -0
      tests/testfiles/result_SimpleInclude.shdr
  22. +11
    -0
      tests/testfiles/result_SimpleMain.shdr
  23. +97
    -9
      tests/uShaderFileTestCase.pas
  24. +26
    -10
      uengShaderGeneratorArgs.pas
  25. +3
    -1
      uengShaderPartIf.pas
  26. +3
    -3
      uengShaderPartParameter.pas

+ 0
- 17
tests/ShaderFileTests.lpi 查看文件

@@ -43,7 +43,6 @@
<Unit0>
<Filename Value="ShaderFileTests.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="ShaderFileTests"/>
</Unit0>
<Unit1>
<Filename Value="uShaderFileTestCase.pas"/>
@@ -53,22 +52,18 @@
<Unit2>
<Filename Value="..\uengShaderPart.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderPart"/>
</Unit2>
<Unit3>
<Filename Value="..\uengShaderFileTypes.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderFileTypes"/>
</Unit3>
<Unit4>
<Filename Value="..\uengShaderFile.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderFile"/>
</Unit4>
<Unit5>
<Filename Value="..\uengShaderGenerator.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderGenerator"/>
</Unit5>
<Unit6>
<Filename Value="..\uengShaderFileConstants.pas"/>
@@ -88,7 +83,6 @@
<Unit9>
<Filename Value="..\uengShaderFileParser.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderFileParser"/>
</Unit9>
<Unit10>
<Filename Value="..\uengShaderFileScope.pas"/>
@@ -103,27 +97,22 @@
<Unit12>
<Filename Value="..\uengShaderPartCall.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderPartCall"/>
</Unit12>
<Unit13>
<Filename Value="..\uengShaderPartClass.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderPartClass"/>
</Unit13>
<Unit14>
<Filename Value="..\uengShaderPartCntr.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderPartCntr"/>
</Unit14>
<Unit15>
<Filename Value="..\uengShaderPartComment.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderPartComment"/>
</Unit15>
<Unit16>
<Filename Value="..\uengShaderPartEcho.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderPartEcho"/>
</Unit16>
<Unit17>
<Filename Value="..\uengShaderPartIf.pas"/>
@@ -133,22 +122,18 @@
<Unit18>
<Filename Value="..\uengShaderPartInclude.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderPartInclude"/>
</Unit18>
<Unit19>
<Filename Value="..\uengShaderPartKeyValuePair.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderPartKeyValuePair"/>
</Unit19>
<Unit20>
<Filename Value="..\uengShaderPartMessage.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderPartMessage"/>
</Unit20>
<Unit21>
<Filename Value="..\uengShaderPartMeta.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderPartMeta"/>
</Unit21>
<Unit22>
<Filename Value="..\uengShaderPartParameter.pas"/>
@@ -163,12 +148,10 @@
<Unit24>
<Filename Value="..\uengShaderPartScope.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderPartScope"/>
</Unit24>
<Unit25>
<Filename Value="..\uengShaderPartText.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uengShaderPartText"/>
</Unit25>
<Unit26>
<Filename Value="..\uengShaderCodePart.pas"/>


tests/code_IfElseElifEnd.shdr → tests/testfiles/code_IfElseElifEnd.shdr 查看文件


+ 15
- 0
tests/testfiles/code_InlineFuncMultiReturn.shdr 查看文件

@@ -0,0 +1,15 @@
{$FUNC 'vec4' 'CalcColor' 'vec4' 'seed' $INLINE}
{$UNIFORM 'sampler2D' 'uTexture0'}
{$UNIFORM 'sampler2D' 'uTexture1'}
vec4 tex0 = texture2D(uTexture0, texCoord);
vec4 tex1 = texture2D(uTexture1, texCoord);
if (seed.r == 0.0)
return tex0 * tex1 * uColor;
else
return tex0 * tex1 * (-1.0 * uColor);
{$END}

{$MAIN}
{$UNIFORM 'vec4' 'uColor'}
gl_FragColor = {$CALL CalcColor 'uColor'};
{$END}

+ 12
- 0
tests/testfiles/code_InlineFuncSingleReturn.shdr 查看文件

@@ -0,0 +1,12 @@
{$FUNC 'vec4' 'CalcColor' 'vec4' 'seed' $INLINE}
{$UNIFORM 'sampler2D' 'uTexture0'}
{$UNIFORM 'sampler2D' 'uTexture1'}
vec4 tex0 = texture2D(uTexture0, texCoord);
vec4 tex1 = texture2D(uTexture1, texCoord);
return tex0 * tex1 * uColor;
{$END}

{$MAIN}
{$UNIFORM 'vec4' 'uColor'}
gl_FragColor = {$CALL CalcColor 'uColor'};
{$END}

tests/code_InlineIf.shdr → tests/testfiles/code_InlineIf.shdr 查看文件


+ 15
- 0
tests/testfiles/code_InlineProc.shdr 查看文件

@@ -0,0 +1,15 @@
{$PROC 'CalcColor' 'vec4' 'seed' 'out vec4' 'color' $INLINE}
{$UNIFORM 'sampler2D' 'uTexture0'}
{$UNIFORM 'sampler2D' 'uTexture1'}
color =
texture2D(uTexture0, texCoord) *
texture2D(uTexture1, texCoord) *
uColor;
{$END}

{$MAIN}
{$UNIFORM 'vec4' 'uColor'}
vec4 color;
{$CALL CalcColor 'uColor' 'color'}
gl_FragColor = color;
{$END}

+ 14
- 0
tests/testfiles/code_SimpleFunc.shdr 查看文件

@@ -0,0 +1,14 @@
{$PROPERTY TestProperty '0'}

{$FUNC 'vec4' 'CalcColor' 'vec4' 'seed'}
{$UNIFORM 'sampler2D' 'uTexture0'}
{$UNIFORM 'sampler2D' 'uTexture1'}
return texture2D(uTexture0, texCoord) *
texture2D(uTexture1, texCoord) *
seed;
{$END}

{$MAIN}
{$UNIFORM 'vec4' 'uColor'}
gl_FragColor = {$IF TestProperty}uColor{$ELSE}{$CALL CalcColor 'uColor'}{$END};
{$END}

+ 8
- 0
tests/testfiles/code_SimpleInclude.shdr 查看文件

@@ -0,0 +1,8 @@
{$INCLUDE './code_SimpleInclude_include.shdr'}

uniform vec4 uColor;

void main(void)
{
gl_FragColor = CalcColor(uColor);
}

+ 15
- 0
tests/testfiles/code_SimpleInclude_include.shdr 查看文件

@@ -0,0 +1,15 @@


uniform sampler2D uTexture0;
uniform sampler2D uTexture1;



vec4 CalcColor(vec4 seed)
{
return texture2D(uTexture0, texCoord) *
texture2D(uTexture1, texCoord) *
seed;
}



+ 10
- 0
tests/testfiles/code_SimpleMain.shdr 查看文件

@@ -0,0 +1,10 @@
{$MAIN}
{$UNIFORM 'sampler2D' 'uTexture0'}
{$UNIFORM 'sampler2D' 'uTexture1'}
{$UNIFORM 'vec4' 'uColor'}

gl_FragColor =
texture2D(uTexture0, texCoord) *
texture2D(uTexture1, texCoord) *
uColor;
{$END}

tests/result_IfElseElifEnd_0.shdr → tests/testfiles/result_IfElseElifEnd_0.shdr 查看文件


tests/result_IfElseElifEnd_1.shdr → tests/testfiles/result_IfElseElifEnd_1.shdr 查看文件


tests/result_IfElseElifEnd_2.shdr → tests/testfiles/result_IfElseElifEnd_2.shdr 查看文件


+ 15
- 0
tests/testfiles/result_InlineFuncMultiReturn.shdr 查看文件

@@ -0,0 +1,15 @@
uniform sampler2D uTexture0;
uniform sampler2D uTexture1;
uniform vec4 uColor;

void main(void)
{
vec4 CalcColor_ret0000;
vec4 tex0 = texture2D(uTexture0, texCoord);
vec4 tex1 = texture2D(uTexture1, texCoord);
if (uColor.r == 0.0)
CalcColor_ret0000 = tex0 * tex1 * uColor;
else
CalcColor_ret0000 = tex0 * tex1 * (-1.0 * uColor);
gl_FragColor = CalcColor_ret0000;
}

+ 10
- 0
tests/testfiles/result_InlineFuncSingleReturn.shdr 查看文件

@@ -0,0 +1,10 @@
uniform sampler2D uTexture0;
uniform sampler2D uTexture1;
uniform vec4 uColor;

void main(void)
{
vec4 tex0 = texture2D(uTexture0, texCoord);
vec4 tex1 = texture2D(uTexture1, texCoord);
gl_FragColor = (tex0 * tex1 * uColor);
}

tests/result_InlineIf_0.shdr → tests/testfiles/result_InlineIf_0.shdr 查看文件


tests/result_InlineIf_1.shdr → tests/testfiles/result_InlineIf_1.shdr 查看文件


+ 13
- 0
tests/testfiles/result_InlineProc.shdr 查看文件

@@ -0,0 +1,13 @@
uniform sampler2D uTexture0;
uniform sampler2D uTexture1;
uniform vec4 uColor;

void main(void)
{
vec4 color;
color =
texture2D(uTexture0, texCoord) *
texture2D(uTexture1, texCoord) *
uColor;
gl_FragColor = color;
}

+ 15
- 0
tests/testfiles/result_SimpleFunc_0.shdr 查看文件

@@ -0,0 +1,15 @@
uniform sampler2D uTexture0;
uniform sampler2D uTexture1;
uniform vec4 uColor;

vec4 CalcColor(vec4 seed)
{
return texture2D(uTexture0, texCoord) *
texture2D(uTexture1, texCoord) *
seed;
}

void main(void)
{
gl_FragColor = CalcColor(uColor);
}

+ 6
- 0
tests/testfiles/result_SimpleFunc_1.shdr 查看文件

@@ -0,0 +1,6 @@
uniform vec4 uColor;

void main(void)
{
gl_FragColor = uColor;
}

+ 16
- 0
tests/testfiles/result_SimpleInclude.shdr 查看文件

@@ -0,0 +1,16 @@
uniform sampler2D uTexture0;
uniform sampler2D uTexture1;

vec4 CalcColor(vec4 seed)
{
return texture2D(uTexture0, texCoord) *
texture2D(uTexture1, texCoord) *
seed;
}

uniform vec4 uColor;

void main(void)
{
gl_FragColor = CalcColor(uColor);
}

+ 11
- 0
tests/testfiles/result_SimpleMain.shdr 查看文件

@@ -0,0 +1,11 @@
uniform sampler2D uTexture0;
uniform sampler2D uTexture1;
uniform vec4 uColor;

void main(void)
{
gl_FragColor =
texture2D(uTexture0, texCoord) *
texture2D(uTexture1, texCoord) *
uColor;
}

+ 97
- 9
tests/uShaderFileTestCase.pas 查看文件

@@ -10,11 +10,37 @@ uses

type
TShaderFileTestCase = class(TTestCase)
private
protected
procedure DoTest(const aCode: String; const aValue: Integer; const aResult: String);
procedure DoTest(const aCode: String; const aResult: String);
end;

TTestCase_IfElseElifEnd = class(TShaderFileTestCase)
published
procedure IfElseElifEnd;
procedure InlineIf;
procedure IfElifElseEnd0;
procedure IfElifElseEnd1;
procedure IfElifElseEnd2;

procedure InlineIf0;
procedure InlineIf1;
end;

TTestCase_FuncProcMain = class(TShaderFileTestCase)
published
procedure SimpleMain;

procedure SimpleFunc0;
procedure SimpleFunc1;

procedure InlineProc;

procedure InlineFuncSingleReturn;
procedure InlineFuncMultiReturn;
end;

TTestCase_Include = class(TShaderFileTestCase)
published
procedure SimpleInclude;
end;

implementation
@@ -23,7 +49,7 @@ uses
Forms;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TShaderFileTestCase///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TShaderFileTestCase///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TShaderFileTestCase.DoTest(const aCode: String; const aValue: Integer; const aResult: String);
var
@@ -36,12 +62,12 @@ begin
code := TengShaderCode.Create;
sl := TStringList.Create;
try
shdr.LoadFromFile(ExpandFileName(aCode));
shdr.LoadFromFile(ExpandFileName('testfiles\' + aCode));
gen := shdr.Generator[''];
if (gen.PropertyCount > 0) then
gen.PropertyByIndex[0] := aValue;
gen.GenerateCode(code);
sl.LoadFromFile(ExpandFileName(aResult));
sl.LoadFromFile(ExpandFileName('testfiles\' + aResult));
AssertEquals(sl.Text, code.Text);
finally
FreeAndNil(sl);
@@ -50,23 +76,85 @@ begin
end;
end;

procedure TShaderFileTestCase.DoTest(const aCode: String; const aResult: String);
begin
DoTest(aCode, 0, aResult);
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TTestCase_IfElseElifEnd///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TShaderFileTestCase.IfElseElifEnd;
procedure TTestCase_IfElseElifEnd.IfElifElseEnd0;
begin
DoTest('code_IfElseElifEnd.shdr', 0, 'result_IfElseElifEnd_0.shdr');
end;

procedure TTestCase_IfElseElifEnd.IfElifElseEnd1;
begin
DoTest('code_IfElseElifEnd.shdr', 1, 'result_IfElseElifEnd_1.shdr');
end;

procedure TTestCase_IfElseElifEnd.IfElifElseEnd2;
begin
DoTest('code_IfElseElifEnd.shdr', 2, 'result_IfElseElifEnd_2.shdr');
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TShaderFileTestCase.InlineIf;
procedure TTestCase_IfElseElifEnd.InlineIf0;
begin
DoTest('code_InlineIf.shdr', 0, 'result_InlineIf_0.shdr');
end;

procedure TTestCase_IfElseElifEnd.InlineIf1;
begin
DoTest('code_InlineIf.shdr', 1, 'result_InlineIf_1.shdr');
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TTestCase_MainSimple//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TTestCase_FuncProcMain.SimpleMain;
begin
DoTest('code_SimpleMain.shdr', 'result_SimpleMain.shdr');
end;

procedure TTestCase_FuncProcMain.SimpleFunc0;
begin
DoTest('code_SimpleFunc.shdr', 0, 'result_SimpleFunc_0.shdr');
end;

procedure TTestCase_FuncProcMain.SimpleFunc1;
begin
DoTest('code_SimpleFunc.shdr', 1, 'result_SimpleFunc_1.shdr');
end;

procedure TTestCase_FuncProcMain.InlineProc;
begin
DoTest('code_InlineProc.shdr', 'result_InlineProc.shdr');
end;

procedure TTestCase_FuncProcMain.InlineFuncSingleReturn;
begin
DoTest('code_InlineFuncSingleReturn.shdr', 'result_InlineFuncSingleReturn.shdr');
end;

procedure TTestCase_FuncProcMain.InlineFuncMultiReturn;
begin
DoTest('code_InlineFuncMultiReturn.shdr', 'result_InlineFuncMultiReturn.shdr');
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TTestCase_Include/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TTestCase_Include.SimpleInclude;
begin
DoTest('code_SimpleInclude.shdr', 0, 'result_SimpleInclude.shdr');
end;

initialization
RegisterTest(TShaderFileTestCase);
RegisterTest(TTestCase_IfElseElifEnd);
RegisterTest(TTestCase_FuncProcMain);
RegisterTest(TTestCase_Include);

end.


+ 26
- 10
uengShaderGeneratorArgs.pas 查看文件

@@ -37,12 +37,13 @@ type
TengShaderGeneratorArgs = class(TObject)
private type
TengGeneratorToken = (
gtNormal = 0, // normal text
gtLineBreak = 1, // line break
gtCommandEnd = 2, // command end (like ';')
gtBlockBegin = 3, // code block begin (to calculate indent)
gtBlockEnd = 4, // code block end (to calculate indent)
gtToken = 5 // code token (like '$INCLUDE' or '$IF')
gtNormal = 0, // normal text
gtLineBreak = 1, // line break
gtCommandEnd = 2, // command end (like ';')
gtBlockBegin = 3, // code block begin (to calculate indent)
gtBlockEnd = 4, // code block end (to calculate indent)
gtAppendToPrev = 5, // append current line to prev line
gtToken = 6 // code token (like '$INCLUDE' or '$IF')
);

TCodePart = class(TObject)
@@ -121,7 +122,8 @@ type
function AddCommandEnd(const aToken: String): TengShaderGeneratorArgs;
function AddLineBreak: TengShaderGeneratorArgs;
function BeginBlock(const aIndent: Integer = 0): TengShaderGeneratorArgs;
function EndBlock: TengShaderGeneratorArgs;
function EndBlock(const aCanAppend: Boolean = false): TengShaderGeneratorArgs;
function AppendToPrevLine: TengShaderGeneratorArgs;

procedure AddMeta(const aMeta: TengMetaData);
procedure AddParameter(const aParam: TengShaderPart);
@@ -172,6 +174,7 @@ begin
gtBlockBegin: result := format('[B%d]', [fIndent]);
gtBlockEnd: result := '[E]';
gtToken: result := '[T' + fText + ']';
gtAppendToPrev: result := '[A]';
else
result := '[' + IntToStr(Integer(fToken)) + ']' + fText
end;
@@ -317,11 +320,13 @@ var

gtBlockEnd: begin
IndentBlock(FirstLineIndex, aIndent);
if (Trim(line) = '') and not (gfPrevIsEmpty in f) then
include(f, gfAddToPrev);
exit;
end;

gtAppendToPrev: begin
if (Trim(line) = '') and not (gfPrevIsEmpty in f) then
include(f, gfAddToPrev);
end;
else
s := cp.Code;
line := line + s;
@@ -329,6 +334,7 @@ var
end;
end;

{$IFDEF DEBUG}
procedure GenerateDebugCode;
var
cp: TCodePart;
@@ -346,12 +352,15 @@ var
FreeAndNil(sl);
end;
end;
{$ENDIF}

begin
i := 0;
f := [gfPrevIsEmpty, gfCodeIsEmpty];
line := '';
{$IFDEF DEBUG}
GenerateDebugCode;
{$ENDIF}
ProgressBlock(0);
end;

@@ -590,12 +599,19 @@ begin
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function TengShaderGeneratorArgs.EndBlock: TengShaderGeneratorArgs;
function TengShaderGeneratorArgs.EndBlock(const aCanAppend: Boolean): TengShaderGeneratorArgs;
begin
fCode.Last.Items.Add(TCodePart.Create(gtBlockEnd, ''));
result := self;
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function TengShaderGeneratorArgs.AppendToPrevLine: TengShaderGeneratorArgs;
begin
fCode.Last.Items.Add(TCodePart.Create(gtAppendToPrev, ''));
result := self;
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TengShaderGeneratorArgs.AddMeta(const aMeta: TengMetaData);
begin


+ 3
- 1
uengShaderPartIf.pas 查看文件

@@ -166,8 +166,10 @@ begin
if b
then p := fIfPart
else p := fElsePart;
if Assigned(p) then
if Assigned(p) then begin
p.GenerateCodeIntern(aArgs);
aArgs.AppendToPrevLine;
end;
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


+ 3
- 3
uengShaderPartParameter.pas 查看文件

@@ -168,7 +168,7 @@ procedure TengShaderPartVar.GenerateCodeIntern(const aArgs: TengShaderGeneratorA
begin
inherited GenerateCodeIntern(aArgs);
if (gfGenerateParameterCode in aArgs.Flags) then begin
aArgs.AddText(format('%*s %s', [aArgs.MaxParameterLength, fType, fName]));
aArgs.AddText(format('%-*s %s', [aArgs.MaxParameterLength, fType, fName]));
if (fDefaultValue <> '') then
aArgs.AddText(' = ' + fDefaultValue);
aArgs.AddCommandEnd(';');
@@ -188,7 +188,7 @@ procedure TengShaderPartVarying.GenerateCodeIntern(const aArgs: TengShaderGenera
begin
inherited GenerateCodeIntern(aArgs);
if (gfGenerateParameterCode in aArgs.Flags) then
aArgs.AddText(Format('varying %*s %s;', [aArgs.MaxParameterLength, fType, fName]));
aArgs.AddText(Format('varying %-*s %s;', [aArgs.MaxParameterLength, fType, fName]));
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -204,7 +204,7 @@ procedure TengShaderPartUniform.GenerateCodeIntern(const aArgs: TengShaderGenera
begin
inherited GenerateCodeIntern(aArgs);
if (gfGenerateParameterCode in aArgs.Flags) then
aArgs.AddText(Format('uniform %*s %s;', [aArgs.MaxParameterLength, fType, fName]));
aArgs.AddText(Format('uniform %-*s %s;', [aArgs.MaxParameterLength, fType, fName]));
end;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


Loading…
取消
儲存