Double Buffer with SSE 128 copy working
This commit is contained in:
parent
161cea4920
commit
b5582b1284
@ -55,25 +55,24 @@ end;
|
|||||||
procedure Flush(FrontBuffer : PVideoBuffer; BackBuffer : PVideoBuffer);
|
procedure Flush(FrontBuffer : PVideoBuffer; BackBuffer : PVideoBuffer);
|
||||||
var
|
var
|
||||||
idx : uint32;
|
idx : uint32;
|
||||||
Back,Front : PuInt64;
|
Back,Front : uint32;
|
||||||
BufferSize : uint32;
|
BufferSize : uint32;
|
||||||
|
|
||||||
const
|
const
|
||||||
COPY_WIDTH = 64;
|
//COPY_WIDTH = 64; //Use this for 64bit copies
|
||||||
|
COPY_WIDTH = 128; //Use this for SSE copies
|
||||||
|
|
||||||
begin
|
begin
|
||||||
//tracer.push_trace('doublebuffer.Flush.enter');
|
//tracer.push_trace('doublebuffer.Flush.enter');
|
||||||
if not(BackBuffer^.Initialized) then exit;
|
if not(BackBuffer^.Initialized) then exit;
|
||||||
if ((FrontBuffer^.Width > BackBuffer^.Width) or (FrontBuffer^.Height > BackBuffer^.Height)) then exit;
|
if ((FrontBuffer^.Width > BackBuffer^.Width) or (FrontBuffer^.Height > BackBuffer^.Height)) then exit;
|
||||||
Back:= PUint64(BackBuffer^.Location);
|
Back:= BackBuffer^.Location;
|
||||||
Front:= PuInt64(FrontBuffer^.Location);
|
Front:= FrontBuffer^.Location;
|
||||||
BufferSize:= ( ( BackBuffer^.Width * BackBuffer^.Height * BackBuffer^.BitsPerPixel) div COPY_WIDTH ) - 1;
|
BufferSize:= ( ( BackBuffer^.Width * BackBuffer^.Height * BackBuffer^.BitsPerPixel) div COPY_WIDTH ) - 1;
|
||||||
for idx:=0 to BufferSize do begin
|
for idx:=0 to BufferSize do begin
|
||||||
Front[idx]:= Back[idx];
|
//Front[idx]:= Back[idx];
|
||||||
// -- TODO: Get SSE working here for 128bit copies --
|
// -- TODO: Get SSE working here for 128bit copies --
|
||||||
// __SSE_128_memcpy(uint32(Front), uint32(Back));
|
__SSE_128_memcpy(Back + (idx * 16), Front + (idx * 16));
|
||||||
// Front:= PUint64(uint32(Front) + 16);
|
|
||||||
// Back:= PUint64(uint32(Back) + 16);
|
|
||||||
end;
|
end;
|
||||||
//tracer.push_trace('doublebuffer.Flush.exit');
|
//tracer.push_trace('doublebuffer.Flush.exit');
|
||||||
end;
|
end;
|
||||||
|
@ -131,9 +131,9 @@ end;
|
|||||||
procedure __SSE_128_memcpy(source : uint32; dest : uint32); assembler;
|
procedure __SSE_128_memcpy(source : uint32; dest : uint32); assembler;
|
||||||
asm
|
asm
|
||||||
MOV EAX, Source
|
MOV EAX, Source
|
||||||
MOV ECX, Dest
|
MOVAPS XMM1, [EAX]
|
||||||
MOVUPS XMM0, [EAX]
|
MOV EAX, Dest
|
||||||
MOVUPS [ECX], XMM0
|
MOVAPS [EAX], XMM1
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function switchendian16(b : uint16) : uint16;
|
function switchendian16(b : uint16) : uint16;
|
||||||
|
@ -127,6 +127,9 @@ var
|
|||||||
|
|
||||||
colour : TRGB32;
|
colour : TRGB32;
|
||||||
|
|
||||||
|
array1 : Array[0..255] of char;
|
||||||
|
array2 : Array[0..255] of char;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{ Serial Init }
|
{ Serial Init }
|
||||||
serial.init();
|
serial.init();
|
||||||
@ -210,6 +213,32 @@ begin
|
|||||||
video.enable('BASIC_DOUBLE_BUFFER');
|
video.enable('BASIC_DOUBLE_BUFFER');
|
||||||
colour:= color.white;
|
colour:= color.white;
|
||||||
|
|
||||||
|
// serial.sendHex(uint32(@array1[8]));
|
||||||
|
// serial.sendHex(uint32(@array2[8]));
|
||||||
|
// for i:=8 to 23 do begin
|
||||||
|
// array2[i]:= '?';
|
||||||
|
// end;
|
||||||
|
// array2[24]:= #0;
|
||||||
|
|
||||||
|
// array1[8]:= 'H';
|
||||||
|
// array1[9]:= 'e';
|
||||||
|
// array1[10]:= 'l';
|
||||||
|
// array1[11]:= 'l';
|
||||||
|
// array1[12]:= 'o';
|
||||||
|
// array1[13]:= 'w';
|
||||||
|
// array1[14]:= 'o';
|
||||||
|
// array1[15]:= 'r';
|
||||||
|
// array1[16]:= 'l';
|
||||||
|
// array1[17]:= 'd';
|
||||||
|
// array1[18]:= '1';
|
||||||
|
// array1[19]:= '2';
|
||||||
|
// array1[20]:= '3';
|
||||||
|
// array1[21]:= '4';
|
||||||
|
// array1[22]:= '5';
|
||||||
|
// array1[23]:= '!';
|
||||||
|
// __SSE_128_memcpy(uint32(@array1[8]), uint32(@array2[8]));
|
||||||
|
// serial.sendString(pchar(@array2[8]));
|
||||||
|
|
||||||
for i:=0 to video.frontBufferWidth-1 do begin
|
for i:=0 to video.frontBufferWidth-1 do begin
|
||||||
for z:=0 to video.frontBufferHeight-1 do begin
|
for z:=0 to video.frontBufferHeight-1 do begin
|
||||||
video.DrawPixel(i, z, colour);
|
video.DrawPixel(i, z, colour);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user