mirror of https://github.com/red-prig/fpPS4.git
This commit is contained in:
parent
283aacf56b
commit
99c8ce22b4
File diff suppressed because it is too large
Load Diff
|
@ -305,6 +305,19 @@ begin
|
|||
Result:=0;
|
||||
end;
|
||||
|
||||
var // y x
|
||||
element_index_table_32:array[0..7,0..7] of Byte=
|
||||
(
|
||||
( 0, 4, 8, 12, 32, 36, 40, 44),
|
||||
( 16, 20, 24, 28, 48, 52, 56, 60),
|
||||
( 64, 68, 72, 76, 96, 100, 104, 108),
|
||||
( 80, 84, 88, 92, 112, 116, 120, 124),
|
||||
(128, 132, 136, 140, 160, 164, 168, 172),
|
||||
(144, 148, 152, 156, 176, 180, 184, 188),
|
||||
(192, 196, 200, 204, 224, 228, 232, 236),
|
||||
(208, 212, 216, 220, 240, 244, 248, 252)
|
||||
);
|
||||
|
||||
function getTiledElementByteOffset_32(PITCH,x,y:DWORD):QWORD;
|
||||
var
|
||||
element_index:DWORD;
|
||||
|
@ -312,12 +325,14 @@ var
|
|||
total_offset:QWORD;
|
||||
begin
|
||||
//getElementIndex [0..5]
|
||||
element_index:= ( (x ) and 1) shl 2;
|
||||
element_index:=element_index or ( (x shr 1) and 1) shl 3;
|
||||
element_index:=element_index or ( (y ) and 1) shl 4;
|
||||
element_index:=element_index or ( (x shr 2) and 1) shl 5;
|
||||
element_index:=element_index or ( (y shr 1) and 1) shl 6;
|
||||
element_index:=element_index or ( (y shr 2) and 1) shl 7;
|
||||
//element_index:= ( (x ) and 1) shl 2;
|
||||
//element_index:=element_index or ( (x shr 1) and 1) shl 3;
|
||||
//element_index:=element_index or ( (y ) and 1) shl 4;
|
||||
//element_index:=element_index or ( (x shr 2) and 1) shl 5;
|
||||
//element_index:=element_index or ( (y shr 1) and 1) shl 6;
|
||||
//element_index:=element_index or ( (y shr 2) and 1) shl 7;
|
||||
|
||||
element_index:=element_index_table_32[y and 7,x and 7];
|
||||
|
||||
//getPipeIndex [6..8]
|
||||
pipe:= ( ((x shr 3) xor (y shr 3) xor (x shr 4)) and 1) shl 8;
|
||||
|
@ -343,12 +358,14 @@ var
|
|||
total_offset:QWORD;
|
||||
begin
|
||||
//getElementIndex [0..5]
|
||||
element_index:= ( (x ) and 1) shl 2;
|
||||
element_index:=element_index or ( (x shr 1) and 1) shl 3;
|
||||
element_index:=element_index or ( (y ) and 1) shl 4;
|
||||
element_index:=element_index or ( (x shr 2) and 1) shl 5;
|
||||
element_index:=element_index or ( (y shr 1) and 1) shl 6;
|
||||
element_index:=element_index or ( (y shr 2) and 1) shl 7;
|
||||
//element_index:= ( (x ) and 1) shl 2;
|
||||
//element_index:=element_index or ( (x shr 1) and 1) shl 3;
|
||||
//element_index:=element_index or ( (y ) and 1) shl 4;
|
||||
//element_index:=element_index or ( (x shr 2) and 1) shl 5;
|
||||
//element_index:=element_index or ( (y shr 1) and 1) shl 6;
|
||||
//element_index:=element_index or ( (y shr 2) and 1) shl 7;
|
||||
|
||||
element_index:=element_index_table_32[y and 7,x and 7];
|
||||
|
||||
//getPipeIndex [6..9]
|
||||
pipe:= ( ((x shr 3) xor (y shr 3) xor (x shr 4)) and 1) shl 8;
|
||||
|
|
|
@ -131,7 +131,7 @@ begin
|
|||
if (m_height=0) then m_height:=1;
|
||||
end;
|
||||
|
||||
Result:=(Result+255) and (not Ptruint(255));
|
||||
//Result:=(Result+255) and (not Ptruint(255));
|
||||
|
||||
Result:=Result*
|
||||
image.key.params.depth*
|
||||
|
@ -385,7 +385,7 @@ var
|
|||
|
||||
m_bytePerElement:Ptruint;
|
||||
m_level,m_width,m_height:Ptruint;
|
||||
m_padwidth,m_padheight:Ptruint;
|
||||
//m_padwidth,m_padheight:Ptruint;
|
||||
//m_slice:Ptruint;
|
||||
|
||||
m_full_linear_size:Ptruint;
|
||||
|
@ -425,7 +425,10 @@ begin
|
|||
|
||||
m_bytePerElement:=getFormatSize(image.key.cformat);
|
||||
|
||||
tiler.init_surface(m_bytePerElement*8,image.key.params.tiling.idx,image.key.params.tiling.alt);
|
||||
tiler.init_surface(m_bytePerElement,
|
||||
ord(IsTexelFormat(image.key.cformat)),
|
||||
image.key.params.tiling.idx,
|
||||
image.key.params.tiling.alt);
|
||||
|
||||
//TvBuffer
|
||||
|
||||
|
@ -437,44 +440,8 @@ begin
|
|||
|
||||
while (m_level>0) do
|
||||
begin
|
||||
m_padwidth :=Get1dThinAlignWidth(m_bytePerElement,m_width);
|
||||
m_padheight:=(m_height+7) and (not 7);
|
||||
tiler.init_size_2d(m_width,m_height);
|
||||
|
||||
if IsTexelFormat(image.key.cformat) then
|
||||
begin
|
||||
m_padwidth :=(m_padwidth +3) shr 2;
|
||||
m_padheight:=(m_padheight+3) shr 2;
|
||||
end;
|
||||
|
||||
{
|
||||
m_slice:=m_padwidth*
|
||||
m_padheight*
|
||||
m_bytePerElement;
|
||||
|
||||
m_slice:=(m_slice+255) and (not Ptruint(255));
|
||||
}
|
||||
|
||||
//
|
||||
tiler.m_linearWidth :=m_width;
|
||||
tiler.m_linearHeight :=m_height;
|
||||
tiler.m_linearDepth :=1;
|
||||
|
||||
if IsTexelFormat(image.key.cformat) then
|
||||
begin
|
||||
tiler.m_linearWidth :=(tiler.m_linearWidth +3) shr 2;
|
||||
tiler.m_linearHeight:=(tiler.m_linearHeight+3) shr 2;
|
||||
end;
|
||||
|
||||
tiler.m_paddedWidth :=m_padwidth;
|
||||
tiler.m_paddedHeight :=m_padheight;
|
||||
tiler.m_paddedDepth :=1;
|
||||
|
||||
tiler.m_linearSizeBytes:=tiler.m_linearWidth*tiler.m_linearHeight*tiler.m_linearDepth*m_bytePerElement;
|
||||
tiler.m_tiledSizeBytes :=tiler.m_paddedWidth*tiler.m_paddedHeight*tiler.m_paddedDepth*m_bytePerElement;
|
||||
//tiler.m_tiledSizeBytes:=(tiler.m_tiledSizeBytes+255) and (not Ptruint(255));
|
||||
|
||||
tiler.m_tilesPerRow :=tiler.m_paddedWidth div kMicroTileWidth;
|
||||
tiler.m_tilesPerSlice :=tiler.m_tilesPerRow * (tiler.m_paddedHeight div kMicroTileHeight);
|
||||
//
|
||||
|
||||
if (ptruint(dst-m_base)+tiler.m_linearSizeBytes)>m_full_linear_size then
|
||||
|
@ -631,6 +598,38 @@ end;
|
|||
var
|
||||
a_load_from:array[0..63] of t_load_from_cb;
|
||||
|
||||
function TileIdx(idx,alt:Byte):Byte; inline;
|
||||
begin
|
||||
Result:=idx;
|
||||
TvTiling(Result).alt:=alt;
|
||||
end;
|
||||
|
||||
procedure Init;
|
||||
begin
|
||||
a_load_from[TileIdx(kTileModeDisplay_2dThin ,0)]:=@load_Linear;//@load_clear;
|
||||
a_load_from[TileIdx(kTileModeDisplay_2dThin ,1)]:=@load_Linear;//@load_clear;
|
||||
|
||||
a_load_from[TileIdx(kTileModeDepth_2dThin_256 ,0)]:=@load_Linear;//@load_clear;
|
||||
a_load_from[TileIdx(kTileModeDepth_2dThin_256 ,1)]:=@load_Linear;//@load_clear;
|
||||
|
||||
a_load_from[TileIdx(kTileModeDepth_2dThin_64 ,0)]:=@load_Linear;//@load_clear;
|
||||
a_load_from[TileIdx(kTileModeDepth_2dThin_64 ,1)]:=@load_Linear;//@load_clear;
|
||||
|
||||
//
|
||||
a_load_from[TileIdx(kTileModeDepth_1dThin ,0)]:=@load_1dThin;
|
||||
a_load_from[TileIdx(kTileModeDepth_1dThin ,1)]:=@load_1dThin;
|
||||
|
||||
a_load_from[TileIdx(kTileModeDisplay_1dThin ,0)]:=@load_1dThin;
|
||||
a_load_from[TileIdx(kTileModeDisplay_1dThin ,1)]:=@load_1dThin;
|
||||
|
||||
a_load_from[TileIdx(kTileModeThin_1dThin ,0)]:=@load_1dThin;
|
||||
a_load_from[TileIdx(kTileModeThin_1dThin ,1)]:=@load_1dThin;
|
||||
//
|
||||
|
||||
a_load_from[TileIdx(kTileModeDisplay_LinearAligned,0)]:=@load_Linear;
|
||||
a_load_from[TileIdx(kTileModeDisplay_LinearAligned,1)]:=@load_Linear;
|
||||
end;
|
||||
|
||||
procedure pm4_load_from(cmd:TvCustomCmdBuffer;ri:TvImage2;IMAGE_USAGE:Byte);
|
||||
var
|
||||
cb:t_load_from_cb;
|
||||
|
@ -642,29 +641,6 @@ begin
|
|||
|
||||
//IMAGE_USAGE:=IMAGE_USAGE and (not TM_READ);
|
||||
|
||||
a_load_from[10 ]:=@load_Linear;//@load_clear;
|
||||
a_load_from[10+32]:=@load_Linear;//@load_clear;
|
||||
|
||||
a_load_from[2 ]:=@load_Linear;//@load_clear;
|
||||
a_load_from[2+32 ]:=@load_Linear;//@load_clear;
|
||||
|
||||
a_load_from[0 ]:=@load_Linear;//@load_clear;
|
||||
a_load_from[0+32 ]:=@load_Linear;//@load_clear;
|
||||
|
||||
//
|
||||
a_load_from[ 5 ]:=@load_1dThin;
|
||||
a_load_from[ 5+32]:=@load_1dThin;
|
||||
|
||||
a_load_from[ 9 ]:=@load_1dThin;
|
||||
a_load_from[ 9+32]:=@load_1dThin;
|
||||
|
||||
a_load_from[13 ]:=@load_1dThin;
|
||||
a_load_from[13+32]:=@load_1dThin;
|
||||
//
|
||||
|
||||
a_load_from[8 ]:=@load_Linear;
|
||||
a_load_from[8+32 ]:=@load_Linear;
|
||||
|
||||
cb:=a_load_from[Byte(ri.key.params.tiling)];
|
||||
|
||||
if (cb=nil) then
|
||||
|
@ -713,5 +689,8 @@ begin
|
|||
end;
|
||||
}
|
||||
|
||||
initialization
|
||||
Init;
|
||||
|
||||
end.
|
||||
|
||||
|
|
Loading…
Reference in New Issue