I forgot about d3d... again.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5327 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-10-27 05:34:08 +00:00
parent 45b4659de6
commit b024a19fc8
2 changed files with 6 additions and 4 deletions

View file

@ -393,14 +393,14 @@ void D3D11_UploadLightmap(lightmapinfo_t *lm)
mips.mip[0].width = lm->width;
mips.mip[0].height = lm->height;
mips.mip[0].datasize = lm->width*lm->height*4;
switch (lightmap_fmt)
switch (lm->fmt)
{
default:
case PTI_A2BGR10:
case PTI_E5BGR9:
case PTI_RGBA16F:
case PTI_RGBA32F:
mips.encoding = lightmap_fmt;
mips.encoding = lm->fmt;
break;
case PTI_BGRA8:
mips.encoding = PTI_BGRX8;

View file

@ -3292,13 +3292,14 @@ static void BE_UploadLightmaps(qboolean force)
glRect_t *theRect = &lm->rectchange;
int r;
int w;
int pixbytes;
if (!TEXLOADED(lm->lightmap_texture))
lm->lightmap_texture = Image_CreateTexture("***lightmap***", NULL, (r_lightmap_nearest.ival?IF_NEAREST:IF_LINEAR)|IF_NOMIPMAP);
tex = lm->lightmap_texture->ptr;
if (!tex)
{
switch(lightmap_fmt)
switch(lm->fmt)
{
default:
break;
@ -3342,10 +3343,11 @@ static void BE_UploadLightmaps(qboolean force)
rect.top = theRect->t;
rect.bottom = theRect->b;
pixbytes = lightmap[i]->pixbytes;
IDirect3DTexture9_LockRect(tex, 0, &lock, &rect, 0);
for (r = 0, w = theRect->r-theRect->l; r < lightmap[i]->rectchange.b-lightmap[i]->rectchange.t; r++)
{
memcpy((char*)lock.pBits + r*lock.Pitch, lightmap[i]->lightmaps+(theRect->l+((r+theRect->t)*lm->width))*lightmap_bytes, w*lightmap_bytes);
memcpy((char*)lock.pBits + r*lock.Pitch, lightmap[i]->lightmaps+(theRect->l+((r+theRect->t)*lm->width))*pixbytes, w*pixbytes);
}
IDirect3DTexture9_UnlockRect(tex, 0);
theRect->l = lm->width;