mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Code refactor: move struct FBOTextureFormats to separate files.
This commit is contained in:
parent
64799264d5
commit
4c4b1bf57d
|
@ -230,6 +230,7 @@
|
|||
<ClCompile Include="..\..\src\DepthBufferRender\DepthBufferRender.cpp" />
|
||||
<ClCompile Include="..\..\src\F3DEX2CBFD.cpp" />
|
||||
<ClCompile Include="..\..\src\F3DSWSE.cpp" />
|
||||
<ClCompile Include="..\..\src\FBOTextureFormats.cpp" />
|
||||
<ClCompile Include="..\..\src\FrameBuffer.cpp" />
|
||||
<ClCompile Include="..\..\src\FrameBufferInfo.cpp" />
|
||||
<ClCompile Include="..\..\src\GBI.cpp" />
|
||||
|
@ -325,6 +326,7 @@
|
|||
<ClInclude Include="..\..\src\DepthBufferRender\DepthBufferRender.h" />
|
||||
<ClInclude Include="..\..\src\F3DEX2CBFD.h" />
|
||||
<ClInclude Include="..\..\src\F3DSWSE.h" />
|
||||
<ClInclude Include="..\..\src\FBOTextureFormats.h" />
|
||||
<ClInclude Include="..\..\src\FrameBuffer.h" />
|
||||
<ClInclude Include="..\..\src\FrameBufferInfo.h" />
|
||||
<ClInclude Include="..\..\src\FrameBufferInfoAPI.h" />
|
||||
|
|
|
@ -233,6 +233,9 @@
|
|||
<ClCompile Include="..\..\src\DepthBufferRender\DepthBufferRender.cpp">
|
||||
<Filter>Source Files\DepthBufferRender</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\FBOTextureFormats.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\3DMath.h">
|
||||
|
@ -418,5 +421,8 @@
|
|||
<ClInclude Include="..\..\src\DepthBufferRender\DepthBufferRender.h">
|
||||
<Filter>Header Files\DepthBufferRender</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\FBOTextureFormats.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -4,6 +4,7 @@
|
|||
#include "ColorBufferToRDRAM.h"
|
||||
#include "WriteToRDRAM.h"
|
||||
|
||||
#include <FBOTextureFormats.h>
|
||||
#include <FrameBuffer.h>
|
||||
#include <Textures.h>
|
||||
#include <Config.h>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "ColorBufferToRDRAM.h"
|
||||
|
||||
#include <Textures.h>
|
||||
#include <FBOTextureFormats.h>
|
||||
|
||||
class ColorBufferToRDRAM_GL : public ColorBufferToRDRAM
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "ColorBufferToRDRAM.h"
|
||||
|
||||
#include <Textures.h>
|
||||
#include <FBOTextureFormats.h>
|
||||
|
||||
#include <ui/GraphicBuffer.h>
|
||||
#include <android/native_window.h>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "DepthBufferToRDRAM.h"
|
||||
#include "WriteToRDRAM.h"
|
||||
|
||||
#include <FBOTextureFormats.h>
|
||||
#include <FrameBuffer.h>
|
||||
#include <DepthBuffer.h>
|
||||
#include <Textures.h>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "RDRAMtoColorBuffer.h"
|
||||
|
||||
#include <FBOTextureFormats.h>
|
||||
#include <FrameBufferInfo.h>
|
||||
#include <GLSLCombiner.h>
|
||||
#include <FrameBuffer.h>
|
||||
|
|
|
@ -21,6 +21,7 @@ set(GLideN64_SOURCES
|
|||
F3DSWSE.cpp
|
||||
F3DEX2.cpp
|
||||
F3DEX2CBFD.cpp
|
||||
FBOTextureFormats.cpp
|
||||
FrameBuffer.cpp
|
||||
FrameBufferInfo.cpp
|
||||
GBI.cpp
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "VI.h"
|
||||
#include "Config.h"
|
||||
#include "Debug.h"
|
||||
#include "FBOTextureFormats.h"
|
||||
|
||||
const GLuint ZlutImageUnit = 0;
|
||||
const GLuint TlutImageUnit = 1;
|
||||
|
|
81
src/FBOTextureFormats.cpp
Normal file
81
src/FBOTextureFormats.cpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
#include "FBOTextureFormats.h"
|
||||
|
||||
FBOTextureFormats fboFormats;
|
||||
|
||||
void FBOTextureFormats::init()
|
||||
{
|
||||
#ifdef GLES2
|
||||
monochromeInternalFormat = GL_RGB;
|
||||
monochromeFormat = GL_RGB;
|
||||
monochromeType = GL_UNSIGNED_SHORT_5_6_5;
|
||||
monochromeFormatBytes = 2;
|
||||
|
||||
depthInternalFormat = GL_DEPTH_COMPONENT16;
|
||||
depthFormat = GL_DEPTH_COMPONENT;
|
||||
depthType = GL_UNSIGNED_INT;
|
||||
depthFormatBytes = 2;
|
||||
|
||||
if (OGLVideo::isExtensionSupported("GL_OES_rgb8_rgba8")) {
|
||||
colorInternalFormat = GL_RGBA;
|
||||
colorFormat = GL_RGBA;
|
||||
colorType = GL_UNSIGNED_BYTE;
|
||||
colorFormatBytes = 4;
|
||||
} else {
|
||||
colorInternalFormat = GL_RGB;
|
||||
colorFormat = GL_RGB;
|
||||
colorType = GL_UNSIGNED_SHORT_5_6_5;
|
||||
colorFormatBytes = 2;
|
||||
}
|
||||
#elif defined(GLES3) || defined (GLES3_1)
|
||||
colorInternalFormat = GL_RGBA;
|
||||
colorFormat = GL_RGBA;
|
||||
colorType = GL_UNSIGNED_BYTE;
|
||||
colorFormatBytes = 4;
|
||||
|
||||
monochromeInternalFormat = GL_RED;
|
||||
monochromeFormat = GL_RED;
|
||||
monochromeType = GL_UNSIGNED_BYTE;
|
||||
monochromeFormatBytes = 1;
|
||||
|
||||
depthInternalFormat = GL_DEPTH_COMPONENT32F;
|
||||
depthFormat = GL_DEPTH_COMPONENT;
|
||||
depthType = GL_FLOAT;
|
||||
depthFormatBytes = 4;
|
||||
|
||||
depthImageInternalFormat = GL_RGBA32F;
|
||||
depthImageFormat = GL_RGBA;
|
||||
depthImageType = GL_FLOAT;
|
||||
depthImageFormatBytes = 16;
|
||||
|
||||
lutInternalFormat = GL_R32UI;
|
||||
lutFormat = GL_RED;
|
||||
lutType = GL_UNSIGNED_INT;
|
||||
lutFormatBytes = 4;
|
||||
#else
|
||||
colorInternalFormat = GL_RGBA;
|
||||
colorFormat = GL_RGBA;
|
||||
colorType = GL_UNSIGNED_BYTE;
|
||||
colorFormatBytes = 4;
|
||||
|
||||
monochromeInternalFormat = GL_RED;
|
||||
monochromeFormat = GL_RED;
|
||||
monochromeType = GL_UNSIGNED_BYTE;
|
||||
monochromeFormatBytes = 1;
|
||||
|
||||
depthInternalFormat = GL_DEPTH_COMPONENT;
|
||||
depthFormat = GL_DEPTH_COMPONENT;
|
||||
depthType = GL_FLOAT;
|
||||
depthFormatBytes = 4;
|
||||
|
||||
depthImageInternalFormat = GL_RG32F;
|
||||
depthImageFormat = GL_RG;
|
||||
depthImageType = GL_FLOAT;
|
||||
depthImageFormatBytes = 8;
|
||||
|
||||
lutInternalFormat = GL_R16;
|
||||
lutFormat = GL_RED;
|
||||
lutType = GL_UNSIGNED_SHORT;
|
||||
lutFormatBytes = 2;
|
||||
|
||||
#endif
|
||||
}
|
38
src/FBOTextureFormats.h
Normal file
38
src/FBOTextureFormats.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
#ifndef FBOTEXTUREFORMATS_H
|
||||
#define FBOTEXTUREFORMATS_H
|
||||
|
||||
#include "OpenGL.h"
|
||||
|
||||
struct FBOTextureFormats
|
||||
{
|
||||
GLint colorInternalFormat;
|
||||
GLenum colorFormat;
|
||||
GLenum colorType;
|
||||
u32 colorFormatBytes;
|
||||
|
||||
GLint monochromeInternalFormat;
|
||||
GLenum monochromeFormat;
|
||||
GLenum monochromeType;
|
||||
u32 monochromeFormatBytes;
|
||||
|
||||
GLint depthInternalFormat;
|
||||
GLenum depthFormat;
|
||||
GLenum depthType;
|
||||
u32 depthFormatBytes;
|
||||
|
||||
GLint depthImageInternalFormat;
|
||||
GLenum depthImageFormat;
|
||||
GLenum depthImageType;
|
||||
u32 depthImageFormatBytes;
|
||||
|
||||
GLint lutInternalFormat;
|
||||
GLenum lutFormat;
|
||||
GLenum lutType;
|
||||
u32 lutFormatBytes;
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
extern FBOTextureFormats fboFormats;
|
||||
|
||||
#endif // FBOTEXTUREFORMATS_H
|
|
@ -18,6 +18,7 @@
|
|||
#include "Debug.h"
|
||||
#include "PostProcessor.h"
|
||||
#include "FrameBufferInfo.h"
|
||||
#include "FBOTextureFormats.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include "BufferCopy/ColorBufferToRDRAM.h"
|
||||
|
|
|
@ -3,16 +3,17 @@
|
|||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "../N64.h"
|
||||
#include "../OpenGL.h"
|
||||
#include "../Config.h"
|
||||
#include "../GLSLCombiner.h"
|
||||
#include "../ShaderUtils.h"
|
||||
#include "../FrameBuffer.h"
|
||||
#include "../DepthBuffer.h"
|
||||
#include "../RSP.h"
|
||||
#include "../VI.h"
|
||||
#include "../Log.h"
|
||||
#include <N64.h>
|
||||
#include <OpenGL.h>
|
||||
#include <Config.h>
|
||||
#include <GLSLCombiner.h>
|
||||
#include <ShaderUtils.h>
|
||||
#include <FrameBuffer.h>
|
||||
#include <DepthBuffer.h>
|
||||
#include <RSP.h>
|
||||
#include <VI.h>
|
||||
#include <Log.h>
|
||||
#include <FBOTextureFormats.h>
|
||||
|
||||
#include "Shaders_gles2.h"
|
||||
|
||||
|
|
|
@ -4,16 +4,17 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "../N64.h"
|
||||
#include "../OpenGL.h"
|
||||
#include "../Config.h"
|
||||
#include "../GLSLCombiner.h"
|
||||
#include "../ShaderUtils.h"
|
||||
#include "../FrameBuffer.h"
|
||||
#include "../DepthBuffer.h"
|
||||
#include "../RSP.h"
|
||||
#include "../VI.h"
|
||||
#include "../Log.h"
|
||||
#include <N64.h>
|
||||
#include <OpenGL.h>
|
||||
#include <Config.h>
|
||||
#include <GLSLCombiner.h>
|
||||
#include <ShaderUtils.h>
|
||||
#include <FrameBuffer.h>
|
||||
#include <DepthBuffer.h>
|
||||
#include <RSP.h>
|
||||
#include <VI.h>
|
||||
#include <Log.h>
|
||||
#include <FBOTextureFormats.h>
|
||||
|
||||
#include "Shaders_ogl3x.h"
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "PostProcessor.h"
|
||||
#include "ShaderUtils.h"
|
||||
#include "SoftwareRender.h"
|
||||
#include "FBOTextureFormats.h"
|
||||
#include "TextureFilterHandler.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -1715,86 +1716,6 @@ void OGLRender::clearColorBuffer(float *_pColor )
|
|||
glEnable( GL_SCISSOR_TEST );
|
||||
}
|
||||
|
||||
FBOTextureFormats fboFormats;
|
||||
|
||||
void FBOTextureFormats::init()
|
||||
{
|
||||
#ifdef GLES2
|
||||
monochromeInternalFormat = GL_RGB;
|
||||
monochromeFormat = GL_RGB;
|
||||
monochromeType = GL_UNSIGNED_SHORT_5_6_5;
|
||||
monochromeFormatBytes = 2;
|
||||
|
||||
depthInternalFormat = GL_DEPTH_COMPONENT16;
|
||||
depthFormat = GL_DEPTH_COMPONENT;
|
||||
depthType = GL_UNSIGNED_INT;
|
||||
depthFormatBytes = 2;
|
||||
|
||||
if (OGLVideo::isExtensionSupported("GL_OES_rgb8_rgba8")) {
|
||||
colorInternalFormat = GL_RGBA;
|
||||
colorFormat = GL_RGBA;
|
||||
colorType = GL_UNSIGNED_BYTE;
|
||||
colorFormatBytes = 4;
|
||||
} else {
|
||||
colorInternalFormat = GL_RGB;
|
||||
colorFormat = GL_RGB;
|
||||
colorType = GL_UNSIGNED_SHORT_5_6_5;
|
||||
colorFormatBytes = 2;
|
||||
}
|
||||
#elif defined(GLES3) || defined (GLES3_1)
|
||||
colorInternalFormat = GL_RGBA;
|
||||
colorFormat = GL_RGBA;
|
||||
colorType = GL_UNSIGNED_BYTE;
|
||||
colorFormatBytes = 4;
|
||||
|
||||
monochromeInternalFormat = GL_RED;
|
||||
monochromeFormat = GL_RED;
|
||||
monochromeType = GL_UNSIGNED_BYTE;
|
||||
monochromeFormatBytes = 1;
|
||||
|
||||
depthInternalFormat = GL_DEPTH_COMPONENT32F;
|
||||
depthFormat = GL_DEPTH_COMPONENT;
|
||||
depthType = GL_FLOAT;
|
||||
depthFormatBytes = 4;
|
||||
|
||||
depthImageInternalFormat = GL_RGBA32F;
|
||||
depthImageFormat = GL_RGBA;
|
||||
depthImageType = GL_FLOAT;
|
||||
depthImageFormatBytes = 16;
|
||||
|
||||
lutInternalFormat = GL_R32UI;
|
||||
lutFormat = GL_RED;
|
||||
lutType = GL_UNSIGNED_INT;
|
||||
lutFormatBytes = 4;
|
||||
#else
|
||||
colorInternalFormat = GL_RGBA;
|
||||
colorFormat = GL_RGBA;
|
||||
colorType = GL_UNSIGNED_BYTE;
|
||||
colorFormatBytes = 4;
|
||||
|
||||
monochromeInternalFormat = GL_RED;
|
||||
monochromeFormat = GL_RED;
|
||||
monochromeType = GL_UNSIGNED_BYTE;
|
||||
monochromeFormatBytes = 1;
|
||||
|
||||
depthInternalFormat = GL_DEPTH_COMPONENT;
|
||||
depthFormat = GL_DEPTH_COMPONENT;
|
||||
depthType = GL_FLOAT;
|
||||
depthFormatBytes = 4;
|
||||
|
||||
depthImageInternalFormat = GL_RG32F;
|
||||
depthImageFormat = GL_RG;
|
||||
depthImageType = GL_FLOAT;
|
||||
depthImageFormatBytes = 8;
|
||||
|
||||
lutInternalFormat = GL_R16;
|
||||
lutFormat = GL_RED;
|
||||
lutType = GL_UNSIGNED_SHORT;
|
||||
lutFormatBytes = 2;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void OGLRender::_initExtensions()
|
||||
{
|
||||
LOG(LOG_VERBOSE, "OpenGL version string: %s\n", glGetString(GL_VERSION));
|
||||
|
|
32
src/OpenGL.h
32
src/OpenGL.h
|
@ -319,38 +319,6 @@ private:
|
|||
virtual bool _resizeWindow() = 0;
|
||||
};
|
||||
|
||||
struct FBOTextureFormats
|
||||
{
|
||||
GLint colorInternalFormat;
|
||||
GLenum colorFormat;
|
||||
GLenum colorType;
|
||||
u32 colorFormatBytes;
|
||||
|
||||
GLint monochromeInternalFormat;
|
||||
GLenum monochromeFormat;
|
||||
GLenum monochromeType;
|
||||
u32 monochromeFormatBytes;
|
||||
|
||||
GLint depthInternalFormat;
|
||||
GLenum depthFormat;
|
||||
GLenum depthType;
|
||||
u32 depthFormatBytes;
|
||||
|
||||
GLint depthImageInternalFormat;
|
||||
GLenum depthImageFormat;
|
||||
GLenum depthImageType;
|
||||
u32 depthImageFormatBytes;
|
||||
|
||||
GLint lutInternalFormat;
|
||||
GLenum lutFormat;
|
||||
GLenum lutType;
|
||||
u32 lutFormatBytes;
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
extern FBOTextureFormats fboFormats;
|
||||
|
||||
inline
|
||||
OGLVideo & video()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user