mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- changed GLDebug to receive char pointers instead of FStrings.
The most frequent call using this is the regular texture creation function where this results in a pointless allocation and destruction of a temporary string which is easily avoided.
This commit is contained in:
parent
ad021cc374
commit
e654a99d39
7 changed files with 27 additions and 25 deletions
|
@ -428,8 +428,8 @@ void FGLRenderBuffers::CreateExposureLevels(int width, int height)
|
|||
FGLExposureTextureLevel level;
|
||||
level.Width = width;
|
||||
level.Height = height;
|
||||
level.Texture = Create2DTexture(textureName, GL_R32F, level.Width, level.Height);
|
||||
level.Framebuffer = CreateFrameBuffer(fbName, level.Texture);
|
||||
level.Texture = Create2DTexture(textureName.GetChars(), GL_R32F, level.Width, level.Height);
|
||||
level.Framebuffer = CreateFrameBuffer(fbName.GetChars(), level.Texture);
|
||||
ExposureLevels.Push(level);
|
||||
} while (width > 1 || height > 1);
|
||||
|
||||
|
@ -474,7 +474,7 @@ void FGLRenderBuffers::CreateEyeBuffers(int eye)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
GLuint FGLRenderBuffers::Create2DTexture(const FString &name, GLuint format, int width, int height, const void *data)
|
||||
GLuint FGLRenderBuffers::Create2DTexture(const char *name, GLuint format, int width, int height, const void *data)
|
||||
{
|
||||
GLuint handle = 0;
|
||||
glGenTextures(1, &handle);
|
||||
|
@ -508,7 +508,7 @@ GLuint FGLRenderBuffers::Create2DTexture(const FString &name, GLuint format, int
|
|||
return handle;
|
||||
}
|
||||
|
||||
GLuint FGLRenderBuffers::Create2DMultisampleTexture(const FString &name, GLuint format, int width, int height, int samples, bool fixedSampleLocations)
|
||||
GLuint FGLRenderBuffers::Create2DMultisampleTexture(const char *name, GLuint format, int width, int height, int samples, bool fixedSampleLocations)
|
||||
{
|
||||
GLuint handle = 0;
|
||||
glGenTextures(1, &handle);
|
||||
|
@ -525,7 +525,7 @@ GLuint FGLRenderBuffers::Create2DMultisampleTexture(const FString &name, GLuint
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
GLuint FGLRenderBuffers::CreateRenderBuffer(const FString &name, GLuint format, int width, int height)
|
||||
GLuint FGLRenderBuffers::CreateRenderBuffer(const char *name, GLuint format, int width, int height)
|
||||
{
|
||||
GLuint handle = 0;
|
||||
glGenRenderbuffers(1, &handle);
|
||||
|
@ -535,7 +535,7 @@ GLuint FGLRenderBuffers::CreateRenderBuffer(const FString &name, GLuint format,
|
|||
return handle;
|
||||
}
|
||||
|
||||
GLuint FGLRenderBuffers::CreateRenderBuffer(const FString &name, GLuint format, int width, int height, int samples)
|
||||
GLuint FGLRenderBuffers::CreateRenderBuffer(const char *name, GLuint format, int width, int height, int samples)
|
||||
{
|
||||
if (samples <= 1)
|
||||
return CreateRenderBuffer(name, format, width, height);
|
||||
|
@ -554,7 +554,7 @@ GLuint FGLRenderBuffers::CreateRenderBuffer(const FString &name, GLuint format,
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
GLuint FGLRenderBuffers::CreateFrameBuffer(const FString &name, GLuint colorbuffer)
|
||||
GLuint FGLRenderBuffers::CreateFrameBuffer(const char *name, GLuint colorbuffer)
|
||||
{
|
||||
GLuint handle = 0;
|
||||
glGenFramebuffers(1, &handle);
|
||||
|
@ -566,7 +566,7 @@ GLuint FGLRenderBuffers::CreateFrameBuffer(const FString &name, GLuint colorbuff
|
|||
return handle;
|
||||
}
|
||||
|
||||
GLuint FGLRenderBuffers::CreateFrameBuffer(const FString &name, GLuint colorbuffer, GLuint depthstencil, bool colorIsARenderBuffer)
|
||||
GLuint FGLRenderBuffers::CreateFrameBuffer(const char *name, GLuint colorbuffer, GLuint depthstencil, bool colorIsARenderBuffer)
|
||||
{
|
||||
GLuint handle = 0;
|
||||
glGenFramebuffers(1, &handle);
|
||||
|
@ -582,7 +582,7 @@ GLuint FGLRenderBuffers::CreateFrameBuffer(const FString &name, GLuint colorbuff
|
|||
return handle;
|
||||
}
|
||||
|
||||
GLuint FGLRenderBuffers::CreateFrameBuffer(const FString &name, GLuint colorbuffer0, GLuint colorbuffer1, GLuint colorbuffer2, GLuint depthstencil, bool multisample)
|
||||
GLuint FGLRenderBuffers::CreateFrameBuffer(const char *name, GLuint colorbuffer0, GLuint colorbuffer1, GLuint colorbuffer2, GLuint depthstencil, bool multisample)
|
||||
{
|
||||
GLuint handle = 0;
|
||||
glGenFramebuffers(1, &handle);
|
||||
|
|
|
@ -97,13 +97,14 @@ private:
|
|||
void CreateEyeBuffers(int eye);
|
||||
void CreateShadowMap();
|
||||
void CreateAmbientOcclusion(int width, int height);
|
||||
GLuint Create2DTexture(const FString &name, GLuint format, int width, int height, const void *data = nullptr);
|
||||
GLuint Create2DMultisampleTexture(const FString &name, GLuint format, int width, int height, int samples, bool fixedSampleLocations);
|
||||
GLuint CreateRenderBuffer(const FString &name, GLuint format, int width, int height);
|
||||
GLuint CreateRenderBuffer(const FString &name, GLuint format, int width, int height, int samples);
|
||||
GLuint CreateFrameBuffer(const FString &name, GLuint colorbuffer);
|
||||
GLuint CreateFrameBuffer(const FString &name, GLuint colorbuffer, GLuint depthstencil, bool colorIsARenderBuffer);
|
||||
GLuint CreateFrameBuffer(const FString &name, GLuint colorbuffer0, GLuint colorbuffer1, GLuint colorbuffer2, GLuint depthstencil, bool multisample);
|
||||
|
||||
GLuint Create2DTexture(const char *name, GLuint format, int width, int height, const void *data = nullptr);
|
||||
GLuint Create2DMultisampleTexture(const char *name, GLuint format, int width, int height, int samples, bool fixedSampleLocations);
|
||||
GLuint CreateRenderBuffer(const char *name, GLuint format, int width, int height);
|
||||
GLuint CreateRenderBuffer(const char *name, GLuint format, int width, int height, int samples);
|
||||
GLuint CreateFrameBuffer(const char *name, GLuint colorbuffer);
|
||||
GLuint CreateFrameBuffer(const char *name, GLuint colorbuffer, GLuint depthstencil, bool colorIsARenderBuffer);
|
||||
GLuint CreateFrameBuffer(const char *name, GLuint colorbuffer0, GLuint colorbuffer1, GLuint colorbuffer2, GLuint depthstencil, bool multisample);
|
||||
bool CheckFrameBufferCompleteness();
|
||||
void ClearFrameBuffer(bool stencil, bool depth);
|
||||
void DeleteTexture(GLuint &handle);
|
||||
|
|
|
@ -101,19 +101,19 @@ void FGLDebug::Update()
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void FGLDebug::LabelObject(GLenum type, GLuint handle, const FString &name)
|
||||
void FGLDebug::LabelObject(GLenum type, GLuint handle, const char *name)
|
||||
{
|
||||
if (HasDebugApi() && gl_debug_level != 0)
|
||||
{
|
||||
glObjectLabel(type, handle, (GLsizei)name.Len(), name.GetChars());
|
||||
glObjectLabel(type, handle, -1, name);
|
||||
}
|
||||
}
|
||||
|
||||
void FGLDebug::LabelObjectPtr(void *ptr, const FString &name)
|
||||
void FGLDebug::LabelObjectPtr(void *ptr, const char *name)
|
||||
{
|
||||
if (HasDebugApi() && gl_debug_level != 0)
|
||||
{
|
||||
glObjectPtrLabel(ptr, (GLsizei)name.Len(), name.GetChars());
|
||||
glObjectPtrLabel(ptr, -1, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ class FGLDebug
|
|||
public:
|
||||
void Update();
|
||||
|
||||
static void LabelObject(GLenum type, GLuint handle, const FString &name);
|
||||
static void LabelObjectPtr(void *ptr, const FString &name);
|
||||
static void LabelObject(GLenum type, GLuint handle, const char *name);
|
||||
static void LabelObjectPtr(void *ptr, const char *name);
|
||||
|
||||
static void PushGroup(const FString &name);
|
||||
static void PopGroup();
|
||||
|
|
|
@ -160,7 +160,7 @@ void FHardwareTexture::Resize(int swidth, int sheight, int width, int height, un
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int h, int texunit, bool mipmap, int translation, const FString &name)
|
||||
unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int h, int texunit, bool mipmap, int translation, const char *name)
|
||||
{
|
||||
int rh,rw;
|
||||
int texformat=TexFormat[gl_texture_format];
|
||||
|
|
|
@ -86,7 +86,8 @@ public:
|
|||
void AllocateBuffer(int w, int h, int texelsize);
|
||||
uint8_t *MapBuffer();
|
||||
|
||||
unsigned int CreateTexture(unsigned char * buffer, int w, int h, int texunit, bool mipmap, int translation, const FString &name);
|
||||
unsigned int CreateTexture(unsigned char * buffer, int w, int h, int texunit, bool mipmap, int translation, const FString &name) = delete;
|
||||
unsigned int CreateTexture(unsigned char * buffer, int w, int h, int texunit, bool mipmap, int translation, const char *name);
|
||||
unsigned int GetTextureHandle(int translation);
|
||||
|
||||
void Clean(bool all);
|
||||
|
|
|
@ -58,7 +58,7 @@ FSamplerManager::FSamplerManager()
|
|||
{
|
||||
FString name;
|
||||
name.Format("mSamplers[%d]", i);
|
||||
FGLDebug::LabelObject(GL_SAMPLER, mSamplers[i], name);
|
||||
FGLDebug::LabelObject(GL_SAMPLER, mSamplers[i], name.GetChars());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue