Render3D: Make _textureList universal for all 3D renderers.

This commit is contained in:
rogerman 2016-11-29 17:09:25 -08:00
parent 1368b2d5c7
commit 8821e7b162
7 changed files with 11 additions and 6 deletions

View File

@ -3056,7 +3056,7 @@ Render3DError OpenGLRenderer_1_2::SetupPolygon(const POLY &thePoly)
Render3DError OpenGLRenderer_1_2::SetupTexture(const POLY &thePoly, size_t polyRenderIndex) Render3DError OpenGLRenderer_1_2::SetupTexture(const POLY &thePoly, size_t polyRenderIndex)
{ {
OpenGLTexture *theTexture = this->_textureList[polyRenderIndex]; OpenGLTexture *theTexture = (OpenGLTexture *)this->_textureList[polyRenderIndex];
const NDSTextureFormat packFormat = theTexture->GetPackFormat(); const NDSTextureFormat packFormat = theTexture->GetPackFormat();
const OGLRenderRef &OGLRef = *this->ref; const OGLRenderRef &OGLRef = *this->ref;
@ -4650,7 +4650,7 @@ Render3DError OpenGLRenderer_2_0::SetupPolygon(const POLY &thePoly)
Render3DError OpenGLRenderer_2_0::SetupTexture(const POLY &thePoly, size_t polyRenderIndex) Render3DError OpenGLRenderer_2_0::SetupTexture(const POLY &thePoly, size_t polyRenderIndex)
{ {
OpenGLTexture *theTexture = this->_textureList[polyRenderIndex]; OpenGLTexture *theTexture = (OpenGLTexture *)this->_textureList[polyRenderIndex];
const NDSTextureFormat packFormat = theTexture->GetPackFormat(); const NDSTextureFormat packFormat = theTexture->GetPackFormat();
const OGLRenderRef &OGLRef = *this->ref; const OGLRenderRef &OGLRef = *this->ref;

View File

@ -611,7 +611,6 @@ protected:
bool _pixelReadNeedsFinish; bool _pixelReadNeedsFinish;
size_t _currentPolyIndex; size_t _currentPolyIndex;
std::vector<u8> _shadowPolyID; std::vector<u8> _shadowPolyID;
OpenGLTexture *_textureList[POLYLIST_SIZE];
Render3DError FlushFramebuffer(const FragmentColor *__restrict srcFramebuffer, FragmentColor *__restrict dstFramebuffer, u16 *__restrict dstRGBA5551); Render3DError FlushFramebuffer(const FragmentColor *__restrict srcFramebuffer, FragmentColor *__restrict dstFramebuffer, u16 *__restrict dstRGBA5551);
OpenGLTexture* GetLoadedTextureFromPolygon(const POLY &thePoly, bool enableTexturing); OpenGLTexture* GetLoadedTextureFromPolygon(const POLY &thePoly, bool enableTexturing);

View File

@ -1687,7 +1687,7 @@ Render3DError OpenGLRenderer_3_2::SetupPolygon(const POLY &thePoly)
Render3DError OpenGLRenderer_3_2::SetupTexture(const POLY &thePoly, size_t polyRenderIndex) Render3DError OpenGLRenderer_3_2::SetupTexture(const POLY &thePoly, size_t polyRenderIndex)
{ {
OpenGLTexture *theTexture = this->_textureList[polyRenderIndex]; OpenGLTexture *theTexture = (OpenGLTexture *)this->_textureList[polyRenderIndex];
glBindTexture(GL_TEXTURE_2D, theTexture->GetID()); glBindTexture(GL_TEXTURE_2D, theTexture->GetID());

View File

@ -345,7 +345,7 @@ public:
Render3DError SetupTexture(const POLY &thePoly, size_t polyRenderIndex) Render3DError SetupTexture(const POLY &thePoly, size_t polyRenderIndex)
{ {
SoftRasterizerTexture *theTexture = this->_softRender->_textureList[polyRenderIndex]; SoftRasterizerTexture *theTexture = (SoftRasterizerTexture *)this->_softRender->GetTextureByPolygonRenderIndex(polyRenderIndex);
this->currentTexture = theTexture; this->currentTexture = theTexture;
if (!theTexture->IsSamplingEnabled()) if (!theTexture->IsSamplingEnabled())

View File

@ -122,7 +122,6 @@ public:
FragmentColor toonColor32LUT[32]; FragmentColor toonColor32LUT[32];
GFX3D_Clipper::TClippedPoly *clippedPolys; GFX3D_Clipper::TClippedPoly *clippedPolys;
FragmentAttributesBuffer *_framebufferAttributes; FragmentAttributesBuffer *_framebufferAttributes;
SoftRasterizerTexture *_textureList[POLYLIST_SIZE];
bool polyVisible[POLYLIST_SIZE]; bool polyVisible[POLYLIST_SIZE];
bool polyBackfacing[POLYLIST_SIZE]; bool polyBackfacing[POLYLIST_SIZE];
GFX3D_State *currentRenderState; GFX3D_State *currentRenderState;

View File

@ -453,6 +453,11 @@ void Render3D::SetTextureProcessingProperties(size_t scalingFactor, bool willDep
} }
} }
Render3DTexture* Render3D::GetTextureByPolygonRenderIndex(size_t polyRenderIndex) const
{
return this->_textureList[polyRenderIndex];
}
Render3DError Render3D::BeginRender(const GFX3D &engine) Render3DError Render3D::BeginRender(const GFX3D &engine)
{ {
return RENDER3DERROR_NOERR; return RENDER3DERROR_NOERR;

View File

@ -162,6 +162,7 @@ protected:
SSurface _textureDeposterizeDstSurface; SSurface _textureDeposterizeDstSurface;
u32 *_textureUpscaleBuffer; u32 *_textureUpscaleBuffer;
Render3DTexture *_textureList[POLYLIST_SIZE];
CACHE_ALIGN u16 clearImageColor16Buffer[GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT]; CACHE_ALIGN u16 clearImageColor16Buffer[GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT];
CACHE_ALIGN u32 clearImageDepthBuffer[GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT]; CACHE_ALIGN u32 clearImageDepthBuffer[GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT];
@ -230,6 +231,7 @@ public:
void SetRenderNeedsFinish(const bool renderNeedsFinish); void SetRenderNeedsFinish(const bool renderNeedsFinish);
void SetTextureProcessingProperties(size_t scalingFactor, bool willDeposterize, bool willSmooth); void SetTextureProcessingProperties(size_t scalingFactor, bool willDeposterize, bool willSmooth);
Render3DTexture* GetTextureByPolygonRenderIndex(size_t polyRenderIndex) const;
}; };
#ifdef ENABLE_SSE2 #ifdef ENABLE_SSE2