clang warnings (OnSetMaterial multiple inheritance IMaterialRendererServices,IShaderConstantSetCallBack)

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6378 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
engineer_apple 2022-05-04 10:29:41 +00:00
parent f0efd5857d
commit 83851413a6
17 changed files with 82 additions and 398 deletions

@ -454,7 +454,7 @@ void get_scale(interlaced_control& o, const irr::SIrrlichtCreationParameters& pa
if (o.enable || o.target_scalex || o.tex_scalex) if (o.enable || o.target_scalex || o.tex_scalex)
{ {
char buf[256]; char buf[256];
snprintf_irr(buf, sizeof(buf), "Burningvideo: Interlaced:%d,%d target:%d,%d tex:%d,%d", snprintf_irr(buf, sizeof(buf), "Burningvideo: Interlaced:%u,%u target:%u,%u tex:%u,%u",
o.enable, o.enable,
o.bypass, o.bypass,
o.target_scalex, o.target_scalex,
@ -466,26 +466,6 @@ void get_scale(interlaced_control& o, const irr::SIrrlichtCreationParameters& pa
} }
} }
#if 0
#include <fenv.h>
//#pragma STDC FENV_ACCESS ON
#pragma fenv_access (on)
void show_fe_exceptions(void)
{
int t = fetestexcept(FE_ALL_EXCEPT);
if (t == 0) return;
printf("exceptions raised:");
if (t & FE_DIVBYZERO) printf(" FE_DIVBYZERO");
if (t & FE_INEXACT) printf(" FE_INEXACT");
if (t & FE_INVALID) printf(" FE_INVALID");
if (t & FE_OVERFLOW) printf(" FE_OVERFLOW");
if (t & FE_UNDERFLOW) printf(" FE_UNDERFLOW");
feclearexcept(FE_ALL_EXCEPT);
printf("\n");
}
#endif
#if 0 #if 0
//code snippets //code snippets
#include <IrrlichtDevice.h> #include <IrrlichtDevice.h>
@ -788,10 +768,6 @@ bool CBurningVideoDriver::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
on = 1; on = 1;
break; break;
case EVDF_DEPTH_CLAMP: // shadow
on = 1;
break;
case EVDF_ARB_FRAGMENT_PROGRAM_1: case EVDF_ARB_FRAGMENT_PROGRAM_1:
case EVDF_ARB_VERTEX_PROGRAM_1: case EVDF_ARB_VERTEX_PROGRAM_1:
on = 1; on = 1;
@ -805,6 +781,9 @@ bool CBurningVideoDriver::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
case EVDF_TEXTURE_NPOT: // for 2D case EVDF_TEXTURE_NPOT: // for 2D
on = 0; on = 0;
break; break;
case EVDF_DEPTH_CLAMP: // shadow
on = 1;
break;
#endif #endif
#if defined(SOFTWARE_DRIVER_2_2D_AS_3D) #if defined(SOFTWARE_DRIVER_2_2D_AS_3D)
@ -1474,89 +1453,6 @@ u32 CBurningVideoDriver::clipToFrustum(const u32 vIn /*, const size_t clipmask_f
replace w/w by 1/w replace w/w by 1/w
*/ */
//aliasing problems! [dest = source + 1] //aliasing problems! [dest = source + 1]
#if 0
inline void CBurningVideoDriver::ndc_2_dc_and_project(s4DVertexPair* dest, const s4DVertexPair* source, const size_t vIn) const
{
const f32* dc = Transformation_ETS_CLIPSCALE[TransformationStack];
for (size_t g = 0; g < vIn; g += sizeof_s4DVertexPairRel)
{
//cache doesn't work anymore?
//if ( dest[g].flag & VERTEX4D_PROJECTED )
// continue;
//dest[g].flag = source[g].flag | VERTEX4D_PROJECTED;
const f32 iw = reciprocal_zero_pos_underflow(source[g].Pos.w);
// to device coordinates
dest[g].Pos.x = iw * source[g].Pos.x * dc[0] + dc[1];
dest[g].Pos.y = iw * source[g].Pos.y * dc[2] + dc[3];
//burning uses direct Z. for OpenGL it should be -Z,[-1;1] and texture flip
#if !defined(SOFTWARE_DRIVER_2_USE_WBUFFER) || 1
dest[g].Pos.z = -iw * source[g].Pos.z * 0.5f + 0.5f;
#endif
dest[g].Pos.w = iw;
//ortographic projection w == 1 looses stencil
//dest[g].Pos.w = 1.f - dest[g].Pos.z;
// Texture Coordinates will be projected after mipmap selection
// satisfy write-combiner
#if 1
#if BURNING_MATERIAL_MAX_TEXTURES > 0
dest[g].Tex[0] = source[g].Tex[0];
#endif
#if BURNING_MATERIAL_MAX_TEXTURES > 1
dest[g].Tex[1] = source[g].Tex[1];
#endif
#if BURNING_MATERIAL_MAX_TEXTURES > 2
dest[g].Tex[2] = source[g].Tex[2];
#endif
#if BURNING_MATERIAL_MAX_TEXTURES > 3
dest[g].Tex[3] = source[g].Tex[3];
#endif
#endif
#if BURNING_MATERIAL_MAX_COLORS > 0
#ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
dest[g].Color[0] = source[g].Color[0] * iw; // alpha?
#else
dest[g].Color[0] = source[g].Color[0];
#endif
#endif
#if BURNING_MATERIAL_MAX_COLORS > 1
#ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
dest[g].Color[1] = source[g].Color[1] * iw; // alpha?
#else
dest[g].Color[1] = source[g].Color[1];
#endif
#endif
#if BURNING_MATERIAL_MAX_COLORS > 2
#ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
dest[g].Color[2] = source[g].Color[2] * iw; // alpha?
#else
dest[g].Color[2] = source[g].Color[2];
#endif
#endif
#if BURNING_MATERIAL_MAX_COLORS > 3
#ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
dest[g].Color[3] = source[g].Color[3] * iw; // alpha?
#else
dest[g].Color[3] = source[g].Color[3];
#endif
#endif
#if BURNING_MATERIAL_MAX_LIGHT_TANGENT > 0
dest[g].LightTangent[0] = source[g].LightTangent[0] * iw;
#endif
}
}
#endif
inline void ndc_2_dc_and_project(s4DVertexPair* burning_restrict v, const u32 vIn, inline void ndc_2_dc_and_project(s4DVertexPair* burning_restrict v, const u32 vIn,
const f32* burning_restrict dc_matrix const f32* burning_restrict dc_matrix
@ -1751,37 +1647,6 @@ inline void ndc_2_dc_and_project_grid(s4DVertexPair* burning_restrict v, const u
} }
#if 0
/*!
crossproduct in projected 2D, face
*/
REALINLINE f32 CBurningVideoDriver::screenarea_inside(const s4DVertexPair* burning_restrict const face[]) const
{
return (((face[1] + 1)->Pos.x - (face[0] + 1)->Pos.x) * ((face[2] + 1)->Pos.y - (face[0] + 1)->Pos.y)) -
(((face[2] + 1)->Pos.x - (face[0] + 1)->Pos.x) * ((face[1] + 1)->Pos.y - (face[0] + 1)->Pos.y));
/*
float signedArea = 0;
for (int k = 1; k < output->count; k++) {
signedArea += (output->vertices[k - 1].values[0] * output->vertices[k - 0].values[1]);
signedArea -= (output->vertices[k - 0].values[0] * output->vertices[k - 1].values[1]);
}
*/
}
static inline f32 dot(const sVec2& a, const sVec2& b) { return a.x * b.x + a.y * b.y; }
sVec2 dFdx(const sVec2& v) { return v; }
sVec2 dFdy(const sVec2& v) { return v; }
f32 MipmapLevel(const sVec2& uv, const sVec2& textureSize)
{
sVec2 dx = dFdx(uv * textureSize.x);
sVec2 dy = dFdy(uv * textureSize.y);
f32 d = core::max_(dot(dx, dx), dot(dy, dy));
return log2f(sqrtf(d));
}
#endif
#define MAT_TEXTURE(tex) ( (video::CSoftwareTexture2*) Material.org.TextureLayer[tex].Texture ) #define MAT_TEXTURE(tex) ( (video::CSoftwareTexture2*) Material.org.TextureLayer[tex].Texture )
//! clamp(value,0,1) //! clamp(value,0,1)
@ -1799,124 +1664,14 @@ static inline float clampf01(const float v)
return v < 0.f ? 0.f : v > 1.f ? 1.f : v; return v < 0.f ? 0.f : v > 1.f ? 1.f : v;
} }
#if 0
/*!
calculate from unprojected.
attribute need not to follow winding rule from position.
Edge-walking problem
Texture Wrapping problem
Atlas problem
*/
REALINLINE s32 CBurningVideoDriver::lodFactor_inside(const s4DVertexPair* burning_restrict const face[],
const size_t m, const f32 dc_area_one_over, const f32 lod_bias) const
{
/*
sVec2 a(v[1]->Tex[tex].x - v[0]->Tex[tex].x,v[1]->Tex[tex].y - v[0]->Tex[tex].y);
sVec2 b(v[2]->Tex[tex].x - v[0]->Tex[tex].x,v[2]->Tex[tex].y - v[0]->Tex[tex].y);
f32 area = a.x * b.y - b.x * a.y;
*/
/*
degenerate(A, B, C, minarea) = ((B - A).cross(C - A)).lengthSquared() < (4.0f * minarea * minarea);
check for collapsed or "long thin triangles"
*/
ieee754 signedArea;
ieee754 t[4];
t[0].f = face[1]->Tex[m].x - face[0]->Tex[m].x;
t[1].f = face[1]->Tex[m].y - face[0]->Tex[m].y;
t[2].f = face[2]->Tex[m].x - face[0]->Tex[m].x;
t[3].f = face[2]->Tex[m].y - face[0]->Tex[m].y;
//|crossproduct| in projected 2D -> screen area triangle * 0.5f
signedArea.f = t[0].f * t[3].f - t[2].f * t[1].f;
//signedArea =
// ((face[1]->Tex[m].x - face[0]->Tex[m].x) * (face[2]->Tex[m].y - face[0]->Tex[m].y))
// - ((face[2]->Tex[m].x - face[0]->Tex[m].x) * (face[1]->Tex[m].y - face[0]->Tex[m].y));
//if (signedArea*signedArea <= 0.00000000001f)
if (signedArea.fields.exp == 0)
{
ieee754 _max;
_max.u = t[0].abs.frac_exp;
if (t[1].abs.frac_exp > _max.u) _max.u = t[1].abs.frac_exp;
if (t[2].abs.frac_exp > _max.u) _max.u = t[2].abs.frac_exp;
if (t[3].abs.frac_exp > _max.u) _max.u = t[3].abs.frac_exp;
signedArea.u = _max.fields.exp ? _max.u : ieee754_one;
/*
//dot,length
ieee754 v[2];
v[0].f = t[0] * t[2];
v[1].f = t[1] * t[3];
//signedArea.f = t[4] > t[5] ? t[4] : t[5];
signedArea.u = v[0].fields.frac > v[1].fields.frac ? v[0].u : v[1].u;
if (signedArea.fields.exp == 0)
{
return -1;
}
*/
}
//only guessing: take more detail (lower mipmap) in light+bump textures
//assume transparent add is ~50% transparent -> more detail
// 2.f from dc_area, 2.f from tex triangle ( parallelogram area)
const u32* d = MAT_TEXTURE(m)->getMipMap0_Area();
f32 texelspace = d[0] * d[1] * lod_bias; //(m ? 0.5f : 0.5f);
ieee754 ratio;
ratio.f = (signedArea.f * texelspace) * dc_area_one_over;
ratio.fields.sign = 0;
//log2(0)==denormal [ use high lod] [ only if dc_area == 0 checked outside ]
return (ratio.fields.exp & 0x80) ? ratio.fields.exp - 127 : 0; /*denormal very high lod*/
}
#endif
#if 0
/*!
texcoo in current mipmap dimension (face, already clipped)
-> want to help fixpoint
*/
inline void CBurningVideoDriver::select_polygon_mipmap_inside(s4DVertexPair* burning_restrict face[], const size_t tex, const CSoftwareTexture2_Bound& b) const
{
#ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT
(face[0] + 1)->Tex[tex].x = face[0]->Tex[tex].x * (face[0] + 1)->Pos.w * b.mat[0] + b.mat[1];
(face[0] + 1)->Tex[tex].y = face[0]->Tex[tex].y * (face[0] + 1)->Pos.w * b.mat[2] + b.mat[3];
(face[1] + 1)->Tex[tex].x = face[1]->Tex[tex].x * (face[1] + 1)->Pos.w * b.mat[0] + b.mat[1];
(face[1] + 1)->Tex[tex].y = face[1]->Tex[tex].y * (face[1] + 1)->Pos.w * b.mat[2] + b.mat[3];
(face[2] + 1)->Tex[tex].x = face[2]->Tex[tex].x * (face[2] + 1)->Pos.w * b.mat[0] + b.mat[1];
(face[2] + 1)->Tex[tex].y = face[2]->Tex[tex].y * (face[2] + 1)->Pos.w * b.mat[2] + b.mat[3];
#else
(face[0] + 1)->Tex[tex].x = face[0]->Tex[tex].x * b.mat[0] + b.mat[1];
(face[0] + 1)->Tex[tex].y = face[0]->Tex[tex].y * b.mat[2] + b.mat[3];
(face[1] + 1)->Tex[tex].x = face[1]->Tex[tex].x * b.mat[0] + b.mat[1];
(face[1] + 1)->Tex[tex].y = face[1]->Tex[tex].y * b.mat[2] + b.mat[3];
(face[2] + 1)->Tex[tex].x = face[2]->Tex[tex].x * b.mat[0] + b.mat[1];
(face[2] + 1)->Tex[tex].y = face[2]->Tex[tex].y * b.mat[2] + b.mat[3];
#endif
}
#endif
// Vertex Cache // Vertex Cache
//! setup Vertex Format //! setup Vertex Format
void CBurningVideoDriver::VertexCache_map_source_format() void CBurningVideoDriver::VertexCache_map_source_format()
{ {
u32 s0 = sizeof(s4DVertex); const u32 s0 = sizeof(s4DVertex);
u32 s1 = sizeof(s4DVertex_proxy); const u32 s1 = sizeof(s4DVertex_proxy);
if (s1 <= sizeof_s4DVertex / 2) if (s1 <= sizeof_s4DVertex / 2)
{ {
@ -2718,21 +2473,6 @@ clipandproject:
} }
#if 0
//todo: this should return only index
s4DVertexPair* CBurningVideoDriver::VertexCache_getVertex(const u32 sourceIndex) const
{
for (size_t i = 0; i < VERTEXCACHE_ELEMENT; ++i)
{
if (VertexShader.info[i].index == sourceIndex)
{
return VertexShader.mem.data + s4DVertex_ofs(i);
}
}
return VertexShader.mem.data; //error
}
#endif
void SVertexShader::setIndices(const void* _indices, const video::E_INDEX_TYPE _iType) void SVertexShader::setIndices(const void* _indices, const video::E_INDEX_TYPE _iType)
{ {
@ -2950,78 +2690,6 @@ void SVertexShader::getPrimitive(s4DVertexPair* face[4], CBurningVideoDriver* dr
indicesRun += indicesPitch; indicesRun += indicesPitch;
} }
#if 0
void CBurningVideoDriver::VertexCache_get(s4DVertexPair* face[4])
{
// next primitive must be complete in cache
if (VertexShader.indicesIndex - VertexShader.indicesRun < VertexShader.primitiveHasVertex &&
VertexShader.indicesIndex < VertexShader.indexCount
)
{
// get the next unique vertices cache line
VertexShader.get_next_info();
// mark all existing
VertexShader.mark_existing();
// fill new
for (u32 i = 0; i != VertexShader.fillIndex; ++i)
{
if (VertexShader.info_temp[i].hit != VERTEXCACHE_MISS)
continue;
for (u32 dIndex = 0; dIndex < VERTEXCACHE_ELEMENT; ++dIndex)
{
if (0 == VertexShader.info[dIndex].hit)
{
VertexCache_fill(VertexShader.info_temp[i].index, dIndex);
VertexShader.info[dIndex].hit += 1;
VertexShader.info_temp[i].hit = dIndex;
break;
}
}
}
}
VertexShader.getPrimitive(face);
#if 0
//const u32 i0 = core::if_c_a_else_0 ( VertexShader.pType != scene::EPT_TRIANGLE_FAN, VertexShader.indicesRun );
const u32 i0 = VertexShader.pType != scene::EPT_TRIANGLE_FAN ? VertexShader.indicesRun : 0;
switch (VertexShader.iType)
{
case E4IT_16BIT:
{
const u16* p = (const u16*)VertexShader.indices;
face[0] = VertexCache_getVertex(p[i0]);
face[1] = VertexCache_getVertex(p[VertexShader.indicesRun + 1]);
face[2] = VertexCache_getVertex(p[VertexShader.indicesRun + 2]);
}
break;
case E4IT_32BIT:
{
const u32* p = (const u32*)VertexShader.indices;
face[0] = VertexCache_getVertex(p[i0]);
face[1] = VertexCache_getVertex(p[VertexShader.indicesRun + 1]);
face[2] = VertexCache_getVertex(p[VertexShader.indicesRun + 2]);
}
break;
case E4IT_NONE:
face[0] = VertexCache_getVertex(VertexShader.indicesRun + 0);
face[1] = VertexCache_getVertex(VertexShader.indicesRun + 1);
face[2] = VertexCache_getVertex(VertexShader.indicesRun + 2);
break;
default:
face[0] = face[1] = face[2] = VertexCache_getVertex(VertexShader.indicesRun + 0);
break;
}
face[3] = face[0]; // quad unsupported
VertexShader.indicesRun += VertexShader.indicesPitch;
#endif
}
#endif
/*! /*!
*/ */
@ -3821,7 +3489,7 @@ void CBurningVideoDriver::setMaterial(const SMaterial& material)
if (EyeSpace.TL_Flag & TL_FOG) CurrentShader->setFog(FogColor); if (EyeSpace.TL_Flag & TL_FOG) CurrentShader->setFog(FogColor);
if (EyeSpace.TL_Flag & TL_SCISSOR) CurrentShader->setScissor(Scissor); if (EyeSpace.TL_Flag & TL_SCISSOR) CurrentShader->setScissor(Scissor);
CurrentShader->setRenderTarget(RenderTargetSurface, ViewPort, Interlaced); CurrentShader->setRenderTarget(RenderTargetSurface, ViewPort, Interlaced);
CurrentShader->OnSetMaterial(Material); CurrentShader->OnSetMaterialBurning(Material);
CurrentShader->setEdgeTest(in.Wireframe, in.PointCloud); CurrentShader->setEdgeTest(in.Wireframe, in.PointCloud);
} }
@ -4095,40 +3763,18 @@ void CBurningVideoDriver::lightVertex_eye(s4DVertex* dest, const u32 vertexargb)
dColor.add_rgb(Material.EmissiveColor); dColor.add_rgb(Material.EmissiveColor);
// https://www.ozone3d.net/tutorials/glsl_lighting_phong.php
dColor.sat_alpha_pass(dest->Color[0], vertexColor.a); dColor.sat_alpha_pass(dest->Color[0], vertexColor.a);
} }
#endif #endif
/*
CImage* getImage(const video::ITexture* texture)
{
if (!texture) return 0;
CImage* img = 0;
switch (texture->getDriverType())
{
case EDT_BURNINGSVIDEO:
img = ((CSoftwareTexture2*)texture)->getImage();
break;
case EDT_SOFTWARE:
img = ((CSoftwareTexture*)texture)->getImage();
break;
default:
os::Printer::log("Fatal Error: Tried to copy from a surface not owned by this driver.", ELL_ERROR);
break;
}
return img;
}
*/
/* /*
draw2DImage with single color scales into destination quad & cliprect(more like viewport) draw2DImage with single color scales into destination quad & cliprect(more like viewport)
draw2DImage with 4 color scales on destination and cliprect is scissor draw2DImage with 4 color scales on destination and cliprect is scissor
*/ */
static const u16 quad_triangle_indexList[6 + 2] = { 0,1,2,0,2,3, 3,3 }; static const u32 quad_triangle_indexList[6 + 2] = { 0,1,2,0,2,3, 3,3 };
#if defined(SOFTWARE_DRIVER_2_2D_AS_2D) #if defined(SOFTWARE_DRIVER_2_2D_AS_2D)
@ -4427,7 +4073,7 @@ void CBurningVideoDriver::draw2DImage(const video::ITexture* texture, const core
drawVertexPrimitiveList(Quad2DVertices, 4, drawVertexPrimitiveList(Quad2DVertices, 4,
quad_triangle_indexList, 2, quad_triangle_indexList, 2,
EVT_STANDARD, scene::EPT_TRIANGLES, EIT_16BIT); EVT_STANDARD, scene::EPT_TRIANGLES, EIT_32BIT);
setRenderStates3DMode(); setRenderStates3DMode();
@ -4496,7 +4142,7 @@ void CBurningVideoDriver::draw2DImage(const video::ITexture* texture, const core
drawVertexPrimitiveList(Quad2DVertices, 4, drawVertexPrimitiveList(Quad2DVertices, 4,
quad_triangle_indexList, 2, quad_triangle_indexList, 2,
EVT_STANDARD, scene::EPT_TRIANGLES, EIT_16BIT); EVT_STANDARD, scene::EPT_TRIANGLES, EIT_32BIT);
if (clipRect) if (clipRect)
EyeSpace.TL_Flag &= ~TL_SCISSOR; EyeSpace.TL_Flag &= ~TL_SCISSOR;
@ -4545,7 +4191,7 @@ void CBurningVideoDriver::draw2DRectangle(const core::rect<s32>& position,
drawVertexPrimitiveList(Quad2DVertices, 4, drawVertexPrimitiveList(Quad2DVertices, 4,
quad_triangle_indexList, 2, quad_triangle_indexList, 2,
EVT_STANDARD, scene::EPT_TRIANGLES, EIT_16BIT); EVT_STANDARD, scene::EPT_TRIANGLES, EIT_32BIT);
setRenderStates3DMode(); setRenderStates3DMode();
@ -4718,7 +4364,7 @@ void CBurningVideoDriver::pushShader(scene::E_PRIMITIVE_TYPE pType, int testCurr
PushShader.push(CurrentShader); PushShader.push(CurrentShader);
CurrentShader = shader; CurrentShader = shader;
shader->setRenderTarget(RenderTargetSurface, ViewPort, Interlaced); shader->setRenderTarget(RenderTargetSurface, ViewPort, Interlaced);
shader->OnSetMaterial(Material); shader->OnSetMaterialBurning(Material);
} }
shader->setEdgeTest(wireFrame, pointCloud); shader->setEdgeTest(wireFrame, pointCloud);
} }

@ -426,10 +426,11 @@ void CSoftwareTexture2::calcDerivative()
/* Software Render Target 2 */ /* Software Render Target 2 */
CSoftwareRenderTarget2::CSoftwareRenderTarget2(CBurningVideoDriver* driver) : Driver(driver) CSoftwareRenderTarget2::CSoftwareRenderTarget2(CBurningVideoDriver* driver) :
#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0) #if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
, IRenderTarget(0), DepthStencil(0) IRenderTarget(0), DepthStencil(0),
#endif #endif
Driver(driver)
{ {
DriverType = EDT_BURNINGSVIDEO; DriverType = EDT_BURNINGSVIDEO;

@ -178,6 +178,7 @@ public:
virtual void setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces, u32 numCubeSurfaces) IRR_OVERRIDE; virtual void setTextures(ITexture* const * textures, u32 numTextures, ITexture* depthStencil, const E_CUBE_SURFACE* cubeSurfaces, u32 numCubeSurfaces) IRR_OVERRIDE;
#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0) #if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
public:
E_DRIVER_TYPE DriverType; E_DRIVER_TYPE DriverType;
core::array<ITexture*> Textures; core::array<ITexture*> Textures;
ITexture* DepthStencil; ITexture* DepthStencil;

@ -64,6 +64,15 @@
#undef IPOL_C1 #undef IPOL_C1
#endif #endif
#if BURNING_MATERIAL_MAX_COLORS < 3
#define IPOL_L0
#undef IPOL_C2
#endif
#if BURNING_MATERIAL_MAX_COLORS < 4
#undef IPOL_C3
#endif
#if BURNING_MATERIAL_MAX_LIGHT_TANGENT < 1 #if BURNING_MATERIAL_MAX_LIGHT_TANGENT < 1
#undef IPOL_L0 #undef IPOL_L0
#endif #endif
@ -100,7 +109,7 @@ public:
//! draws an indexed triangle list //! draws an indexed triangle list
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) IRR_OVERRIDE; 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; virtual void OnSetMaterialBurning(const SBurningShaderMaterial& material) IRR_OVERRIDE;
virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData) IRR_OVERRIDE; virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData) IRR_OVERRIDE;
private: private:
void fragmentShader(); void fragmentShader();
@ -125,7 +134,7 @@ CTRNormalMap::~CTRNormalMap()
CallBack = 0; CallBack = 0;
} }
void CTRNormalMap::OnSetMaterial(const SBurningShaderMaterial& material) void CTRNormalMap::OnSetMaterialBurning(const SBurningShaderMaterial& material)
{ {
} }

@ -108,7 +108,7 @@ public:
//! draws an indexed triangle list //! draws an indexed triangle list
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) IRR_OVERRIDE; 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; virtual void OnSetMaterialBurning(const SBurningShaderMaterial& material) IRR_OVERRIDE;
virtual void OnSetMaterial(const video::SMaterial& material, virtual void OnSetMaterial(const video::SMaterial& material,
const video::SMaterial& lastMaterial, const video::SMaterial& lastMaterial,
bool resetAllRenderstates, video::IMaterialRendererServices* services) IRR_OVERRIDE; bool resetAllRenderstates, video::IMaterialRendererServices* services) IRR_OVERRIDE;
@ -138,7 +138,7 @@ CBurningParallaxMap::~CBurningParallaxMap()
CallBack = 0; CallBack = 0;
} }
void CBurningParallaxMap::OnSetMaterial(const SBurningShaderMaterial& material) void CBurningParallaxMap::OnSetMaterialBurning(const SBurningShaderMaterial& material)
{ {
CurrentScale = material.org.MaterialTypeParam; CurrentScale = material.org.MaterialTypeParam;
} }

@ -85,7 +85,7 @@ namespace video
//! draws an indexed triangle list //! draws an indexed triangle list
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) IRR_OVERRIDE; 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; virtual void OnSetMaterialBurning(const SBurningShaderMaterial& material) IRR_OVERRIDE;
private: private:
// fragment shader // fragment shader
@ -120,7 +120,7 @@ CTRTextureBlend::CTRTextureBlend(CBurningVideoDriver* driver)
/*! /*!
*/ */
void CTRTextureBlend::OnSetMaterial(const SBurningShaderMaterial& material) void CTRTextureBlend::OnSetMaterialBurning(const SBurningShaderMaterial& material)
{ {
int showname = 0; int showname = 0;

@ -91,7 +91,7 @@ public:
//! draws an indexed triangle list //! draws an indexed triangle list
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) IRR_OVERRIDE; 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; virtual void OnSetMaterialBurning(const SBurningShaderMaterial& material) IRR_OVERRIDE;
private: private:
void fragmentShader(); void fragmentShader();
@ -110,7 +110,7 @@ CTRTextureGouraudAlpha2::CTRTextureGouraudAlpha2(CBurningVideoDriver* driver)
/*! /*!
*/ */
void CTRTextureGouraudAlpha2::OnSetMaterial(const SBurningShaderMaterial& material) void CTRTextureGouraudAlpha2::OnSetMaterialBurning(const SBurningShaderMaterial& material)
{ {
#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff #if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
AlphaRef = core::floor32(material.org.MaterialTypeParam * 256.f); AlphaRef = core::floor32(material.org.MaterialTypeParam * 256.f);

@ -86,7 +86,7 @@ public:
//! draws an indexed triangle list //! draws an indexed triangle list
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) IRR_OVERRIDE; 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; virtual void OnSetMaterialBurning(const SBurningShaderMaterial& material) IRR_OVERRIDE;
private: private:
@ -115,7 +115,7 @@ CTRTextureGouraudAlphaNoZ::CTRTextureGouraudAlphaNoZ(CBurningVideoDriver* driver
/*! /*!
*/ */
void CTRTextureGouraudAlphaNoZ::OnSetMaterial(const SBurningShaderMaterial& material) void CTRTextureGouraudAlphaNoZ::OnSetMaterialBurning(const SBurningShaderMaterial& material)
{ {
#if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff #if defined(BURNINGVIDEO_RENDERER_FAST) && COLOR_MAX==0xff
AlphaRef = core::floor32(material.org.MaterialTypeParam * 256.f); AlphaRef = core::floor32(material.org.MaterialTypeParam * 256.f);

@ -84,7 +84,7 @@ public:
//! draws an indexed triangle list //! draws an indexed triangle list
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) IRR_OVERRIDE; 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; virtual void OnSetMaterialBurning(const SBurningShaderMaterial& material) IRR_OVERRIDE;
virtual bool canWireFrame() IRR_OVERRIDE { return true; } virtual bool canWireFrame() IRR_OVERRIDE { return true; }
@ -111,7 +111,7 @@ CTRTextureGouraudNoZ2::CTRTextureGouraudNoZ2(CBurningVideoDriver* driver)
/*! /*!
*/ */
void CTRTextureGouraudNoZ2::OnSetMaterial(const SBurningShaderMaterial& material) void CTRTextureGouraudNoZ2::OnSetMaterialBurning(const SBurningShaderMaterial& material)
{ {
if (material.org.TextureLayer[0].BilinearFilter || if (material.org.TextureLayer[0].BilinearFilter ||

@ -78,7 +78,7 @@ public:
//! constructor //! constructor
CTRTextureWire2(CBurningVideoDriver* driver); CTRTextureWire2(CBurningVideoDriver* driver);
virtual void OnSetMaterial(const SBurningShaderMaterial& material) IRR_OVERRIDE; virtual void OnSetMaterialBurning(const SBurningShaderMaterial& material) IRR_OVERRIDE;
//! draws an indexed triangle list //! draws an indexed triangle list
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) IRR_OVERRIDE; virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) IRR_OVERRIDE;
@ -108,7 +108,7 @@ CTRTextureWire2::CTRTextureWire2(CBurningVideoDriver* driver)
depth_write = 0; depth_write = 0;
} }
void CTRTextureWire2::OnSetMaterial(const SBurningShaderMaterial& material) void CTRTextureWire2::OnSetMaterialBurning(const SBurningShaderMaterial& material)
{ {
depth_pass = material.depth_test == 0; depth_pass = material.depth_test == 0;
depth_write = material.depth_write; depth_write = material.depth_write;

@ -87,7 +87,7 @@ public:
//! draws an indexed triangle list //! draws an indexed triangle list
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) IRR_OVERRIDE; 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; virtual void OnSetMaterialBurning(const SBurningShaderMaterial& material) IRR_OVERRIDE;
private: private:
void fragmentShader(); void fragmentShader();
@ -105,7 +105,7 @@ CTR_transparent_reflection_2_layer::CTR_transparent_reflection_2_layer(CBurningV
#endif #endif
} }
void CTR_transparent_reflection_2_layer::OnSetMaterial(const SBurningShaderMaterial& material) void CTR_transparent_reflection_2_layer::OnSetMaterialBurning(const SBurningShaderMaterial& material)
{ {
MaterialType = material.org.MaterialType; MaterialType = material.org.MaterialType;

@ -20,7 +20,7 @@
#include "IMaterialRenderer.h" #include "IMaterialRenderer.h"
#include "IMaterialRendererServices.h" #include "IMaterialRendererServices.h"
#include "IGPUProgrammingServices.h" #include "IGPUProgrammingServices.h"
#include "IShaderConstantSetCallback.h" #include "IShaderConstantSetCallBack.h"
burning_namespace_start burning_namespace_start
@ -302,7 +302,7 @@ public:
void drawWireFrameTriangle(s4DVertex* a, s4DVertex* b, s4DVertex* c); void drawWireFrameTriangle(s4DVertex* a, s4DVertex* b, s4DVertex* c);
virtual void OnSetMaterial(const SBurningShaderMaterial& material) {}; virtual void OnSetMaterialBurning(const SBurningShaderMaterial& material) {};
void setEdgeTest(const int wireFrame, const int pointCloud) void setEdgeTest(const int wireFrame, const int pointCloud)
{ {
@ -317,6 +317,7 @@ public:
//IShaderConstantSetCallBack //IShaderConstantSetCallBack
virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData) IRR_OVERRIDE {}; virtual void OnSetConstants(IMaterialRendererServices* services, s32 userData) IRR_OVERRIDE {};
virtual void OnSetMaterial(const SMaterial& material) IRR_OVERRIDE { }
//IMaterialRenderer //IMaterialRenderer
virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial, virtual void OnSetMaterial(const SMaterial& material, const SMaterial& lastMaterial,

@ -292,8 +292,18 @@ typedef float ipoltype;
#define burning_namespace_end } /* end namespace video*/ } /* end namespace irr */ #define burning_namespace_end } /* end namespace video*/ } /* end namespace irr */
#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0) #if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0)
#if defined(_MSC_VER) && _MSC_VER > 1310 && !defined (_WIN32_WCE)
#define snprintf_irr sprintf_s #define snprintf_irr sprintf_s
#define EVDF_DEPTH_CLAMP 43 #elif defined(__APPLE__)
#define snprintf_irr snprintf
#elif !defined(__CYGWIN__)
#define swprintf_irr _snwprintf
#define snprintf_irr _snprintf
#endif
//#define EVDF_DEPTH_CLAMP (video::E_VIDEO_DRIVER_FEATURE) 43
#define E_CUBE_SURFACE int #define E_CUBE_SURFACE int
#define ECFN_DISABLED 0 #define ECFN_DISABLED 0

@ -1210,15 +1210,15 @@ static REALINLINE void getSample_texture(tFixPoint& a,
// get Sample linear == getSample_fixpoint // get Sample linear == getSample_fixpoint
static REALINLINE void getSample_texture(tFixPoint& r, tFixPoint& g, tFixPoint& b, static REALINLINE void getSample_texture(tFixPoint& r, tFixPoint& g, tFixPoint& b,
const sInternalTexture* burning_restrict t, const tFixPointu tx, const tFixPointu ty const sInternalTexture* burning_restrict tex, const tFixPointu tx, const tFixPointu ty
) )
{ {
size_t ofs; size_t ofs;
ofs = (((ty + FIX_POINT_ZERO_DOT_FIVE) & t->textureYMask) >> FIX_POINT_PRE) << t->pitchlog2; ofs = (((ty + FIX_POINT_ZERO_DOT_FIVE) & tex->textureYMask) >> FIX_POINT_PRE) << tex->pitchlog2;
ofs += ((tx + FIX_POINT_ZERO_DOT_FIVE) & t->textureXMask) >> (FIX_POINT_PRE - SOFTWARE_DRIVER_2_TEXTURE_GRANULARITY); ofs += ((tx + FIX_POINT_ZERO_DOT_FIVE) & tex->textureXMask) >> (FIX_POINT_PRE - SOFTWARE_DRIVER_2_TEXTURE_GRANULARITY);
// texel // texel
const tVideoSample t00 = *((tVideoSample*)((u8*)t->data + ofs)); const tVideoSample t00 = *((tVideoSample*)((u8*)tex->data + ofs));
(tFixPointu&)r = (t00 & MASK_R) >> (SHIFT_R - FIX_POINT_PRE); (tFixPointu&)r = (t00 & MASK_R) >> (SHIFT_R - FIX_POINT_PRE);
(tFixPointu&)g = (t00 & MASK_G) << (FIX_POINT_PRE - SHIFT_G); (tFixPointu&)g = (t00 & MASK_G) << (FIX_POINT_PRE - SHIFT_G);
@ -1226,15 +1226,15 @@ static REALINLINE void getSample_texture(tFixPoint& r, tFixPoint& g, tFixPoint&
} }
static REALINLINE void getSample_texture(tFixPoint& a, tFixPoint& r, tFixPoint& g, tFixPoint& b, static REALINLINE void getSample_texture(tFixPoint& a, tFixPoint& r, tFixPoint& g, tFixPoint& b,
const sInternalTexture* burning_restrict t, const tFixPointu tx, const tFixPointu ty const sInternalTexture* burning_restrict tex, const tFixPointu tx, const tFixPointu ty
) )
{ {
size_t ofs; size_t ofs;
ofs = (((ty + FIX_POINT_ZERO_DOT_FIVE) & t->textureYMask) >> FIX_POINT_PRE) << t->pitchlog2; ofs = (((ty + FIX_POINT_ZERO_DOT_FIVE) & tex->textureYMask) >> FIX_POINT_PRE) << tex->pitchlog2;
ofs += ((tx + FIX_POINT_ZERO_DOT_FIVE) & t->textureXMask) >> (FIX_POINT_PRE - SOFTWARE_DRIVER_2_TEXTURE_GRANULARITY); ofs += ((tx + FIX_POINT_ZERO_DOT_FIVE) & tex->textureXMask) >> (FIX_POINT_PRE - SOFTWARE_DRIVER_2_TEXTURE_GRANULARITY);
// texel // texel
const tVideoSample t00 = *((tVideoSample*)((u8*)t->data + ofs)); const tVideoSample t00 = *((tVideoSample*)((u8*)tex->data + ofs));
(tFixPointu&)a = (t00 & MASK_A) >> (SHIFT_A - FIX_POINT_PRE); (tFixPointu&)a = (t00 & MASK_A) >> (SHIFT_A - FIX_POINT_PRE);
fix_alpha_color_max(a); fix_alpha_color_max(a);
@ -1244,6 +1244,22 @@ static REALINLINE void getSample_texture(tFixPoint& a, tFixPoint& r, tFixPoint&
} }
// get Sample bilinear
static REALINLINE void getSample_texture(tFixPoint& a,
const sInternalTexture* burning_restrict tex, const tFixPointu tx, const tFixPointu ty
)
{
size_t ofs;
ofs = (((ty + FIX_POINT_ZERO_DOT_FIVE) & tex->textureYMask) >> FIX_POINT_PRE) << tex->pitchlog2;
ofs += ((tx + FIX_POINT_ZERO_DOT_FIVE) & tex->textureXMask) >> (FIX_POINT_PRE - SOFTWARE_DRIVER_2_TEXTURE_GRANULARITY);
// texel
const tVideoSample t00 = *((tVideoSample*)((u8*)tex->data + ofs));
(tFixPointu&)a = (t00 & MASK_A) >> (SHIFT_A - FIX_POINT_PRE);
fix_alpha_color_max(a);
}
#endif // SOFTWARE_DRIVER_2_BILINEAR #endif // SOFTWARE_DRIVER_2_BILINEAR

@ -20,7 +20,7 @@ namespace video
/*! /*!
*/ */
void burning_shader_class::OnSetMaterial(const SBurningShaderMaterial& material) void burning_shader_class::OnSetMaterialBurning(const SBurningShaderMaterial& material)
{ {
switch (material.org.MaterialType) switch (material.org.MaterialType)
{ {

@ -11,7 +11,7 @@ public:
virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) IRR_OVERRIDE; virtual void drawTriangle(const s4DVertex* burning_restrict a, const s4DVertex* burning_restrict b, const s4DVertex* burning_restrict c) IRR_OVERRIDE;
virtual bool canWireFrame() IRR_OVERRIDE { return true; } virtual bool canWireFrame() IRR_OVERRIDE { return true; }
virtual void OnSetMaterial(const SBurningShaderMaterial& material) IRR_OVERRIDE; virtual void OnSetMaterialBurning(const SBurningShaderMaterial& material) IRR_OVERRIDE;
private: private:

@ -1,4 +1,4 @@
Tests finished. 72 tests of 72 passed. Tests finished. 72 tests of 72 passed.
Compiled as RELEASE Compiled as RELEASE
Test suite pass at GMT Tue May 3 20:01:55 2022 Test suite pass at GMT Wed May 4 10:25:42 2022