first commit

This commit is contained in:
2026-06-22 11:49:35 +02:00
commit d805f2ba86
619 changed files with 126873 additions and 0 deletions

View File

@ -0,0 +1,75 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#ifndef __GPUFBO__
#define __GPUFBO__
#include "ntypes.h"
#include "geometry/rect.h"
#include "alloc/ialloc.h"
namespace GS {
namespace Render { struct Texture; }
namespace GPU {
class Renderer;
/*!
@short GPU frame buffer object.
@author Emmanuel Julien (ejulien@nworks.fr)
*/
struct FBO
{
NPLACEMENT_NEW(Renderer)
Renderer &renderer;
uint color_texture_count;
Render::Texture *color_texture[8], *depth_texture;
/// Set output color texture.
virtual void SetColorTexture(Render::Texture *t)
{
color_texture[0] = t;
color_texture_count = 1;
}
/// Set output color texture.
virtual void SetColorTexture(Render::Texture *t[], uint n)
{
for (color_texture_count = 0; color_texture_count < n; ++color_texture_count)
color_texture[color_texture_count] = t[color_texture_count];
}
/// Set output depth texture.
virtual void SetDepthTexture(Render::Texture *t)
{ depth_texture = t; }
/// Blit attachment to another FBO attachment.
virtual void Blit(FBO *out, const iRect &src, const iRect &dst, bool color = true, bool depth = true) = 0;
/// Transfer color pixels into a CPU based buffer, this buffer is expected to be big enough to hold the required region in RGBA format.
virtual void ReadColorPixels(char *out, int x, int y, int w, int h) = 0;
/// Create FBO.
virtual bool Create() = 0;
/// Free FBO.
virtual void Free() = 0;
FBO(Renderer &r) : renderer(r)
{
for (uint n = 0; n < 8; ++n)
color_texture[n] = 0;
color_texture_count = 0;
depth_texture = 0;
}
virtual ~FBO() {}
};
} // GPU
} // GS
#endif // __GPUFBO__