diff --git a/src/r_draw.cpp b/src/r_draw.cpp index d2b694f05..83a4472f3 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -178,7 +178,7 @@ FDynamicColormap ShadeFakeColormap[16]; BYTE identitymap[256]; EXTERN_CVAR (Int, r_columnmethod) - +EXTERN_CVAR (Bool, r_swtruecolor) void R_InitShadeMaps() { @@ -4135,181 +4135,180 @@ const BYTE *R_GetColumn (FTexture *tex, int col) // [RH] Initialize the column drawer pointers void R_InitColumnDrawers () { -#ifndef PALETTEOUTPUT - - R_DrawColumnHoriz = R_DrawColumnHorizP_RGBA_C; - R_DrawColumn = R_DrawColumnP_RGBA_C; - R_DrawFuzzColumn = R_DrawFuzzColumnP_RGBA_C; - R_DrawTranslatedColumn = R_DrawTranslatedColumnP_RGBA_C; - R_DrawShadedColumn = R_DrawShadedColumnP_RGBA_C; - R_DrawSpan = R_DrawSpanP_RGBA_C; - R_DrawSpanMasked = R_DrawSpanMaskedP_RGBA_C; - rt_map4cols = rt_map4cols_RGBA_c; - - R_DrawSpanTranslucent = R_DrawSpanTranslucentP_RGBA_C; - R_DrawSpanMaskedTranslucent = R_DrawSpanMaskedTranslucentP_RGBA_C; - R_DrawSpanAddClamp = R_DrawSpanAddClampP_RGBA_C; - R_DrawSpanMaskedAddClamp = R_DrawSpanMaskedAddClampP_RGBA_C; - R_FillColumn = R_FillColumnP_RGBA; - R_FillAddColumn = R_FillAddColumn_RGBA_C; - R_FillAddClampColumn = R_FillAddClampColumn_RGBA; - R_FillSubClampColumn = R_FillSubClampColumn_RGBA; - R_FillRevSubClampColumn = R_FillRevSubClampColumn_RGBA; - R_DrawAddColumn = R_DrawAddColumnP_RGBA_C; - R_DrawTlatedAddColumn = R_DrawTlatedAddColumnP_RGBA_C; - R_DrawAddClampColumn = R_DrawAddClampColumnP_RGBA_C; - R_DrawAddClampTranslatedColumn = R_DrawAddClampTranslatedColumnP_RGBA_C; - R_DrawSubClampColumn = R_DrawSubClampColumnP_RGBA_C; - R_DrawSubClampTranslatedColumn = R_DrawSubClampTranslatedColumnP_RGBA_C; - R_DrawRevSubClampColumn = R_DrawRevSubClampColumnP_RGBA_C; - R_DrawRevSubClampTranslatedColumn = R_DrawRevSubClampTranslatedColumnP_RGBA_C; - R_FillSpan = R_FillSpan_RGBA; - R_DrawFogBoundary = R_DrawFogBoundary_RGBA; - R_FillColumnHoriz = R_FillColumnHorizP_RGBA_C; - - R_DrawFogBoundary = R_DrawFogBoundary_RGBA; - R_MapColoredPlane = R_MapColoredPlane_RGBA; - R_DrawParticle = R_DrawParticle_RGBA; - - tmvline1_add = tmvline1_add_RGBA; - tmvline4_add = tmvline4_add_RGBA; - tmvline1_addclamp = tmvline1_addclamp_RGBA; - tmvline4_addclamp = tmvline4_addclamp_RGBA; - tmvline1_subclamp = tmvline1_subclamp_RGBA; - tmvline4_subclamp = tmvline4_subclamp_RGBA; - tmvline1_revsubclamp = tmvline1_revsubclamp_RGBA; - tmvline4_revsubclamp = tmvline4_revsubclamp_RGBA; - - rt_copy1col = rt_copy1col_RGBA_c; - rt_copy4cols = rt_copy4cols_RGBA_c; - rt_map1col = rt_map1col_RGBA_c; - rt_shaded4cols = rt_shaded4cols_RGBA_c; - rt_add4cols = rt_add4cols_RGBA_c; - rt_addclamp4cols = rt_addclamp4cols_RGBA_c; - rt_shaded1col = rt_shaded1col_RGBA_c; - rt_add1col = rt_add1col_RGBA_c; - rt_addclamp1col = rt_addclamp1col_RGBA_c; - rt_subclamp1col = rt_subclamp1col_RGBA_c; - rt_revsubclamp1col = rt_revsubclamp1col_RGBA_c; - rt_tlate1col = rt_tlate1col_RGBA_c; - rt_tlateadd1col = rt_tlateadd1col_RGBA_c; - rt_tlateaddclamp1col = rt_tlateaddclamp1col_RGBA_c; - rt_tlatesubclamp1col = rt_tlatesubclamp1col_RGBA_c; - rt_tlaterevsubclamp1col = rt_tlaterevsubclamp1col_RGBA_c; - rt_map4cols = rt_map4cols_RGBA_c; - rt_subclamp4cols = rt_subclamp4cols_RGBA_c; - rt_revsubclamp4cols = rt_revsubclamp4cols_RGBA_c; - rt_tlate4cols = rt_tlate4cols_RGBA_c; - rt_tlateadd4cols = rt_tlateadd4cols_RGBA_c; - rt_tlateaddclamp4cols = rt_tlateaddclamp4cols_RGBA_c; - rt_tlatesubclamp4cols = rt_tlatesubclamp4cols_RGBA_c; - rt_tlaterevsubclamp4cols = rt_tlaterevsubclamp4cols_RGBA_c; - rt_initcols = rt_initcols_rgba; - - dovline1 = vlinec1_RGBA; - doprevline1 = vlinec1_RGBA; - dovline4 = vlinec4_RGBA; - domvline1 = mvlinec1_RGBA; - domvline4 = mvlinec4_RGBA; - -#else - -#ifdef X86_ASM - R_DrawColumn = R_DrawColumnP_ASM; - R_DrawColumnHoriz = R_DrawColumnHorizP_ASM; - R_DrawFuzzColumn = R_DrawFuzzColumnP_ASM; - R_DrawTranslatedColumn = R_DrawTranslatedColumnP_C; - R_DrawShadedColumn = R_DrawShadedColumnP_C; - R_DrawSpan = R_DrawSpanP_ASM; - R_DrawSpanMasked = R_DrawSpanMaskedP_ASM; - if (CPU.Family <= 5) + if (r_swtruecolor) { - rt_map4cols = rt_map4cols_asm2; + R_DrawColumnHoriz = R_DrawColumnHorizP_RGBA_C; + R_DrawColumn = R_DrawColumnP_RGBA_C; + R_DrawFuzzColumn = R_DrawFuzzColumnP_RGBA_C; + R_DrawTranslatedColumn = R_DrawTranslatedColumnP_RGBA_C; + R_DrawShadedColumn = R_DrawShadedColumnP_RGBA_C; + R_DrawSpan = R_DrawSpanP_RGBA_C; + R_DrawSpanMasked = R_DrawSpanMaskedP_RGBA_C; + rt_map4cols = rt_map4cols_RGBA_c; + + R_DrawSpanTranslucent = R_DrawSpanTranslucentP_RGBA_C; + R_DrawSpanMaskedTranslucent = R_DrawSpanMaskedTranslucentP_RGBA_C; + R_DrawSpanAddClamp = R_DrawSpanAddClampP_RGBA_C; + R_DrawSpanMaskedAddClamp = R_DrawSpanMaskedAddClampP_RGBA_C; + R_FillColumn = R_FillColumnP_RGBA; + R_FillAddColumn = R_FillAddColumn_RGBA_C; + R_FillAddClampColumn = R_FillAddClampColumn_RGBA; + R_FillSubClampColumn = R_FillSubClampColumn_RGBA; + R_FillRevSubClampColumn = R_FillRevSubClampColumn_RGBA; + R_DrawAddColumn = R_DrawAddColumnP_RGBA_C; + R_DrawTlatedAddColumn = R_DrawTlatedAddColumnP_RGBA_C; + R_DrawAddClampColumn = R_DrawAddClampColumnP_RGBA_C; + R_DrawAddClampTranslatedColumn = R_DrawAddClampTranslatedColumnP_RGBA_C; + R_DrawSubClampColumn = R_DrawSubClampColumnP_RGBA_C; + R_DrawSubClampTranslatedColumn = R_DrawSubClampTranslatedColumnP_RGBA_C; + R_DrawRevSubClampColumn = R_DrawRevSubClampColumnP_RGBA_C; + R_DrawRevSubClampTranslatedColumn = R_DrawRevSubClampTranslatedColumnP_RGBA_C; + R_FillSpan = R_FillSpan_RGBA; + R_DrawFogBoundary = R_DrawFogBoundary_RGBA; + R_FillColumnHoriz = R_FillColumnHorizP_RGBA_C; + + R_DrawFogBoundary = R_DrawFogBoundary_RGBA; + R_MapColoredPlane = R_MapColoredPlane_RGBA; + R_DrawParticle = R_DrawParticle_RGBA; + + tmvline1_add = tmvline1_add_RGBA; + tmvline4_add = tmvline4_add_RGBA; + tmvline1_addclamp = tmvline1_addclamp_RGBA; + tmvline4_addclamp = tmvline4_addclamp_RGBA; + tmvline1_subclamp = tmvline1_subclamp_RGBA; + tmvline4_subclamp = tmvline4_subclamp_RGBA; + tmvline1_revsubclamp = tmvline1_revsubclamp_RGBA; + tmvline4_revsubclamp = tmvline4_revsubclamp_RGBA; + + rt_copy1col = rt_copy1col_RGBA_c; + rt_copy4cols = rt_copy4cols_RGBA_c; + rt_map1col = rt_map1col_RGBA_c; + rt_shaded4cols = rt_shaded4cols_RGBA_c; + rt_add4cols = rt_add4cols_RGBA_c; + rt_addclamp4cols = rt_addclamp4cols_RGBA_c; + rt_shaded1col = rt_shaded1col_RGBA_c; + rt_add1col = rt_add1col_RGBA_c; + rt_addclamp1col = rt_addclamp1col_RGBA_c; + rt_subclamp1col = rt_subclamp1col_RGBA_c; + rt_revsubclamp1col = rt_revsubclamp1col_RGBA_c; + rt_tlate1col = rt_tlate1col_RGBA_c; + rt_tlateadd1col = rt_tlateadd1col_RGBA_c; + rt_tlateaddclamp1col = rt_tlateaddclamp1col_RGBA_c; + rt_tlatesubclamp1col = rt_tlatesubclamp1col_RGBA_c; + rt_tlaterevsubclamp1col = rt_tlaterevsubclamp1col_RGBA_c; + rt_map4cols = rt_map4cols_RGBA_c; + rt_subclamp4cols = rt_subclamp4cols_RGBA_c; + rt_revsubclamp4cols = rt_revsubclamp4cols_RGBA_c; + rt_tlate4cols = rt_tlate4cols_RGBA_c; + rt_tlateadd4cols = rt_tlateadd4cols_RGBA_c; + rt_tlateaddclamp4cols = rt_tlateaddclamp4cols_RGBA_c; + rt_tlatesubclamp4cols = rt_tlatesubclamp4cols_RGBA_c; + rt_tlaterevsubclamp4cols = rt_tlaterevsubclamp4cols_RGBA_c; + rt_initcols = rt_initcols_rgba; + + dovline1 = vlinec1_RGBA; + doprevline1 = vlinec1_RGBA; + dovline4 = vlinec4_RGBA; + domvline1 = mvlinec1_RGBA; + domvline4 = mvlinec4_RGBA; } else { - rt_map4cols = rt_map4cols_asm1; - } +#ifdef X86_ASM + R_DrawColumn = R_DrawColumnP_ASM; + R_DrawColumnHoriz = R_DrawColumnHorizP_ASM; + R_DrawFuzzColumn = R_DrawFuzzColumnP_ASM; + R_DrawTranslatedColumn = R_DrawTranslatedColumnP_C; + R_DrawShadedColumn = R_DrawShadedColumnP_C; + R_DrawSpan = R_DrawSpanP_ASM; + R_DrawSpanMasked = R_DrawSpanMaskedP_ASM; + if (CPU.Family <= 5) + { + rt_map4cols = rt_map4cols_asm2; + } + else + { + rt_map4cols = rt_map4cols_asm1; + } #else - R_DrawColumnHoriz = R_DrawColumnHorizP_C; - R_DrawColumn = R_DrawColumnP_C; - R_DrawFuzzColumn = R_DrawFuzzColumnP_C; - R_DrawTranslatedColumn = R_DrawTranslatedColumnP_C; - R_DrawShadedColumn = R_DrawShadedColumnP_C; - R_DrawSpan = R_DrawSpanP_C; - R_DrawSpanMasked = R_DrawSpanMaskedP_C; - rt_map4cols = rt_map4cols_c; + R_DrawColumnHoriz = R_DrawColumnHorizP_C; + R_DrawColumn = R_DrawColumnP_C; + R_DrawFuzzColumn = R_DrawFuzzColumnP_C; + R_DrawTranslatedColumn = R_DrawTranslatedColumnP_C; + R_DrawShadedColumn = R_DrawShadedColumnP_C; + R_DrawSpan = R_DrawSpanP_C; + R_DrawSpanMasked = R_DrawSpanMaskedP_C; + rt_map4cols = rt_map4cols_c; #endif - R_DrawSpanTranslucent = R_DrawSpanTranslucentP_C; - R_DrawSpanMaskedTranslucent = R_DrawSpanMaskedTranslucentP_C; - R_DrawSpanAddClamp = R_DrawSpanAddClampP_C; - R_DrawSpanMaskedAddClamp = R_DrawSpanMaskedAddClampP_C; - R_FillColumn = R_FillColumnP_C; - R_FillAddColumn = R_FillAddColumn_C; - R_FillAddClampColumn = R_FillAddClampColumn_C; - R_FillSubClampColumn = R_FillSubClampColumn_C; - R_FillRevSubClampColumn = R_FillRevSubClampColumn_C; - R_DrawAddColumn = R_DrawAddColumnP_C; - R_DrawTlatedAddColumn = R_DrawTlatedAddColumnP_C; - R_DrawAddClampColumn = R_DrawAddClampColumnP_C; - R_DrawAddClampTranslatedColumn = R_DrawAddClampTranslatedColumnP_C; - R_DrawSubClampColumn = R_DrawSubClampColumnP_C; - R_DrawSubClampTranslatedColumn = R_DrawSubClampTranslatedColumnP_C; - R_DrawRevSubClampColumn = R_DrawRevSubClampColumnP_C; - R_DrawRevSubClampTranslatedColumn = R_DrawRevSubClampTranslatedColumnP_C; - R_FillSpan = R_FillSpan_C; - R_DrawFogBoundary = R_DrawFogBoundary_C; - R_FillColumnHoriz = R_FillColumnHorizP_C; + R_DrawSpanTranslucent = R_DrawSpanTranslucentP_C; + R_DrawSpanMaskedTranslucent = R_DrawSpanMaskedTranslucentP_C; + R_DrawSpanAddClamp = R_DrawSpanAddClampP_C; + R_DrawSpanMaskedAddClamp = R_DrawSpanMaskedAddClampP_C; + R_FillColumn = R_FillColumnP_C; + R_FillAddColumn = R_FillAddColumn_C; + R_FillAddClampColumn = R_FillAddClampColumn_C; + R_FillSubClampColumn = R_FillSubClampColumn_C; + R_FillRevSubClampColumn = R_FillRevSubClampColumn_C; + R_DrawAddColumn = R_DrawAddColumnP_C; + R_DrawTlatedAddColumn = R_DrawTlatedAddColumnP_C; + R_DrawAddClampColumn = R_DrawAddClampColumnP_C; + R_DrawAddClampTranslatedColumn = R_DrawAddClampTranslatedColumnP_C; + R_DrawSubClampColumn = R_DrawSubClampColumnP_C; + R_DrawSubClampTranslatedColumn = R_DrawSubClampTranslatedColumnP_C; + R_DrawRevSubClampColumn = R_DrawRevSubClampColumnP_C; + R_DrawRevSubClampTranslatedColumn = R_DrawRevSubClampTranslatedColumnP_C; + R_FillSpan = R_FillSpan_C; + R_DrawFogBoundary = R_DrawFogBoundary_C; + R_FillColumnHoriz = R_FillColumnHorizP_C; - R_DrawFogBoundary = R_DrawFogBoundary_C; - R_MapColoredPlane = R_MapColoredPlane_C; - R_DrawParticle = R_DrawParticle_C; + R_DrawFogBoundary = R_DrawFogBoundary_C; + R_MapColoredPlane = R_MapColoredPlane_C; + R_DrawParticle = R_DrawParticle_C; - tmvline1_add = tmvline1_add_C; - tmvline4_add = tmvline4_add_C; - tmvline1_addclamp = tmvline1_addclamp_C; - tmvline4_addclamp = tmvline4_addclamp_C; - tmvline1_subclamp = tmvline1_subclamp_C; - tmvline4_subclamp = tmvline4_subclamp_C; - tmvline1_revsubclamp = tmvline1_revsubclamp_C; - tmvline4_revsubclamp = tmvline4_revsubclamp_C; + tmvline1_add = tmvline1_add_C; + tmvline4_add = tmvline4_add_C; + tmvline1_addclamp = tmvline1_addclamp_C; + tmvline4_addclamp = tmvline4_addclamp_C; + tmvline1_subclamp = tmvline1_subclamp_C; + tmvline4_subclamp = tmvline4_subclamp_C; + tmvline1_revsubclamp = tmvline1_revsubclamp_C; + tmvline4_revsubclamp = tmvline4_revsubclamp_C; #ifdef X86_ASM - rt_copy1col = rt_copy1col_asm; - rt_copy4cols = rt_copy4cols_asm; - rt_map1col = rt_map1col_asm; - rt_shaded4cols = rt_shaded4cols_asm; - rt_add4cols = rt_add4cols_asm; - rt_addclamp4cols = rt_addclamp4cols_asm; + rt_copy1col = rt_copy1col_asm; + rt_copy4cols = rt_copy4cols_asm; + rt_map1col = rt_map1col_asm; + rt_shaded4cols = rt_shaded4cols_asm; + rt_add4cols = rt_add4cols_asm; + rt_addclamp4cols = rt_addclamp4cols_asm; #else - rt_copy1col = rt_copy1col_c; - rt_copy4cols = rt_copy4cols_c; - rt_map1col = rt_map1col_c; - rt_shaded4cols = rt_shaded4cols_c; - rt_add4cols = rt_add4cols_c; - rt_addclamp4cols = rt_addclamp4cols_c; -#endif - rt_shaded1col = rt_shaded1col_c; - rt_add1col = rt_add1col_c; - rt_addclamp1col = rt_addclamp1col_c; - rt_subclamp1col = rt_subclamp1col_c; - rt_revsubclamp1col = rt_revsubclamp1col_c; - rt_tlate1col = rt_tlate1col_c; - rt_tlateadd1col = rt_tlateadd1col_c; - rt_tlateaddclamp1col = rt_tlateaddclamp1col_c; - rt_tlatesubclamp1col = rt_tlatesubclamp1col_c; - rt_tlaterevsubclamp1col = rt_tlaterevsubclamp1col_c; - rt_map4cols = rt_map4cols_c; - rt_subclamp4cols = rt_subclamp4cols_c; - rt_revsubclamp4cols = rt_revsubclamp4cols_c; - rt_tlate4cols = rt_tlate4cols_c; - rt_tlateadd4cols = rt_tlateadd4cols_c; - rt_tlateaddclamp4cols = rt_tlateaddclamp4cols_c; - rt_tlatesubclamp4cols = rt_tlatesubclamp4cols_c; - rt_tlaterevsubclamp4cols = rt_tlaterevsubclamp4cols_c; - rt_initcols = rt_initcols_pal; - + rt_copy1col = rt_copy1col_c; + rt_copy4cols = rt_copy4cols_c; + rt_map1col = rt_map1col_c; + rt_shaded4cols = rt_shaded4cols_c; + rt_add4cols = rt_add4cols_c; + rt_addclamp4cols = rt_addclamp4cols_c; #endif + rt_shaded1col = rt_shaded1col_c; + rt_add1col = rt_add1col_c; + rt_addclamp1col = rt_addclamp1col_c; + rt_subclamp1col = rt_subclamp1col_c; + rt_revsubclamp1col = rt_revsubclamp1col_c; + rt_tlate1col = rt_tlate1col_c; + rt_tlateadd1col = rt_tlateadd1col_c; + rt_tlateaddclamp1col = rt_tlateaddclamp1col_c; + rt_tlatesubclamp1col = rt_tlatesubclamp1col_c; + rt_tlaterevsubclamp1col = rt_tlaterevsubclamp1col_c; + rt_map4cols = rt_map4cols_c; + rt_subclamp4cols = rt_subclamp4cols_c; + rt_revsubclamp4cols = rt_revsubclamp4cols_c; + rt_tlate4cols = rt_tlate4cols_c; + rt_tlateadd4cols = rt_tlateadd4cols_c; + rt_tlateaddclamp4cols = rt_tlateaddclamp4cols_c; + rt_tlatesubclamp4cols = rt_tlatesubclamp4cols_c; + rt_tlaterevsubclamp4cols = rt_tlaterevsubclamp4cols_c; + rt_initcols = rt_initcols_pal; + } } // [RH] Choose column drawers in a single place diff --git a/src/r_main.cpp b/src/r_main.cpp index b7723d07d..d85cd62a0 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -103,6 +103,7 @@ bool r_dontmaplines; CVAR (String, r_viewsize, "", CVAR_NOSET) CVAR (Bool, r_shadercolormaps, true, CVAR_ARCHIVE) +CVAR (Bool, r_swtruecolor, false, CVAR_ARCHIVE) double r_BaseVisibility; double r_WallVisibility; diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index 14a78d4cd..0cc9045ee 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -187,6 +187,7 @@ EXTERN_CVAR (Float, Gamma) EXTERN_CVAR (Bool, vid_vsync) EXTERN_CVAR (Float, transsouls) EXTERN_CVAR (Int, vid_refreshrate) +EXTERN_CVAR (Bool, r_swtruecolor) extern IDirect3D9 *D3D; @@ -765,11 +766,7 @@ void D3DFB::KillNativeTexs() bool D3DFB::CreateFBTexture () { -#ifndef PALETTEOUTPUT - D3DFORMAT FBFormat = D3DFMT_A8R8G8B8; -#else - D3DFORMAT FBFormat = D3DFMT_L8; -#endif + FBFormat = r_swtruecolor ? D3DFMT_A8R8G8B8 : D3DFMT_L8; if (FAILED(D3DDevice->CreateTexture(Width, Height, 1, D3DUSAGE_DYNAMIC, FBFormat, D3DPOOL_DEFAULT, &FBTexture, NULL))) { @@ -1310,20 +1307,45 @@ void D3DFB::Draw3DPart(bool copy3d) SUCCEEDED(FBTexture->LockRect (0, &lockrect, NULL, D3DLOCK_DISCARD))) || SUCCEEDED(FBTexture->LockRect (0, &lockrect, &texrect, 0))) { - if (lockrect.Pitch == Pitch * sizeof(canvas_pixel_t) && Pitch == Width) + if (r_swtruecolor && FBFormat == D3DFMT_A8R8G8B8) { - memcpy (lockrect.pBits, MemBuffer, Width * Height * sizeof(canvas_pixel_t)); + if (lockrect.Pitch == Pitch * sizeof(uint32_t) && Pitch == Width) + { + memcpy(lockrect.pBits, MemBuffer, Width * Height * sizeof(uint32_t)); + } + else + { + uint32_t *dest = (uint32_t *)lockrect.pBits; + uint32_t *src = MemBuffer; + for (int y = 0; y < Height; y++) + { + memcpy(dest, src, Width * sizeof(uint32_t)); + dest = reinterpret_cast(reinterpret_cast(dest) + lockrect.Pitch); + src += Pitch; + } + } + } + else if (!r_swtruecolor && FBFormat == D3DFMT_L8) + { + if (lockrect.Pitch == Pitch && Pitch == Width) + { + memcpy(lockrect.pBits, MemBuffer, Width * Height); + } + else + { + BYTE *dest = (BYTE *)lockrect.pBits; + BYTE *src = (BYTE *)MemBuffer; + for (int y = 0; y < Height; y++) + { + memcpy(dest, src, Width); + dest = reinterpret_cast(reinterpret_cast(dest) + lockrect.Pitch); + src += Pitch; + } + } } else { - canvas_pixel_t *dest = (canvas_pixel_t *)lockrect.pBits; - canvas_pixel_t *src = MemBuffer; - for (int y = 0; y < Height; y++) - { - memcpy (dest, src, Width * sizeof(canvas_pixel_t)); - dest = reinterpret_cast(reinterpret_cast(dest) + lockrect.Pitch); - src += Pitch; - } + memset(lockrect.pBits, 0, lockrect.Pitch * Height); } FBTexture->UnlockRect (0); } @@ -1355,11 +1377,10 @@ void D3DFB::Draw3DPart(bool copy3d) memset(Constant, 0, sizeof(Constant)); SetAlphaBlend(D3DBLENDOP(0)); EnableAlphaTest(FALSE); -#ifndef PALETTEOUTPUT - SetPixelShader(Shaders[SHADER_NormalColor]); -#else - SetPixelShader(Shaders[SHADER_NormalColorPal]); -#endif + if (r_swtruecolor) + SetPixelShader(Shaders[SHADER_NormalColor]); + else + SetPixelShader(Shaders[SHADER_NormalColorPal]); if (copy3d) { FBVERTEX verts[4]; @@ -1377,11 +1398,10 @@ void D3DFB::Draw3DPart(bool copy3d) realfixedcolormap->ColorizeStart[1]/2, realfixedcolormap->ColorizeStart[2]/2, 0); color1 = D3DCOLOR_COLORVALUE(realfixedcolormap->ColorizeEnd[0]/2, realfixedcolormap->ColorizeEnd[1]/2, realfixedcolormap->ColorizeEnd[2]/2, 1); -#ifndef PALETTEOUTPUT - SetPixelShader(Shaders[SHADER_SpecialColormap]); -#else - SetPixelShader(Shaders[SHADER_SpecialColormapPal]); -#endif + if (r_swtruecolor) + SetPixelShader(Shaders[SHADER_SpecialColormap]); + else + SetPixelShader(Shaders[SHADER_SpecialColormapPal]); } } else @@ -1392,11 +1412,10 @@ void D3DFB::Draw3DPart(bool copy3d) CalcFullscreenCoords(verts, Accel2D, false, color0, color1); D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX)); } -#ifndef PALETTEOUTPUT - SetPixelShader(Shaders[SHADER_NormalColor]); -#else - SetPixelShader(Shaders[SHADER_NormalColorPal]); -#endif + if (r_swtruecolor) + SetPixelShader(Shaders[SHADER_NormalColor]); + else + SetPixelShader(Shaders[SHADER_NormalColorPal]); } //========================================================================== diff --git a/src/win32/win32iface.h b/src/win32/win32iface.h index 73a2c6966..d26765100 100644 --- a/src/win32/win32iface.h +++ b/src/win32/win32iface.h @@ -424,6 +424,7 @@ private: bool NeedPalUpdate; bool NeedGammaUpdate; int FBWidth, FBHeight; + D3DFORMAT FBFormat; bool VSync; RECT BlendingRect; int In2D; diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 62761a417..001172185 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -1780,6 +1780,7 @@ DSPLYMNU_BRIGHTNESS = "Brightness"; DSPLYMNU_VSYNC = "Vertical Sync"; DSPLYMNU_CAPFPS = "Rendering Interpolation"; DSPLYMNU_COLUMNMETHOD = "Column render mode"; +DSPLYMNU_TRUECOLOR = "True color output"; DSPLYMNU_WIPETYPE = "Screen wipe style"; DSPLYMNU_SHOWENDOOM = "Show ENDOOM screen"; DSPLYMNU_PALLETEHACK = "DirectDraw palette hack"; // Not used diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index ff395ff2a..93e33ce79 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -661,6 +661,7 @@ OptionMenu "VideoOptions" Option "$DSPLYMNU_VSYNC", "vid_vsync", "OnOff" Option "$DSPLYMNU_CAPFPS", "cl_capfps", "OffOn" Option "$DSPLYMNU_COLUMNMETHOD", "r_columnmethod", "ColumnMethods" + Option "$DSPLYMNU_TRUECOLOR", "r_swtruecolor", "OnOff" StaticText " " Option "$DSPLYMNU_WIPETYPE", "wipetype", "Wipes"