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
Height = 17
Caption = 'Low priority'
Enabled = False
TabOrder = 10
Visible = False
OnClick = chkThreadPriorityClick
end
object SaveDialog: TSaveDialog

View File

@ -1,6 +1,7 @@
{
Apophysis Copyright (C) 2001-2004 Mark Townsend
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
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
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
}
unit FormRender;
interface
@ -511,12 +513,15 @@ begin
Renderer := TRenderThread.Create;
assert(Renderer <> nil);
{
if chkThreadPriority.Checked then
Renderer.SetPriority(tpLower)
else
Renderer.SetPriority(tpNormal);
}
if chkThreadPriority.Visible then
begin
if chkThreadPriority.Checked then
Renderer.SetPriority(tpLower)
else
Renderer.SetPriority(tpNormal);
end;
Renderer.BitsPerSample := BitsPerSample;
if chkLimitMem.checked then
Renderer.MaxMem := MaxMemory;//StrToInt(cbMaxMemory.text);
@ -584,12 +589,15 @@ begin
Renderer := TRenderThread.Create;
assert(Renderer <> nil);
{
if chkThreadPriority.Checked then
Renderer.SetPriority(tpLower)
else
Renderer.SetPriority(tpNormal);
}
if chkThreadPriority.Visible then
begin
if chkThreadPriority.Checked then
Renderer.SetPriority(tpLower)
else
Renderer.SetPriority(tpNormal);
end;
Renderer.BitsPerSample := BitsPerSample;
if chkLimitMem.checked then
Renderer.MaxMem := MaxMemory;//StrToInt(cbMaxMemory.text);
@ -653,7 +661,7 @@ begin
ShowMemoryStatus;
Ratio := ImageWidth / ImageHeight;
chkSaveIncompleteRenders.Checked := SaveIncompleteRenders;
// chkThreadPriority.Checked := LowerRenderPriority;
chkThreadPriority.Checked := LowerRenderPriority;
end;
procedure TRenderForm.txtWidthChange(Sender: TObject);
@ -1054,16 +1062,13 @@ end;
procedure TRenderForm.chkThreadPriorityClick(Sender: TObject);
begin
{
LowerRenderPriority := chkThreadPriority.Checked;
if Assigned(Renderer) then begin
if LowerRenderPriority then
Renderer.SetPriority(tpLower)
else
Renderer.SetPriority(tpNormal);
end;
}
end;
end.

View File

@ -1,6 +1,7 @@
{
Apophysis Copyright (C) 2001-2004 Mark Townsend
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
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
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
}
unit Global;
interface
@ -151,7 +153,7 @@ var
SaveIncompleteRenders: boolean;
ShowRenderStats: boolean;
//LowerRenderPriority: boolean;
LowerRenderPriority: boolean;
SymmetryType: integer;
SymmetryOrder: integer;

View File

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

View File

@ -1,6 +1,7 @@
{
Apophysis Copyright (C) 2001-2004 Mark Townsend
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
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
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
}
unit Regstry;
interface
@ -408,7 +410,7 @@ begin
if Registry.ValueExists('MaxLum') then
begin
MaxLum := Registry.ReadInteger('MaxLum');
if MaxLum < 0 then MaxLum := 0;
if MaxLum <= 0 then MaxLum := 100;
end
else
begin
@ -541,15 +543,7 @@ begin
begin
SheepServer := 'http://v2d5.sheepserver.net/';
end;
{ if Registry.ValueExists('ResizeOnLoad') then
begin
ResizeOnLoad := Registry.ReadBool('ResizeOnLoad');
end
else
begin
ResizeOnLoad := False;
end;
} if Registry.ValueExists('ShowProgress') then
if Registry.ValueExists('ShowProgress') then
begin
ShowProgress := Registry.ReadBool('ShowProgress');
end else begin
@ -567,11 +561,11 @@ begin
end else begin
ShowRenderStats := false;
end;
// if Registry.ValueExists('LowerRenderPriority') then begin
// LowerRenderPriority := Registry.ReadBool('LowerRenderPriority');
// end else begin
// LowerRenderPriority := false;
// end;
if Registry.ValueExists('LowerRenderPriority') then begin
LowerRenderPriority := Registry.ReadBool('LowerRenderPriority');
end else begin
LowerRenderPriority := false;
end;
if Registry.ValueExists('PNGTransparency') then begin
PNGTransparency := Registry.ReadInteger('PNGTransparency');
@ -678,10 +672,9 @@ begin
SheepPW := '';
flam3Path := DefaultPath + 'flam3.exe';
SheepServer := 'http://v2d5.sheepserver.net/';
// ResizeOnLoad := False;
ShowProgress := true;
SaveIncompleteRenders := false;
// LowerRenderPriority := false;
LowerRenderPriority := false;
ShowRenderStats := false;
PNGTransparency := 1;
ShowTransparency := False;
@ -1130,7 +1123,6 @@ begin
Registry.WriteString('Renderer', flam3Path);
Registry.WriteString('Server', SheepServer);
Registry.WriteString('Pass', SheepPW);
// Registry.WriteBool('ResizeOnLoad', ResizeOnLoad);
Registry.WriteBool('ShowProgress', ShowProgress);
Registry.WriteBool('KeepBackground', KeepBackground);
Registry.WriteBool('PreserveQuality', PreserveQuality);
@ -1143,7 +1135,7 @@ begin
Registry.WriteBool('SaveIncompleteRenders', SaveIncompleteRenders);
Registry.WriteBool('ShowRenderStats', ShowRenderStats);
// Registry.WriteBool('LowerRenderPriority', LowerRenderPriority);
Registry.WriteBool('LowerRenderPriority', LowerRenderPriority);
Registry.WriteInteger('NrTreads', NrTreads);
Registry.WriteInteger('UseNrThreads', UseNrThreads);

View File

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

View File

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