mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
Merge branch 'master' of https://github.com/coelckers/gzdoom into lightmaps2
This commit is contained in:
commit
ff3cdb7e56
5 changed files with 52 additions and 12 deletions
|
@ -81,12 +81,11 @@ unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int
|
||||||
int texformat = GL_RGBA;// TexFormat[gl_texture_format];
|
int texformat = GL_RGBA;// TexFormat[gl_texture_format];
|
||||||
bool deletebuffer=false;
|
bool deletebuffer=false;
|
||||||
|
|
||||||
/*
|
// When running in SW mode buffer will be null, so set it to the texBuffer already created
|
||||||
if (forcenocompression)
|
// There could be other use cases I do not know about which means this is a bad idea..
|
||||||
{
|
if (buffer == nullptr)
|
||||||
texformat = GL_RGBA8;
|
buffer = texBuffer;
|
||||||
}
|
|
||||||
*/
|
|
||||||
bool firstCall = glTexID == 0;
|
bool firstCall = glTexID == 0;
|
||||||
if (firstCall)
|
if (firstCall)
|
||||||
{
|
{
|
||||||
|
@ -136,9 +135,19 @@ unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int
|
||||||
sourcetype = GL_BGRA;
|
sourcetype = GL_BGRA;
|
||||||
texformat = GL_BGRA;
|
texformat = GL_BGRA;
|
||||||
#else
|
#else
|
||||||
|
if (glTextureBytes == 1)
|
||||||
|
{
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
sourcetype = GL_RED;
|
||||||
|
texformat = GL_R8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sourcetype = GL_BGRA;
|
sourcetype = GL_BGRA;
|
||||||
texformat = GL_RGBA;
|
texformat = GL_RGBA;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, texformat, rw, rh, 0, sourcetype, GL_UNSIGNED_BYTE, buffer);
|
glTexImage2D(GL_TEXTURE_2D, 0, texformat, rw, rh, 0, sourcetype, GL_UNSIGNED_BYTE, buffer);
|
||||||
|
|
||||||
if (deletebuffer && buffer) free(buffer);
|
if (deletebuffer && buffer) free(buffer);
|
||||||
|
@ -155,6 +164,26 @@ unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FHardwareTexture::AllocateBuffer(int w, int h, int texelsize)
|
||||||
|
{
|
||||||
|
int rw = GetTexDimension(w);
|
||||||
|
int rh = GetTexDimension(h);
|
||||||
|
|
||||||
|
if (texelsize < 1 || texelsize > 4) texelsize = 4;
|
||||||
|
glTextureBytes = texelsize;
|
||||||
|
bufferpitch = w;
|
||||||
|
|
||||||
|
if (texBuffer)
|
||||||
|
delete[] texBuffer;
|
||||||
|
|
||||||
|
texBuffer = new uint8_t[(w * h) * texelsize];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t* FHardwareTexture::MapBuffer()
|
||||||
|
{
|
||||||
|
return texBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
|
@ -164,6 +193,9 @@ unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int
|
||||||
FHardwareTexture::~FHardwareTexture()
|
FHardwareTexture::~FHardwareTexture()
|
||||||
{
|
{
|
||||||
if (glTexID != 0) glDeleteTextures(1, &glTexID);
|
if (glTexID != 0) glDeleteTextures(1, &glTexID);
|
||||||
|
|
||||||
|
if (texBuffer)
|
||||||
|
delete[] texBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,8 @@ private:
|
||||||
|
|
||||||
unsigned int glTexID = 0;
|
unsigned int glTexID = 0;
|
||||||
unsigned int glDepthID = 0; // only used by camera textures
|
unsigned int glDepthID = 0; // only used by camera textures
|
||||||
|
uint8_t* texBuffer;
|
||||||
|
|
||||||
int glTextureBytes;
|
int glTextureBytes;
|
||||||
bool mipmapped = false;
|
bool mipmapped = false;
|
||||||
|
|
||||||
|
@ -52,6 +54,8 @@ public:
|
||||||
{
|
{
|
||||||
forcenofilter = disablefilter;
|
forcenofilter = disablefilter;
|
||||||
glTextureBytes = numchannels;
|
glTextureBytes = numchannels;
|
||||||
|
|
||||||
|
texBuffer = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
~FHardwareTexture();
|
~FHardwareTexture();
|
||||||
|
@ -64,8 +68,8 @@ public:
|
||||||
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) {} // Not used
|
void AllocateBuffer(int w, int h, int texelsize);
|
||||||
uint8_t* MapBuffer() { return 0; } // Not used
|
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()
|
unsigned int GetTextureHandle()
|
||||||
|
|
|
@ -32,6 +32,10 @@ static void* LoadGLES2Proc(const char* name)
|
||||||
{
|
{
|
||||||
glesLib = dlopen("libGLESv2.so", flags);
|
glesLib = dlopen("libGLESv2.so", flags);
|
||||||
}
|
}
|
||||||
|
if(!glesLib)
|
||||||
|
{
|
||||||
|
glesLib = dlopen("libGLESv2.so.2", flags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void * ret = NULL;
|
void * ret = NULL;
|
||||||
|
|
|
@ -578,7 +578,7 @@ inline BufferBuilder::BufferBuilder()
|
||||||
|
|
||||||
inline void BufferBuilder::setSize(size_t size)
|
inline void BufferBuilder::setSize(size_t size)
|
||||||
{
|
{
|
||||||
bufferInfo.size = size;
|
bufferInfo.size = std::max(size, (size_t)16);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void BufferBuilder::setUsage(VkBufferUsageFlags bufferUsage, VmaMemoryUsage memoryUsage, VmaAllocationCreateFlags allocFlags)
|
inline void BufferBuilder::setUsage(VkBufferUsageFlags bufferUsage, VmaMemoryUsage memoryUsage, VmaAllocationCreateFlags allocFlags)
|
||||||
|
|
|
@ -140,7 +140,7 @@ class PlayerPawn : Actor
|
||||||
if (health > 0) Height = FullHeight;
|
if (health > 0) Height = FullHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bWeaponLevel2Ended)
|
if (player && bWeaponLevel2Ended)
|
||||||
{
|
{
|
||||||
bWeaponLevel2Ended = false;
|
bWeaponLevel2Ended = false;
|
||||||
if (player.ReadyWeapon != NULL && player.ReadyWeapon.bPowered_Up)
|
if (player.ReadyWeapon != NULL && player.ReadyWeapon.bPowered_Up)
|
||||||
|
|
Loading…
Reference in a new issue