1
0

Burningsvideo 0.52

- scissor for 2D
- downscaled internal rendertargets,interlaced drawing
- supertuxkart gui ok

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6154 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
engineer_apple
2020-11-10 18:49:39 +00:00
parent 6805226b5b
commit 5cb28ea357
59 changed files with 2115 additions and 1848 deletions

View File

@@ -93,20 +93,6 @@ public:
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) _IRR_OVERRIDE_;
virtual void OnSetMaterial(const SBurningShaderMaterial& material) _IRR_OVERRIDE_;
#if defined(PATCH_SUPERTUX_8_0_1)
SBurningShaderMaterial Material;
virtual void setMaterial(const SBurningShaderMaterial &material)
{
Material = material;
}
virtual void setParam(u32 index, f32 value)
{
OnSetMaterial(Material);
}
#endif
private:
// fragment shader
@@ -198,7 +184,7 @@ void CTRTextureGouraudAlphaNoZ::fragment_linear()
return;
// slopes
const f32 invDeltaX = reciprocal_zero2( line.x[1] - line.x[0] );
const f32 invDeltaX = fill_step_x( line.x[1] - line.x[0] );
#ifdef IPOL_Z
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
@@ -268,7 +254,7 @@ void CTRTextureGouraudAlphaNoZ::fragment_linear()
tFixPoint a3,r3, g3, b3;
#endif
for ( s32 i = 0; i <= dx; ++i )
for ( s32 i = 0; i <= dx; i += SOFTWARE_DRIVER_2_STEP_X)
{
#ifdef CMP_Z
if ( line.z[0] < z[i] )
@@ -276,7 +262,7 @@ void CTRTextureGouraudAlphaNoZ::fragment_linear()
#ifdef CMP_W
if ( line.w[0] >= z[i] )
#endif
scissor_test_x
{
#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
@@ -418,7 +404,7 @@ void CTRTextureGouraudAlphaNoZ::fragment_linear_test()
return;
// slopes
const f32 invDeltaX = reciprocal_zero2(line.x[1] - line.x[0]);
const f32 invDeltaX = fill_step_x(line.x[1] - line.x[0]);
#ifdef IPOL_Z
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
@@ -488,91 +474,91 @@ void CTRTextureGouraudAlphaNoZ::fragment_linear_test()
tFixPoint a3, r3, g3, b3;
#endif
for (s32 i = 0; i <= dx; ++i)
for (s32 i = 0; i <= dx; i += SOFTWARE_DRIVER_2_STEP_X)
{
#ifdef CMP_Z
if (line.z[0] < z[i])
#endif
#ifdef CMP_W
if (line.w[0] >= z[i])
if (line.w[0] >= z[i])
#endif
{
scissor_test_x
{
#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
const tFixPointu d = dithermask[dIndex | (i) & 3];
const tFixPointu d = dithermask[dIndex | (i) & 3];
#ifdef INVERSE_W
inversew = fix_inverse32(line.w[0]);
inversew = fix_inverse32(line.w[0]);
#endif
u32 argb = getTexel_plain(&IT[0], d + tofix(line.t[0][0].x, inversew),
d + tofix(line.t[0][0].y, inversew)
);
u32 argb = getTexel_plain(&IT[0], d + tofix(line.t[0][0].x, inversew),
d + tofix(line.t[0][0].y, inversew)
);
const tFixPoint alpha = (argb >> 24);
if (alpha > AlphaRef)
{
const tFixPoint alpha = (argb >> 24);
if (alpha > AlphaRef)
{
#ifdef WRITE_Z
z[i] = line.z[0];
z[i] = line.z[0];
#endif
#ifdef WRITE_W
z[i] = line.w[0];
z[i] = line.w[0];
#endif
dst[i] = PixelBlend32(dst[i], argb, alpha);
}
dst[i] = PixelBlend32(dst[i], argb, alpha);
}
#else
#ifdef INVERSE_W
inversew = fix_inverse32(line.w[0]);
inversew = fix_inverse32(line.w[0]);
#endif
getSample_texture(a0, r0, g0, b0,
&IT[0],
tofix(line.t[0][0].x, inversew),
tofix(line.t[0][0].y, inversew)
);
getSample_texture(a0, r0, g0, b0,
&IT[0],
tofix(line.t[0][0].x, inversew),
tofix(line.t[0][0].y, inversew)
);
if (a0 > AlphaRef)
{
if (a0 > AlphaRef)
{
#ifdef WRITE_Z
z[i] = line.z[0];
z[i] = line.z[0];
#endif
#ifdef WRITE_W
z[i] = line.w[0];
z[i] = line.w[0];
#endif
#ifdef IPOL_C0
vec4_to_fix(a2, r2, g2, b2, line.c[0][0], inversew);
vec4_to_fix(a2, r2, g2, b2, line.c[0][0], inversew);
a0 = imulFix(a0, a2); //2D uses vertexalpha*texelalpha
r0 = imulFix(r0, r2);
g0 = imulFix(g0, g2);
b0 = imulFix(b0, b2);
a0 = imulFix(a0, a2); //2D uses vertexalpha*texelalpha
r0 = imulFix(r0, r2);
g0 = imulFix(g0, g2);
b0 = imulFix(b0, b2);
color_to_fix(r1, g1, b1, dst[i]);
color_to_fix(r1, g1, b1, dst[i]);
fix_color_norm(a0);
fix_color_norm(a0);
r2 = r1 + imulFix(a0, r0 - r1);
g2 = g1 + imulFix(a0, g0 - g1);
b2 = b1 + imulFix(a0, b0 - b1);
dst[i] = fix4_to_sample(a0, r2, g2, b2);
r2 = r1 + imulFix(a0, r0 - r1);
g2 = g1 + imulFix(a0, g0 - g1);
b2 = b1 + imulFix(a0, b0 - b1);
dst[i] = fix4_to_sample(a0, r2, g2, b2);
#else
dst[i] = PixelBlend32(dst[i],
fix_to_sample(r0, g0, b0),
fixPointu_to_u32(a0)
);
#endif
}
dst[i] = PixelBlend32(dst[i],
fix_to_sample(r0, g0, b0),
fixPointu_to_u32(a0)
);
#endif
}
#endif
}
#ifdef IPOL_Z
line.z[0] += slopeZ;
@@ -639,7 +625,7 @@ void CTRTextureGouraudAlphaNoZ::fragment_point_noz()
return;
// slopes
const f32 invDeltaX = reciprocal_zero2(line.x[1] - line.x[0]);
const f32 invDeltaX = fill_step_x(line.x[1] - line.x[0]);
#ifdef IPOL_Z
slopeZ = (line.z[1] - line.z[0]) * invDeltaX;
@@ -708,15 +694,15 @@ void CTRTextureGouraudAlphaNoZ::fragment_point_noz()
#ifdef IPOL_C1
tFixPoint a3, r3, g3, b3;
#endif
for (s32 i = 0; i <= dx; ++i)
for (s32 i = 0; i <= dx; i += SOFTWARE_DRIVER_2_STEP_X)
{
#ifdef CMP_Z
if (line.z[0] < z[i])
//if (line.z[0] < z[i])
#endif
#ifdef CMP_W
// if (line.w[0] >= z[i])
#endif
scissor_test_x
{
#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
@@ -827,9 +813,9 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle(const s4DVertex* burning_restrict a
const f32 ba = b->Pos.y - a->Pos.y;
const f32 cb = c->Pos.y - b->Pos.y;
// calculate delta y of the edges
scan.invDeltaY[0] = reciprocal_zero( ca );
scan.invDeltaY[1] = reciprocal_zero( ba );
scan.invDeltaY[2] = reciprocal_zero( cb );
scan.invDeltaY[0] = fill_step_y( ca );
scan.invDeltaY[1] = fill_step_y( ba );
scan.invDeltaY[2] = fill_step_y( cb );
if ( F32_LOWER_EQUAL_0 ( scan.invDeltaY[0] ) )
return;
@@ -968,7 +954,7 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle(const s4DVertex* burning_restrict a
#endif
// rasterize the edge scanlines
for( line.y = yStart; line.y <= yEnd; ++line.y)
for( line.y = yStart; line.y <= yEnd; line.y += SOFTWARE_DRIVER_2_STEP_Y)
{
line.x[scan.left] = scan.x[0];
line.x[scan.right] = scan.x[1];
@@ -1004,6 +990,8 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle(const s4DVertex* burning_restrict a
#endif
// render a scanline
interlace_scanline
scissor_test_y
(this->*fragmentShader) ();
scan.x[0] += scan.slopeX[0];
@@ -1112,7 +1100,6 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle(const s4DVertex* burning_restrict a
yEnd = fill_convention_right( c->Pos.y );
#ifdef SUBTEXEL
subPixel = ( (f32) yStart ) - b->Pos.y;
// correct to pixel center
@@ -1152,7 +1139,7 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle(const s4DVertex* burning_restrict a
#endif
// rasterize the edge scanlines
for( line.y = yStart; line.y <= yEnd; ++line.y)
for( line.y = yStart; line.y <= yEnd; line.y += SOFTWARE_DRIVER_2_STEP_Y)
{
line.x[scan.left] = scan.x[0];
line.x[scan.right] = scan.x[1];
@@ -1188,6 +1175,8 @@ void CTRTextureGouraudAlphaNoZ::drawTriangle(const s4DVertex* burning_restrict a
#endif
// render a scanline
interlace_scanline
scissor_test_y
(this->*fragmentShader) ();
scan.x[0] += scan.slopeX[0];