- minor cleanup of FHardwareTexture.

Inlining of a trivial function and removing dependency on the render state, unbinding the render state should be done elsewhere.
This commit is contained in:
Christoph Oelckers 2020-05-29 11:48:29 +02:00
parent a517b04908
commit 5861fdd4bd
3 changed files with 19 additions and 15 deletions

View file

@ -263,6 +263,7 @@ void OpenGLFrameBuffer::Swap()
Finish.Unclock();
camtexcount = 0;
FHardwareTexture::UnbindAll();
gl_RenderState.ClearLastMaterial();
mDebug->Update();
}
@ -321,6 +322,7 @@ void OpenGLFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
}
// unbind everything.
FHardwareTexture::UnbindAll();
gl_RenderState.ClearLastMaterial();
}
IVertexBuffer *OpenGLFrameBuffer::CreateVertexBuffer()

View file

@ -42,8 +42,8 @@
#include "hw_cvars.h"
#include "gl_debug.h"
#include "gl_renderer.h"
#include "gl_renderstate.h"
#include "gl_samplers.h"
#include "gl_hwtexture.h"
namespace OpenGLRenderer
{
@ -237,11 +237,6 @@ unsigned int FHardwareTexture::Bind(int texunit, bool needmipmap)
return 0;
}
unsigned int FHardwareTexture::GetTextureHandle(int translation)
{
return glTexID;
}
void FHardwareTexture::Unbind(int texunit)
{
if (lastbound[texunit] != 0)
@ -259,7 +254,6 @@ void FHardwareTexture::UnbindAll()
{
Unbind(texunit);
}
gl_RenderState.ClearLastMaterial();
}
//===========================================================================

View file

@ -1,6 +1,10 @@
#pragma once
class FBitmap;
class FTexture;
#include "tarray.h"
#include "hw_ihwtexture.h"
#ifndef __GLTEXTURE_H
#define __GLTEXTURE_H
#ifdef LoadImage
#undef LoadImage
@ -65,8 +69,12 @@ public:
uint8_t* MapBuffer();
unsigned int CreateTexture(unsigned char* buffer, int w, int h, int texunit, bool mipmap, const char* name);
unsigned int GetTextureHandle(int translation);
unsigned int GetTextureHandle()
{
return glTexID;
}
int numChannels() { return glTextureBytes; }
};
}
#endif