thread priority control enabled. use at your own risk :)

This commit is contained in:
zueuk 2008-10-10 13:25:39 +00:00
parent 16ef13bd18
commit 2f453fc47b
7 changed files with 46 additions and 45 deletions

View File

@ -568,9 +568,7 @@ object RenderForm: TRenderForm
Width = 73 Width = 73
Height = 17 Height = 17
Caption = 'Low priority' Caption = 'Low priority'
Enabled = False
TabOrder = 10 TabOrder = 10
Visible = False
OnClick = chkThreadPriorityClick OnClick = chkThreadPriorityClick
end end
object SaveDialog: TSaveDialog object SaveDialog: TSaveDialog

View File

@ -1,6 +1,7 @@
{ {
Apophysis Copyright (C) 2001-2004 Mark Townsend Apophysis Copyright (C) 2001-2004 Mark Townsend
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Boris, Peter Sdobnov Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Boris, Peter Sdobnov
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -16,6 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
} }
unit FormRender; unit FormRender;
interface interface
@ -511,12 +513,15 @@ begin
Renderer := TRenderThread.Create; Renderer := TRenderThread.Create;
assert(Renderer <> nil); assert(Renderer <> nil);
{
if chkThreadPriority.Checked then if chkThreadPriority.Visible then
Renderer.SetPriority(tpLower) begin
else if chkThreadPriority.Checked then
Renderer.SetPriority(tpNormal); Renderer.SetPriority(tpLower)
} else
Renderer.SetPriority(tpNormal);
end;
Renderer.BitsPerSample := BitsPerSample; Renderer.BitsPerSample := BitsPerSample;
if chkLimitMem.checked then if chkLimitMem.checked then
Renderer.MaxMem := MaxMemory;//StrToInt(cbMaxMemory.text); Renderer.MaxMem := MaxMemory;//StrToInt(cbMaxMemory.text);
@ -584,12 +589,15 @@ begin
Renderer := TRenderThread.Create; Renderer := TRenderThread.Create;
assert(Renderer <> nil); assert(Renderer <> nil);
{
if chkThreadPriority.Checked then if chkThreadPriority.Visible then
Renderer.SetPriority(tpLower) begin
else if chkThreadPriority.Checked then
Renderer.SetPriority(tpNormal); Renderer.SetPriority(tpLower)
} else
Renderer.SetPriority(tpNormal);
end;
Renderer.BitsPerSample := BitsPerSample; Renderer.BitsPerSample := BitsPerSample;
if chkLimitMem.checked then if chkLimitMem.checked then
Renderer.MaxMem := MaxMemory;//StrToInt(cbMaxMemory.text); Renderer.MaxMem := MaxMemory;//StrToInt(cbMaxMemory.text);
@ -653,7 +661,7 @@ begin
ShowMemoryStatus; ShowMemoryStatus;
Ratio := ImageWidth / ImageHeight; Ratio := ImageWidth / ImageHeight;
chkSaveIncompleteRenders.Checked := SaveIncompleteRenders; chkSaveIncompleteRenders.Checked := SaveIncompleteRenders;
// chkThreadPriority.Checked := LowerRenderPriority; chkThreadPriority.Checked := LowerRenderPriority;
end; end;
procedure TRenderForm.txtWidthChange(Sender: TObject); procedure TRenderForm.txtWidthChange(Sender: TObject);
@ -1054,16 +1062,13 @@ end;
procedure TRenderForm.chkThreadPriorityClick(Sender: TObject); procedure TRenderForm.chkThreadPriorityClick(Sender: TObject);
begin begin
{
LowerRenderPriority := chkThreadPriority.Checked; LowerRenderPriority := chkThreadPriority.Checked;
if Assigned(Renderer) then begin if Assigned(Renderer) then begin
if LowerRenderPriority then if LowerRenderPriority then
Renderer.SetPriority(tpLower) Renderer.SetPriority(tpLower)
else else
Renderer.SetPriority(tpNormal); Renderer.SetPriority(tpNormal);
end; end;
}
end; end;
end. end.

View File

@ -1,6 +1,7 @@
{ {
Apophysis Copyright (C) 2001-2004 Mark Townsend Apophysis Copyright (C) 2001-2004 Mark Townsend
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -16,6 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
} }
unit Global; unit Global;
interface interface
@ -151,7 +153,7 @@ var
SaveIncompleteRenders: boolean; SaveIncompleteRenders: boolean;
ShowRenderStats: boolean; ShowRenderStats: boolean;
//LowerRenderPriority: boolean; LowerRenderPriority: boolean;
SymmetryType: integer; SymmetryType: integer;
SymmetryOrder: integer; SymmetryOrder: integer;

View File

@ -1219,7 +1219,7 @@ object OptionsForm: TOptionsForm
Height = 21 Height = 21
HelpContext = 1036 HelpContext = 1036
TabOrder = 6 TabOrder = 6
Text = '0' Text = '1'
OnChange = txtMinLumChange OnChange = txtMinLumChange
end end
object txtMaxLum: TEdit object txtMaxLum: TEdit
@ -1303,6 +1303,8 @@ object OptionsForm: TOptionsForm
Height = 21 Height = 21
HelpContext = 1036 HelpContext = 1036
Associate = txtMinLum Associate = txtMinLum
Min = 1
Position = 1
TabOrder = 14 TabOrder = 14
end end
object udMaxLum: TUpDown object udMaxLum: TUpDown

View File

@ -1,6 +1,7 @@
{ {
Apophysis Copyright (C) 2001-2004 Mark Townsend Apophysis Copyright (C) 2001-2004 Mark Townsend
Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov Apophysis Copyright (C) 2005-2006 Ronald Hordijk, Piotr Borys, Peter Sdobnov
Apophysis Copyright (C) 2007-2008 Piotr Borys, Peter Sdobnov
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -16,6 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
} }
unit Regstry; unit Regstry;
interface interface
@ -408,7 +410,7 @@ begin
if Registry.ValueExists('MaxLum') then if Registry.ValueExists('MaxLum') then
begin begin
MaxLum := Registry.ReadInteger('MaxLum'); MaxLum := Registry.ReadInteger('MaxLum');
if MaxLum < 0 then MaxLum := 0; if MaxLum <= 0 then MaxLum := 100;
end end
else else
begin begin
@ -541,15 +543,7 @@ begin
begin begin
SheepServer := 'http://v2d5.sheepserver.net/'; SheepServer := 'http://v2d5.sheepserver.net/';
end; end;
{ if Registry.ValueExists('ResizeOnLoad') then if Registry.ValueExists('ShowProgress') then
begin
ResizeOnLoad := Registry.ReadBool('ResizeOnLoad');
end
else
begin
ResizeOnLoad := False;
end;
} if Registry.ValueExists('ShowProgress') then
begin begin
ShowProgress := Registry.ReadBool('ShowProgress'); ShowProgress := Registry.ReadBool('ShowProgress');
end else begin end else begin
@ -567,11 +561,11 @@ begin
end else begin end else begin
ShowRenderStats := false; ShowRenderStats := false;
end; end;
// if Registry.ValueExists('LowerRenderPriority') then begin if Registry.ValueExists('LowerRenderPriority') then begin
// LowerRenderPriority := Registry.ReadBool('LowerRenderPriority'); LowerRenderPriority := Registry.ReadBool('LowerRenderPriority');
// end else begin end else begin
// LowerRenderPriority := false; LowerRenderPriority := false;
// end; end;
if Registry.ValueExists('PNGTransparency') then begin if Registry.ValueExists('PNGTransparency') then begin
PNGTransparency := Registry.ReadInteger('PNGTransparency'); PNGTransparency := Registry.ReadInteger('PNGTransparency');
@ -678,10 +672,9 @@ begin
SheepPW := ''; SheepPW := '';
flam3Path := DefaultPath + 'flam3.exe'; flam3Path := DefaultPath + 'flam3.exe';
SheepServer := 'http://v2d5.sheepserver.net/'; SheepServer := 'http://v2d5.sheepserver.net/';
// ResizeOnLoad := False;
ShowProgress := true; ShowProgress := true;
SaveIncompleteRenders := false; SaveIncompleteRenders := false;
// LowerRenderPriority := false; LowerRenderPriority := false;
ShowRenderStats := false; ShowRenderStats := false;
PNGTransparency := 1; PNGTransparency := 1;
ShowTransparency := False; ShowTransparency := False;
@ -1130,7 +1123,6 @@ begin
Registry.WriteString('Renderer', flam3Path); Registry.WriteString('Renderer', flam3Path);
Registry.WriteString('Server', SheepServer); Registry.WriteString('Server', SheepServer);
Registry.WriteString('Pass', SheepPW); Registry.WriteString('Pass', SheepPW);
// Registry.WriteBool('ResizeOnLoad', ResizeOnLoad);
Registry.WriteBool('ShowProgress', ShowProgress); Registry.WriteBool('ShowProgress', ShowProgress);
Registry.WriteBool('KeepBackground', KeepBackground); Registry.WriteBool('KeepBackground', KeepBackground);
Registry.WriteBool('PreserveQuality', PreserveQuality); Registry.WriteBool('PreserveQuality', PreserveQuality);
@ -1143,7 +1135,7 @@ begin
Registry.WriteBool('SaveIncompleteRenders', SaveIncompleteRenders); Registry.WriteBool('SaveIncompleteRenders', SaveIncompleteRenders);
Registry.WriteBool('ShowRenderStats', ShowRenderStats); Registry.WriteBool('ShowRenderStats', ShowRenderStats);
// Registry.WriteBool('LowerRenderPriority', LowerRenderPriority); Registry.WriteBool('LowerRenderPriority', LowerRenderPriority);
Registry.WriteInteger('NrTreads', NrTreads); Registry.WriteInteger('NrTreads', NrTreads);
Registry.WriteInteger('UseNrThreads', UseNrThreads); Registry.WriteInteger('UseNrThreads', UseNrThreads);

View File

@ -169,13 +169,13 @@ begin
end; end;
procedure TBaseMTRenderer.SetThreadPriority(p: TThreadPriority); procedure TBaseMTRenderer.SetThreadPriority(p: TThreadPriority);
//var var
// i: integer; i: integer;
begin begin
inherited; inherited;
//for i := 0 to High(WorkingThreads) do for i := 0 to High(WorkingThreads) do
// WorkingThreads[i].Priority := p; WorkingThreads[i].Priority := p;
end; end;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -183,7 +183,9 @@ function TBaseMTRenderer.NewThread: TBucketFillerThread;
begin begin
Result := TBucketFillerThread.Create(fcp); Result := TBucketFillerThread.Create(fcp);
assert(Result<>nil); assert(Result<>nil);
Result.Priority := tpLower; //FThreadPriority;
if FThreadPriority <> tpNormal then
Result.Priority := {tpLower;} FThreadPriority;
if FCP.FAngle = 0 then if FCP.FAngle = 0 then
Result.AddPointsProc := self.AddPointsToBuckets Result.AddPointsProc := self.AddPointsToBuckets

View File

@ -279,7 +279,7 @@ end;
procedure TRenderThread.SetPriority(p: TThreadPriority); procedure TRenderThread.SetPriority(p: TThreadPriority);
begin begin
Priority := p; //! Priority := p;
if assigned(FRenderer) then if assigned(FRenderer) then
FRenderer.SetThreadPriority(p); FRenderer.SetThreadPriority(p);