Fixed frame buffer depth issues for all render paths, consolidated the code

This commit is contained in:
Jens Hemprich 2007-08-20 11:10:48 +00:00
parent eb31a1311e
commit e931b834dd
4 changed files with 16 additions and 17 deletions

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,6 @@ public:
void free_buffers(); void free_buffers();
void initialise_format(GrLfbWriteMode_t format); void initialise_format(GrLfbWriteMode_t format);
bool begin_write(); bool begin_write();
void end_write();
void end_write(FxU32 alpha, GLfloat depth); void end_write(FxU32 alpha, GLfloat depth);
void end_write_opaque(); void end_write_opaque();
inline FxU16 GetChromaKeyValue() {return m_ChromaKey.Scalar;}; inline FxU16 GetChromaKeyValue() {return m_ChromaKey.Scalar;};
@ -40,8 +39,7 @@ public:
} }
protected: protected:
void Clear(); void Clear();
void draw(const tilesize* tilesizetable); int buildVertexArrays();
void drawCompiledVertexArrays(const tilesize* tilesizetable, int vertexarrayindex, int tilecount);
int buildVertexArrays(const tilesize* tilesizetable, int vertexarrayindex); int buildVertexArrays(const tilesize* tilesizetable, int vertexarrayindex);
void set_gl_state(); void set_gl_state();
void restore_gl_state(); void restore_gl_state();
@ -107,4 +105,8 @@ private:
vector bool short Vector; vector bool short Vector;
#endif #endif
} m_ChromaKey; } m_ChromaKey;
//#ifdef DEBUG_TILE_RENDERING
protected:
static void highlightTileCorners(const Framebuffer::TileUpdateState updateState, FxU32* texbuffer, const GLint x_step, const GLint y_step);
//#endif
}; };

View File

@ -82,9 +82,9 @@ void RenderInitialize(void)
GlideMsg( "RenderInitialize()\n"); GlideMsg( "RenderInitialize()\n");
#endif #endif
glReportErrors("RenderInitialize"); glReportErrors("RenderInitialize");
// initialise triagle buffers // Allocate vertex array buffers
OGLRender.NumberOfTriangles = 0; OGLRender.NumberOfTriangles = 0;
const int triangles = InternalConfig.EXT_compiled_vertex_array ? OGLRender.FrameBufferStartIndex + 2 * Framebuffer::MaxTiles * Framebuffer::MaxTiles : OGLRender.FrameBufferStartIndex; const int triangles = OGLRender.FrameBufferStartIndex + 2 * Framebuffer::MaxTiles * Framebuffer::MaxTiles;
// Framebuffer utilises color, vertex and texture array only // Framebuffer utilises color, vertex and texture array only
OGLRender.TColor = (TColorStruct*) AllocBuffer(triangles, sizeof(TColorStruct)); OGLRender.TColor = (TColorStruct*) AllocBuffer(triangles, sizeof(TColorStruct));
if (OpenGL.ColorAlphaUnit2 == 0) if (OpenGL.ColorAlphaUnit2 == 0)
@ -585,10 +585,10 @@ void RenderDrawTriangles_impl( void )
glReportError(); glReportError();
} }
} }
if ( use_two_tex ) if (use_two_tex)
{ {
glActiveTextureARB(OpenGL.ColorAlphaUnit1 + 1); glActiveTextureARB(OpenGL.ColorAlphaUnit1 + 1);
if (InternalConfig.EXT_compiled_vertex_array) if (use_compiled_vertex_arrays)
{ {
glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer( 4, GL_FLOAT, 0, NULL); glTexCoordPointer( 4, GL_FLOAT, 0, NULL);

View File

@ -362,7 +362,7 @@ void GlideFramebuffer::OnBeforeBufferClear()
m_bufferclearcalls++; m_bufferclearcalls++;
if (m_bufferclearcalls == 2) if (m_bufferclearcalls == 2)
{ {
// Trigger write in order to render cockpit layer before the retro mirror 3D-view // Trigger write in order to render cockpit layer before the retro mirror 3D-view
#ifdef OGL_FRAMEBUFFER #ifdef OGL_FRAMEBUFFER
GlideMsg( "Triggering write in order to render cockpit layer before the retro mirror 3D-view\n"); GlideMsg( "Triggering write in order to render cockpit layer before the retro mirror 3D-view\n");
#endif #endif
@ -550,10 +550,7 @@ void GlideFramebuffer::WriteFrameBuffer()
} }
else else
{ {
end_write(); end_write(0x000000ff, OpenGL.ZNear);
// @todo: it would be nice to eleminate the condition,but
// m_alpha is always applied to the write and depth never
// end_write(m_alpha, m_depth);
} }
} }
else else
@ -632,15 +629,15 @@ void GlideFramebuffer::SetAlpha(FxU32 alpha)
if (m_must_write && m_framebuffer->PixelPipeline && m_alpha != alpha) if (m_must_write && m_framebuffer->PixelPipeline && m_alpha != alpha)
{ {
WriteFrameBuffer(); WriteFrameBuffer();
m_alpha = alpha;
} }
}; m_alpha = alpha;
}
void GlideFramebuffer::SetDepth(GLfloat depth) void GlideFramebuffer::SetDepth(GLfloat depth)
{ {
if (m_must_write && m_framebuffer->PixelPipeline && m_depth != depth) if (m_must_write && m_framebuffer->PixelPipeline && m_depth != depth)
{ {
WriteFrameBuffer(); WriteFrameBuffer();
m_depth = depth;
} }
}; m_depth = depth;
}