mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- 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:
parent
a517b04908
commit
5861fdd4bd
3 changed files with 19 additions and 15 deletions
|
@ -263,6 +263,7 @@ void OpenGLFrameBuffer::Swap()
|
||||||
Finish.Unclock();
|
Finish.Unclock();
|
||||||
camtexcount = 0;
|
camtexcount = 0;
|
||||||
FHardwareTexture::UnbindAll();
|
FHardwareTexture::UnbindAll();
|
||||||
|
gl_RenderState.ClearLastMaterial();
|
||||||
mDebug->Update();
|
mDebug->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,6 +322,7 @@ void OpenGLFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
|
||||||
}
|
}
|
||||||
// unbind everything.
|
// unbind everything.
|
||||||
FHardwareTexture::UnbindAll();
|
FHardwareTexture::UnbindAll();
|
||||||
|
gl_RenderState.ClearLastMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
IVertexBuffer *OpenGLFrameBuffer::CreateVertexBuffer()
|
IVertexBuffer *OpenGLFrameBuffer::CreateVertexBuffer()
|
||||||
|
|
|
@ -42,14 +42,14 @@
|
||||||
#include "hw_cvars.h"
|
#include "hw_cvars.h"
|
||||||
#include "gl_debug.h"
|
#include "gl_debug.h"
|
||||||
#include "gl_renderer.h"
|
#include "gl_renderer.h"
|
||||||
#include "gl_renderstate.h"
|
|
||||||
#include "gl_samplers.h"
|
#include "gl_samplers.h"
|
||||||
|
#include "gl_hwtexture.h"
|
||||||
|
|
||||||
namespace OpenGLRenderer
|
namespace OpenGLRenderer
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
TexFilter_s TexFilter[]={
|
TexFilter_s TexFilter[] = {
|
||||||
{GL_NEAREST, GL_NEAREST, false},
|
{GL_NEAREST, GL_NEAREST, false},
|
||||||
{GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST, true},
|
{GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST, true},
|
||||||
{GL_LINEAR, GL_LINEAR, false},
|
{GL_LINEAR, GL_LINEAR, false},
|
||||||
|
@ -237,11 +237,6 @@ unsigned int FHardwareTexture::Bind(int texunit, bool needmipmap)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int FHardwareTexture::GetTextureHandle(int translation)
|
|
||||||
{
|
|
||||||
return glTexID;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FHardwareTexture::Unbind(int texunit)
|
void FHardwareTexture::Unbind(int texunit)
|
||||||
{
|
{
|
||||||
if (lastbound[texunit] != 0)
|
if (lastbound[texunit] != 0)
|
||||||
|
@ -259,7 +254,6 @@ void FHardwareTexture::UnbindAll()
|
||||||
{
|
{
|
||||||
Unbind(texunit);
|
Unbind(texunit);
|
||||||
}
|
}
|
||||||
gl_RenderState.ClearLastMaterial();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
|
@ -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
|
#ifdef LoadImage
|
||||||
#undef LoadImage
|
#undef LoadImage
|
||||||
|
@ -59,14 +63,18 @@ public:
|
||||||
void BindToFrameBuffer(int w, int h);
|
void BindToFrameBuffer(int w, int h);
|
||||||
|
|
||||||
unsigned int Bind(int texunit, bool needmipmap);
|
unsigned int Bind(int texunit, bool needmipmap);
|
||||||
bool BindOrCreate(FTexture *tex, int texunit, int clampmode, int translation, int flags);
|
bool BindOrCreate(FTexture* tex, int texunit, int clampmode, int translation, int flags);
|
||||||
|
|
||||||
void AllocateBuffer(int w, int h, int texelsize);
|
void AllocateBuffer(int w, int h, int texelsize);
|
||||||
uint8_t *MapBuffer();
|
uint8_t* MapBuffer();
|
||||||
|
|
||||||
unsigned int CreateTexture(unsigned char * buffer, int w, int h, int texunit, bool mipmap, const char *name);
|
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
|
|
||||||
|
|
Loading…
Reference in a new issue