@@ -1290,7 +1290,7 @@ OpenGLRenderer::OpenGLRenderer()
1290
1290
memset (ref, 0 , sizeof (OGLRenderRef));
1291
1291
1292
1292
_mappedFramebuffer = NULL ;
1293
- _workingTextureUnpackBuffer = (Color4u8 *)malloc_alignedCacheLine (1024 * 1024 * sizeof (Color4u8));
1293
+ _workingTextureUnpackBuffer = (Color4u8 *)malloc_alignedPage (1024 * 1024 * sizeof (Color4u8));
1294
1294
_pixelReadNeedsFinish = false ;
1295
1295
_needsZeroDstAlphaPass = true ;
1296
1296
_currentPolyIndex = 0 ;
@@ -2292,6 +2292,8 @@ Render3DError OpenGLRenderer::ApplyRenderingSettings(const GFX3D_State &renderSt
2292
2292
2293
2293
OpenGLRenderer_1_2::OpenGLRenderer_1_2 ()
2294
2294
{
2295
+ _variantID = OpenGLVariantID_Legacy_1_2;
2296
+
2295
2297
_geometryDrawBuffersEnum = GeometryDrawBuffersEnumStandard;
2296
2298
_geometryAttachmentWorkingBuffer = GeometryAttachmentWorkingBufferStandard;
2297
2299
_geometryAttachmentPolyID = GeometryAttachmentPolyIDStandard;
@@ -5167,7 +5169,7 @@ Render3DError OpenGLRenderer_1_2::Reset()
5167
5169
{
5168
5170
OGLRenderRef &OGLRef = *this ->ref ;
5169
5171
5170
- if (!BEGINGL ())
5172
+ if (!BEGINGL ())
5171
5173
{
5172
5174
return OGLERROR_BEGINGL_FAILED;
5173
5175
}
@@ -5227,7 +5229,7 @@ Render3DError OpenGLRenderer_1_2::RenderPowerOff()
5227
5229
memset (GPU->GetEngineMain ()->Get3DFramebufferMain (), 0 , this ->_framebufferColorSizeBytes );
5228
5230
memset (GPU->GetEngineMain ()->Get3DFramebuffer16 (), 0 , this ->_framebufferPixCount * sizeof (u16));
5229
5231
5230
- if (!BEGINGL ())
5232
+ if (!BEGINGL ())
5231
5233
{
5232
5234
return OGLERROR_BEGINGL_FAILED;
5233
5235
}
@@ -5272,7 +5274,7 @@ Render3DError OpenGLRenderer_1_2::RenderFinish()
5272
5274
{
5273
5275
this ->_pixelReadNeedsFinish = false ;
5274
5276
5275
- if (!BEGINGL ())
5277
+ if (!BEGINGL ())
5276
5278
{
5277
5279
return OGLERROR_BEGINGL_FAILED;
5278
5280
}
@@ -5394,7 +5396,7 @@ Render3DError OpenGLRenderer_1_2::SetFramebufferSize(size_t w, size_t h)
5394
5396
else
5395
5397
{
5396
5398
Color4u8 *oldFramebufferColor = this ->_framebufferColor ;
5397
- Color4u8 *newFramebufferColor = (Color4u8 *)malloc_alignedCacheLine (newFramebufferColorSizeBytes);
5399
+ Color4u8 *newFramebufferColor = (Color4u8 *)malloc_alignedPage (newFramebufferColorSizeBytes);
5398
5400
this ->_framebufferColor = newFramebufferColor;
5399
5401
free_aligned (oldFramebufferColor);
5400
5402
}
@@ -5442,6 +5444,11 @@ Render3DError OpenGLRenderer_1_2::SetFramebufferSize(size_t w, size_t h)
5442
5444
return error;
5443
5445
}
5444
5446
5447
+ OpenGLRenderer_2_0::OpenGLRenderer_2_0 ()
5448
+ {
5449
+ _variantID = OpenGLVariantID_Legacy_2_0;
5450
+ }
5451
+
5445
5452
Render3DError OpenGLRenderer_2_0::InitFinalRenderStates (const std::set<std::string> *oglExtensionSet)
5446
5453
{
5447
5454
OGLRenderRef &OGLRef = *this ->ref ;
@@ -5674,86 +5681,9 @@ Render3DError OpenGLRenderer_2_0::BeginRender(const GFX3D_State &renderState, co
5674
5681
return OGLERROR_NOERR;
5675
5682
}
5676
5683
5677
- Render3DError OpenGLRenderer_2_0::SetupTexture ( const POLY &thePoly, size_t polyRenderIndex )
5684
+ OpenGLRenderer_2_1::OpenGLRenderer_2_1 ( )
5678
5685
{
5679
- OpenGLTexture *theTexture = (OpenGLTexture *)this ->_textureList [polyRenderIndex];
5680
- const NDSTextureFormat packFormat = theTexture->GetPackFormat ();
5681
- const OGLRenderRef &OGLRef = *this ->ref ;
5682
-
5683
- glUniform2f (OGLRef.uniformPolyTexScale [this ->_geometryProgramFlags .value ], theTexture->GetInvWidth (), theTexture->GetInvHeight ());
5684
-
5685
- // Check if we need to use textures
5686
- if (!theTexture->IsSamplingEnabled ())
5687
- {
5688
- glUniform1i (OGLRef.uniformPolyEnableTexture [this ->_geometryProgramFlags .value ], GL_FALSE);
5689
- glUniform1i (OGLRef.uniformTexSingleBitAlpha [this ->_geometryProgramFlags .value ], GL_FALSE);
5690
- return OGLERROR_NOERR;
5691
- }
5692
-
5693
- glUniform1i (OGLRef.uniformPolyEnableTexture [this ->_geometryProgramFlags .value ], GL_TRUE);
5694
- glUniform1i (OGLRef.uniformTexSingleBitAlpha [this ->_geometryProgramFlags .value ], (packFormat != TEXMODE_A3I5 && packFormat != TEXMODE_A5I3) ? GL_TRUE : GL_FALSE);
5695
-
5696
- glBindTexture (GL_TEXTURE_2D, theTexture->GetID ());
5697
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ((thePoly.texParam .RepeatS_Enable ) ? ((thePoly.texParam .MirroredRepeatS_Enable ) ? GL_MIRRORED_REPEAT : GL_REPEAT) : GL_CLAMP_TO_EDGE));
5698
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ((thePoly.texParam .RepeatT_Enable ) ? ((thePoly.texParam .MirroredRepeatT_Enable ) ? GL_MIRRORED_REPEAT : GL_REPEAT) : GL_CLAMP_TO_EDGE));
5699
-
5700
- if (this ->_enableTextureSmoothing )
5701
- {
5702
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (this ->_textureScalingFactor > 1 ) ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR);
5703
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
5704
- glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, this ->_deviceInfo .maxAnisotropy );
5705
- }
5706
- else
5707
- {
5708
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
5709
- glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
5710
- glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1 .0f );
5711
- }
5712
-
5713
- theTexture->ResetCacheAge ();
5714
- theTexture->IncreaseCacheUsageCount (1 );
5715
-
5716
- return OGLERROR_NOERR;
5717
- }
5718
-
5719
- Render3DError OpenGLRenderer_2_1::RenderFinish ()
5720
- {
5721
- if (!this ->_renderNeedsFinish )
5722
- {
5723
- return OGLERROR_NOERR;
5724
- }
5725
-
5726
- if (this ->_pixelReadNeedsFinish )
5727
- {
5728
- this ->_pixelReadNeedsFinish = false ;
5729
-
5730
- if (!BEGINGL ())
5731
- {
5732
- return OGLERROR_BEGINGL_FAILED;
5733
- }
5734
- this ->_mappedFramebuffer = (Color4u8 *__restrict)glMapBuffer (GL_PIXEL_PACK_BUFFER, GL_READ_ONLY);
5735
- ENDGL ();
5736
- }
5737
-
5738
- this ->_renderNeedsFlushMain = true ;
5739
- this ->_renderNeedsFlush16 = true ;
5740
-
5741
- return OGLERROR_NOERR;
5742
- }
5743
-
5744
- Render3DError OpenGLRenderer_2_1::RenderFlush (bool willFlushBuffer32, bool willFlushBuffer16)
5745
- {
5746
- if (!this ->_isPoweredOn )
5747
- {
5748
- return RENDER3DERROR_NOERR;
5749
- }
5750
-
5751
- Color4u8 *framebufferMain = (willFlushBuffer32) ? GPU->GetEngineMain ()->Get3DFramebufferMain () : NULL ;
5752
- u16 *framebuffer16 = (willFlushBuffer16) ? GPU->GetEngineMain ()->Get3DFramebuffer16 () : NULL ;
5753
-
5754
- this ->FlushFramebuffer (this ->_mappedFramebuffer , framebufferMain, framebuffer16);
5755
-
5756
- return RENDER3DERROR_NOERR;
5686
+ _variantID = OpenGLVariantID_Legacy_2_1;
5757
5687
}
5758
5688
5759
5689
template size_t OpenGLRenderer::DrawPolygonsForIndexRange<OGLPolyDrawMode_DrawOpaquePolys>(const POLY *rawPolyList, const CPoly *clippedPolyList, const size_t clippedPolyCount, size_t firstIndex, size_t lastIndex, size_t &indexOffset, POLYGON_ATTR &lastPolyAttr);
0 commit comments