Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ function dxRenderTargetCalc( fWidth, fHeight, bAlpha )
- local iPixels = ( fWidth * fHeight );
- return ( bAlpha and ( iPixels * ( 4 + 4 + 4 + 4 ) ) or ( iPixels * ( 2 + 2 + 2 ) ) ) / 1e+6;
- end;
- print( dxRenderTargetCalc( 1920, 1080, true ) ) -- 33.1776 MiB
- --]]
- CRenderTarget =
- {
- GetWeightFromSize = function ( this, fWidth, fHeight, bAlpha )
- local iPixels = ( fWidth * fHeight );
- return ( bAlpha and ( iPixels * ( 4 + 4 + 4 + 4 ) ) or ( iPixels * ( 2 + 2 + 2 ) ) ) / 1e+6;
- end;
- GetPixelsFromWeight = function ( this, iMiB, bAlpha )
- local iBytes = iMiB * 1e+6;
- return ( bAlpha and ( iBytes / ( 4 + 4 + 4 + 4 ) ) or ( iBytes / ( 2 + 2 + 2 ) ) );
- end;
- };
- local iMiB = CRenderTarget:GetWeightFromSize( 1920, 1080, false );
- print( 'iMiB: ', iMiB ); -- iMiB: 12.4416
- local iPixels = CRenderTarget:GetPixelsFromWeight( iMiB, false );
- print( 'iPixels:', iPixels ); -- iPixels: 2073600.0
Add Comment
Please, Sign In to add comment