2006-11-19 02:10:25 +00:00
|
|
|
/*
|
|
|
|
** fb_d3d9.cpp
|
|
|
|
** Code to let ZDoom use Direct3D 9 as a simple framebuffer
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
2011-04-17 04:04:34 +00:00
|
|
|
** Copyright 1998-2011 Randy Heit
|
2006-11-19 02:10:25 +00:00
|
|
|
** All rights reserved.
|
|
|
|
**
|
|
|
|
** Redistribution and use in source and binary forms, with or without
|
|
|
|
** modification, are permitted provided that the following conditions
|
|
|
|
** are met:
|
|
|
|
**
|
|
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer.
|
|
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
|
|
** documentation and/or other materials provided with the distribution.
|
|
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
|
|
** derived from this software without specific prior written permission.
|
|
|
|
**
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
2008-02-14 22:58:56 +00:00
|
|
|
** This file does _not_ implement hardware-acclerated 3D rendering. It is
|
|
|
|
** just a means of getting the pixel data to the screen in a more reliable
|
2006-11-19 02:10:25 +00:00
|
|
|
** method on modern hardware by copying the entire frame to a texture,
|
|
|
|
** drawing that to the screen, and presenting.
|
2011-04-17 04:04:34 +00:00
|
|
|
**
|
|
|
|
** That said, it does implement hardware-accelerated 2D rendering.
|
2006-11-19 02:10:25 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
// HEADER FILES ------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
#define D3D_DEBUG_INFO
|
|
|
|
#endif
|
|
|
|
#define DIRECT3D_VERSION 0x0900
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <d3d9.h>
|
2008-04-29 02:43:42 +00:00
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define USE_WINDOWS_DWORD
|
|
|
|
#include "doomtype.h"
|
|
|
|
|
|
|
|
#include "c_dispatch.h"
|
|
|
|
#include "templates.h"
|
|
|
|
#include "i_system.h"
|
|
|
|
#include "i_video.h"
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
#include "i_input.h"
|
2006-11-19 02:10:25 +00:00
|
|
|
#include "v_video.h"
|
|
|
|
#include "v_pfx.h"
|
|
|
|
#include "stats.h"
|
|
|
|
#include "doomerrors.h"
|
2009-09-22 04:21:27 +00:00
|
|
|
#include "r_main.h"
|
2011-07-06 08:50:15 +00:00
|
|
|
#include "r_data/r_translate.h"
|
2007-12-30 04:18:39 +00:00
|
|
|
#include "f_wipe.h"
|
2013-02-27 03:10:25 +00:00
|
|
|
#include "sbar.h"
|
2006-11-19 02:10:25 +00:00
|
|
|
#include "win32iface.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "doomstat.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
#include "v_palette.h"
|
2009-09-20 03:50:05 +00:00
|
|
|
#include "w_wad.h"
|
2011-07-06 07:35:36 +00:00
|
|
|
#include "r_data/colormaps.h"
|
2016-01-09 04:07:16 +00:00
|
|
|
#include "SkylineBinPack.h"
|
2006-11-19 02:10:25 +00:00
|
|
|
|
|
|
|
// MACROS ------------------------------------------------------------------
|
|
|
|
|
2008-01-09 21:04:21 +00:00
|
|
|
// The number of points for the vertex buffer.
|
|
|
|
#define NUM_VERTS 10240
|
2007-12-18 01:50:08 +00:00
|
|
|
|
2008-01-09 21:04:21 +00:00
|
|
|
// The number of indices for the index buffer.
|
|
|
|
#define NUM_INDEXES ((NUM_VERTS * 6) / 4)
|
2008-01-04 05:22:30 +00:00
|
|
|
|
2008-01-06 04:03:33 +00:00
|
|
|
// The number of quads we can batch together.
|
2008-01-09 21:04:21 +00:00
|
|
|
#define MAX_QUAD_BATCH (NUM_INDEXES / 6)
|
2008-01-06 04:03:33 +00:00
|
|
|
|
2016-01-11 04:14:35 +00:00
|
|
|
// The default size for a texture atlas.
|
|
|
|
#define DEF_ATLAS_WIDTH 512
|
|
|
|
#define DEF_ATLAS_HEIGHT 512
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
// TYPES -------------------------------------------------------------------
|
|
|
|
|
|
|
|
IMPLEMENT_CLASS(D3DFB)
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
struct D3DFB::PackedTexture
|
|
|
|
{
|
2016-01-09 02:08:10 +00:00
|
|
|
D3DFB::Atlas *Owner;
|
2008-01-10 04:11:38 +00:00
|
|
|
|
2016-01-09 04:07:16 +00:00
|
|
|
PackedTexture **Prev, *Next;
|
2008-01-10 04:11:38 +00:00
|
|
|
|
|
|
|
// Pixels this image covers
|
|
|
|
RECT Area;
|
|
|
|
|
|
|
|
// Texture coordinates for this image
|
|
|
|
float Left, Top, Right, Bottom;
|
2009-11-19 01:49:19 +00:00
|
|
|
|
|
|
|
// Texture has extra space on the border?
|
|
|
|
bool Padded;
|
2008-01-10 04:11:38 +00:00
|
|
|
};
|
|
|
|
|
2016-01-09 02:08:10 +00:00
|
|
|
struct D3DFB::Atlas
|
2008-01-10 04:11:38 +00:00
|
|
|
{
|
2016-01-09 02:08:10 +00:00
|
|
|
Atlas(D3DFB *fb, int width, int height, D3DFORMAT format);
|
|
|
|
~Atlas();
|
2008-01-10 04:11:38 +00:00
|
|
|
|
2016-01-09 04:07:16 +00:00
|
|
|
PackedTexture *AllocateImage(const Rect &rect, bool padded);
|
2008-01-10 04:11:38 +00:00
|
|
|
void FreeBox(PackedTexture *box);
|
|
|
|
|
2016-01-09 04:07:16 +00:00
|
|
|
SkylineBinPack Packer;
|
2016-01-09 02:08:10 +00:00
|
|
|
Atlas *Next;
|
2008-01-10 04:11:38 +00:00
|
|
|
IDirect3DTexture9 *Tex;
|
|
|
|
D3DFORMAT Format;
|
|
|
|
PackedTexture *UsedList; // Boxes that contain images
|
|
|
|
int Width, Height;
|
|
|
|
bool OneUse;
|
|
|
|
};
|
|
|
|
|
2007-12-20 04:36:43 +00:00
|
|
|
class D3DTex : public FNativeTexture
|
|
|
|
{
|
|
|
|
public:
|
2008-01-10 04:11:38 +00:00
|
|
|
D3DTex(FTexture *tex, D3DFB *fb, bool wrapping);
|
2007-12-20 04:36:43 +00:00
|
|
|
~D3DTex();
|
|
|
|
|
|
|
|
FTexture *GameTex;
|
2008-01-10 04:11:38 +00:00
|
|
|
D3DFB::PackedTexture *Box;
|
2007-12-20 04:36:43 +00:00
|
|
|
|
2007-12-27 04:30:12 +00:00
|
|
|
D3DTex **Prev;
|
|
|
|
D3DTex *Next;
|
|
|
|
|
2007-12-20 04:36:43 +00:00
|
|
|
bool IsGray;
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
bool Create(D3DFB *fb, bool wrapping);
|
2007-12-20 04:36:43 +00:00
|
|
|
bool Update();
|
2008-01-10 04:11:38 +00:00
|
|
|
bool CheckWrapping(bool wrapping);
|
2007-12-20 04:36:43 +00:00
|
|
|
D3DFORMAT GetTexFormat();
|
|
|
|
FTextureFormat ToTexFmt(D3DFORMAT fmt);
|
|
|
|
};
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
class D3DPal : public FNativePalette
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
D3DPal(FRemapTable *remap, D3DFB *fb);
|
|
|
|
~D3DPal();
|
|
|
|
|
2007-12-27 04:30:12 +00:00
|
|
|
D3DPal **Prev;
|
|
|
|
D3DPal *Next;
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
IDirect3DTexture9 *Tex;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
D3DCOLOR BorderColor;
|
2009-09-05 03:55:29 +00:00
|
|
|
bool DoColorSkip;
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
|
|
|
|
bool Update();
|
|
|
|
|
|
|
|
FRemapTable *Remap;
|
|
|
|
int RoundedPaletteSize;
|
|
|
|
};
|
|
|
|
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
|
|
|
|
|
|
|
void DoBlending (const PalEntry *from, PalEntry *to, int count, int r, int g, int b, int a);
|
|
|
|
|
|
|
|
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
|
|
|
|
|
|
|
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
|
|
|
|
|
|
|
extern HWND Window;
|
|
|
|
extern IVideo *Video;
|
|
|
|
extern BOOL AppActive;
|
|
|
|
extern int SessionState;
|
|
|
|
extern bool VidResizing;
|
|
|
|
|
|
|
|
EXTERN_CVAR (Bool, fullscreen)
|
|
|
|
EXTERN_CVAR (Float, Gamma)
|
|
|
|
EXTERN_CVAR (Bool, vid_vsync)
|
2007-12-20 04:36:43 +00:00
|
|
|
EXTERN_CVAR (Float, transsouls)
|
2008-02-19 02:48:56 +00:00
|
|
|
EXTERN_CVAR (Int, vid_refreshrate)
|
2006-11-19 02:10:25 +00:00
|
|
|
|
|
|
|
extern IDirect3D9 *D3D;
|
|
|
|
|
|
|
|
extern cycle_t BlitCycles;
|
|
|
|
|
|
|
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
const char *const D3DFB::ShaderNames[D3DFB::NUM_SHADERS] =
|
|
|
|
{
|
|
|
|
"NormalColor.pso",
|
|
|
|
"NormalColorPal.pso",
|
|
|
|
"NormalColorInv.pso",
|
|
|
|
"NormalColorPalInv.pso",
|
|
|
|
|
|
|
|
"RedToAlpha.pso",
|
|
|
|
"RedToAlphaInv.pso",
|
|
|
|
|
|
|
|
"VertexColor.pso",
|
|
|
|
|
|
|
|
"SpecialColormap.pso",
|
|
|
|
"SpecialColorMapPal.pso",
|
|
|
|
|
|
|
|
"InGameColormap.pso",
|
|
|
|
"InGameColormapDesat.pso",
|
|
|
|
"InGameColormapInv.pso",
|
|
|
|
"InGameColormapInvDesat.pso",
|
|
|
|
"InGameColormapPal.pso",
|
|
|
|
"InGameColormapPalDesat.pso",
|
|
|
|
"InGameColormapPalInv.pso",
|
|
|
|
"InGameColormapPalInvDesat.pso",
|
|
|
|
|
|
|
|
"BurnWipe.pso",
|
|
|
|
"GammaCorrection.pso",
|
|
|
|
};
|
2006-11-19 02:10:25 +00:00
|
|
|
|
|
|
|
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
|
|
|
|
2008-02-14 04:58:45 +00:00
|
|
|
CUSTOM_CVAR(Bool, vid_hw2d, true, CVAR_NOINITCALL)
|
2007-12-30 04:18:39 +00:00
|
|
|
{
|
2013-02-27 03:10:25 +00:00
|
|
|
V_SetBorderNeedRefresh();
|
|
|
|
ST_SetNeedRefresh();
|
2007-12-30 04:18:39 +00:00
|
|
|
}
|
|
|
|
|
2009-09-22 20:17:54 +00:00
|
|
|
CVAR(Bool, d3d_antilag, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
2008-01-10 04:11:38 +00:00
|
|
|
CVAR(Int, d3d_showpacks, 0, 0)
|
2008-09-10 03:33:02 +00:00
|
|
|
CVAR(Bool, vid_hwaalines, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
2008-01-10 04:11:38 +00:00
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
// CODE --------------------------------------------------------------------
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB - Constructor
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2010-07-08 23:59:45 +00:00
|
|
|
D3DFB::D3DFB (UINT adapter, int width, int height, bool fullscreen)
|
2006-11-19 02:10:25 +00:00
|
|
|
: BaseWinFB (width, height)
|
|
|
|
{
|
|
|
|
D3DPRESENT_PARAMETERS d3dpp;
|
|
|
|
|
2010-05-14 04:06:30 +00:00
|
|
|
LastHR = 0;
|
|
|
|
|
2010-07-08 23:59:45 +00:00
|
|
|
Adapter = adapter;
|
2006-11-19 02:10:25 +00:00
|
|
|
D3DDevice = NULL;
|
2008-01-09 21:04:21 +00:00
|
|
|
VertexBuffer = NULL;
|
|
|
|
IndexBuffer = NULL;
|
2006-11-19 02:10:25 +00:00
|
|
|
FBTexture = NULL;
|
2007-12-30 04:18:39 +00:00
|
|
|
TempRenderTexture = NULL;
|
2009-12-02 05:49:45 +00:00
|
|
|
RenderTexture[0] = NULL;
|
|
|
|
RenderTexture[1] = NULL;
|
2007-12-30 04:18:39 +00:00
|
|
|
InitialWipeScreen = NULL;
|
2008-01-12 06:27:13 +00:00
|
|
|
ScreenshotTexture = NULL;
|
|
|
|
ScreenshotSurface = NULL;
|
2007-12-30 04:18:39 +00:00
|
|
|
FinalWipeScreen = NULL;
|
2006-11-19 02:10:25 +00:00
|
|
|
PaletteTexture = NULL;
|
2009-10-08 04:03:32 +00:00
|
|
|
GammaTexture = NULL;
|
2009-12-02 05:02:40 +00:00
|
|
|
FrontCopySurface = NULL;
|
2009-09-20 03:50:05 +00:00
|
|
|
for (int i = 0; i < NUM_SHADERS; ++i)
|
|
|
|
{
|
|
|
|
Shaders[i] = NULL;
|
|
|
|
}
|
2009-10-08 04:03:32 +00:00
|
|
|
GammaShader = NULL;
|
2009-09-22 20:17:54 +00:00
|
|
|
BlockSurface[0] = NULL;
|
|
|
|
BlockSurface[1] = NULL;
|
2006-11-19 02:10:25 +00:00
|
|
|
VSync = vid_vsync;
|
2007-12-18 01:50:08 +00:00
|
|
|
BlendingRect.left = 0;
|
|
|
|
BlendingRect.top = 0;
|
|
|
|
BlendingRect.right = FBWidth;
|
|
|
|
BlendingRect.bottom = FBHeight;
|
2007-12-20 04:36:43 +00:00
|
|
|
In2D = 0;
|
2007-12-27 04:30:12 +00:00
|
|
|
Palettes = NULL;
|
|
|
|
Textures = NULL;
|
|
|
|
Accel2D = true;
|
2007-12-30 04:18:39 +00:00
|
|
|
GatheringWipeScreen = false;
|
2008-01-01 03:07:05 +00:00
|
|
|
ScreenWipe = NULL;
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
InScene = false;
|
2010-08-27 15:20:05 +00:00
|
|
|
QuadExtra = new BufferedTris[MAX_QUAD_BATCH];
|
2016-01-09 02:08:10 +00:00
|
|
|
Atlases = NULL;
|
2008-01-29 18:20:05 +00:00
|
|
|
PixelDoubling = 0;
|
2009-10-08 23:44:50 +00:00
|
|
|
SkipAt = -1;
|
2009-12-02 05:49:45 +00:00
|
|
|
CurrRenderTexture = 0;
|
|
|
|
RenderTextureToggle = 0;
|
2006-11-19 02:10:25 +00:00
|
|
|
|
|
|
|
Gamma = 1.0;
|
2008-01-04 05:22:30 +00:00
|
|
|
FlashColor0 = 0;
|
|
|
|
FlashColor1 = 0xFFFFFFFF;
|
2006-11-19 02:10:25 +00:00
|
|
|
FlashColor = 0;
|
|
|
|
FlashAmount = 0;
|
|
|
|
|
|
|
|
NeedGammaUpdate = false;
|
|
|
|
NeedPalUpdate = false;
|
|
|
|
|
|
|
|
if (MemBuffer == NULL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-09-10 03:33:02 +00:00
|
|
|
memcpy(SourcePalette, GPalette.BaseColors, sizeof(PalEntry)*256);
|
2006-11-19 02:10:25 +00:00
|
|
|
|
2008-09-10 03:33:02 +00:00
|
|
|
Windowed = !(static_cast<Win32Video *>(Video)->GoFullscreen(fullscreen));
|
2006-11-19 02:10:25 +00:00
|
|
|
|
|
|
|
TrueHeight = height;
|
|
|
|
if (fullscreen)
|
|
|
|
{
|
|
|
|
for (Win32Video::ModeInfo *mode = static_cast<Win32Video *>(Video)->m_Modes; mode != NULL; mode = mode->next)
|
|
|
|
{
|
|
|
|
if (mode->width == Width && mode->height == Height)
|
|
|
|
{
|
|
|
|
TrueHeight = mode->realheight;
|
2008-01-29 18:20:05 +00:00
|
|
|
PixelDoubling = mode->doubling;
|
2006-11-19 02:10:25 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-12-28 03:30:05 +00:00
|
|
|
// Offset from top of screen to top of letterboxed screen
|
|
|
|
LBOffsetI = (TrueHeight - Height) / 2;
|
|
|
|
LBOffset = float(LBOffsetI);
|
2006-11-19 02:10:25 +00:00
|
|
|
|
2008-09-10 03:33:02 +00:00
|
|
|
FillPresentParameters(&d3dpp, fullscreen, VSync);
|
2006-11-19 02:10:25 +00:00
|
|
|
|
|
|
|
HRESULT hr;
|
|
|
|
|
2010-05-14 04:13:59 +00:00
|
|
|
LOG("CreateDevice attempt 1 hwvp\n");
|
2010-07-08 23:59:45 +00:00
|
|
|
if (FAILED(hr = D3D->CreateDevice(Adapter, D3DDEVTYPE_HAL, Window,
|
2010-05-14 03:54:35 +00:00
|
|
|
D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)) &&
|
2010-05-14 04:06:30 +00:00
|
|
|
(hr != D3DERR_DEVICELOST || D3DDevice == NULL))
|
2006-11-19 02:10:25 +00:00
|
|
|
{
|
2010-05-14 04:13:59 +00:00
|
|
|
LOG2("CreateDevice returned hr %08x dev %p; attempt 2 swvp\n", hr, D3DDevice);
|
2010-07-08 23:59:45 +00:00
|
|
|
if (FAILED(D3D->CreateDevice(Adapter, D3DDEVTYPE_HAL, Window,
|
2010-05-14 03:54:35 +00:00
|
|
|
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)) &&
|
2010-05-14 04:06:30 +00:00
|
|
|
(hr != D3DERR_DEVICELOST || D3DDevice == NULL))
|
2006-11-19 02:10:25 +00:00
|
|
|
{
|
2008-02-19 02:48:56 +00:00
|
|
|
if (d3dpp.FullScreen_RefreshRateInHz != 0)
|
|
|
|
{
|
|
|
|
d3dpp.FullScreen_RefreshRateInHz = 0;
|
2010-05-14 04:13:59 +00:00
|
|
|
LOG2("CreateDevice returned hr %08x dev %p; attempt 3 (hwvp, default Hz)\n", hr, D3DDevice);
|
2010-07-08 23:59:45 +00:00
|
|
|
if (FAILED(hr = D3D->CreateDevice(Adapter, D3DDEVTYPE_HAL, Window,
|
2010-05-14 03:54:35 +00:00
|
|
|
D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)) &&
|
2010-05-14 04:06:30 +00:00
|
|
|
(hr != D3DERR_DEVICELOST || D3DDevice == NULL))
|
2008-02-19 02:48:56 +00:00
|
|
|
{
|
2010-05-14 04:13:59 +00:00
|
|
|
LOG2("CreateDevice returned hr %08x dev %p; attempt 4 (swvp, default Hz)\n", hr, D3DDevice);
|
2010-07-08 23:59:45 +00:00
|
|
|
if (FAILED(D3D->CreateDevice(Adapter, D3DDEVTYPE_HAL, Window,
|
2010-05-14 03:54:35 +00:00
|
|
|
D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &d3dpp, &D3DDevice)) &&
|
|
|
|
hr != D3DERR_DEVICELOST)
|
2008-02-19 02:48:56 +00:00
|
|
|
{
|
|
|
|
D3DDevice = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-14 04:13:59 +00:00
|
|
|
LOG2("Final CreateDevice returned HR %08x and device %p\n", hr, D3DDevice);
|
2010-05-14 04:06:30 +00:00
|
|
|
LastHR = hr;
|
2006-11-19 02:10:25 +00:00
|
|
|
if (D3DDevice != NULL)
|
|
|
|
{
|
2008-09-10 03:33:02 +00:00
|
|
|
D3DADAPTER_IDENTIFIER9 adapter_id;
|
|
|
|
D3DDEVICE_CREATION_PARAMETERS create_params;
|
|
|
|
|
|
|
|
if (FAILED(hr = D3DDevice->GetDeviceCaps(&DeviceCaps)))
|
|
|
|
{
|
|
|
|
memset(&DeviceCaps, 0, sizeof(DeviceCaps));
|
|
|
|
}
|
|
|
|
if (SUCCEEDED(hr = D3DDevice->GetCreationParameters(&create_params)) &&
|
|
|
|
SUCCEEDED(hr = D3D->GetAdapterIdentifier(create_params.AdapterOrdinal, 0, &adapter_id)))
|
|
|
|
{
|
|
|
|
// NVidia's drivers lie, claiming they don't support
|
|
|
|
// antialiased lines when, really, they do.
|
|
|
|
if (adapter_id.VendorId == 0x10de)
|
|
|
|
{
|
|
|
|
DeviceCaps.LineCaps |= D3DLINECAPS_ANTIALIAS;
|
|
|
|
}
|
2010-05-14 04:06:30 +00:00
|
|
|
// ATI's drivers apparently also lie, so screw this caps bit.
|
2008-09-10 03:33:02 +00:00
|
|
|
}
|
|
|
|
CreateResources();
|
|
|
|
SetInitialState();
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB - Destructor
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
D3DFB::~D3DFB ()
|
|
|
|
{
|
2008-09-10 03:33:02 +00:00
|
|
|
ReleaseResources();
|
2008-01-09 21:04:21 +00:00
|
|
|
SAFE_RELEASE( D3DDevice );
|
2008-01-06 04:03:33 +00:00
|
|
|
delete[] QuadExtra;
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: SetInitialState
|
|
|
|
//
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
// Called after initial device creation and reset, when everything is set
|
|
|
|
// to D3D's defaults.
|
2009-09-20 03:50:05 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
void D3DFB::SetInitialState()
|
|
|
|
{
|
|
|
|
AlphaBlendEnabled = FALSE;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
AlphaBlendOp = D3DBLENDOP_ADD;
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
AlphaSrcBlend = D3DBLEND(0);
|
|
|
|
AlphaDestBlend = D3DBLEND(0);
|
|
|
|
|
|
|
|
CurPixelShader = NULL;
|
|
|
|
memset(Constant, 0, sizeof(Constant));
|
|
|
|
|
2009-11-08 02:51:22 +00:00
|
|
|
for (unsigned i = 0; i < countof(Texture); ++i)
|
2009-10-08 04:03:32 +00:00
|
|
|
{
|
|
|
|
Texture[i] = NULL;
|
|
|
|
D3DDevice->SetSamplerState(i, D3DSAMP_ADDRESSU, (i == 1 && SM14) ? D3DTADDRESS_BORDER : D3DTADDRESS_CLAMP);
|
|
|
|
D3DDevice->SetSamplerState(i, D3DSAMP_ADDRESSV, (i == 1 && SM14) ? D3DTADDRESS_BORDER : D3DTADDRESS_CLAMP);
|
|
|
|
if (i > 1)
|
|
|
|
{
|
|
|
|
// Set linear filtering for the SM14 gamma texture.
|
|
|
|
D3DDevice->SetSamplerState(i, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
|
|
|
|
}
|
|
|
|
}
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
NeedGammaUpdate = true;
|
|
|
|
NeedPalUpdate = true;
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
OldRenderTarget = NULL;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
|
|
|
|
if (!Windowed && SM14)
|
|
|
|
{
|
|
|
|
// Fix for Radeon 9000, possibly other R200s: When the device is
|
|
|
|
// reset, it resets the gamma ramp, but the driver apparently keeps a
|
|
|
|
// cached copy of the ramp that it doesn't update, so when
|
|
|
|
// SetGammaRamp is called later to handle the NeedGammaUpdate flag,
|
|
|
|
// it doesn't do anything, because the gamma ramp is the same as the
|
|
|
|
// one passed in the last call, even though the visible gamma ramp
|
|
|
|
// actually has changed.
|
|
|
|
//
|
|
|
|
// So here we force the gamma ramp to something absolutely horrible and
|
|
|
|
// trust that we will be able to properly set the gamma later when
|
|
|
|
// NeedGammaUpdate is handled.
|
|
|
|
D3DGAMMARAMP ramp;
|
|
|
|
memset(&ramp, 0, sizeof(ramp));
|
|
|
|
D3DDevice->SetGammaRamp(0, 0, &ramp);
|
|
|
|
}
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
// This constant is used for grayscaling weights (.xyz) and color inversion (.w)
|
|
|
|
float weights[4] = { 77/256.f, 143/256.f, 37/256.f, 1 };
|
|
|
|
D3DDevice->SetPixelShaderConstantF(PSCONST_Weights, weights, 1);
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
|
|
|
|
// D3DRS_ALPHATESTENABLE defaults to FALSE
|
|
|
|
// D3DRS_ALPHAREF defaults to 0
|
|
|
|
D3DDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_NOTEQUAL);
|
|
|
|
AlphaTestEnabled = FALSE;
|
|
|
|
|
|
|
|
CurBorderColor = 0;
|
2009-11-29 02:42:20 +00:00
|
|
|
|
|
|
|
// Clear to black, just in case it wasn't done already.
|
|
|
|
D3DDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 0, 0);
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
}
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: FillPresentParameters
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
void D3DFB::FillPresentParameters (D3DPRESENT_PARAMETERS *pp, bool fullscreen, bool vsync)
|
|
|
|
{
|
|
|
|
memset (pp, 0, sizeof(*pp));
|
|
|
|
pp->Windowed = !fullscreen;
|
|
|
|
pp->SwapEffect = D3DSWAPEFFECT_DISCARD;
|
2008-01-29 18:20:05 +00:00
|
|
|
pp->BackBufferWidth = Width << PixelDoubling;
|
|
|
|
pp->BackBufferHeight = TrueHeight << PixelDoubling;
|
2007-12-30 04:18:39 +00:00
|
|
|
pp->BackBufferFormat = fullscreen ? D3DFMT_A8R8G8B8 : D3DFMT_UNKNOWN;
|
2008-03-28 00:38:17 +00:00
|
|
|
pp->BackBufferCount = 1;
|
2006-11-19 02:10:25 +00:00
|
|
|
pp->hDeviceWindow = Window;
|
|
|
|
pp->PresentationInterval = vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
2008-02-19 02:48:56 +00:00
|
|
|
if (fullscreen)
|
|
|
|
{
|
|
|
|
pp->FullScreen_RefreshRateInHz = vid_refreshrate;
|
|
|
|
}
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: CreateResources
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
bool D3DFB::CreateResources()
|
2006-11-19 02:10:25 +00:00
|
|
|
{
|
2016-01-09 02:08:10 +00:00
|
|
|
Atlases = NULL;
|
2006-11-19 02:10:25 +00:00
|
|
|
if (!Windowed)
|
|
|
|
{
|
|
|
|
// Remove the window border in fullscreen mode
|
2007-02-13 00:10:16 +00:00
|
|
|
SetWindowLong (Window, GWL_STYLE, WS_POPUP|WS_VISIBLE|WS_SYSMENU);
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Resize the window to match desired dimensions
|
2015-03-11 18:59:51 +00:00
|
|
|
RECT rect = { 0, 0, Width, Height };
|
|
|
|
AdjustWindowRectEx(&rect, WS_VISIBLE|WS_OVERLAPPEDWINDOW, FALSE, WS_EX_APPWINDOW);
|
|
|
|
int sizew = rect.right - rect.left;
|
|
|
|
int sizeh = rect.bottom - rect.top;
|
2006-11-19 02:10:25 +00:00
|
|
|
LOG2 ("Resize window to %dx%d\n", sizew, sizeh);
|
|
|
|
VidResizing = true;
|
|
|
|
// Make sure the window has a border in windowed mode
|
2009-09-20 03:50:05 +00:00
|
|
|
SetWindowLong(Window, GWL_STYLE, WS_VISIBLE|WS_OVERLAPPEDWINDOW);
|
|
|
|
if (GetWindowLong(Window, GWL_EXSTYLE) & WS_EX_TOPMOST)
|
2006-11-21 05:43:34 +00:00
|
|
|
{
|
|
|
|
// Direct3D 9 will apparently add WS_EX_TOPMOST to fullscreen windows,
|
|
|
|
// and removing it is a little tricky. Using SetWindowLongPtr to clear it
|
|
|
|
// will not do the trick, but sending the window behind everything will.
|
2009-09-20 03:50:05 +00:00
|
|
|
SetWindowPos(Window, HWND_BOTTOM, 0, 0, sizew, sizeh,
|
2006-11-21 05:43:34 +00:00
|
|
|
SWP_DRAWFRAME | SWP_NOCOPYBITS | SWP_NOMOVE);
|
2009-09-20 03:50:05 +00:00
|
|
|
SetWindowPos(Window, HWND_TOP, 0, 0, 0, 0, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE);
|
2006-11-21 05:43:34 +00:00
|
|
|
}
|
|
|
|
else
|
2006-11-19 02:10:25 +00:00
|
|
|
{
|
2009-09-20 03:50:05 +00:00
|
|
|
SetWindowPos(Window, NULL, 0, 0, sizew, sizeh,
|
2006-11-21 05:43:34 +00:00
|
|
|
SWP_DRAWFRAME | SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOZORDER);
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
2009-09-20 03:50:05 +00:00
|
|
|
I_RestoreWindowedPos();
|
2006-11-19 02:10:25 +00:00
|
|
|
VidResizing = false;
|
|
|
|
}
|
2009-09-20 03:50:05 +00:00
|
|
|
if (!LoadShaders())
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2007-12-20 04:36:43 +00:00
|
|
|
if (!CreateFBTexture() ||
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
!CreatePaletteTexture())
|
2006-11-19 02:10:25 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!CreateVertexes())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2009-10-08 04:03:32 +00:00
|
|
|
CreateGammaTexture();
|
2009-09-22 20:17:54 +00:00
|
|
|
CreateBlockSurfaces();
|
2006-11-19 02:10:25 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: LoadShaders
|
|
|
|
//
|
|
|
|
// Returns true if all required shaders were loaded. (Gamma and burn wipe
|
|
|
|
// are the only ones not considered "required".)
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
bool D3DFB::LoadShaders()
|
|
|
|
{
|
2009-10-08 04:03:32 +00:00
|
|
|
static const char models[][4] = { "30/", "20/", "14/" };
|
2009-09-20 03:50:05 +00:00
|
|
|
FString shaderdir, shaderpath;
|
2009-11-08 02:51:22 +00:00
|
|
|
unsigned model, i;
|
|
|
|
int lump;
|
2009-09-20 03:50:05 +00:00
|
|
|
|
|
|
|
// We determine the best available model simply by trying them all in
|
|
|
|
// order of decreasing preference.
|
|
|
|
for (model = 0; model < countof(models); ++model)
|
|
|
|
{
|
|
|
|
shaderdir = "shaders/d3d/sm";
|
|
|
|
shaderdir += models[model];
|
|
|
|
for (i = 0; i < NUM_SHADERS; ++i)
|
|
|
|
{
|
|
|
|
shaderpath = shaderdir;
|
|
|
|
shaderpath += ShaderNames[i];
|
|
|
|
lump = Wads.CheckNumForFullName(shaderpath);
|
|
|
|
if (lump >= 0)
|
|
|
|
{
|
|
|
|
FMemLump data = Wads.ReadLump(lump);
|
|
|
|
if (FAILED(D3DDevice->CreatePixelShader((DWORD *)data.GetMem(), &Shaders[i])) &&
|
2009-10-08 04:03:32 +00:00
|
|
|
i < SHADER_BurnWipe)
|
2009-09-20 03:50:05 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (i == NUM_SHADERS)
|
|
|
|
{ // Success!
|
|
|
|
SM14 = (model == countof(models) - 1);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
// Failure. Release whatever managed to load (which is probably nothing.)
|
|
|
|
for (i = 0; i < NUM_SHADERS; ++i)
|
|
|
|
{
|
|
|
|
SAFE_RELEASE( Shaders[i] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: ReleaseResources
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
void D3DFB::ReleaseResources ()
|
|
|
|
{
|
2007-02-13 00:10:16 +00:00
|
|
|
I_SaveWindowedPos ();
|
2008-01-01 03:07:05 +00:00
|
|
|
KillNativeTexs();
|
|
|
|
KillNativePals();
|
|
|
|
ReleaseDefaultPoolItems();
|
2008-01-12 06:27:13 +00:00
|
|
|
SAFE_RELEASE( ScreenshotSurface );
|
|
|
|
SAFE_RELEASE( ScreenshotTexture );
|
2008-01-09 21:04:21 +00:00
|
|
|
SAFE_RELEASE( PaletteTexture );
|
2009-09-20 03:50:05 +00:00
|
|
|
for (int i = 0; i < NUM_SHADERS; ++i)
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
{
|
2009-09-20 03:50:05 +00:00
|
|
|
SAFE_RELEASE( Shaders[i] );
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
}
|
2009-10-08 04:03:32 +00:00
|
|
|
GammaShader = NULL;
|
2008-01-01 03:07:05 +00:00
|
|
|
if (ScreenWipe != NULL)
|
|
|
|
{
|
|
|
|
delete ScreenWipe;
|
|
|
|
ScreenWipe = NULL;
|
|
|
|
}
|
2016-01-09 02:08:10 +00:00
|
|
|
Atlas *pack, *next;
|
|
|
|
for (pack = Atlases; pack != NULL; pack = next)
|
2008-01-10 04:11:38 +00:00
|
|
|
{
|
|
|
|
next = pack->Next;
|
|
|
|
delete pack;
|
|
|
|
}
|
2008-01-01 03:07:05 +00:00
|
|
|
GatheringWipeScreen = false;
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: ReleaseDefaultPoolItems
|
|
|
|
//
|
2008-01-01 03:07:05 +00:00
|
|
|
// Free resources created with D3DPOOL_DEFAULT.
|
2009-09-20 03:50:05 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-01-01 03:07:05 +00:00
|
|
|
void D3DFB::ReleaseDefaultPoolItems()
|
2006-11-19 02:10:25 +00:00
|
|
|
{
|
2008-01-09 21:04:21 +00:00
|
|
|
SAFE_RELEASE( FBTexture );
|
2009-12-02 05:49:45 +00:00
|
|
|
SAFE_RELEASE( FinalWipeScreen );
|
|
|
|
SAFE_RELEASE( RenderTexture[0] );
|
|
|
|
SAFE_RELEASE( RenderTexture[1] );
|
2008-01-09 21:04:21 +00:00
|
|
|
SAFE_RELEASE( InitialWipeScreen );
|
|
|
|
SAFE_RELEASE( VertexBuffer );
|
|
|
|
SAFE_RELEASE( IndexBuffer );
|
2009-09-22 20:17:54 +00:00
|
|
|
SAFE_RELEASE( BlockSurface[0] );
|
|
|
|
SAFE_RELEASE( BlockSurface[1] );
|
2009-12-02 05:02:40 +00:00
|
|
|
SAFE_RELEASE( FrontCopySurface );
|
2008-01-01 03:07:05 +00:00
|
|
|
}
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: Reset
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-01-01 03:07:05 +00:00
|
|
|
bool D3DFB::Reset ()
|
|
|
|
{
|
|
|
|
D3DPRESENT_PARAMETERS d3dpp;
|
|
|
|
|
|
|
|
ReleaseDefaultPoolItems();
|
2006-11-19 02:10:25 +00:00
|
|
|
FillPresentParameters (&d3dpp, !Windowed, VSync);
|
|
|
|
if (!SUCCEEDED(D3DDevice->Reset (&d3dpp)))
|
|
|
|
{
|
2008-02-19 02:48:56 +00:00
|
|
|
if (d3dpp.FullScreen_RefreshRateInHz != 0)
|
|
|
|
{
|
|
|
|
d3dpp.FullScreen_RefreshRateInHz = 0;
|
|
|
|
if (!SUCCEEDED(D3DDevice->Reset (&d3dpp)))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
LOG("Device was reset\n");
|
2006-11-19 02:10:25 +00:00
|
|
|
if (!CreateFBTexture() || !CreateVertexes())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2009-09-22 20:17:54 +00:00
|
|
|
CreateBlockSurfaces();
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
SetInitialState();
|
2006-11-19 02:10:25 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-09-22 20:17:54 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: CreateBlockSurfaces
|
|
|
|
//
|
|
|
|
// Create blocking surfaces for antilag. It's okay if these can't be
|
|
|
|
// created; antilag just won't work.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::CreateBlockSurfaces()
|
|
|
|
{
|
|
|
|
BlockNum = 0;
|
|
|
|
if (SUCCEEDED(D3DDevice->CreateOffscreenPlainSurface(16, 16, D3DFMT_A8R8G8B8,
|
|
|
|
D3DPOOL_DEFAULT, &BlockSurface[0], 0)))
|
|
|
|
{
|
|
|
|
if (FAILED(D3DDevice->CreateOffscreenPlainSurface(16, 16, D3DFMT_A8R8G8B8,
|
|
|
|
D3DPOOL_DEFAULT, &BlockSurface[1], 0)))
|
|
|
|
{
|
|
|
|
BlockSurface[0]->Release();
|
|
|
|
BlockSurface[0] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-27 04:30:12 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: KillNativePals
|
|
|
|
//
|
|
|
|
// Frees all native palettes.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::KillNativePals()
|
|
|
|
{
|
|
|
|
while (Palettes != NULL)
|
|
|
|
{
|
|
|
|
delete Palettes;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: KillNativeTexs
|
|
|
|
//
|
|
|
|
// Frees all native textures.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::KillNativeTexs()
|
|
|
|
{
|
|
|
|
while (Textures != NULL)
|
|
|
|
{
|
|
|
|
delete Textures;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: CreateFBTexture
|
|
|
|
//
|
|
|
|
// Creates the "Framebuffer" texture. With the advent of hardware-assisted
|
|
|
|
// 2D, this is something of a misnomer now. The FBTexture is only used for
|
|
|
|
// uploading the software 3D image to video memory so that it can be drawn
|
|
|
|
// to the real frame buffer.
|
|
|
|
//
|
|
|
|
// It also creates the TempRenderTexture, since this seemed like a
|
|
|
|
// convenient place to do so.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
bool D3DFB::CreateFBTexture ()
|
|
|
|
{
|
2009-12-02 05:02:40 +00:00
|
|
|
if (FAILED(D3DDevice->CreateTexture(Width, Height, 1, D3DUSAGE_DYNAMIC, D3DFMT_L8, D3DPOOL_DEFAULT, &FBTexture, NULL)))
|
2006-11-19 02:10:25 +00:00
|
|
|
{
|
|
|
|
int pow2width, pow2height, i;
|
|
|
|
|
|
|
|
for (i = 1; i < Width; i <<= 1) {} pow2width = i;
|
|
|
|
for (i = 1; i < Height; i <<= 1) {} pow2height = i;
|
|
|
|
|
2009-12-02 05:02:40 +00:00
|
|
|
if (FAILED(D3DDevice->CreateTexture(pow2width, pow2height, 1, D3DUSAGE_DYNAMIC, D3DFMT_L8, D3DPOOL_DEFAULT, &FBTexture, NULL)))
|
2006-11-19 02:10:25 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FBWidth = pow2width;
|
|
|
|
FBHeight = pow2height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FBWidth = Width;
|
|
|
|
FBHeight = Height;
|
|
|
|
}
|
2009-12-02 05:49:45 +00:00
|
|
|
RenderTextureToggle = 0;
|
|
|
|
RenderTexture[0] = NULL;
|
|
|
|
RenderTexture[1] = NULL;
|
|
|
|
if (FAILED(D3DDevice->CreateTexture(FBWidth, FBHeight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &RenderTexture[0], NULL)))
|
2007-12-27 04:30:12 +00:00
|
|
|
{
|
2009-12-02 05:49:45 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (Windowed || PixelDoubling)
|
|
|
|
{
|
|
|
|
// Windowed or pixel doubling: Create another render texture so we can flip between them.
|
|
|
|
RenderTextureToggle = 1;
|
|
|
|
if (FAILED(D3DDevice->CreateTexture(FBWidth, FBHeight, 1, D3DUSAGE_RENDERTARGET, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &RenderTexture[1], NULL)))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2007-12-27 04:30:12 +00:00
|
|
|
}
|
2009-11-29 02:42:20 +00:00
|
|
|
else
|
|
|
|
{
|
2009-12-02 05:49:45 +00:00
|
|
|
// Fullscreen and not pixel doubling: Create a render target to have the back buffer copied to.
|
|
|
|
if (FAILED(D3DDevice->CreateRenderTarget(Width, Height, D3DFMT_X8R8G8B8, D3DMULTISAMPLE_NONE, 0, FALSE, &FrontCopySurface, NULL)))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Initialize the TempRenderTextures to black.
|
|
|
|
for (int i = 0; i <= RenderTextureToggle; ++i)
|
|
|
|
{
|
2009-11-29 02:42:20 +00:00
|
|
|
IDirect3DSurface9 *surf;
|
2009-12-02 05:49:45 +00:00
|
|
|
if (SUCCEEDED(RenderTexture[i]->GetSurfaceLevel(0, &surf)))
|
2009-11-29 02:42:20 +00:00
|
|
|
{
|
|
|
|
D3DDevice->ColorFill(surf, NULL, D3DCOLOR_XRGB(0,0,0));
|
|
|
|
surf->Release();
|
|
|
|
}
|
|
|
|
}
|
2009-12-02 05:49:45 +00:00
|
|
|
TempRenderTexture = RenderTexture[0];
|
|
|
|
CurrRenderTexture = 0;
|
2006-11-19 02:10:25 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: CreatePaletteTexture
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
bool D3DFB::CreatePaletteTexture ()
|
|
|
|
{
|
|
|
|
if (FAILED(D3DDevice->CreateTexture (256, 1, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &PaletteTexture, NULL)))
|
|
|
|
{
|
2007-12-20 04:36:43 +00:00
|
|
|
return false;
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
2007-12-20 04:36:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: CreateGammaTexture
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2009-10-08 04:03:32 +00:00
|
|
|
bool D3DFB::CreateGammaTexture ()
|
|
|
|
{
|
|
|
|
// If this fails, you just won't get gamma correction in a window
|
|
|
|
// on SM14 cards.
|
|
|
|
assert(GammaTexture == NULL);
|
|
|
|
if (SM14)
|
|
|
|
{
|
|
|
|
return SUCCEEDED(D3DDevice->CreateTexture(256, 1, 1, 0, D3DFMT_A8R8G8B8,
|
|
|
|
D3DPOOL_MANAGED, &GammaTexture, NULL));
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: CreateVertexes
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
bool D3DFB::CreateVertexes ()
|
2007-12-18 01:50:08 +00:00
|
|
|
{
|
2008-01-09 21:04:21 +00:00
|
|
|
VertexPos = -1;
|
|
|
|
IndexPos = -1;
|
|
|
|
QuadBatchPos = -1;
|
|
|
|
BatchType = BATCH_None;
|
|
|
|
if (FAILED(D3DDevice->CreateVertexBuffer(sizeof(FBVERTEX)*NUM_VERTS,
|
|
|
|
D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DFVF_FBVERTEX, D3DPOOL_DEFAULT, &VertexBuffer, NULL)))
|
2007-12-18 01:50:08 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2008-01-09 21:04:21 +00:00
|
|
|
if (FAILED(D3DDevice->CreateIndexBuffer(sizeof(WORD)*NUM_INDEXES,
|
|
|
|
D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DFMT_INDEX16, D3DPOOL_DEFAULT, &IndexBuffer, NULL)))
|
2008-01-06 04:03:33 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2007-12-18 01:50:08 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: CalcFullscreenCoords
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-01-29 18:20:05 +00:00
|
|
|
void D3DFB::CalcFullscreenCoords (FBVERTEX verts[4], bool viewarea_only, bool can_double, D3DCOLOR color0, D3DCOLOR color1) const
|
2006-11-19 02:10:25 +00:00
|
|
|
{
|
2008-01-04 05:22:30 +00:00
|
|
|
float offset = OldRenderTarget != NULL ? 0 : LBOffset;
|
|
|
|
float top = offset - 0.5f;
|
2006-11-19 02:10:25 +00:00
|
|
|
float texright = float(Width) / float(FBWidth);
|
|
|
|
float texbot = float(Height) / float(FBHeight);
|
2008-01-04 05:22:30 +00:00
|
|
|
float mxl, mxr, myt, myb, tmxl, tmxr, tmyt, tmyb;
|
|
|
|
|
|
|
|
if (viewarea_only)
|
|
|
|
{ // Just calculate vertices for the viewarea/BlendingRect
|
|
|
|
mxl = float(BlendingRect.left) - 0.5f;
|
|
|
|
mxr = float(BlendingRect.right) - 0.5f;
|
|
|
|
myt = float(BlendingRect.top) + top;
|
|
|
|
myb = float(BlendingRect.bottom) + top;
|
|
|
|
tmxl = float(BlendingRect.left) / float(Width) * texright;
|
|
|
|
tmxr = float(BlendingRect.right) / float(Width) * texright;
|
|
|
|
tmyt = float(BlendingRect.top) / float(Height) * texbot;
|
|
|
|
tmyb = float(BlendingRect.bottom) / float(Height) * texbot;
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
2008-01-04 05:22:30 +00:00
|
|
|
else
|
|
|
|
{ // Calculate vertices for the whole screen
|
|
|
|
mxl = -0.5f;
|
2008-01-29 18:20:05 +00:00
|
|
|
mxr = float(Width << (can_double ? PixelDoubling : 0)) - 0.5f;
|
2008-01-04 05:22:30 +00:00
|
|
|
myt = top;
|
2008-01-29 18:20:05 +00:00
|
|
|
myb = float(Height << (can_double ? PixelDoubling : 0)) + top;
|
2008-01-04 05:22:30 +00:00
|
|
|
tmxl = 0;
|
|
|
|
tmxr = texright;
|
|
|
|
tmyt = 0;
|
|
|
|
tmyb = texbot;
|
|
|
|
}
|
|
|
|
|
|
|
|
//{ mxl, myt, 0, 1, 0, 0xFFFFFFFF, tmxl, tmyt },
|
|
|
|
//{ mxr, myt, 0, 1, 0, 0xFFFFFFFF, tmxr, tmyt },
|
|
|
|
//{ mxr, myb, 0, 1, 0, 0xFFFFFFFF, tmxr, tmyb },
|
|
|
|
//{ mxl, myb, 0, 1, 0, 0xFFFFFFFF, tmxl, tmyb },
|
|
|
|
|
|
|
|
verts[0].x = mxl;
|
|
|
|
verts[0].y = myt;
|
|
|
|
verts[0].z = 0;
|
|
|
|
verts[0].rhw = 1;
|
|
|
|
verts[0].color0 = color0;
|
|
|
|
verts[0].color1 = color1;
|
|
|
|
verts[0].tu = tmxl;
|
|
|
|
verts[0].tv = tmyt;
|
|
|
|
|
|
|
|
verts[1].x = mxr;
|
|
|
|
verts[1].y = myt;
|
|
|
|
verts[1].z = 0;
|
|
|
|
verts[1].rhw = 1;
|
|
|
|
verts[1].color0 = color0;
|
|
|
|
verts[1].color1 = color1;
|
|
|
|
verts[1].tu = tmxr;
|
|
|
|
verts[1].tv = tmyt;
|
|
|
|
|
|
|
|
verts[2].x = mxr;
|
|
|
|
verts[2].y = myb;
|
|
|
|
verts[2].z = 0;
|
|
|
|
verts[2].rhw = 1;
|
|
|
|
verts[2].color0 = color0;
|
|
|
|
verts[2].color1 = color1;
|
|
|
|
verts[2].tu = tmxr;
|
|
|
|
verts[2].tv = tmyb;
|
|
|
|
|
|
|
|
verts[3].x = mxl;
|
|
|
|
verts[3].y = myb;
|
|
|
|
verts[3].z = 0;
|
|
|
|
verts[3].rhw = 1;
|
|
|
|
verts[3].color0 = color0;
|
|
|
|
verts[3].color1 = color1;
|
|
|
|
verts[3].tu = tmxl;
|
|
|
|
verts[3].tv = tmyb;
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: GetPageCount
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
int D3DFB::GetPageCount ()
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: PaletteChanged
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
void D3DFB::PaletteChanged ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: QueryNewPalette
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
int D3DFB::QueryNewPalette ()
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: IsValid
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
bool D3DFB::IsValid ()
|
|
|
|
{
|
|
|
|
return D3DDevice != NULL;
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: GetHR
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
HRESULT D3DFB::GetHR ()
|
|
|
|
{
|
2010-05-14 04:06:30 +00:00
|
|
|
return LastHR;
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: IsFullscreen
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
bool D3DFB::IsFullscreen ()
|
|
|
|
{
|
|
|
|
return !Windowed;
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: Lock
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
bool D3DFB::Lock (bool buffered)
|
|
|
|
{
|
|
|
|
if (LockCount++ > 0)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2008-02-14 04:58:45 +00:00
|
|
|
assert (!In2D);
|
|
|
|
Accel2D = vid_hw2d;
|
2006-11-19 02:10:25 +00:00
|
|
|
Buffer = MemBuffer;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: Unlock
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
void D3DFB::Unlock ()
|
|
|
|
{
|
|
|
|
LOG1 ("Unlock <%d>\n", LockCount);
|
|
|
|
|
|
|
|
if (LockCount == 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (UpdatePending && LockCount == 1)
|
|
|
|
{
|
|
|
|
Update ();
|
|
|
|
}
|
|
|
|
else if (--LockCount == 0)
|
|
|
|
{
|
|
|
|
Buffer = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: Update
|
|
|
|
//
|
2007-12-20 04:36:43 +00:00
|
|
|
// When In2D == 0: Copy buffer to screen and present
|
|
|
|
// When In2D == 1: Copy buffer to screen but do not present
|
2008-01-02 05:21:48 +00:00
|
|
|
// When In2D == 2: Set up for 2D drawing but do not draw anything
|
|
|
|
// When In2D == 3: Present and set In2D to 0
|
2009-11-29 02:42:20 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
void D3DFB::Update ()
|
|
|
|
{
|
2008-01-02 05:21:48 +00:00
|
|
|
if (In2D == 3)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
if (InScene)
|
|
|
|
{
|
|
|
|
DrawRateStuff();
|
2008-01-10 04:11:38 +00:00
|
|
|
DrawPackedTextures(d3d_showpacks);
|
2008-01-09 21:04:21 +00:00
|
|
|
EndBatch(); // Make sure all batched primitives are drawn.
|
2009-09-22 20:17:54 +00:00
|
|
|
Flip();
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
}
|
2007-12-22 04:00:25 +00:00
|
|
|
In2D = 0;
|
2007-12-20 04:36:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
if (LockCount != 1)
|
|
|
|
{
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
I_FatalError ("Framebuffer must have exactly 1 lock to be updated");
|
2006-11-19 02:10:25 +00:00
|
|
|
if (LockCount > 0)
|
|
|
|
{
|
|
|
|
UpdatePending = true;
|
|
|
|
--LockCount;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
if (In2D == 0)
|
|
|
|
{
|
|
|
|
DrawRateStuff();
|
|
|
|
}
|
2006-11-19 02:10:25 +00:00
|
|
|
|
|
|
|
if (NeedGammaUpdate)
|
|
|
|
{
|
2007-12-27 04:30:12 +00:00
|
|
|
float psgamma[4];
|
|
|
|
float igamma;
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
NeedGammaUpdate = false;
|
2007-12-27 04:30:12 +00:00
|
|
|
igamma = 1 / Gamma;
|
|
|
|
if (!Windowed)
|
|
|
|
{
|
|
|
|
D3DGAMMARAMP ramp;
|
|
|
|
|
|
|
|
for (int i = 0; i < 256; ++i)
|
|
|
|
{
|
|
|
|
ramp.blue[i] = ramp.green[i] = ramp.red[i] = WORD(65535.f * powf(i / 255.f, igamma));
|
|
|
|
}
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
LOG("SetGammaRamp\n");
|
2007-12-27 04:30:12 +00:00
|
|
|
D3DDevice->SetGammaRamp(0, D3DSGR_CALIBRATE, &ramp);
|
|
|
|
}
|
2009-10-08 04:03:32 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (igamma != 1)
|
|
|
|
{
|
|
|
|
UpdateGammaTexture(igamma);
|
|
|
|
GammaShader = Shaders[SHADER_GammaCorrection];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GammaShader = NULL;
|
|
|
|
}
|
|
|
|
}
|
2007-12-27 04:30:12 +00:00
|
|
|
psgamma[2] = psgamma[1] = psgamma[0] = igamma;
|
2009-10-08 04:03:32 +00:00
|
|
|
psgamma[3] = 0.5; // For SM14 version
|
2009-09-20 03:50:05 +00:00
|
|
|
D3DDevice->SetPixelShaderConstantF(PSCONST_Gamma, psgamma, 1);
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (NeedPalUpdate)
|
|
|
|
{
|
|
|
|
UploadPalette();
|
|
|
|
}
|
|
|
|
|
2008-08-10 03:56:53 +00:00
|
|
|
BlitCycles.Reset();
|
|
|
|
BlitCycles.Clock();
|
2006-11-19 02:10:25 +00:00
|
|
|
|
|
|
|
LockCount = 0;
|
2008-01-02 05:21:48 +00:00
|
|
|
HRESULT hr = D3DDevice->TestCooperativeLevel();
|
|
|
|
if (FAILED(hr) && (hr != D3DERR_DEVICENOTRESET || !Reset()))
|
|
|
|
{
|
|
|
|
Sleep(1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Draw3DPart(In2D <= 1);
|
2007-12-20 04:36:43 +00:00
|
|
|
if (In2D == 0)
|
|
|
|
{
|
2009-09-22 20:17:54 +00:00
|
|
|
Flip();
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
2006-11-19 02:10:25 +00:00
|
|
|
|
2008-08-10 03:56:53 +00:00
|
|
|
BlitCycles.Unclock();
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
//LOG1 ("cycles = %d\n", BlitCycles);
|
2006-11-19 02:10:25 +00:00
|
|
|
|
|
|
|
Buffer = NULL;
|
|
|
|
UpdatePending = false;
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: Flip
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2009-09-22 20:17:54 +00:00
|
|
|
void D3DFB::Flip()
|
|
|
|
{
|
|
|
|
assert(InScene);
|
|
|
|
|
2011-04-17 04:04:34 +00:00
|
|
|
DrawLetterbox();
|
2009-09-22 20:17:54 +00:00
|
|
|
DoWindowedGamma();
|
|
|
|
D3DDevice->EndScene();
|
|
|
|
|
2009-12-02 05:02:40 +00:00
|
|
|
CopyNextFrontBuffer();
|
|
|
|
|
2009-09-22 20:17:54 +00:00
|
|
|
// Attempt to counter input lag.
|
|
|
|
if (d3d_antilag && BlockSurface[0] != NULL)
|
|
|
|
{
|
|
|
|
D3DLOCKED_RECT lr;
|
|
|
|
volatile int dummy;
|
|
|
|
D3DDevice->ColorFill(BlockSurface[BlockNum], NULL, D3DCOLOR_ARGB(0xFF,0,0x20,0x50));
|
|
|
|
BlockNum ^= 1;
|
|
|
|
if (!FAILED((BlockSurface[BlockNum]->LockRect(&lr, NULL, D3DLOCK_READONLY))))
|
|
|
|
{
|
|
|
|
dummy = *(int *)lr.pBits;
|
|
|
|
BlockSurface[BlockNum]->UnlockRect();
|
|
|
|
}
|
|
|
|
}
|
2012-09-16 04:40:56 +00:00
|
|
|
// Limiting the frame rate is as simple as waiting for the timer to signal this event.
|
|
|
|
if (FPSLimitEvent != NULL)
|
|
|
|
{
|
|
|
|
WaitForSingleObject(FPSLimitEvent, 1000);
|
|
|
|
}
|
2009-09-22 20:17:54 +00:00
|
|
|
D3DDevice->Present(NULL, NULL, NULL, NULL);
|
|
|
|
InScene = false;
|
2009-12-02 05:49:45 +00:00
|
|
|
|
|
|
|
if (RenderTextureToggle)
|
|
|
|
{
|
|
|
|
// Flip the TempRenderTexture to the other one now.
|
|
|
|
CurrRenderTexture ^= RenderTextureToggle;
|
|
|
|
TempRenderTexture = RenderTexture[CurrRenderTexture];
|
|
|
|
}
|
2009-09-22 20:17:54 +00:00
|
|
|
}
|
|
|
|
|
2009-12-02 05:02:40 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: CopyNextFrontBuffer
|
|
|
|
//
|
|
|
|
// Duplicates the contents of the back buffer that will become the front
|
|
|
|
// buffer upon Present into FrontCopySurface so that we can get the
|
|
|
|
// contents of the display without wasting time in GetFrontBufferData().
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::CopyNextFrontBuffer()
|
|
|
|
{
|
|
|
|
IDirect3DSurface9 *backbuff;
|
|
|
|
|
|
|
|
if (Windowed || PixelDoubling)
|
|
|
|
{
|
|
|
|
// Windowed mode or pixel doubling: TempRenderTexture has what we want
|
2009-12-02 05:49:45 +00:00
|
|
|
SAFE_RELEASE( FrontCopySurface );
|
2009-12-02 05:02:40 +00:00
|
|
|
if (SUCCEEDED(TempRenderTexture->GetSurfaceLevel(0, &backbuff)))
|
|
|
|
{
|
2009-12-02 05:49:45 +00:00
|
|
|
FrontCopySurface = backbuff;
|
2009-12-02 05:02:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Fullscreen, not pixel doubled: The back buffer has what we want,
|
|
|
|
// but it might be letter boxed.
|
|
|
|
if (SUCCEEDED(D3DDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuff)))
|
|
|
|
{
|
|
|
|
RECT srcrect = { 0, LBOffsetI, Width, LBOffsetI + Height };
|
|
|
|
D3DDevice->StretchRect(backbuff, &srcrect, FrontCopySurface, NULL, D3DTEXF_NONE);
|
|
|
|
backbuff->Release();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: PaintToWindow
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
bool D3DFB::PaintToWindow ()
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
if (LockCount != 0)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
hr = D3DDevice->TestCooperativeLevel();
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
if (hr != D3DERR_DEVICENOTRESET || !Reset())
|
|
|
|
{
|
|
|
|
Sleep (1);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2008-01-02 05:21:48 +00:00
|
|
|
Draw3DPart(true);
|
2007-12-20 04:36:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-11-29 02:42:20 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: Draw3DPart
|
|
|
|
//
|
|
|
|
// The software 3D part, to be exact.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-01-02 05:21:48 +00:00
|
|
|
void D3DFB::Draw3DPart(bool copy3d)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
2008-01-02 05:21:48 +00:00
|
|
|
if (copy3d)
|
2006-11-19 02:10:25 +00:00
|
|
|
{
|
2008-01-29 18:20:05 +00:00
|
|
|
RECT texrect = { 0, 0, Width, Height };
|
|
|
|
D3DLOCKED_RECT lockrect;
|
|
|
|
|
2008-01-02 05:21:48 +00:00
|
|
|
if ((FBWidth == Width && FBHeight == Height &&
|
|
|
|
SUCCEEDED(FBTexture->LockRect (0, &lockrect, NULL, D3DLOCK_DISCARD))) ||
|
|
|
|
SUCCEEDED(FBTexture->LockRect (0, &lockrect, &texrect, 0)))
|
2006-11-19 02:10:25 +00:00
|
|
|
{
|
2011-06-18 05:18:28 +00:00
|
|
|
if (lockrect.Pitch == Pitch && Pitch == Width)
|
2006-11-19 02:10:25 +00:00
|
|
|
{
|
2008-01-02 05:21:48 +00:00
|
|
|
memcpy (lockrect.pBits, MemBuffer, Width * Height);
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
2008-01-02 05:21:48 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
BYTE *dest = (BYTE *)lockrect.pBits;
|
|
|
|
BYTE *src = MemBuffer;
|
|
|
|
for (int y = 0; y < Height; y++)
|
|
|
|
{
|
|
|
|
memcpy (dest, src, Width);
|
|
|
|
dest += lockrect.Pitch;
|
|
|
|
src += Pitch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FBTexture->UnlockRect (0);
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
|
|
|
}
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
InScene = true;
|
2006-11-19 02:10:25 +00:00
|
|
|
D3DDevice->BeginScene();
|
2008-09-12 00:04:15 +00:00
|
|
|
D3DDevice->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, vid_hwaalines);
|
2008-01-02 05:21:48 +00:00
|
|
|
assert(OldRenderTarget == NULL);
|
2007-12-30 04:18:39 +00:00
|
|
|
if (TempRenderTexture != NULL &&
|
2009-11-29 02:33:52 +00:00
|
|
|
((Windowed && TempRenderTexture != FinalWipeScreen) || GatheringWipeScreen || PixelDoubling))
|
2007-12-27 04:30:12 +00:00
|
|
|
{
|
|
|
|
IDirect3DSurface9 *targetsurf;
|
2008-01-02 05:21:48 +00:00
|
|
|
if (SUCCEEDED(TempRenderTexture->GetSurfaceLevel(0, &targetsurf)))
|
2007-12-27 04:30:12 +00:00
|
|
|
{
|
2008-01-02 05:21:48 +00:00
|
|
|
if (SUCCEEDED(D3DDevice->GetRenderTarget(0, &OldRenderTarget)))
|
|
|
|
{
|
|
|
|
if (FAILED(D3DDevice->SetRenderTarget(0, targetsurf)))
|
|
|
|
{
|
|
|
|
// Setting the render target failed.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
targetsurf->Release();
|
2007-12-27 04:30:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-17 04:04:34 +00:00
|
|
|
SetTexture(0, FBTexture);
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
SetPaletteTexture(PaletteTexture, 256, BorderColor);
|
2006-11-19 02:10:25 +00:00
|
|
|
D3DDevice->SetFVF (D3DFVF_FBVERTEX);
|
2008-01-04 05:22:30 +00:00
|
|
|
memset(Constant, 0, sizeof(Constant));
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
SetAlphaBlend(D3DBLENDOP(0));
|
|
|
|
EnableAlphaTest(FALSE);
|
2009-09-22 04:21:27 +00:00
|
|
|
SetPixelShader(Shaders[SHADER_NormalColorPal]);
|
2008-01-02 05:21:48 +00:00
|
|
|
if (copy3d)
|
|
|
|
{
|
2008-01-04 05:22:30 +00:00
|
|
|
FBVERTEX verts[4];
|
2009-09-20 03:50:05 +00:00
|
|
|
D3DCOLOR color0, color1;
|
|
|
|
if (Accel2D)
|
|
|
|
{
|
2009-09-22 04:21:27 +00:00
|
|
|
if (realfixedcolormap == NULL)
|
|
|
|
{
|
|
|
|
color0 = 0;
|
|
|
|
color1 = 0xFFFFFFF;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
color0 = D3DCOLOR_COLORVALUE(realfixedcolormap->ColorizeStart[0]/2,
|
|
|
|
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);
|
|
|
|
SetPixelShader(Shaders[SHADER_SpecialColormapPal]);
|
|
|
|
}
|
2009-09-20 03:50:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
color0 = FlashColor0;
|
|
|
|
color1 = FlashColor1;
|
|
|
|
}
|
|
|
|
CalcFullscreenCoords(verts, Accel2D, false, color0, color1);
|
2008-01-04 05:22:30 +00:00
|
|
|
D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX));
|
2007-12-27 04:30:12 +00:00
|
|
|
}
|
2009-09-22 04:21:27 +00:00
|
|
|
SetPixelShader(Shaders[SHADER_NormalColorPal]);
|
2007-12-27 04:30:12 +00:00
|
|
|
}
|
|
|
|
|
2007-12-30 04:18:39 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: DrawLetterbox
|
|
|
|
//
|
|
|
|
// Draws the black bars at the top and bottom of the screen for letterboxed
|
|
|
|
// modes.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::DrawLetterbox()
|
|
|
|
{
|
2008-01-02 05:21:48 +00:00
|
|
|
if (LBOffsetI != 0)
|
2007-12-30 04:18:39 +00:00
|
|
|
{
|
|
|
|
D3DRECT rects[2] = { { 0, 0, Width, LBOffsetI }, { 0, Height + LBOffsetI, Width, TrueHeight } };
|
|
|
|
D3DDevice->Clear (2, rects, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0,0,0), 1.f, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-27 04:30:12 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: DoWindowedGamma
|
|
|
|
//
|
|
|
|
// Draws the render target texture to the real back buffer using a gamma-
|
|
|
|
// correcting pixel shader.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2007-12-18 01:50:08 +00:00
|
|
|
|
2007-12-27 04:30:12 +00:00
|
|
|
void D3DFB::DoWindowedGamma()
|
|
|
|
{
|
|
|
|
if (OldRenderTarget != NULL)
|
|
|
|
{
|
2008-01-04 05:22:30 +00:00
|
|
|
FBVERTEX verts[4];
|
|
|
|
|
2008-01-29 18:20:05 +00:00
|
|
|
CalcFullscreenCoords(verts, false, true, 0, 0xFFFFFFFF);
|
2007-12-27 04:30:12 +00:00
|
|
|
D3DDevice->SetRenderTarget(0, OldRenderTarget);
|
|
|
|
D3DDevice->SetFVF(D3DFVF_FBVERTEX);
|
2007-12-30 04:18:39 +00:00
|
|
|
SetTexture(0, TempRenderTexture);
|
2009-10-08 04:03:32 +00:00
|
|
|
SetPixelShader(Windowed && GammaShader ? GammaShader : Shaders[SHADER_NormalColor]);
|
|
|
|
if (SM14 && Windowed && GammaShader)
|
|
|
|
{
|
|
|
|
SetTexture(2, GammaTexture);
|
|
|
|
SetTexture(3, GammaTexture);
|
|
|
|
SetTexture(4, GammaTexture);
|
|
|
|
}
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
SetAlphaBlend(D3DBLENDOP(0));
|
|
|
|
EnableAlphaTest(FALSE);
|
2008-01-04 05:22:30 +00:00
|
|
|
D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX));
|
2008-01-02 05:21:48 +00:00
|
|
|
OldRenderTarget->Release();
|
2007-12-27 04:30:12 +00:00
|
|
|
OldRenderTarget = NULL;
|
2009-10-08 04:03:32 +00:00
|
|
|
if (SM14 && Windowed && GammaShader)
|
|
|
|
{
|
|
|
|
// SetTexture(0, GammaTexture);
|
|
|
|
// SetPixelShader(Shaders[SHADER_NormalColor]);
|
|
|
|
// D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: UpdateGammaTexture
|
|
|
|
//
|
|
|
|
// Updates the gamma texture used by the PS14 shader. We only use the first
|
|
|
|
// half of the texture so that we needn't worry about imprecision causing
|
|
|
|
// it to grab from the border.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::UpdateGammaTexture(float igamma)
|
|
|
|
{
|
|
|
|
D3DLOCKED_RECT lockrect;
|
|
|
|
|
|
|
|
if (GammaTexture != NULL && SUCCEEDED(GammaTexture->LockRect(0, &lockrect, NULL, 0)))
|
|
|
|
{
|
|
|
|
BYTE *pix = (BYTE *)lockrect.pBits;
|
|
|
|
for (int i = 0; i <= 128; ++i)
|
|
|
|
{
|
|
|
|
pix[i*4+2] = pix[i*4+1] = pix[i*4] = BYTE(255.f * powf(i / 128.f, igamma));
|
|
|
|
pix[i*4+3] = 255;
|
|
|
|
}
|
|
|
|
GammaTexture->UnlockRect(0);
|
2007-12-18 01:50:08 +00:00
|
|
|
}
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
|
|
|
|
2009-10-08 23:44:50 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: DoOffByOneCheck
|
|
|
|
//
|
|
|
|
// Pixel Shader 1.x does not have enough precision to properly map a "color"
|
|
|
|
// from the source texture to an index in the palette texture. The best we
|
|
|
|
// can do is use 255 pixels of the palette and get the 256th from the
|
|
|
|
// texture border color. This routine determines which pixel of the texture
|
|
|
|
// is skipped so that we don't use it for palette data.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::DoOffByOneCheck ()
|
|
|
|
{
|
|
|
|
IDirect3DSurface9 *savedrendertarget;
|
|
|
|
IDirect3DSurface9 *testsurf, *readsurf;
|
|
|
|
D3DLOCKED_RECT lockrect;
|
|
|
|
RECT testrect = { 0, 0, 256, 1 };
|
|
|
|
float texright = 256.f / float(FBWidth);
|
|
|
|
float texbot = 1.f / float(FBHeight);
|
|
|
|
FBVERTEX verts[4] =
|
|
|
|
{
|
2016-02-06 03:43:35 +00:00
|
|
|
{ -0.5f, -0.5f, 0.5f, 1.f, D3DCOLOR_RGBA(0,0,0,0), D3DCOLOR_RGBA(255,255,255,255), 0.f, 0.f },
|
|
|
|
{ 255.5f, -0.5f, 0.5f, 1.f, D3DCOLOR_RGBA(0,0,0,0), D3DCOLOR_RGBA(255,255,255,255), texright, 0.f },
|
|
|
|
{ 255.5f, 0.5f, 0.5f, 1.f, D3DCOLOR_RGBA(0,0,0,0), D3DCOLOR_RGBA(255,255,255,255), texright, texbot },
|
|
|
|
{ -0.5f, 0.5f, 0.5f, 1.f, D3DCOLOR_RGBA(0,0,0,0), D3DCOLOR_RGBA(255,255,255,255), 0.f, texbot }
|
2009-10-08 23:44:50 +00:00
|
|
|
};
|
|
|
|
int i, c;
|
|
|
|
|
|
|
|
if (SkipAt >= 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create an easily recognizable R3G3B2 palette.
|
|
|
|
if (SUCCEEDED(PaletteTexture->LockRect(0, &lockrect, NULL, 0)))
|
|
|
|
{
|
|
|
|
BYTE *pal = (BYTE *)(lockrect.pBits);
|
|
|
|
for (i = 0; i < 256; ++i)
|
|
|
|
{
|
|
|
|
pal[i*4+0] = (i & 0x03) << 6; // blue
|
|
|
|
pal[i*4+1] = (i & 0x1C) << 3; // green
|
|
|
|
pal[i*4+2] = (i & 0xE0); // red;
|
|
|
|
pal[i*4+3] = 255;
|
|
|
|
}
|
|
|
|
PaletteTexture->UnlockRect (0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Prepare a texture with values 0-256.
|
|
|
|
if (SUCCEEDED(FBTexture->LockRect(0, &lockrect, &testrect, 0)))
|
|
|
|
{
|
|
|
|
for (i = 0; i < 256; ++i)
|
|
|
|
{
|
|
|
|
((BYTE *)lockrect.pBits)[i] = i;
|
|
|
|
}
|
|
|
|
FBTexture->UnlockRect(0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Create a render target that we can draw it to.
|
|
|
|
if (FAILED(D3DDevice->GetRenderTarget(0, &savedrendertarget)))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (FAILED(D3DDevice->CreateRenderTarget(256, 1, D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, 0, FALSE, &testsurf, NULL)))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (FAILED(D3DDevice->CreateOffscreenPlainSurface(256, 1, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &readsurf, NULL)))
|
|
|
|
{
|
|
|
|
testsurf->Release();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (FAILED(D3DDevice->SetRenderTarget(0, testsurf)))
|
|
|
|
{
|
|
|
|
testsurf->Release();
|
|
|
|
readsurf->Release();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Write it to the render target using the pixel shader.
|
|
|
|
D3DDevice->BeginScene();
|
|
|
|
D3DDevice->SetTexture(0, FBTexture);
|
|
|
|
D3DDevice->SetTexture(1, PaletteTexture);
|
|
|
|
D3DDevice->SetFVF(D3DFVF_FBVERTEX);
|
|
|
|
D3DDevice->SetPixelShader(Shaders[SHADER_NormalColorPal]);
|
|
|
|
SetConstant(PSCONST_PaletteMod, 1.f, 0.5f / 256.f, 0, 0);
|
|
|
|
D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX));
|
|
|
|
D3DDevice->EndScene();
|
|
|
|
D3DDevice->SetRenderTarget(0, savedrendertarget);
|
|
|
|
savedrendertarget->Release();
|
|
|
|
// Now read it back and see where it skips an entry
|
|
|
|
if (SUCCEEDED(D3DDevice->GetRenderTargetData(testsurf, readsurf)) &&
|
|
|
|
SUCCEEDED(readsurf->LockRect(&lockrect, &testrect, D3DLOCK_READONLY)))
|
|
|
|
{
|
|
|
|
const BYTE *pix = (const BYTE *)lockrect.pBits;
|
|
|
|
for (i = 0; i < 256; ++i, pix += 4)
|
|
|
|
{
|
|
|
|
c = (pix[0] >> 6) | // blue
|
|
|
|
((pix[1] >> 5) << 2) | // green
|
|
|
|
((pix[2] >> 5) << 5); // red
|
|
|
|
if (c != i)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
readsurf->UnlockRect();
|
|
|
|
readsurf->Release();
|
|
|
|
testsurf->Release();
|
|
|
|
SkipAt = i;
|
|
|
|
}
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
void D3DFB::UploadPalette ()
|
|
|
|
{
|
|
|
|
D3DLOCKED_RECT lockrect;
|
|
|
|
|
2009-10-08 23:44:50 +00:00
|
|
|
if (SkipAt < 0)
|
|
|
|
{
|
|
|
|
if (SM14)
|
|
|
|
{
|
|
|
|
DoOffByOneCheck();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SkipAt = 256;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (SUCCEEDED(PaletteTexture->LockRect(0, &lockrect, NULL, 0)))
|
2006-11-19 02:10:25 +00:00
|
|
|
{
|
2007-12-20 04:36:43 +00:00
|
|
|
BYTE *pix = (BYTE *)lockrect.pBits;
|
2009-10-08 23:44:50 +00:00
|
|
|
int i;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
|
2009-10-08 23:44:50 +00:00
|
|
|
for (i = 0; i < SkipAt; ++i, pix += 4)
|
2006-11-19 02:10:25 +00:00
|
|
|
{
|
2007-12-27 04:30:12 +00:00
|
|
|
pix[0] = SourcePalette[i].b;
|
|
|
|
pix[1] = SourcePalette[i].g;
|
|
|
|
pix[2] = SourcePalette[i].r;
|
2007-12-20 04:36:43 +00:00
|
|
|
pix[3] = (i == 0 ? 0 : 255);
|
|
|
|
// To let masked textures work, the first palette entry's alpha is 0.
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
pix += 4;
|
|
|
|
for (; i < 255; ++i, pix += 4)
|
|
|
|
{
|
|
|
|
pix[0] = SourcePalette[i].b;
|
|
|
|
pix[1] = SourcePalette[i].g;
|
|
|
|
pix[2] = SourcePalette[i].r;
|
|
|
|
pix[3] = 255;
|
|
|
|
}
|
2009-10-08 23:44:50 +00:00
|
|
|
PaletteTexture->UnlockRect(0);
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
BorderColor = D3DCOLOR_XRGB(SourcePalette[255].r, SourcePalette[255].g, SourcePalette[255].b);
|
2006-11-19 02:10:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PalEntry *D3DFB::GetPalette ()
|
|
|
|
{
|
|
|
|
return SourcePalette;
|
|
|
|
}
|
|
|
|
|
|
|
|
void D3DFB::UpdatePalette ()
|
|
|
|
{
|
|
|
|
NeedPalUpdate = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool D3DFB::SetGamma (float gamma)
|
|
|
|
{
|
|
|
|
LOG1 ("SetGamma %g\n", gamma);
|
|
|
|
Gamma = gamma;
|
|
|
|
NeedGammaUpdate = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool D3DFB::SetFlash (PalEntry rgb, int amount)
|
|
|
|
{
|
|
|
|
FlashColor = rgb;
|
|
|
|
FlashAmount = amount;
|
|
|
|
|
|
|
|
// Fill in the constants for the pixel shader to do linear interpolation between the palette and the flash:
|
|
|
|
float r = rgb.r / 255.f, g = rgb.g / 255.f, b = rgb.b / 255.f, a = amount / 256.f;
|
2008-01-04 05:22:30 +00:00
|
|
|
FlashColor0 = D3DCOLOR_COLORVALUE(r * a, g * a, b * a, 0);
|
2006-11-19 02:10:25 +00:00
|
|
|
a = 1 - a;
|
2008-01-04 05:22:30 +00:00
|
|
|
FlashColor1 = D3DCOLOR_COLORVALUE(a, a, a, 1);
|
2006-11-19 02:10:25 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void D3DFB::GetFlash (PalEntry &rgb, int &amount)
|
|
|
|
{
|
|
|
|
rgb = FlashColor;
|
|
|
|
amount = FlashAmount;
|
|
|
|
}
|
|
|
|
|
|
|
|
void D3DFB::GetFlashedPalette (PalEntry pal[256])
|
|
|
|
{
|
|
|
|
memcpy (pal, SourcePalette, 256*sizeof(PalEntry));
|
|
|
|
if (FlashAmount)
|
|
|
|
{
|
|
|
|
DoBlending (pal, pal, 256, FlashColor.r, FlashColor.g, FlashColor.b, FlashAmount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void D3DFB::SetVSync (bool vsync)
|
|
|
|
{
|
|
|
|
if (VSync != vsync)
|
|
|
|
{
|
|
|
|
VSync = vsync;
|
|
|
|
Reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-19 02:48:56 +00:00
|
|
|
void D3DFB::NewRefreshRate ()
|
|
|
|
{
|
|
|
|
if (!Windowed)
|
|
|
|
{
|
|
|
|
Reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-19 02:10:25 +00:00
|
|
|
void D3DFB::Blank ()
|
|
|
|
{
|
|
|
|
// Only used by movie player, which isn't working with D3D9 yet.
|
|
|
|
}
|
2007-12-18 01:50:08 +00:00
|
|
|
|
|
|
|
void D3DFB::SetBlendingRect(int x1, int y1, int x2, int y2)
|
|
|
|
{
|
2008-01-04 05:22:30 +00:00
|
|
|
BlendingRect.left = x1;
|
|
|
|
BlendingRect.top = y1;
|
|
|
|
BlendingRect.right = x2;
|
|
|
|
BlendingRect.bottom = y2;
|
2007-12-18 01:50:08 +00:00
|
|
|
}
|
2007-12-20 04:36:43 +00:00
|
|
|
|
2008-01-12 06:27:13 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: GetScreenshotBuffer
|
|
|
|
//
|
|
|
|
// Returns a pointer into a surface holding the current screen data.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::GetScreenshotBuffer(const BYTE *&buffer, int &pitch, ESSType &color_type)
|
|
|
|
{
|
|
|
|
D3DLOCKED_RECT lrect;
|
|
|
|
|
2008-02-14 04:58:45 +00:00
|
|
|
if (!Accel2D)
|
2008-01-12 06:27:13 +00:00
|
|
|
{
|
|
|
|
Super::GetScreenshotBuffer(buffer, pitch, color_type);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
buffer = NULL;
|
|
|
|
if ((ScreenshotTexture = GetCurrentScreen()) != NULL)
|
|
|
|
{
|
|
|
|
if (FAILED(ScreenshotTexture->GetSurfaceLevel(0, &ScreenshotSurface)))
|
|
|
|
{
|
|
|
|
ScreenshotTexture->Release();
|
|
|
|
ScreenshotTexture = NULL;
|
|
|
|
}
|
|
|
|
else if (FAILED(ScreenshotSurface->LockRect(&lrect, NULL, D3DLOCK_READONLY | D3DLOCK_NOSYSLOCK)))
|
|
|
|
{
|
|
|
|
ScreenshotSurface->Release();
|
|
|
|
ScreenshotSurface = NULL;
|
|
|
|
ScreenshotTexture->Release();
|
|
|
|
ScreenshotTexture = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-06-06 04:53:19 +00:00
|
|
|
buffer = (const BYTE *)lrect.pBits;
|
2008-01-12 06:27:13 +00:00
|
|
|
pitch = lrect.Pitch;
|
|
|
|
color_type = SS_BGRA;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: ReleaseScreenshotBuffer
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::ReleaseScreenshotBuffer()
|
|
|
|
{
|
|
|
|
if (LockCount > 0)
|
|
|
|
{
|
|
|
|
Super::ReleaseScreenshotBuffer();
|
|
|
|
}
|
|
|
|
if (ScreenshotSurface != NULL)
|
|
|
|
{
|
|
|
|
ScreenshotSurface->UnlockRect();
|
|
|
|
ScreenshotSurface->Release();
|
|
|
|
ScreenshotSurface = NULL;
|
|
|
|
}
|
|
|
|
SAFE_RELEASE( ScreenshotTexture );
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: GetCurrentScreen
|
|
|
|
//
|
|
|
|
// Returns a texture containing the pixels currently visible on-screen.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2009-12-01 03:15:00 +00:00
|
|
|
IDirect3DTexture9 *D3DFB::GetCurrentScreen(D3DPOOL pool)
|
2008-01-12 06:27:13 +00:00
|
|
|
{
|
|
|
|
IDirect3DTexture9 *tex;
|
2009-12-02 05:02:40 +00:00
|
|
|
IDirect3DSurface9 *surf;
|
2008-01-12 06:27:13 +00:00
|
|
|
D3DSURFACE_DESC desc;
|
2009-12-02 05:02:40 +00:00
|
|
|
HRESULT hr;
|
2008-01-12 06:27:13 +00:00
|
|
|
|
2009-12-01 03:15:00 +00:00
|
|
|
assert(pool == D3DPOOL_SYSTEMMEM || pool == D3DPOOL_DEFAULT);
|
|
|
|
|
2010-07-30 03:21:13 +00:00
|
|
|
if (FrontCopySurface == NULL || FAILED(FrontCopySurface->GetDesc(&desc)))
|
2008-01-12 06:27:13 +00:00
|
|
|
{
|
2009-12-02 05:02:40 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (pool == D3DPOOL_SYSTEMMEM)
|
|
|
|
{
|
|
|
|
hr = D3DDevice->CreateTexture(desc.Width, desc.Height, 1, 0, desc.Format, D3DPOOL_SYSTEMMEM, &tex, NULL);
|
2008-01-12 06:27:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-12-02 05:02:40 +00:00
|
|
|
hr = D3DDevice->CreateTexture(FBWidth, FBHeight, 1, D3DUSAGE_RENDERTARGET, desc.Format, D3DPOOL_DEFAULT, &tex, NULL);
|
2008-01-12 06:27:13 +00:00
|
|
|
}
|
2009-12-02 05:02:40 +00:00
|
|
|
if (FAILED(hr))
|
2008-01-12 06:27:13 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (FAILED(tex->GetSurfaceLevel(0, &surf)))
|
|
|
|
{
|
|
|
|
tex->Release();
|
|
|
|
return NULL;
|
|
|
|
}
|
2009-12-02 05:02:40 +00:00
|
|
|
if (pool == D3DPOOL_SYSTEMMEM)
|
2008-01-12 06:27:13 +00:00
|
|
|
{
|
2009-12-02 05:02:40 +00:00
|
|
|
// Video -> System memory : use GetRenderTargetData
|
|
|
|
hr = D3DDevice->GetRenderTargetData(FrontCopySurface, surf);
|
2008-01-12 06:27:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-12-02 05:02:40 +00:00
|
|
|
// Video -> Video memory : use StretchRect
|
|
|
|
RECT destrect = { 0, 0, Width, Height };
|
|
|
|
hr = D3DDevice->StretchRect(FrontCopySurface, NULL, surf, &destrect, D3DTEXF_POINT);
|
2008-01-12 06:27:13 +00:00
|
|
|
}
|
2009-12-02 05:02:40 +00:00
|
|
|
surf->Release();
|
|
|
|
if (FAILED(hr))
|
2009-12-01 03:15:00 +00:00
|
|
|
{
|
|
|
|
tex->Release();
|
2009-12-02 05:02:40 +00:00
|
|
|
return NULL;
|
2009-12-01 03:15:00 +00:00
|
|
|
}
|
2008-01-12 06:27:13 +00:00
|
|
|
return tex;
|
|
|
|
}
|
|
|
|
|
2007-12-20 04:36:43 +00:00
|
|
|
/**************************************************************************/
|
|
|
|
/* 2D Stuff */
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: DrawPackedTextures
|
|
|
|
//
|
2016-01-09 02:08:10 +00:00
|
|
|
// DEBUG: Draws the texture atlases to the screen, starting with the
|
|
|
|
// 1-based packnum. Ignores atlases that are flagged for use by one
|
|
|
|
// texture only.
|
2008-01-10 04:11:38 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::DrawPackedTextures(int packnum)
|
|
|
|
{
|
|
|
|
D3DCOLOR empty_colors[8] =
|
|
|
|
{
|
2016-01-11 04:01:29 +00:00
|
|
|
0x50FF0000, 0x5000FF00, 0x500000FF, 0x50FFFF00,
|
|
|
|
0x50FF00FF, 0x5000FFFF, 0x50FF8000, 0x500080FF
|
2008-01-10 04:11:38 +00:00
|
|
|
};
|
2016-01-09 02:08:10 +00:00
|
|
|
Atlas *pack;
|
2008-01-10 04:11:38 +00:00
|
|
|
int x = 8, y = 8;
|
|
|
|
|
|
|
|
if (packnum <= 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2016-01-09 02:08:10 +00:00
|
|
|
pack = Atlases;
|
|
|
|
// Find the first texture atlas that is an actual atlas.
|
2008-01-10 04:11:38 +00:00
|
|
|
while (pack != NULL && pack->OneUse)
|
2016-01-09 02:08:10 +00:00
|
|
|
{ // Skip textures that aren't used as atlases
|
2008-01-10 04:11:38 +00:00
|
|
|
pack = pack->Next;
|
|
|
|
}
|
2016-01-09 02:08:10 +00:00
|
|
|
// Skip however many atlases we would have otherwise drawn
|
|
|
|
// until we've skipped <packnum> of them.
|
2008-01-10 04:11:38 +00:00
|
|
|
while (pack != NULL && packnum != 1)
|
|
|
|
{
|
|
|
|
if (!pack->OneUse)
|
2016-01-09 02:08:10 +00:00
|
|
|
{ // Skip textures that aren't used as atlases
|
2008-01-10 04:11:38 +00:00
|
|
|
packnum--;
|
|
|
|
}
|
|
|
|
pack = pack->Next;
|
|
|
|
}
|
2016-01-09 02:08:10 +00:00
|
|
|
// Draw atlases until we run out of room on the screen.
|
2008-01-10 04:11:38 +00:00
|
|
|
while (pack != NULL)
|
|
|
|
{
|
|
|
|
if (pack->OneUse)
|
2016-01-09 02:08:10 +00:00
|
|
|
{ // Skip textures that aren't used as atlases
|
2008-01-10 04:11:38 +00:00
|
|
|
pack = pack->Next;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2016-01-09 04:07:16 +00:00
|
|
|
AddColorOnlyRect(x-1, y-1-LBOffsetI, 258, 258, D3DCOLOR_XRGB(255,255,0));
|
2016-01-11 03:09:16 +00:00
|
|
|
int back = 0;
|
|
|
|
for (PackedTexture *box = pack->UsedList; box != NULL; box = box->Next)
|
|
|
|
{
|
2016-01-11 04:14:35 +00:00
|
|
|
AddColorOnlyQuad(
|
|
|
|
x + box->Area.left * 256 / pack->Width,
|
|
|
|
y + box->Area.top * 256 / pack->Height,
|
|
|
|
(box->Area.right - box->Area.left) * 256 / pack->Width,
|
|
|
|
(box->Area.bottom - box->Area.top) * 256 / pack->Height, empty_colors[back]);
|
2016-01-11 03:09:16 +00:00
|
|
|
back = (back + 1) & 7;
|
|
|
|
}
|
|
|
|
// AddColorOnlyQuad(x, y-LBOffsetI, 256, 256, D3DCOLOR_ARGB(180,0,0,0));
|
2008-01-10 04:11:38 +00:00
|
|
|
|
|
|
|
CheckQuadBatch();
|
|
|
|
|
2010-08-27 15:20:05 +00:00
|
|
|
BufferedTris *quad = &QuadExtra[QuadBatchPos];
|
2008-01-10 04:11:38 +00:00
|
|
|
FBVERTEX *vert = &VertexData[VertexPos];
|
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
quad->Group1 = 0;
|
2008-01-10 04:11:38 +00:00
|
|
|
if (pack->Format == D3DFMT_L8/* && !tex->IsGray*/)
|
|
|
|
{
|
2016-01-09 04:07:16 +00:00
|
|
|
quad->Flags = BQF_WrapUV | BQF_GamePalette/* | BQF_DisableAlphaTest*/;
|
2008-01-10 04:11:38 +00:00
|
|
|
quad->ShaderNum = BQS_PalTex;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-01-09 04:07:16 +00:00
|
|
|
quad->Flags = BQF_WrapUV/* | BQF_DisableAlphaTest*/;
|
2008-01-10 04:11:38 +00:00
|
|
|
quad->ShaderNum = BQS_Plain;
|
|
|
|
}
|
|
|
|
quad->Palette = NULL;
|
2009-12-01 03:15:00 +00:00
|
|
|
quad->Texture = pack->Tex;
|
2010-08-27 15:20:05 +00:00
|
|
|
quad->NumVerts = 4;
|
|
|
|
quad->NumTris = 2;
|
2008-01-10 04:11:38 +00:00
|
|
|
|
|
|
|
float x0 = float(x) - 0.5f;
|
|
|
|
float y0 = float(y) - 0.5f;
|
|
|
|
float x1 = x0 + 256.f;
|
|
|
|
float y1 = y0 + 256.f;
|
|
|
|
|
|
|
|
vert[0].x = x0;
|
|
|
|
vert[0].y = y0;
|
|
|
|
vert[0].z = 0;
|
|
|
|
vert[0].rhw = 1;
|
|
|
|
vert[0].color0 = 0;
|
|
|
|
vert[0].color1 = 0xFFFFFFFF;
|
|
|
|
vert[0].tu = 0;
|
|
|
|
vert[0].tv = 0;
|
|
|
|
|
|
|
|
vert[1].x = x1;
|
|
|
|
vert[1].y = y0;
|
|
|
|
vert[1].z = 0;
|
|
|
|
vert[1].rhw = 1;
|
|
|
|
vert[1].color0 = 0;
|
|
|
|
vert[1].color1 = 0xFFFFFFFF;
|
|
|
|
vert[1].tu = 1;
|
|
|
|
vert[1].tv = 0;
|
|
|
|
|
|
|
|
vert[2].x = x1;
|
|
|
|
vert[2].y = y1;
|
|
|
|
vert[2].z = 0;
|
|
|
|
vert[2].rhw = 1;
|
|
|
|
vert[2].color0 = 0;
|
|
|
|
vert[2].color1 = 0xFFFFFFFF;
|
|
|
|
vert[2].tu = 1;
|
|
|
|
vert[2].tv = 1;
|
|
|
|
|
|
|
|
vert[3].x = x0;
|
|
|
|
vert[3].y = y1;
|
|
|
|
vert[3].z = 0;
|
|
|
|
vert[3].rhw = 1;
|
|
|
|
vert[3].color0 = 0;
|
|
|
|
vert[3].color1 = 0xFFFFFFFF;
|
|
|
|
vert[3].tu = 0;
|
|
|
|
vert[3].tv = 1;
|
|
|
|
|
|
|
|
IndexData[IndexPos ] = VertexPos;
|
|
|
|
IndexData[IndexPos + 1] = VertexPos + 1;
|
|
|
|
IndexData[IndexPos + 2] = VertexPos + 2;
|
|
|
|
IndexData[IndexPos + 3] = VertexPos;
|
|
|
|
IndexData[IndexPos + 4] = VertexPos + 2;
|
|
|
|
IndexData[IndexPos + 5] = VertexPos + 3;
|
|
|
|
|
|
|
|
QuadBatchPos++;
|
|
|
|
VertexPos += 4;
|
|
|
|
IndexPos += 6;
|
|
|
|
|
|
|
|
x += 256 + 8;
|
|
|
|
if (x > Width - 256)
|
|
|
|
{
|
|
|
|
x = 8;
|
|
|
|
y += 256 + 8;
|
|
|
|
if (y > TrueHeight - 256)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pack = pack->Next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: AllocPackedTexture
|
|
|
|
//
|
2016-01-09 02:08:10 +00:00
|
|
|
// Finds space to pack an image inside a texture atlas and returns it.
|
2008-01-10 04:11:38 +00:00
|
|
|
// Large images and those that need to wrap always get their own textures.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
D3DFB::PackedTexture *D3DFB::AllocPackedTexture(int w, int h, bool wrapping, D3DFORMAT format)
|
|
|
|
{
|
2016-01-09 04:07:16 +00:00
|
|
|
Atlas *pack;
|
|
|
|
Rect box;
|
|
|
|
bool padded;
|
2008-01-10 04:11:38 +00:00
|
|
|
|
2016-01-11 04:14:35 +00:00
|
|
|
// The - 2 to account for padding
|
|
|
|
if (w > 256 - 2 || h > 256 - 2 || wrapping)
|
2016-01-09 02:08:10 +00:00
|
|
|
{ // Create a new texture atlas.
|
2016-01-09 04:07:16 +00:00
|
|
|
pack = new Atlas(this, w, h, format);
|
|
|
|
pack->OneUse = true;
|
|
|
|
box = pack->Packer.Insert(w, h);
|
|
|
|
padded = false;
|
2008-01-10 04:11:38 +00:00
|
|
|
}
|
|
|
|
else
|
2016-01-09 02:08:10 +00:00
|
|
|
{ // Try to find space in an existing texture atlas.
|
2009-11-19 01:49:19 +00:00
|
|
|
w += 2; // Add padding
|
|
|
|
h += 2;
|
2016-01-09 04:07:16 +00:00
|
|
|
for (pack = Atlases; pack != NULL; pack = pack->Next)
|
2008-01-10 04:11:38 +00:00
|
|
|
{
|
2016-01-09 04:07:16 +00:00
|
|
|
// Use the first atlas it fits in.
|
2008-01-10 04:11:38 +00:00
|
|
|
if (pack->Format == format)
|
|
|
|
{
|
2016-01-09 04:07:16 +00:00
|
|
|
box = pack->Packer.Insert(w, h);
|
|
|
|
if (box.width != 0)
|
2008-01-10 04:11:38 +00:00
|
|
|
{
|
2016-01-09 04:07:16 +00:00
|
|
|
break;
|
2008-01-10 04:11:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-01-09 04:07:16 +00:00
|
|
|
if (pack == NULL)
|
2016-01-09 02:08:10 +00:00
|
|
|
{ // Create a new texture atlas.
|
2016-01-11 04:14:35 +00:00
|
|
|
pack = new Atlas(this, DEF_ATLAS_WIDTH, DEF_ATLAS_HEIGHT, format);
|
2016-01-09 04:07:16 +00:00
|
|
|
box = pack->Packer.Insert(w, h);
|
2008-01-10 04:11:38 +00:00
|
|
|
}
|
2016-01-09 04:07:16 +00:00
|
|
|
padded = true;
|
2008-01-10 04:11:38 +00:00
|
|
|
}
|
2016-01-09 04:07:16 +00:00
|
|
|
assert(box.width != 0 && box.height != 0);
|
|
|
|
return pack->AllocateImage(box, padded);
|
2008-01-10 04:11:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
2016-01-09 02:08:10 +00:00
|
|
|
// Atlas Constructor
|
2008-01-10 04:11:38 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2016-01-09 02:08:10 +00:00
|
|
|
D3DFB::Atlas::Atlas(D3DFB *fb, int w, int h, D3DFORMAT format)
|
2016-01-09 04:07:16 +00:00
|
|
|
: Packer(w, h, true)
|
2008-01-10 04:11:38 +00:00
|
|
|
{
|
|
|
|
Tex = NULL;
|
|
|
|
Format = format;
|
|
|
|
UsedList = NULL;
|
|
|
|
OneUse = false;
|
|
|
|
Width = 0;
|
|
|
|
Height = 0;
|
2016-01-09 04:07:16 +00:00
|
|
|
Next = NULL;
|
2008-01-10 04:11:38 +00:00
|
|
|
|
2016-01-09 04:07:16 +00:00
|
|
|
// Attach to the end of the atlas list
|
|
|
|
Atlas **prev = &fb->Atlases;
|
|
|
|
while (*prev != NULL)
|
|
|
|
{
|
|
|
|
prev = &((*prev)->Next);
|
|
|
|
}
|
|
|
|
*prev = this;
|
2008-01-10 04:11:38 +00:00
|
|
|
|
|
|
|
#if 1
|
|
|
|
if (FAILED(fb->D3DDevice->CreateTexture(w, h, 1, 0, format, D3DPOOL_MANAGED, &Tex, NULL)))
|
|
|
|
#endif
|
|
|
|
{ // Try again, using power-of-2 sizes
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 1; i < w; i <<= 1) {} w = i;
|
|
|
|
for (i = 1; i < h; i <<= 1) {} h = i;
|
|
|
|
if (FAILED(fb->D3DDevice->CreateTexture(w, h, 1, 0, format, D3DPOOL_MANAGED, &Tex, NULL)))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Width = w;
|
|
|
|
Height = h;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
2016-01-09 02:08:10 +00:00
|
|
|
// Atlas Destructor
|
2008-01-10 04:11:38 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2016-01-09 02:08:10 +00:00
|
|
|
D3DFB::Atlas::~Atlas()
|
2008-01-10 04:11:38 +00:00
|
|
|
{
|
|
|
|
PackedTexture *box, *next;
|
|
|
|
|
|
|
|
SAFE_RELEASE( Tex );
|
|
|
|
for (box = UsedList; box != NULL; box = next)
|
|
|
|
{
|
|
|
|
next = box->Next;
|
|
|
|
delete box;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
2016-01-09 02:08:10 +00:00
|
|
|
// Atlas :: AllocateImage
|
2008-01-10 04:11:38 +00:00
|
|
|
//
|
|
|
|
// Moves the box from the empty list to the used list, sizing it to the
|
|
|
|
// requested dimensions and adding additional boxes to the empty list if
|
|
|
|
// needed.
|
|
|
|
//
|
2016-01-09 02:08:10 +00:00
|
|
|
// The passed box *MUST* be in this texture atlas's empty list.
|
2008-01-10 04:11:38 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2016-01-09 04:07:16 +00:00
|
|
|
D3DFB::PackedTexture *D3DFB::Atlas::AllocateImage(const Rect &rect, bool padded)
|
2008-01-10 04:11:38 +00:00
|
|
|
{
|
2016-01-09 04:07:16 +00:00
|
|
|
PackedTexture *box = new PackedTexture;
|
2008-01-10 04:11:38 +00:00
|
|
|
|
2016-01-09 04:07:16 +00:00
|
|
|
box->Owner = this;
|
|
|
|
box->Area.left = rect.x;
|
|
|
|
box->Area.top = rect.y;
|
|
|
|
box->Area.right = rect.x + rect.width;
|
|
|
|
box->Area.bottom = rect.y + rect.height;
|
2008-01-10 04:11:38 +00:00
|
|
|
|
2016-01-09 04:07:16 +00:00
|
|
|
box->Left = float(box->Area.left + padded) / Width;
|
|
|
|
box->Right = float(box->Area.right - padded) / Width;
|
|
|
|
box->Top = float(box->Area.top + padded) / Height;
|
|
|
|
box->Bottom = float(box->Area.bottom - padded) / Height;
|
2008-01-10 04:11:38 +00:00
|
|
|
|
2016-01-09 04:07:16 +00:00
|
|
|
box->Padded = padded;
|
2008-01-10 04:11:38 +00:00
|
|
|
|
|
|
|
// Add it to the used list.
|
|
|
|
box->Next = UsedList;
|
|
|
|
if (box->Next != NULL)
|
|
|
|
{
|
|
|
|
box->Next->Prev = &box->Next;
|
|
|
|
}
|
|
|
|
UsedList = box;
|
|
|
|
box->Prev = &UsedList;
|
|
|
|
|
|
|
|
return box;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
2016-01-09 02:08:10 +00:00
|
|
|
// Atlas :: FreeBox
|
2008-01-10 04:11:38 +00:00
|
|
|
//
|
2016-01-09 04:07:16 +00:00
|
|
|
// Removes a box from the used list and deletes it. Space is returned to the
|
|
|
|
// waste list. Once all boxes for this atlas are freed, the entire bin
|
|
|
|
// packer is reinitialized for maximum efficiency.
|
2008-01-10 04:11:38 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2016-01-09 02:08:10 +00:00
|
|
|
void D3DFB::Atlas::FreeBox(D3DFB::PackedTexture *box)
|
2008-01-10 04:11:38 +00:00
|
|
|
{
|
|
|
|
*(box->Prev) = box->Next;
|
|
|
|
if (box->Next != NULL)
|
|
|
|
{
|
|
|
|
box->Next->Prev = box->Prev;
|
|
|
|
}
|
2016-01-09 04:07:16 +00:00
|
|
|
Rect waste;
|
|
|
|
waste.x = box->Area.left;
|
|
|
|
waste.y = box->Area.top;
|
|
|
|
waste.width = box->Area.right - box->Area.left;
|
|
|
|
waste.height = box->Area.bottom - box->Area.top;
|
|
|
|
box->Owner->Packer.AddWaste(waste);
|
|
|
|
delete box;
|
2008-01-10 04:11:38 +00:00
|
|
|
if (UsedList == NULL)
|
2016-01-09 04:07:16 +00:00
|
|
|
{
|
|
|
|
Packer.Init(Width, Height, true);
|
2008-01-10 04:11:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-20 04:36:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DTex Constructor
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
D3DTex::D3DTex(FTexture *tex, D3DFB *fb, bool wrapping)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
2007-12-27 04:30:12 +00:00
|
|
|
// Attach to the texture list for the D3DFB
|
|
|
|
Next = fb->Textures;
|
|
|
|
if (Next != NULL)
|
|
|
|
{
|
|
|
|
Next->Prev = &Next;
|
|
|
|
}
|
|
|
|
Prev = &fb->Textures;
|
|
|
|
fb->Textures = this;
|
|
|
|
|
2007-12-20 04:36:43 +00:00
|
|
|
GameTex = tex;
|
2008-01-10 04:11:38 +00:00
|
|
|
Box = NULL;
|
2007-12-20 04:36:43 +00:00
|
|
|
IsGray = false;
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
Create(fb, wrapping);
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DTex Destructor
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
D3DTex::~D3DTex()
|
|
|
|
{
|
2008-01-10 04:11:38 +00:00
|
|
|
if (Box != NULL)
|
|
|
|
{
|
|
|
|
Box->Owner->FreeBox(Box);
|
|
|
|
Box = NULL;
|
|
|
|
}
|
2007-12-27 04:30:12 +00:00
|
|
|
// Detach from the texture list
|
|
|
|
*Prev = Next;
|
|
|
|
if (Next != NULL)
|
|
|
|
{
|
|
|
|
Next->Prev = Prev;
|
|
|
|
}
|
|
|
|
// Remove link from the game texture
|
|
|
|
if (GameTex != NULL)
|
|
|
|
{
|
|
|
|
GameTex->Native = NULL;
|
|
|
|
}
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DTex :: CheckWrapping
|
|
|
|
//
|
|
|
|
// Returns true if the texture is compatible with the specified wrapping
|
|
|
|
// mode.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
bool D3DTex::CheckWrapping(bool wrapping)
|
|
|
|
{
|
|
|
|
// If it doesn't need to wrap, then it works.
|
|
|
|
if (!wrapping)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
// If it needs to wrap, then it can't be packed inside another texture.
|
|
|
|
return Box->Owner->OneUse;
|
|
|
|
}
|
2009-11-19 01:49:19 +00:00
|
|
|
|
2007-12-20 04:36:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DTex :: Create
|
|
|
|
//
|
|
|
|
// Creates an IDirect3DTexture9 for the texture and copies the image data
|
|
|
|
// to it. Note that unlike FTexture, this image is row-major.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
bool D3DTex::Create(D3DFB *fb, bool wrapping)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
2016-01-09 04:07:16 +00:00
|
|
|
assert(Box == NULL);
|
2008-01-10 04:11:38 +00:00
|
|
|
if (Box != NULL)
|
2007-12-28 03:30:05 +00:00
|
|
|
{
|
2008-01-10 04:11:38 +00:00
|
|
|
Box->Owner->FreeBox(Box);
|
2007-12-28 03:30:05 +00:00
|
|
|
}
|
2007-12-20 04:36:43 +00:00
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
Box = fb->AllocPackedTexture(GameTex->GetWidth(), GameTex->GetHeight(), wrapping, GetTexFormat());
|
|
|
|
|
|
|
|
if (Box == NULL)
|
|
|
|
{
|
|
|
|
return false;
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
|
|
|
if (!Update())
|
|
|
|
{
|
2008-01-10 04:11:38 +00:00
|
|
|
Box->Owner->FreeBox(Box);
|
|
|
|
Box = NULL;
|
2007-12-20 04:36:43 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DTex :: Update
|
|
|
|
//
|
|
|
|
// Copies image data from the underlying FTexture to the D3D texture.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
bool D3DTex::Update()
|
|
|
|
{
|
|
|
|
D3DSURFACE_DESC desc;
|
|
|
|
D3DLOCKED_RECT lrect;
|
|
|
|
RECT rect;
|
2009-11-19 01:49:19 +00:00
|
|
|
BYTE *dest;
|
2007-12-20 04:36:43 +00:00
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
assert(Box != NULL);
|
|
|
|
assert(Box->Owner != NULL);
|
|
|
|
assert(Box->Owner->Tex != NULL);
|
2007-12-20 04:36:43 +00:00
|
|
|
assert(GameTex != NULL);
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
if (FAILED(Box->Owner->Tex->GetLevelDesc(0, &desc)))
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2008-01-10 04:11:38 +00:00
|
|
|
rect = Box->Area;
|
|
|
|
if (FAILED(Box->Owner->Tex->LockRect(0, &lrect, &rect, 0)))
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2009-11-19 01:49:19 +00:00
|
|
|
dest = (BYTE *)lrect.pBits;
|
|
|
|
if (Box->Padded)
|
|
|
|
{
|
|
|
|
dest += lrect.Pitch + (desc.Format == D3DFMT_L8 ? 1 : 4);
|
|
|
|
}
|
|
|
|
GameTex->FillBuffer(dest, lrect.Pitch, GameTex->GetHeight(), ToTexFmt(desc.Format));
|
|
|
|
if (Box->Padded)
|
|
|
|
{
|
|
|
|
// Clear top padding row.
|
|
|
|
dest = (BYTE *)lrect.pBits;
|
|
|
|
int numbytes = GameTex->GetWidth() + 2;
|
|
|
|
if (desc.Format != D3DFMT_L8)
|
|
|
|
{
|
|
|
|
numbytes <<= 2;
|
|
|
|
}
|
|
|
|
memset(dest, 0, numbytes);
|
|
|
|
dest += lrect.Pitch;
|
|
|
|
// Clear left and right padding columns.
|
|
|
|
if (desc.Format == D3DFMT_L8)
|
|
|
|
{
|
|
|
|
for (int y = Box->Area.bottom - Box->Area.top - 2; y > 0; --y)
|
|
|
|
{
|
|
|
|
dest[0] = 0;
|
|
|
|
dest[numbytes-1] = 0;
|
|
|
|
dest += lrect.Pitch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (int y = Box->Area.bottom - Box->Area.top - 2; y > 0; --y)
|
|
|
|
{
|
|
|
|
*(DWORD *)dest = 0;
|
|
|
|
*(DWORD *)(dest + numbytes - 4) = 0;
|
|
|
|
dest += lrect.Pitch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Clear bottom padding row.
|
|
|
|
memset(dest, 0, numbytes);
|
|
|
|
}
|
2008-01-10 04:11:38 +00:00
|
|
|
Box->Owner->Tex->UnlockRect(0);
|
2007-12-20 04:36:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DTex :: GetTexFormat
|
|
|
|
//
|
|
|
|
// Returns the texture format that would best fit this texture.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
D3DFORMAT D3DTex::GetTexFormat()
|
|
|
|
{
|
|
|
|
FTextureFormat fmt = GameTex->GetFormat();
|
|
|
|
|
|
|
|
IsGray = false;
|
|
|
|
|
|
|
|
switch (fmt)
|
|
|
|
{
|
|
|
|
case TEX_Pal: return D3DFMT_L8;
|
|
|
|
case TEX_Gray: IsGray = true; return D3DFMT_L8;
|
|
|
|
case TEX_RGB: return D3DFMT_A8R8G8B8;
|
|
|
|
case TEX_DXT1: return D3DFMT_DXT1;
|
|
|
|
case TEX_DXT2: return D3DFMT_DXT2;
|
|
|
|
case TEX_DXT3: return D3DFMT_DXT3;
|
|
|
|
case TEX_DXT4: return D3DFMT_DXT4;
|
|
|
|
case TEX_DXT5: return D3DFMT_DXT5;
|
|
|
|
default: I_FatalError ("GameTex->GetFormat() returned invalid format.");
|
|
|
|
}
|
|
|
|
return D3DFMT_L8;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DTex :: ToTexFmt
|
|
|
|
//
|
|
|
|
// Converts a D3DFORMAT constant to something the FTexture system
|
|
|
|
// understands.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
FTextureFormat D3DTex::ToTexFmt(D3DFORMAT fmt)
|
|
|
|
{
|
|
|
|
switch (fmt)
|
|
|
|
{
|
|
|
|
case D3DFMT_L8: return IsGray ? TEX_Gray : TEX_Pal;
|
|
|
|
case D3DFMT_A8R8G8B8: return TEX_RGB;
|
|
|
|
case D3DFMT_DXT1: return TEX_DXT1;
|
|
|
|
case D3DFMT_DXT2: return TEX_DXT2;
|
|
|
|
case D3DFMT_DXT3: return TEX_DXT3;
|
|
|
|
case D3DFMT_DXT4: return TEX_DXT4;
|
|
|
|
case D3DFMT_DXT5: return TEX_DXT5;
|
|
|
|
default:
|
|
|
|
assert(0); // LOL WUT?
|
|
|
|
return TEX_Pal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DPal Constructor
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
D3DPal::D3DPal(FRemapTable *remap, D3DFB *fb)
|
|
|
|
: Tex(NULL), Remap(remap)
|
|
|
|
{
|
|
|
|
int count;
|
|
|
|
|
2007-12-27 04:30:12 +00:00
|
|
|
// Attach to the palette list for the D3DFB
|
|
|
|
Next = fb->Palettes;
|
|
|
|
if (Next != NULL)
|
|
|
|
{
|
|
|
|
Next->Prev = &Next;
|
|
|
|
}
|
|
|
|
Prev = &fb->Palettes;
|
|
|
|
fb->Palettes = this;
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
// Palette textures must be 256 entries for Shader Model 1.4
|
|
|
|
if (fb->SM14)
|
|
|
|
{
|
|
|
|
count = 256;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
// If the palette isn't big enough, then we don't need to
|
|
|
|
// worry about setting the gamma ramp.
|
2009-09-05 03:55:29 +00:00
|
|
|
DoColorSkip = (remap->NumEntries >= 256 - 8);
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int pow2count;
|
|
|
|
|
|
|
|
// Round up to the nearest power of 2.
|
|
|
|
for (pow2count = 1; pow2count < remap->NumEntries; pow2count <<= 1)
|
|
|
|
{ }
|
|
|
|
count = pow2count;
|
2009-09-05 03:55:29 +00:00
|
|
|
DoColorSkip = false;
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
}
|
2009-09-05 03:55:29 +00:00
|
|
|
BorderColor = 0;
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
RoundedPaletteSize = count;
|
|
|
|
if (SUCCEEDED(fb->D3DDevice->CreateTexture(count, 1, 1, 0,
|
|
|
|
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &Tex, NULL)))
|
|
|
|
{
|
|
|
|
if (!Update())
|
|
|
|
{
|
|
|
|
Tex->Release();
|
|
|
|
Tex = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DPal Destructor
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
D3DPal::~D3DPal()
|
|
|
|
{
|
2008-01-09 21:04:21 +00:00
|
|
|
SAFE_RELEASE( Tex );
|
2007-12-27 04:30:12 +00:00
|
|
|
// Detach from the palette list
|
|
|
|
*Prev = Next;
|
|
|
|
if (Next != NULL)
|
|
|
|
{
|
|
|
|
Next->Prev = Prev;
|
|
|
|
}
|
|
|
|
// Remove link from the remap table
|
|
|
|
if (Remap != NULL)
|
|
|
|
{
|
|
|
|
Remap->Native = NULL;
|
|
|
|
}
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DPal :: Update
|
|
|
|
//
|
|
|
|
// Copies the palette to the texture.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
bool D3DPal::Update()
|
|
|
|
{
|
|
|
|
D3DLOCKED_RECT lrect;
|
|
|
|
D3DCOLOR *buff;
|
|
|
|
const PalEntry *pal;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
int skipat, i;
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
|
|
|
|
assert(Tex != NULL);
|
|
|
|
|
|
|
|
if (FAILED(Tex->LockRect(0, &lrect, NULL, 0)))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
buff = (D3DCOLOR *)lrect.pBits;
|
|
|
|
pal = Remap->Palette;
|
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
// See explanation in UploadPalette() for skipat rationale.
|
2009-09-05 03:55:29 +00:00
|
|
|
skipat = MIN(Remap->NumEntries, DoColorSkip ? 256 - 8 : 256);
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
|
|
|
|
for (i = 0; i < skipat; ++i)
|
|
|
|
{
|
2008-04-22 18:48:30 +00:00
|
|
|
buff[i] = D3DCOLOR_ARGB(pal[i].a, pal[i].r, pal[i].g, pal[i].b);
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
}
|
|
|
|
for (++i; i < Remap->NumEntries; ++i)
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
{
|
2008-04-22 18:48:30 +00:00
|
|
|
buff[i] = D3DCOLOR_ARGB(pal[i].a, pal[i-1].r, pal[i-1].g, pal[i-1].b);
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
}
|
2008-04-22 18:48:30 +00:00
|
|
|
BorderColor = D3DCOLOR_ARGB(pal[i].a, pal[i-1].r, pal[i-1].g, pal[i-1].b);
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
Tex->UnlockRect(0);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-12-20 04:36:43 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: Begin2D
|
|
|
|
//
|
|
|
|
// Begins 2D mode drawing operations. In particular, DrawTexture is
|
|
|
|
// rerouted to use Direct3D instead of the software renderer.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-01-02 05:21:48 +00:00
|
|
|
bool D3DFB::Begin2D(bool copy3d)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
2008-02-14 04:58:45 +00:00
|
|
|
if (!Accel2D)
|
2008-01-02 05:21:48 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2007-12-20 04:36:43 +00:00
|
|
|
if (In2D)
|
|
|
|
{
|
2007-12-27 04:30:12 +00:00
|
|
|
return true;
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
2008-01-02 05:21:48 +00:00
|
|
|
In2D = 2 - copy3d;
|
2007-12-20 04:36:43 +00:00
|
|
|
Update();
|
2008-01-02 05:21:48 +00:00
|
|
|
In2D = 3;
|
2007-12-20 04:36:43 +00:00
|
|
|
|
2007-12-27 04:30:12 +00:00
|
|
|
return true;
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
|
|
|
|
2009-09-20 03:50:05 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: DrawBlendingRect
|
|
|
|
//
|
|
|
|
// Call after Begin2D to blend the 3D view.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::DrawBlendingRect()
|
|
|
|
{
|
|
|
|
if (!In2D || !Accel2D)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Dim(FlashColor, FlashAmount / 256.f, viewwindowx, viewwindowy, viewwidth, viewheight);
|
|
|
|
}
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: CreateTexture
|
|
|
|
//
|
|
|
|
// Returns a native texture that wraps a FTexture.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
FNativeTexture *D3DFB::CreateTexture(FTexture *gametex, bool wrapping)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
2008-01-10 04:11:38 +00:00
|
|
|
D3DTex *tex = new D3DTex(gametex, this, wrapping);
|
|
|
|
if (tex->Box == NULL)
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
{
|
|
|
|
delete tex;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return tex;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: CreatePalette
|
|
|
|
//
|
|
|
|
// Returns a native texture that contains a palette.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
FNativePalette *D3DFB::CreatePalette(FRemapTable *remap)
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
{
|
|
|
|
D3DPal *tex = new D3DPal(remap, this);
|
|
|
|
if (tex->Tex == NULL)
|
|
|
|
{
|
|
|
|
delete tex;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return tex;
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
2007-12-22 04:52:51 +00:00
|
|
|
//
|
|
|
|
// D3DFB :: Clear
|
|
|
|
//
|
|
|
|
// Fills the specified region with a color.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
void D3DFB::Clear (int left, int top, int right, int bottom, int palcolor, uint32 color)
|
2007-12-22 04:52:51 +00:00
|
|
|
{
|
|
|
|
if (In2D < 2)
|
|
|
|
{
|
|
|
|
Super::Clear(left, top, right, bottom, palcolor, color);
|
|
|
|
return;
|
|
|
|
}
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
if (!InScene)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2010-12-16 00:21:13 +00:00
|
|
|
if (palcolor >= 0 && color == 0)
|
2007-12-22 04:52:51 +00:00
|
|
|
{
|
|
|
|
color = GPalette.BaseColors[palcolor];
|
|
|
|
}
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
else if (APART(color) < 255)
|
|
|
|
{
|
|
|
|
Dim(color, APART(color)/255.f, left, top, right - left, bottom - top);
|
|
|
|
return;
|
|
|
|
}
|
2008-01-06 04:03:33 +00:00
|
|
|
AddColorOnlyQuad(left, top, right - left, bottom - top, color | 0xFF000000);
|
2007-12-22 04:52:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: Dim
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
void D3DFB::Dim (PalEntry color, float amount, int x1, int y1, int w, int h)
|
2007-12-22 04:52:51 +00:00
|
|
|
{
|
|
|
|
if (amount <= 0)
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
{
|
2007-12-22 04:52:51 +00:00
|
|
|
return;
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
}
|
2007-12-22 04:52:51 +00:00
|
|
|
if (In2D < 2)
|
|
|
|
{
|
|
|
|
Super::Dim(color, amount, x1, y1, w, h);
|
|
|
|
return;
|
|
|
|
}
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
if (!InScene)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-01-06 04:03:33 +00:00
|
|
|
if (amount > 1)
|
2007-12-22 04:52:51 +00:00
|
|
|
{
|
2008-01-06 04:03:33 +00:00
|
|
|
amount = 1;
|
2007-12-22 04:52:51 +00:00
|
|
|
}
|
2008-01-06 04:03:33 +00:00
|
|
|
AddColorOnlyQuad(x1, y1, w, h, color | (int(amount * 255) << 24));
|
2007-12-22 04:52:51 +00:00
|
|
|
}
|
|
|
|
|
2008-01-04 05:22:30 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
2008-01-09 21:04:21 +00:00
|
|
|
// D3DFB :: BeginLineBatch
|
2008-01-04 05:22:30 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-01-09 21:04:21 +00:00
|
|
|
void D3DFB::BeginLineBatch()
|
2008-01-04 05:22:30 +00:00
|
|
|
{
|
2008-01-09 21:04:21 +00:00
|
|
|
if (In2D < 2 || !InScene || BatchType == BATCH_Lines)
|
2008-01-04 05:22:30 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-01-09 21:04:21 +00:00
|
|
|
EndQuadBatch(); // Make sure all quads have been drawn first.
|
|
|
|
VertexBuffer->Lock(0, 0, (void **)&VertexData, D3DLOCK_DISCARD);
|
|
|
|
VertexPos = 0;
|
|
|
|
BatchType = BATCH_Lines;
|
2008-01-04 05:22:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
2008-01-09 21:04:21 +00:00
|
|
|
// D3DFB :: EndLineBatch
|
2008-01-04 05:22:30 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-01-09 21:04:21 +00:00
|
|
|
void D3DFB::EndLineBatch()
|
2008-01-04 05:22:30 +00:00
|
|
|
{
|
2008-01-09 21:04:21 +00:00
|
|
|
if (In2D < 2 || !InScene || BatchType != BATCH_Lines)
|
2008-01-04 05:22:30 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-01-09 21:04:21 +00:00
|
|
|
VertexBuffer->Unlock();
|
|
|
|
if (VertexPos > 0)
|
2008-01-04 05:22:30 +00:00
|
|
|
{
|
2009-09-20 03:50:05 +00:00
|
|
|
SetPixelShader(Shaders[SHADER_VertexColor]);
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
SetAlphaBlend(D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA);
|
2008-01-09 21:04:21 +00:00
|
|
|
D3DDevice->SetStreamSource(0, VertexBuffer, 0, sizeof(FBVERTEX));
|
|
|
|
D3DDevice->DrawPrimitive(D3DPT_LINELIST, 0, VertexPos / 2);
|
2008-01-04 05:22:30 +00:00
|
|
|
}
|
2008-01-09 21:04:21 +00:00
|
|
|
VertexPos = -1;
|
|
|
|
BatchType = BATCH_None;
|
2008-01-04 05:22:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: DrawLine
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::DrawLine(int x0, int y0, int x1, int y1, int palcolor, uint32 color)
|
|
|
|
{
|
|
|
|
if (In2D < 2)
|
|
|
|
{
|
|
|
|
Super::DrawLine(x0, y0, x1, y1, palcolor, color);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!InScene)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-01-09 21:04:21 +00:00
|
|
|
if (BatchType != BATCH_Lines)
|
|
|
|
{
|
|
|
|
BeginLineBatch();
|
2008-01-04 05:22:30 +00:00
|
|
|
}
|
2008-01-09 21:04:21 +00:00
|
|
|
if (VertexPos == NUM_VERTS)
|
|
|
|
{ // Flush the buffer and refill it.
|
|
|
|
EndLineBatch();
|
|
|
|
BeginLineBatch();
|
2008-01-04 05:22:30 +00:00
|
|
|
}
|
2008-01-09 21:04:21 +00:00
|
|
|
// Add the endpoints to the vertex buffer.
|
|
|
|
VertexData[VertexPos].x = float(x0);
|
|
|
|
VertexData[VertexPos].y = float(y0) + LBOffset;
|
|
|
|
VertexData[VertexPos].z = 0;
|
|
|
|
VertexData[VertexPos].rhw = 1;
|
|
|
|
VertexData[VertexPos].color0 = color;
|
|
|
|
VertexData[VertexPos].color1 = 0;
|
|
|
|
VertexData[VertexPos].tu = 0;
|
|
|
|
VertexData[VertexPos].tv = 0;
|
|
|
|
|
|
|
|
VertexData[VertexPos+1].x = float(x1);
|
|
|
|
VertexData[VertexPos+1].y = float(y1) + LBOffset;
|
|
|
|
VertexData[VertexPos+1].z = 0;
|
|
|
|
VertexData[VertexPos+1].rhw = 1;
|
|
|
|
VertexData[VertexPos+1].color0 = color;
|
|
|
|
VertexData[VertexPos+1].color1 = 0;
|
|
|
|
VertexData[VertexPos+1].tu = 0;
|
|
|
|
VertexData[VertexPos+1].tv = 0;
|
|
|
|
|
|
|
|
VertexPos += 2;
|
2008-01-04 05:22:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: DrawPixel
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::DrawPixel(int x, int y, int palcolor, uint32 color)
|
|
|
|
{
|
|
|
|
if (In2D < 2)
|
|
|
|
{
|
|
|
|
Super::DrawPixel(x, y, palcolor, color);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!InScene)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
FBVERTEX pt =
|
|
|
|
{
|
|
|
|
float(x), float(y), 0, 1, color
|
|
|
|
};
|
2008-01-09 21:04:21 +00:00
|
|
|
EndBatch(); // Draw out any batched operations.
|
2009-09-20 03:50:05 +00:00
|
|
|
SetPixelShader(Shaders[SHADER_VertexColor]);
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
SetAlphaBlend(D3DBLENDOP_ADD, D3DBLEND_SRCALPHA, D3DBLEND_INVSRCALPHA);
|
2008-01-04 05:22:30 +00:00
|
|
|
D3DDevice->DrawPrimitiveUP(D3DPT_POINTLIST, 1, &pt, sizeof(FBVERTEX));
|
|
|
|
}
|
|
|
|
|
2007-12-22 04:52:51 +00:00
|
|
|
//==========================================================================
|
2007-12-20 04:36:43 +00:00
|
|
|
//
|
2007-12-22 04:00:25 +00:00
|
|
|
// D3DFB :: DrawTextureV
|
2007-12-20 04:36:43 +00:00
|
|
|
//
|
|
|
|
// If not in 2D mode, just call the normal software version.
|
|
|
|
// If in 2D mode, then use Direct3D calls to perform the drawing.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
- Changed all coordinates for DrawTexture() to floating point so that the
player sprites will retain the same precision they had when they were
rendered as part of the 3D view. (needed for propery alignment of flashes
on top of weapon sprites) It worked just fine for D3D, but software
rendering was another matter. I consequently did battle with imprecisions
in the whole masked texture drawing routines that had previously been
partially masked by only drawing on whole pixel boundaries. Particularly,
the tops of posts are calculated by multiplying by spryscale, and the
texture mapping coordinates are calculated by multiplying by dc_iscale
(where dc_iscale = 1 / spryscale). Since these are both 16.16 fixed point
values, there is a significant variance. For best results, the drawing
routines should only use one of these values, but that would mean
introducing division into the inner loop. If the division removed the
necessity for the fudge code in R_DrawMaskedColumn(), would it be worth it?
Or would the divide be slower than the fudging? Or would I be better off
doing it like Build and using transparent pixel checks instead, not
bothering with skipping transparent areas? For now, I chop off the
fractional part of the top coordinate for software drawing, since it was
the easiest thing to do (even if it wasn't the most correct thing to do).
SVN r1955 (trunk)
2009-11-01 01:27:33 +00:00
|
|
|
void STACK_ARGS D3DFB::DrawTextureV (FTexture *img, double x, double y, uint32 tags_first, va_list tags)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
|
|
|
if (In2D < 2)
|
|
|
|
{
|
2007-12-22 04:00:25 +00:00
|
|
|
Super::DrawTextureV(img, x, y, tags_first, tags);
|
2007-12-20 04:36:43 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawParms parms;
|
|
|
|
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
if (!InScene || !ParseDrawTextureTags(img, x, y, tags_first, tags, &parms, true))
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
D3DTex *tex = static_cast<D3DTex *>(img->GetNative(false));
|
2007-12-20 04:36:43 +00:00
|
|
|
|
|
|
|
if (tex == NULL)
|
|
|
|
{
|
|
|
|
assert(tex != NULL);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-01-06 04:03:33 +00:00
|
|
|
CheckQuadBatch();
|
|
|
|
|
- Changed all coordinates for DrawTexture() to floating point so that the
player sprites will retain the same precision they had when they were
rendered as part of the 3D view. (needed for propery alignment of flashes
on top of weapon sprites) It worked just fine for D3D, but software
rendering was another matter. I consequently did battle with imprecisions
in the whole masked texture drawing routines that had previously been
partially masked by only drawing on whole pixel boundaries. Particularly,
the tops of posts are calculated by multiplying by spryscale, and the
texture mapping coordinates are calculated by multiplying by dc_iscale
(where dc_iscale = 1 / spryscale). Since these are both 16.16 fixed point
values, there is a significant variance. For best results, the drawing
routines should only use one of these values, but that would mean
introducing division into the inner loop. If the division removed the
necessity for the fudge code in R_DrawMaskedColumn(), would it be worth it?
Or would the divide be slower than the fudging? Or would I be better off
doing it like Build and using transparent pixel checks instead, not
bothering with skipping transparent areas? For now, I chop off the
fractional part of the top coordinate for software drawing, since it was
the easiest thing to do (even if it wasn't the most correct thing to do).
SVN r1955 (trunk)
2009-11-01 01:27:33 +00:00
|
|
|
double xscale = parms.destwidth / parms.texwidth;
|
|
|
|
double yscale = parms.destheight / parms.texheight;
|
|
|
|
double x0 = parms.x - parms.left * xscale;
|
|
|
|
double y0 = parms.y - parms.top * yscale;
|
|
|
|
double x1 = x0 + parms.destwidth;
|
|
|
|
double y1 = y0 + parms.destheight;
|
2008-01-10 04:11:38 +00:00
|
|
|
float u0 = tex->Box->Left;
|
|
|
|
float v0 = tex->Box->Top;
|
|
|
|
float u1 = tex->Box->Right;
|
|
|
|
float v1 = tex->Box->Bottom;
|
- Changed all coordinates for DrawTexture() to floating point so that the
player sprites will retain the same precision they had when they were
rendered as part of the 3D view. (needed for propery alignment of flashes
on top of weapon sprites) It worked just fine for D3D, but software
rendering was another matter. I consequently did battle with imprecisions
in the whole masked texture drawing routines that had previously been
partially masked by only drawing on whole pixel boundaries. Particularly,
the tops of posts are calculated by multiplying by spryscale, and the
texture mapping coordinates are calculated by multiplying by dc_iscale
(where dc_iscale = 1 / spryscale). Since these are both 16.16 fixed point
values, there is a significant variance. For best results, the drawing
routines should only use one of these values, but that would mean
introducing division into the inner loop. If the division removed the
necessity for the fudge code in R_DrawMaskedColumn(), would it be worth it?
Or would the divide be slower than the fudging? Or would I be better off
doing it like Build and using transparent pixel checks instead, not
bothering with skipping transparent areas? For now, I chop off the
fractional part of the top coordinate for software drawing, since it was
the easiest thing to do (even if it wasn't the most correct thing to do).
SVN r1955 (trunk)
2009-11-01 01:27:33 +00:00
|
|
|
double uscale = 1.f / tex->Box->Owner->Width;
|
2009-02-01 03:39:00 +00:00
|
|
|
bool scissoring = false;
|
2012-03-30 04:03:46 +00:00
|
|
|
FBVERTEX *vert;
|
|
|
|
float yoffs;
|
2007-12-20 04:36:43 +00:00
|
|
|
|
|
|
|
if (parms.flipX)
|
|
|
|
{
|
2010-07-23 21:19:59 +00:00
|
|
|
swapvalues(u0, u1);
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
|
|
|
if (parms.windowleft > 0 || parms.windowright < parms.texwidth)
|
|
|
|
{
|
|
|
|
x0 += parms.windowleft * xscale;
|
- Changed all coordinates for DrawTexture() to floating point so that the
player sprites will retain the same precision they had when they were
rendered as part of the 3D view. (needed for propery alignment of flashes
on top of weapon sprites) It worked just fine for D3D, but software
rendering was another matter. I consequently did battle with imprecisions
in the whole masked texture drawing routines that had previously been
partially masked by only drawing on whole pixel boundaries. Particularly,
the tops of posts are calculated by multiplying by spryscale, and the
texture mapping coordinates are calculated by multiplying by dc_iscale
(where dc_iscale = 1 / spryscale). Since these are both 16.16 fixed point
values, there is a significant variance. For best results, the drawing
routines should only use one of these values, but that would mean
introducing division into the inner loop. If the division removed the
necessity for the fudge code in R_DrawMaskedColumn(), would it be worth it?
Or would the divide be slower than the fudging? Or would I be better off
doing it like Build and using transparent pixel checks instead, not
bothering with skipping transparent areas? For now, I chop off the
fractional part of the top coordinate for software drawing, since it was
the easiest thing to do (even if it wasn't the most correct thing to do).
SVN r1955 (trunk)
2009-11-01 01:27:33 +00:00
|
|
|
u0 = float(u0 + parms.windowleft * uscale);
|
2007-12-20 04:36:43 +00:00
|
|
|
x1 -= (parms.texwidth - parms.windowright) * xscale;
|
- Changed all coordinates for DrawTexture() to floating point so that the
player sprites will retain the same precision they had when they were
rendered as part of the 3D view. (needed for propery alignment of flashes
on top of weapon sprites) It worked just fine for D3D, but software
rendering was another matter. I consequently did battle with imprecisions
in the whole masked texture drawing routines that had previously been
partially masked by only drawing on whole pixel boundaries. Particularly,
the tops of posts are calculated by multiplying by spryscale, and the
texture mapping coordinates are calculated by multiplying by dc_iscale
(where dc_iscale = 1 / spryscale). Since these are both 16.16 fixed point
values, there is a significant variance. For best results, the drawing
routines should only use one of these values, but that would mean
introducing division into the inner loop. If the division removed the
necessity for the fudge code in R_DrawMaskedColumn(), would it be worth it?
Or would the divide be slower than the fudging? Or would I be better off
doing it like Build and using transparent pixel checks instead, not
bothering with skipping transparent areas? For now, I chop off the
fractional part of the top coordinate for software drawing, since it was
the easiest thing to do (even if it wasn't the most correct thing to do).
SVN r1955 (trunk)
2009-11-01 01:27:33 +00:00
|
|
|
u1 = float(u1 - (parms.texwidth - parms.windowright) * uscale);
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
2012-03-09 00:12:04 +00:00
|
|
|
|
2009-02-01 03:39:00 +00:00
|
|
|
#if 0
|
|
|
|
float vscale = 1.f / tex->Box->Owner->Height / yscale;
|
|
|
|
if (y0 < parms.uclip)
|
|
|
|
{
|
|
|
|
v0 += (float(parms.uclip) - y0) * vscale;
|
|
|
|
y0 = float(parms.uclip);
|
|
|
|
}
|
|
|
|
if (y1 > parms.dclip)
|
|
|
|
{
|
|
|
|
v1 -= (y1 - float(parms.dclip)) * vscale;
|
|
|
|
y1 = float(parms.dclip);
|
|
|
|
}
|
2007-12-20 04:36:43 +00:00
|
|
|
if (x0 < parms.lclip)
|
|
|
|
{
|
2009-02-01 03:39:00 +00:00
|
|
|
u0 += float(parms.lclip - x0) * uscale / xscale * 2;
|
2007-12-20 04:36:43 +00:00
|
|
|
x0 = float(parms.lclip);
|
|
|
|
}
|
|
|
|
if (x1 > parms.rclip)
|
|
|
|
{
|
2009-02-01 03:39:00 +00:00
|
|
|
u1 -= (x1 - parms.rclip) * uscale / xscale * 2;
|
2007-12-20 04:36:43 +00:00
|
|
|
x1 = float(parms.rclip);
|
|
|
|
}
|
2009-02-01 03:39:00 +00:00
|
|
|
#else
|
|
|
|
// Use a scissor test because the math above introduces some jitter
|
|
|
|
// that is noticeable at low resolutions. Unfortunately, this means this
|
|
|
|
// quad has to be in a batch by itself.
|
|
|
|
if (y0 < parms.uclip || y1 > parms.dclip || x0 < parms.lclip || x1 > parms.rclip)
|
|
|
|
{
|
|
|
|
scissoring = true;
|
|
|
|
if (QuadBatchPos > 0)
|
|
|
|
{
|
|
|
|
EndQuadBatch();
|
|
|
|
BeginQuadBatch();
|
|
|
|
}
|
2009-09-22 01:28:13 +00:00
|
|
|
RECT scissor = {
|
|
|
|
parms.lclip, parms.uclip + LBOffsetI,
|
|
|
|
parms.rclip, parms.dclip + LBOffsetI
|
|
|
|
};
|
2009-02-01 03:39:00 +00:00
|
|
|
D3DDevice->SetScissorRect(&scissor);
|
|
|
|
D3DDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
|
|
|
|
}
|
|
|
|
#endif
|
2012-03-12 01:22:19 +00:00
|
|
|
parms.bilinear = false;
|
|
|
|
|
|
|
|
D3DCOLOR color0, color1;
|
|
|
|
BufferedTris *quad = &QuadExtra[QuadBatchPos];
|
|
|
|
|
|
|
|
if (!SetStyle(tex, parms, color0, color1, *quad))
|
|
|
|
{
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
2010-08-27 15:20:05 +00:00
|
|
|
quad->Texture = tex->Box->Owner->Tex;
|
2008-01-06 04:03:33 +00:00
|
|
|
if (parms.bilinear)
|
|
|
|
{
|
2010-08-27 15:20:05 +00:00
|
|
|
quad->Flags |= BQF_Bilinear;
|
2008-01-06 04:03:33 +00:00
|
|
|
}
|
2010-08-27 15:20:05 +00:00
|
|
|
quad->NumTris = 2;
|
|
|
|
quad->NumVerts = 4;
|
2007-12-20 04:36:43 +00:00
|
|
|
|
2012-03-30 04:03:46 +00:00
|
|
|
yoffs = GatheringWipeScreen ? 0.5f : 0.5f - LBOffset;
|
2008-01-12 02:12:09 +00:00
|
|
|
|
- Changed all coordinates for DrawTexture() to floating point so that the
player sprites will retain the same precision they had when they were
rendered as part of the 3D view. (needed for propery alignment of flashes
on top of weapon sprites) It worked just fine for D3D, but software
rendering was another matter. I consequently did battle with imprecisions
in the whole masked texture drawing routines that had previously been
partially masked by only drawing on whole pixel boundaries. Particularly,
the tops of posts are calculated by multiplying by spryscale, and the
texture mapping coordinates are calculated by multiplying by dc_iscale
(where dc_iscale = 1 / spryscale). Since these are both 16.16 fixed point
values, there is a significant variance. For best results, the drawing
routines should only use one of these values, but that would mean
introducing division into the inner loop. If the division removed the
necessity for the fudge code in R_DrawMaskedColumn(), would it be worth it?
Or would the divide be slower than the fudging? Or would I be better off
doing it like Build and using transparent pixel checks instead, not
bothering with skipping transparent areas? For now, I chop off the
fractional part of the top coordinate for software drawing, since it was
the easiest thing to do (even if it wasn't the most correct thing to do).
SVN r1955 (trunk)
2009-11-01 01:27:33 +00:00
|
|
|
#if 0
|
2008-01-12 02:12:09 +00:00
|
|
|
// Coordinates are truncated to integers, because that's effectively
|
|
|
|
// what the software renderer does. The hardware will instead round
|
|
|
|
// to nearest, it seems.
|
|
|
|
x0 = floorf(x0) - 0.5f;
|
|
|
|
y0 = floorf(y0) - yoffs;
|
|
|
|
x1 = floorf(x1) - 0.5f;
|
|
|
|
y1 = floorf(y1) - yoffs;
|
- Changed all coordinates for DrawTexture() to floating point so that the
player sprites will retain the same precision they had when they were
rendered as part of the 3D view. (needed for propery alignment of flashes
on top of weapon sprites) It worked just fine for D3D, but software
rendering was another matter. I consequently did battle with imprecisions
in the whole masked texture drawing routines that had previously been
partially masked by only drawing on whole pixel boundaries. Particularly,
the tops of posts are calculated by multiplying by spryscale, and the
texture mapping coordinates are calculated by multiplying by dc_iscale
(where dc_iscale = 1 / spryscale). Since these are both 16.16 fixed point
values, there is a significant variance. For best results, the drawing
routines should only use one of these values, but that would mean
introducing division into the inner loop. If the division removed the
necessity for the fudge code in R_DrawMaskedColumn(), would it be worth it?
Or would the divide be slower than the fudging? Or would I be better off
doing it like Build and using transparent pixel checks instead, not
bothering with skipping transparent areas? For now, I chop off the
fractional part of the top coordinate for software drawing, since it was
the easiest thing to do (even if it wasn't the most correct thing to do).
SVN r1955 (trunk)
2009-11-01 01:27:33 +00:00
|
|
|
#else
|
|
|
|
x0 = x0 - 0.5f;
|
|
|
|
y0 = y0 - yoffs;
|
|
|
|
x1 = x1 - 0.5f;
|
|
|
|
y1 = y1 - yoffs;
|
|
|
|
#endif
|
2007-12-20 04:36:43 +00:00
|
|
|
|
2012-03-30 04:03:46 +00:00
|
|
|
vert = &VertexData[VertexPos];
|
2008-01-06 04:03:33 +00:00
|
|
|
|
- Changed all coordinates for DrawTexture() to floating point so that the
player sprites will retain the same precision they had when they were
rendered as part of the 3D view. (needed for propery alignment of flashes
on top of weapon sprites) It worked just fine for D3D, but software
rendering was another matter. I consequently did battle with imprecisions
in the whole masked texture drawing routines that had previously been
partially masked by only drawing on whole pixel boundaries. Particularly,
the tops of posts are calculated by multiplying by spryscale, and the
texture mapping coordinates are calculated by multiplying by dc_iscale
(where dc_iscale = 1 / spryscale). Since these are both 16.16 fixed point
values, there is a significant variance. For best results, the drawing
routines should only use one of these values, but that would mean
introducing division into the inner loop. If the division removed the
necessity for the fudge code in R_DrawMaskedColumn(), would it be worth it?
Or would the divide be slower than the fudging? Or would I be better off
doing it like Build and using transparent pixel checks instead, not
bothering with skipping transparent areas? For now, I chop off the
fractional part of the top coordinate for software drawing, since it was
the easiest thing to do (even if it wasn't the most correct thing to do).
SVN r1955 (trunk)
2009-11-01 01:27:33 +00:00
|
|
|
// Fill the vertex buffer.
|
|
|
|
vert[0].x = float(x0);
|
|
|
|
vert[0].y = float(y0);
|
2008-01-09 21:04:21 +00:00
|
|
|
vert[0].z = 0;
|
|
|
|
vert[0].rhw = 1;
|
|
|
|
vert[0].color0 = color0;
|
|
|
|
vert[0].color1 = color1;
|
|
|
|
vert[0].tu = u0;
|
|
|
|
vert[0].tv = v0;
|
2008-01-06 04:03:33 +00:00
|
|
|
|
- Changed all coordinates for DrawTexture() to floating point so that the
player sprites will retain the same precision they had when they were
rendered as part of the 3D view. (needed for propery alignment of flashes
on top of weapon sprites) It worked just fine for D3D, but software
rendering was another matter. I consequently did battle with imprecisions
in the whole masked texture drawing routines that had previously been
partially masked by only drawing on whole pixel boundaries. Particularly,
the tops of posts are calculated by multiplying by spryscale, and the
texture mapping coordinates are calculated by multiplying by dc_iscale
(where dc_iscale = 1 / spryscale). Since these are both 16.16 fixed point
values, there is a significant variance. For best results, the drawing
routines should only use one of these values, but that would mean
introducing division into the inner loop. If the division removed the
necessity for the fudge code in R_DrawMaskedColumn(), would it be worth it?
Or would the divide be slower than the fudging? Or would I be better off
doing it like Build and using transparent pixel checks instead, not
bothering with skipping transparent areas? For now, I chop off the
fractional part of the top coordinate for software drawing, since it was
the easiest thing to do (even if it wasn't the most correct thing to do).
SVN r1955 (trunk)
2009-11-01 01:27:33 +00:00
|
|
|
vert[1].x = float(x1);
|
|
|
|
vert[1].y = float(y0);
|
2008-01-06 04:03:33 +00:00
|
|
|
vert[1].z = 0;
|
|
|
|
vert[1].rhw = 1;
|
|
|
|
vert[1].color0 = color0;
|
|
|
|
vert[1].color1 = color1;
|
|
|
|
vert[1].tu = u1;
|
|
|
|
vert[1].tv = v0;
|
|
|
|
|
- Changed all coordinates for DrawTexture() to floating point so that the
player sprites will retain the same precision they had when they were
rendered as part of the 3D view. (needed for propery alignment of flashes
on top of weapon sprites) It worked just fine for D3D, but software
rendering was another matter. I consequently did battle with imprecisions
in the whole masked texture drawing routines that had previously been
partially masked by only drawing on whole pixel boundaries. Particularly,
the tops of posts are calculated by multiplying by spryscale, and the
texture mapping coordinates are calculated by multiplying by dc_iscale
(where dc_iscale = 1 / spryscale). Since these are both 16.16 fixed point
values, there is a significant variance. For best results, the drawing
routines should only use one of these values, but that would mean
introducing division into the inner loop. If the division removed the
necessity for the fudge code in R_DrawMaskedColumn(), would it be worth it?
Or would the divide be slower than the fudging? Or would I be better off
doing it like Build and using transparent pixel checks instead, not
bothering with skipping transparent areas? For now, I chop off the
fractional part of the top coordinate for software drawing, since it was
the easiest thing to do (even if it wasn't the most correct thing to do).
SVN r1955 (trunk)
2009-11-01 01:27:33 +00:00
|
|
|
vert[2].x = float(x1);
|
|
|
|
vert[2].y = float(y1);
|
2008-01-09 21:04:21 +00:00
|
|
|
vert[2].z = 0;
|
|
|
|
vert[2].rhw = 1;
|
|
|
|
vert[2].color0 = color0;
|
|
|
|
vert[2].color1 = color1;
|
|
|
|
vert[2].tu = u1;
|
|
|
|
vert[2].tv = v1;
|
|
|
|
|
- Changed all coordinates for DrawTexture() to floating point so that the
player sprites will retain the same precision they had when they were
rendered as part of the 3D view. (needed for propery alignment of flashes
on top of weapon sprites) It worked just fine for D3D, but software
rendering was another matter. I consequently did battle with imprecisions
in the whole masked texture drawing routines that had previously been
partially masked by only drawing on whole pixel boundaries. Particularly,
the tops of posts are calculated by multiplying by spryscale, and the
texture mapping coordinates are calculated by multiplying by dc_iscale
(where dc_iscale = 1 / spryscale). Since these are both 16.16 fixed point
values, there is a significant variance. For best results, the drawing
routines should only use one of these values, but that would mean
introducing division into the inner loop. If the division removed the
necessity for the fudge code in R_DrawMaskedColumn(), would it be worth it?
Or would the divide be slower than the fudging? Or would I be better off
doing it like Build and using transparent pixel checks instead, not
bothering with skipping transparent areas? For now, I chop off the
fractional part of the top coordinate for software drawing, since it was
the easiest thing to do (even if it wasn't the most correct thing to do).
SVN r1955 (trunk)
2009-11-01 01:27:33 +00:00
|
|
|
vert[3].x = float(x0);
|
|
|
|
vert[3].y = float(y1);
|
2008-01-09 21:04:21 +00:00
|
|
|
vert[3].z = 0;
|
|
|
|
vert[3].rhw = 1;
|
|
|
|
vert[3].color0 = color0;
|
|
|
|
vert[3].color1 = color1;
|
|
|
|
vert[3].tu = u0;
|
|
|
|
vert[3].tv = v1;
|
|
|
|
|
- Changed all coordinates for DrawTexture() to floating point so that the
player sprites will retain the same precision they had when they were
rendered as part of the 3D view. (needed for propery alignment of flashes
on top of weapon sprites) It worked just fine for D3D, but software
rendering was another matter. I consequently did battle with imprecisions
in the whole masked texture drawing routines that had previously been
partially masked by only drawing on whole pixel boundaries. Particularly,
the tops of posts are calculated by multiplying by spryscale, and the
texture mapping coordinates are calculated by multiplying by dc_iscale
(where dc_iscale = 1 / spryscale). Since these are both 16.16 fixed point
values, there is a significant variance. For best results, the drawing
routines should only use one of these values, but that would mean
introducing division into the inner loop. If the division removed the
necessity for the fudge code in R_DrawMaskedColumn(), would it be worth it?
Or would the divide be slower than the fudging? Or would I be better off
doing it like Build and using transparent pixel checks instead, not
bothering with skipping transparent areas? For now, I chop off the
fractional part of the top coordinate for software drawing, since it was
the easiest thing to do (even if it wasn't the most correct thing to do).
SVN r1955 (trunk)
2009-11-01 01:27:33 +00:00
|
|
|
// Fill the vertex index buffer.
|
2008-01-09 21:04:21 +00:00
|
|
|
IndexData[IndexPos ] = VertexPos;
|
|
|
|
IndexData[IndexPos + 1] = VertexPos + 1;
|
|
|
|
IndexData[IndexPos + 2] = VertexPos + 2;
|
|
|
|
IndexData[IndexPos + 3] = VertexPos;
|
|
|
|
IndexData[IndexPos + 4] = VertexPos + 2;
|
|
|
|
IndexData[IndexPos + 5] = VertexPos + 3;
|
2008-01-06 04:03:33 +00:00
|
|
|
|
- Changed all coordinates for DrawTexture() to floating point so that the
player sprites will retain the same precision they had when they were
rendered as part of the 3D view. (needed for propery alignment of flashes
on top of weapon sprites) It worked just fine for D3D, but software
rendering was another matter. I consequently did battle with imprecisions
in the whole masked texture drawing routines that had previously been
partially masked by only drawing on whole pixel boundaries. Particularly,
the tops of posts are calculated by multiplying by spryscale, and the
texture mapping coordinates are calculated by multiplying by dc_iscale
(where dc_iscale = 1 / spryscale). Since these are both 16.16 fixed point
values, there is a significant variance. For best results, the drawing
routines should only use one of these values, but that would mean
introducing division into the inner loop. If the division removed the
necessity for the fudge code in R_DrawMaskedColumn(), would it be worth it?
Or would the divide be slower than the fudging? Or would I be better off
doing it like Build and using transparent pixel checks instead, not
bothering with skipping transparent areas? For now, I chop off the
fractional part of the top coordinate for software drawing, since it was
the easiest thing to do (even if it wasn't the most correct thing to do).
SVN r1955 (trunk)
2009-11-01 01:27:33 +00:00
|
|
|
// Batch the quad.
|
2008-01-06 04:03:33 +00:00
|
|
|
QuadBatchPos++;
|
2008-01-09 21:04:21 +00:00
|
|
|
VertexPos += 4;
|
|
|
|
IndexPos += 6;
|
2012-03-12 01:22:19 +00:00
|
|
|
done:
|
2009-02-01 03:39:00 +00:00
|
|
|
if (scissoring)
|
|
|
|
{
|
|
|
|
EndQuadBatch();
|
|
|
|
D3DDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
|
|
|
|
}
|
2008-01-06 04:03:33 +00:00
|
|
|
}
|
|
|
|
|
2008-01-09 23:04:49 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: FlatFill
|
|
|
|
//
|
|
|
|
// Fills an area with a repeating copy of the texture.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::FlatFill(int left, int top, int right, int bottom, FTexture *src, bool local_origin)
|
|
|
|
{
|
|
|
|
if (In2D < 2)
|
|
|
|
{
|
|
|
|
Super::FlatFill(left, top, right, bottom, src, local_origin);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!InScene)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-01-10 04:11:38 +00:00
|
|
|
D3DTex *tex = static_cast<D3DTex *>(src->GetNative(true));
|
2008-01-09 23:04:49 +00:00
|
|
|
if (tex == NULL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
float yoffs = GatheringWipeScreen ? 0.5f : 0.5f - LBOffset;
|
|
|
|
float x0 = float(left);
|
|
|
|
float y0 = float(top);
|
|
|
|
float x1 = float(right);
|
|
|
|
float y1 = float(bottom);
|
|
|
|
float itw = 1.f / float(src->GetWidth());
|
|
|
|
float ith = 1.f / float(src->GetHeight());
|
|
|
|
float xo = local_origin ? x0 : 0;
|
|
|
|
float yo = local_origin ? y0 : 0;
|
|
|
|
float u0 = (x0 - xo) * itw;
|
|
|
|
float v0 = (y0 - yo) * ith;
|
|
|
|
float u1 = (x1 - xo) * itw;
|
|
|
|
float v1 = (y1 - yo) * ith;
|
|
|
|
x0 -= 0.5f;
|
|
|
|
y0 -= yoffs;
|
|
|
|
x1 -= 0.5f;
|
|
|
|
y1 -= yoffs;
|
|
|
|
|
|
|
|
CheckQuadBatch();
|
|
|
|
|
2010-08-27 15:20:05 +00:00
|
|
|
BufferedTris *quad = &QuadExtra[QuadBatchPos];
|
2008-01-09 23:04:49 +00:00
|
|
|
FBVERTEX *vert = &VertexData[VertexPos];
|
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
quad->Group1 = 0;
|
2008-01-09 23:04:49 +00:00
|
|
|
if (tex->GetTexFormat() == D3DFMT_L8 && !tex->IsGray)
|
|
|
|
{
|
2012-06-21 08:54:50 +00:00
|
|
|
quad->Flags = BQF_WrapUV | BQF_GamePalette; // | BQF_DisableAlphaTest;
|
2008-01-09 23:04:49 +00:00
|
|
|
quad->ShaderNum = BQS_PalTex;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-21 08:54:50 +00:00
|
|
|
quad->Flags = BQF_WrapUV; // | BQF_DisableAlphaTest;
|
2008-01-09 23:04:49 +00:00
|
|
|
quad->ShaderNum = BQS_Plain;
|
|
|
|
}
|
|
|
|
quad->Palette = NULL;
|
2009-12-01 03:15:00 +00:00
|
|
|
quad->Texture = tex->Box->Owner->Tex;
|
2010-08-27 15:20:05 +00:00
|
|
|
quad->NumVerts = 4;
|
|
|
|
quad->NumTris = 2;
|
2008-01-09 23:04:49 +00:00
|
|
|
|
|
|
|
vert[0].x = x0;
|
|
|
|
vert[0].y = y0;
|
|
|
|
vert[0].z = 0;
|
|
|
|
vert[0].rhw = 1;
|
|
|
|
vert[0].color0 = 0;
|
|
|
|
vert[0].color1 = 0xFFFFFFFF;
|
|
|
|
vert[0].tu = u0;
|
|
|
|
vert[0].tv = v0;
|
|
|
|
|
|
|
|
vert[1].x = x1;
|
|
|
|
vert[1].y = y0;
|
|
|
|
vert[1].z = 0;
|
|
|
|
vert[1].rhw = 1;
|
|
|
|
vert[1].color0 = 0;
|
|
|
|
vert[1].color1 = 0xFFFFFFFF;
|
|
|
|
vert[1].tu = u1;
|
|
|
|
vert[1].tv = v0;
|
|
|
|
|
|
|
|
vert[2].x = x1;
|
|
|
|
vert[2].y = y1;
|
|
|
|
vert[2].z = 0;
|
|
|
|
vert[2].rhw = 1;
|
|
|
|
vert[2].color0 = 0;
|
|
|
|
vert[2].color1 = 0xFFFFFFFF;
|
|
|
|
vert[2].tu = u1;
|
|
|
|
vert[2].tv = v1;
|
|
|
|
|
|
|
|
vert[3].x = x0;
|
|
|
|
vert[3].y = y1;
|
|
|
|
vert[3].z = 0;
|
|
|
|
vert[3].rhw = 1;
|
|
|
|
vert[3].color0 = 0;
|
|
|
|
vert[3].color1 = 0xFFFFFFFF;
|
|
|
|
vert[3].tu = u0;
|
|
|
|
vert[3].tv = v1;
|
|
|
|
|
|
|
|
IndexData[IndexPos ] = VertexPos;
|
|
|
|
IndexData[IndexPos + 1] = VertexPos + 1;
|
|
|
|
IndexData[IndexPos + 2] = VertexPos + 2;
|
|
|
|
IndexData[IndexPos + 3] = VertexPos;
|
|
|
|
IndexData[IndexPos + 4] = VertexPos + 2;
|
|
|
|
IndexData[IndexPos + 5] = VertexPos + 3;
|
|
|
|
|
|
|
|
QuadBatchPos++;
|
|
|
|
VertexPos += 4;
|
2008-01-10 04:11:38 +00:00
|
|
|
IndexPos += 6;
|
|
|
|
}
|
2008-01-09 23:04:49 +00:00
|
|
|
|
2010-08-27 15:20:05 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: FillSimplePoly
|
|
|
|
//
|
|
|
|
// Here, "simple" means that a simple triangle fan can draw it.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::FillSimplePoly(FTexture *texture, FVector2 *points, int npoints,
|
|
|
|
double originx, double originy, double scalex, double scaley,
|
|
|
|
angle_t rotation, FDynamicColormap *colormap, int lightlevel)
|
|
|
|
{
|
|
|
|
// Use an equation similar to player sprites to determine shade
|
|
|
|
fixed_t shade = LIGHT2SHADE(lightlevel) - 12*FRACUNIT;
|
|
|
|
BufferedTris *quad;
|
|
|
|
FBVERTEX *verts;
|
|
|
|
D3DTex *tex;
|
|
|
|
float yoffs, uscale, vscale;
|
|
|
|
int i, ipos;
|
|
|
|
D3DCOLOR color0, color1;
|
|
|
|
float ox, oy;
|
|
|
|
float cosrot, sinrot;
|
|
|
|
float rot = float(rotation * M_PI / float(1u << 31));
|
|
|
|
bool dorotate = rot != 0;
|
|
|
|
|
|
|
|
if (npoints < 3)
|
|
|
|
{ // This is no polygon.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (In2D < 2)
|
|
|
|
{
|
|
|
|
Super::FillSimplePoly(texture, points, npoints, originx, originy, scalex, scaley, rotation, colormap, lightlevel);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!InScene)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
tex = static_cast<D3DTex *>(texture->GetNative(true));
|
|
|
|
if (tex == NULL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
cosrot = cos(rot);
|
|
|
|
sinrot = sin(rot);
|
|
|
|
|
|
|
|
CheckQuadBatch(npoints - 2, npoints);
|
|
|
|
quad = &QuadExtra[QuadBatchPos];
|
|
|
|
verts = &VertexData[VertexPos];
|
|
|
|
|
|
|
|
color0 = 0;
|
|
|
|
color1 = 0xFFFFFFFF;
|
|
|
|
|
|
|
|
quad->Group1 = 0;
|
|
|
|
if (tex->GetTexFormat() == D3DFMT_L8 && !tex->IsGray)
|
|
|
|
{
|
|
|
|
quad->Flags = BQF_WrapUV | BQF_GamePalette | BQF_DisableAlphaTest;
|
|
|
|
quad->ShaderNum = BQS_PalTex;
|
|
|
|
if (colormap != NULL)
|
|
|
|
{
|
|
|
|
if (colormap->Desaturate != 0)
|
|
|
|
{
|
|
|
|
quad->Flags |= BQF_Desaturated;
|
|
|
|
}
|
|
|
|
quad->ShaderNum = BQS_InGameColormap;
|
2011-05-15 22:30:20 +00:00
|
|
|
quad->Desat = colormap->Desaturate;
|
|
|
|
color0 = D3DCOLOR_ARGB(255, colormap->Color.r, colormap->Color.g, colormap->Color.b);
|
2010-08-27 15:20:05 +00:00
|
|
|
double fadelevel = clamp(shade / (NUMCOLORMAPS * 65536.0), 0.0, 1.0);
|
|
|
|
color1 = D3DCOLOR_ARGB(DWORD((1 - fadelevel) * 255),
|
|
|
|
DWORD(colormap->Fade.r * fadelevel),
|
|
|
|
DWORD(colormap->Fade.g * fadelevel),
|
|
|
|
DWORD(colormap->Fade.b * fadelevel));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
quad->Flags = BQF_WrapUV | BQF_DisableAlphaTest;
|
|
|
|
quad->ShaderNum = BQS_Plain;
|
|
|
|
}
|
|
|
|
quad->Palette = NULL;
|
|
|
|
quad->Texture = tex->Box->Owner->Tex;
|
|
|
|
quad->NumVerts = npoints;
|
|
|
|
quad->NumTris = npoints - 2;
|
|
|
|
|
|
|
|
yoffs = GatheringWipeScreen ? 0 : LBOffset;
|
2010-09-10 13:49:08 +00:00
|
|
|
uscale = float(1.f / (texture->GetScaledWidth() * scalex));
|
|
|
|
vscale = float(1.f / (texture->GetScaledHeight() * scaley));
|
2010-08-27 15:20:05 +00:00
|
|
|
ox = float(originx);
|
|
|
|
oy = float(originy);
|
|
|
|
|
|
|
|
for (i = 0; i < npoints; ++i)
|
|
|
|
{
|
|
|
|
verts[i].x = points[i].X;
|
|
|
|
verts[i].y = points[i].Y + yoffs;
|
|
|
|
verts[i].z = 0;
|
|
|
|
verts[i].rhw = 1;
|
|
|
|
verts[i].color0 = color0;
|
|
|
|
verts[i].color1 = color1;
|
|
|
|
float u = points[i].X - 0.5f - ox;
|
|
|
|
float v = points[i].Y - 0.5f - oy;
|
|
|
|
if (dorotate)
|
|
|
|
{
|
|
|
|
float t = u;
|
|
|
|
u = t * cosrot - v * sinrot;
|
|
|
|
v = v * cosrot + t * sinrot;
|
|
|
|
}
|
|
|
|
verts[i].tu = u * uscale;
|
|
|
|
verts[i].tv = v * vscale;
|
|
|
|
}
|
|
|
|
for (ipos = IndexPos, i = 2; i < npoints; ++i, ipos += 3)
|
|
|
|
{
|
|
|
|
IndexData[ipos ] = VertexPos;
|
|
|
|
IndexData[ipos + 1] = VertexPos + i - 1;
|
|
|
|
IndexData[ipos + 2] = VertexPos + i;
|
|
|
|
}
|
|
|
|
|
|
|
|
QuadBatchPos++;
|
|
|
|
VertexPos += npoints;
|
|
|
|
IndexPos = ipos;
|
|
|
|
}
|
|
|
|
|
2008-01-06 04:03:33 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: AddColorOnlyQuad
|
|
|
|
//
|
|
|
|
// Adds a single-color, untextured quad to the batch.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::AddColorOnlyQuad(int left, int top, int width, int height, D3DCOLOR color)
|
|
|
|
{
|
2010-08-27 15:20:05 +00:00
|
|
|
BufferedTris *quad;
|
2008-01-06 04:03:33 +00:00
|
|
|
FBVERTEX *verts;
|
|
|
|
|
|
|
|
CheckQuadBatch();
|
|
|
|
quad = &QuadExtra[QuadBatchPos];
|
2008-01-09 21:04:21 +00:00
|
|
|
verts = &VertexData[VertexPos];
|
2008-01-06 04:03:33 +00:00
|
|
|
|
|
|
|
float x = float(left) - 0.5f;
|
|
|
|
float y = float(top) - 0.5f + (GatheringWipeScreen ? 0 : LBOffset);
|
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
quad->Group1 = 0;
|
2008-01-06 04:03:33 +00:00
|
|
|
quad->ShaderNum = BQS_ColorOnly;
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
if ((color & 0xFF000000) != 0xFF000000)
|
2008-01-06 04:03:33 +00:00
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
quad->BlendOp = D3DBLENDOP_ADD;
|
2008-01-06 04:03:33 +00:00
|
|
|
quad->SrcBlend = D3DBLEND_SRCALPHA;
|
|
|
|
quad->DestBlend = D3DBLEND_INVSRCALPHA;
|
|
|
|
}
|
|
|
|
quad->Palette = NULL;
|
|
|
|
quad->Texture = NULL;
|
2010-08-27 15:20:05 +00:00
|
|
|
quad->NumVerts = 4;
|
|
|
|
quad->NumTris = 2;
|
2008-01-06 04:03:33 +00:00
|
|
|
|
2008-01-09 21:04:21 +00:00
|
|
|
verts[0].x = x;
|
|
|
|
verts[0].y = y;
|
|
|
|
verts[0].z = 0;
|
|
|
|
verts[0].rhw = 1;
|
|
|
|
verts[0].color0 = color;
|
|
|
|
verts[0].color1 = 0;
|
|
|
|
verts[0].tu = 0;
|
|
|
|
verts[0].tv = 0;
|
2008-01-06 04:03:33 +00:00
|
|
|
|
|
|
|
verts[1].x = x + width;
|
|
|
|
verts[1].y = y;
|
|
|
|
verts[1].z = 0;
|
|
|
|
verts[1].rhw = 1;
|
|
|
|
verts[1].color0 = color;
|
|
|
|
verts[1].color1 = 0;
|
|
|
|
verts[1].tu = 0;
|
|
|
|
verts[1].tv = 0;
|
|
|
|
|
2008-01-09 21:04:21 +00:00
|
|
|
verts[2].x = x + width;
|
|
|
|
verts[2].y = y + height;
|
|
|
|
verts[2].z = 0;
|
|
|
|
verts[2].rhw = 1;
|
|
|
|
verts[2].color0 = color;
|
|
|
|
verts[2].color1 = 0;
|
|
|
|
verts[2].tu = 0;
|
|
|
|
verts[2].tv = 0;
|
|
|
|
|
|
|
|
verts[3].x = x;
|
|
|
|
verts[3].y = y + height;
|
|
|
|
verts[3].z = 0;
|
|
|
|
verts[3].rhw = 1;
|
|
|
|
verts[3].color0 = color;
|
|
|
|
verts[3].color1 = 0;
|
|
|
|
verts[3].tu = 0;
|
|
|
|
verts[3].tv = 0;
|
|
|
|
|
|
|
|
IndexData[IndexPos ] = VertexPos;
|
|
|
|
IndexData[IndexPos + 1] = VertexPos + 1;
|
|
|
|
IndexData[IndexPos + 2] = VertexPos + 2;
|
|
|
|
IndexData[IndexPos + 3] = VertexPos;
|
|
|
|
IndexData[IndexPos + 4] = VertexPos + 2;
|
|
|
|
IndexData[IndexPos + 5] = VertexPos + 3;
|
2008-01-06 04:03:33 +00:00
|
|
|
|
|
|
|
QuadBatchPos++;
|
2008-01-09 21:04:21 +00:00
|
|
|
VertexPos += 4;
|
|
|
|
IndexPos += 6;
|
2008-01-06 04:03:33 +00:00
|
|
|
}
|
|
|
|
|
2016-01-09 04:07:16 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: AddColorOnlyRect
|
|
|
|
//
|
|
|
|
// Like AddColorOnlyQuad, except it's hollow.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::AddColorOnlyRect(int left, int top, int width, int height, D3DCOLOR color)
|
|
|
|
{
|
|
|
|
AddColorOnlyQuad(left, top, width - 1, 1, color); // top
|
|
|
|
AddColorOnlyQuad(left + width - 1, top, 1, height - 1, color); // right
|
|
|
|
AddColorOnlyQuad(left + 1, top + height - 1, width - 1, 1, color); // bottom
|
|
|
|
AddColorOnlyQuad(left, top + 1, 1, height - 1, color); // left
|
|
|
|
}
|
|
|
|
|
2008-01-06 04:03:33 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: CheckQuadBatch
|
|
|
|
//
|
2010-08-27 15:20:05 +00:00
|
|
|
// Make sure there's enough room in the batch for one more set of triangles.
|
2008-01-06 04:03:33 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2010-08-27 15:20:05 +00:00
|
|
|
void D3DFB::CheckQuadBatch(int numtris, int numverts)
|
2008-01-06 04:03:33 +00:00
|
|
|
{
|
2008-01-09 21:04:21 +00:00
|
|
|
if (BatchType == BATCH_Lines)
|
|
|
|
{
|
|
|
|
EndLineBatch();
|
|
|
|
}
|
2010-08-27 15:20:05 +00:00
|
|
|
else if (QuadBatchPos == MAX_QUAD_BATCH ||
|
|
|
|
VertexPos + numverts > NUM_VERTS ||
|
|
|
|
IndexPos + numtris * 3 > NUM_INDEXES)
|
2008-01-06 04:03:33 +00:00
|
|
|
{
|
|
|
|
EndQuadBatch();
|
|
|
|
}
|
|
|
|
if (QuadBatchPos < 0)
|
|
|
|
{
|
|
|
|
BeginQuadBatch();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: BeginQuadBatch
|
|
|
|
//
|
|
|
|
// Locks the vertex buffer for quads and sets the cursor to 0.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::BeginQuadBatch()
|
|
|
|
{
|
|
|
|
if (In2D < 2 || !InScene || QuadBatchPos >= 0)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2008-01-09 21:04:21 +00:00
|
|
|
EndLineBatch(); // Make sure all lines have been drawn first.
|
|
|
|
VertexBuffer->Lock(0, 0, (void **)&VertexData, D3DLOCK_DISCARD);
|
|
|
|
IndexBuffer->Lock(0, 0, (void **)&IndexData, D3DLOCK_DISCARD);
|
|
|
|
VertexPos = 0;
|
|
|
|
IndexPos = 0;
|
2008-01-06 04:03:33 +00:00
|
|
|
QuadBatchPos = 0;
|
2008-01-09 21:04:21 +00:00
|
|
|
BatchType = BATCH_Quads;
|
2008-01-06 04:03:33 +00:00
|
|
|
}
|
2007-12-20 04:36:43 +00:00
|
|
|
|
2008-01-06 04:03:33 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: EndQuadBatch
|
|
|
|
//
|
|
|
|
// Draws all the quads that have been batched up.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::EndQuadBatch()
|
|
|
|
{
|
2008-01-09 21:04:21 +00:00
|
|
|
if (In2D < 2 || !InScene || BatchType != BATCH_Quads)
|
2008-01-04 05:22:30 +00:00
|
|
|
{
|
2008-01-06 04:03:33 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-01-09 21:04:21 +00:00
|
|
|
BatchType = BATCH_None;
|
|
|
|
VertexBuffer->Unlock();
|
|
|
|
IndexBuffer->Unlock();
|
2008-01-06 04:03:33 +00:00
|
|
|
if (QuadBatchPos == 0)
|
|
|
|
{
|
|
|
|
QuadBatchPos = -1;
|
2008-01-09 21:04:21 +00:00
|
|
|
VertexPos = -1;
|
|
|
|
IndexPos = -1;
|
2008-01-06 04:03:33 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-01-09 21:04:21 +00:00
|
|
|
D3DDevice->SetStreamSource(0, VertexBuffer, 0, sizeof(FBVERTEX));
|
|
|
|
D3DDevice->SetIndices(IndexBuffer);
|
2008-01-09 23:04:49 +00:00
|
|
|
bool uv_wrapped = false;
|
|
|
|
bool uv_should_wrap;
|
2010-08-27 15:20:05 +00:00
|
|
|
int indexpos, vertpos;
|
2008-01-09 23:04:49 +00:00
|
|
|
|
2010-08-27 15:20:05 +00:00
|
|
|
indexpos = vertpos = 0;
|
2008-01-06 04:03:33 +00:00
|
|
|
for (int i = 0; i < QuadBatchPos; )
|
|
|
|
{
|
2010-08-27 15:20:05 +00:00
|
|
|
const BufferedTris *quad = &QuadExtra[i];
|
2008-01-06 04:03:33 +00:00
|
|
|
int j;
|
|
|
|
|
2010-08-27 15:20:05 +00:00
|
|
|
int startindex = indexpos;
|
|
|
|
int startvertex = vertpos;
|
|
|
|
|
|
|
|
indexpos += quad->NumTris * 3;
|
|
|
|
vertpos += quad->NumVerts;
|
|
|
|
|
2008-01-06 04:03:33 +00:00
|
|
|
// Quads with matching parameters should be done with a single
|
|
|
|
// DrawPrimitive call.
|
|
|
|
for (j = i + 1; j < QuadBatchPos; ++j)
|
|
|
|
{
|
2010-08-27 15:20:05 +00:00
|
|
|
const BufferedTris *q2 = &QuadExtra[j];
|
2008-01-06 04:03:33 +00:00
|
|
|
if (quad->Texture != q2->Texture ||
|
|
|
|
quad->Group1 != q2->Group1 ||
|
|
|
|
quad->Palette != q2->Palette)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2011-05-15 22:30:20 +00:00
|
|
|
if (quad->ShaderNum == BQS_InGameColormap && (quad->Flags & BQF_Desaturated) && quad->Desat != q2->Desat)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2010-08-27 15:20:05 +00:00
|
|
|
indexpos += q2->NumTris * 3;
|
|
|
|
vertpos += q2->NumVerts;
|
2008-01-06 04:03:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Set the palette (if one)
|
|
|
|
if ((quad->Flags & BQF_Paletted) == BQF_GamePalette)
|
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
SetPaletteTexture(PaletteTexture, 256, BorderColor);
|
2008-01-06 04:03:33 +00:00
|
|
|
}
|
|
|
|
else if ((quad->Flags & BQF_Paletted) == BQF_CustomPalette)
|
|
|
|
{
|
2012-03-09 00:12:04 +00:00
|
|
|
assert(quad->Palette != NULL);
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
SetPaletteTexture(quad->Palette->Tex, quad->Palette->RoundedPaletteSize, quad->Palette->BorderColor);
|
2008-01-06 04:03:33 +00:00
|
|
|
}
|
2009-12-01 03:15:00 +00:00
|
|
|
#if 0
|
2008-01-06 04:03:33 +00:00
|
|
|
// Set paletted bilinear filtering (IF IT WORKED RIGHT!)
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
if ((quad->Flags & (BQF_Paletted | BQF_Bilinear)) == (BQF_Paletted | BQF_Bilinear))
|
2008-01-06 04:03:33 +00:00
|
|
|
{
|
|
|
|
SetPalTexBilinearConstants(quad->Texture);
|
|
|
|
}
|
2009-12-01 03:15:00 +00:00
|
|
|
#endif
|
2008-01-04 05:22:30 +00:00
|
|
|
|
2008-01-06 04:03:33 +00:00
|
|
|
// Set the alpha blending
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
SetAlphaBlend(D3DBLENDOP(quad->BlendOp), D3DBLEND(quad->SrcBlend), D3DBLEND(quad->DestBlend));
|
|
|
|
|
|
|
|
// Set the alpha test
|
|
|
|
EnableAlphaTest(!(quad->Flags & BQF_DisableAlphaTest));
|
2008-01-06 04:03:33 +00:00
|
|
|
|
|
|
|
// Set the pixel shader
|
|
|
|
if (quad->ShaderNum == BQS_PalTex)
|
|
|
|
{
|
2009-09-20 03:50:05 +00:00
|
|
|
SetPixelShader(Shaders[(quad->Flags & BQF_InvertSource) ?
|
|
|
|
SHADER_NormalColorPalInv : SHADER_NormalColorPal]);
|
2008-01-06 04:03:33 +00:00
|
|
|
}
|
|
|
|
else if (quad->ShaderNum == BQS_Plain)
|
|
|
|
{
|
2009-09-20 03:50:05 +00:00
|
|
|
SetPixelShader(Shaders[(quad->Flags & BQF_InvertSource) ?
|
|
|
|
SHADER_NormalColorInv : SHADER_NormalColor]);
|
2008-01-06 04:03:33 +00:00
|
|
|
}
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
else if (quad->ShaderNum == BQS_RedToAlpha)
|
2008-01-06 04:03:33 +00:00
|
|
|
{
|
2009-09-20 03:50:05 +00:00
|
|
|
SetPixelShader(Shaders[(quad->Flags & BQF_InvertSource) ?
|
|
|
|
SHADER_RedToAlphaInv : SHADER_RedToAlpha]);
|
2008-01-06 04:03:33 +00:00
|
|
|
}
|
|
|
|
else if (quad->ShaderNum == BQS_ColorOnly)
|
|
|
|
{
|
2009-09-20 03:50:05 +00:00
|
|
|
SetPixelShader(Shaders[SHADER_VertexColor]);
|
|
|
|
}
|
|
|
|
else if (quad->ShaderNum == BQS_SpecialColormap)
|
|
|
|
{
|
|
|
|
int select;
|
|
|
|
|
2009-09-22 02:54:19 +00:00
|
|
|
select = !!(quad->Flags & BQF_Paletted);
|
2009-09-20 03:50:05 +00:00
|
|
|
SetPixelShader(Shaders[SHADER_SpecialColormap + select]);
|
|
|
|
}
|
|
|
|
else if (quad->ShaderNum == BQS_InGameColormap)
|
|
|
|
{
|
|
|
|
int select;
|
|
|
|
|
|
|
|
select = !!(quad->Flags & BQF_Desaturated);
|
|
|
|
select |= !!(quad->Flags & BQF_InvertSource) << 1;
|
|
|
|
select |= !!(quad->Flags & BQF_Paletted) << 2;
|
2011-05-15 22:30:20 +00:00
|
|
|
if (quad->Flags & BQF_Desaturated)
|
|
|
|
{
|
|
|
|
SetConstant(PSCONST_Desaturation, quad->Desat / 255.f, (255 - quad->Desat) / 255.f, 0, 0);
|
|
|
|
}
|
2009-09-20 03:50:05 +00:00
|
|
|
SetPixelShader(Shaders[SHADER_InGameColormap + select]);
|
2008-01-06 04:03:33 +00:00
|
|
|
}
|
|
|
|
|
2008-01-09 23:04:49 +00:00
|
|
|
// Set the texture clamp addressing mode
|
|
|
|
uv_should_wrap = !!(quad->Flags & BQF_WrapUV);
|
|
|
|
if (uv_wrapped != uv_should_wrap)
|
|
|
|
{
|
|
|
|
DWORD mode = uv_should_wrap ? D3DTADDRESS_WRAP : D3DTADDRESS_BORDER;
|
|
|
|
uv_wrapped = uv_should_wrap;
|
|
|
|
D3DDevice->SetSamplerState(0, D3DSAMP_ADDRESSU, mode);
|
|
|
|
D3DDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, mode);
|
|
|
|
}
|
|
|
|
|
2008-01-06 04:03:33 +00:00
|
|
|
// Set the texture
|
|
|
|
if (quad->Texture != NULL)
|
|
|
|
{
|
2009-12-01 03:15:00 +00:00
|
|
|
SetTexture(0, quad->Texture);
|
2008-01-06 04:03:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Draw the quad
|
2010-08-27 15:20:05 +00:00
|
|
|
D3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0,
|
|
|
|
startvertex, // MinIndex
|
|
|
|
vertpos - startvertex, // NumVertices
|
|
|
|
startindex, // StartIndex
|
|
|
|
(indexpos - startindex) / 3 // PrimitiveCount
|
|
|
|
/*4 * i, 4 * (j - i), 6 * i, 2 * (j - i)*/);
|
2008-01-06 04:03:33 +00:00
|
|
|
i = j;
|
|
|
|
}
|
2008-01-09 23:04:49 +00:00
|
|
|
if (uv_wrapped)
|
|
|
|
{
|
|
|
|
D3DDevice->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
|
|
|
|
D3DDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
|
|
|
}
|
2008-01-06 04:03:33 +00:00
|
|
|
QuadBatchPos = -1;
|
2008-01-09 21:04:21 +00:00
|
|
|
VertexPos = -1;
|
|
|
|
IndexPos = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: EndBatch
|
|
|
|
//
|
|
|
|
// Draws whichever type of primitive is currently being batched.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D3DFB::EndBatch()
|
|
|
|
{
|
|
|
|
if (BatchType == BATCH_Quads)
|
|
|
|
{
|
|
|
|
EndQuadBatch();
|
|
|
|
}
|
|
|
|
else if (BatchType == BATCH_Lines)
|
|
|
|
{
|
|
|
|
EndLineBatch();
|
|
|
|
}
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D3DFB :: SetStyle
|
|
|
|
//
|
|
|
|
// Patterned after R_SetPatchStyle.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2010-08-27 15:20:05 +00:00
|
|
|
bool D3DFB::SetStyle(D3DTex *tex, DrawParms &parms, D3DCOLOR &color0, D3DCOLOR &color1, BufferedTris &quad)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
2007-12-27 04:30:12 +00:00
|
|
|
D3DFORMAT fmt = tex->GetTexFormat();
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
FRenderStyle style = parms.style;
|
2007-12-20 04:36:43 +00:00
|
|
|
float alpha;
|
|
|
|
bool stencilling;
|
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
if (style.Flags & STYLEF_TransSoulsAlpha)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
alpha = transsouls;
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
else if (style.Flags & STYLEF_Alpha1)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
alpha = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
alpha = clamp<fixed_t> (parms.alpha, 0, FRACUNIT) / 65536.f;
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
|
|
|
|
2010-12-25 23:27:26 +00:00
|
|
|
style.CheckFuzz();
|
|
|
|
if (style.BlendOp == STYLEOP_Shadow)
|
|
|
|
{
|
|
|
|
style = LegacyRenderStyles[STYLE_TranslucentStencil];
|
|
|
|
alpha = 0.3f;
|
|
|
|
parms.fillcolor = 0;
|
|
|
|
}
|
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
// FIXME: Fuzz effect is not written
|
|
|
|
if (style.BlendOp == STYLEOP_FuzzOrAdd || style.BlendOp == STYLEOP_Fuzz)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
style.BlendOp = STYLEOP_Add;
|
|
|
|
}
|
|
|
|
else if (style.BlendOp == STYLEOP_FuzzOrSub)
|
|
|
|
{
|
|
|
|
style.BlendOp = STYLEOP_Sub;
|
|
|
|
}
|
|
|
|
else if (style.BlendOp == STYLEOP_FuzzOrRevSub)
|
|
|
|
{
|
|
|
|
style.BlendOp = STYLEOP_RevSub;
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stencilling = false;
|
2008-01-06 04:03:33 +00:00
|
|
|
quad.Palette = NULL;
|
2009-09-21 13:15:36 +00:00
|
|
|
quad.Flags = 0;
|
2011-05-15 22:30:20 +00:00
|
|
|
quad.Desat = 0;
|
2007-12-20 04:36:43 +00:00
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
switch (style.BlendOp)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
default:
|
|
|
|
case STYLEOP_Add: quad.BlendOp = D3DBLENDOP_ADD; break;
|
|
|
|
case STYLEOP_Sub: quad.BlendOp = D3DBLENDOP_SUBTRACT; break;
|
|
|
|
case STYLEOP_RevSub: quad.BlendOp = D3DBLENDOP_REVSUBTRACT; break;
|
|
|
|
case STYLEOP_None: return false;
|
|
|
|
}
|
|
|
|
quad.SrcBlend = GetStyleAlpha(style.SrcAlpha);
|
|
|
|
quad.DestBlend = GetStyleAlpha(style.DestAlpha);
|
2007-12-20 04:36:43 +00:00
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
if (style.Flags & STYLEF_InvertOverlay)
|
|
|
|
{
|
|
|
|
// Only the overlay color is inverted, not the overlay alpha.
|
|
|
|
parms.colorOverlay = D3DCOLOR_ARGB(APART(parms.colorOverlay),
|
|
|
|
255 - RPART(parms.colorOverlay), 255 - GPART(parms.colorOverlay),
|
|
|
|
255 - BPART(parms.colorOverlay));
|
|
|
|
}
|
2007-12-20 04:36:43 +00:00
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
SetColorOverlay(parms.colorOverlay, alpha, color0, color1);
|
|
|
|
|
2009-09-22 02:54:19 +00:00
|
|
|
if (style.Flags & STYLEF_ColorIsFixed)
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
{
|
|
|
|
if (style.Flags & STYLEF_InvertSource)
|
|
|
|
{ // Since the source color is a constant, we can invert it now
|
|
|
|
// without spending time doing it in the shader.
|
|
|
|
parms.fillcolor = D3DCOLOR_XRGB(255 - RPART(parms.fillcolor),
|
|
|
|
255 - GPART(parms.fillcolor), 255 - BPART(parms.fillcolor));
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
// Set up the color mod to replace the color from the image data.
|
|
|
|
color0 = (color0 & D3DCOLOR_RGBA(0,0,0,255)) | (parms.fillcolor & D3DCOLOR_RGBA(255,255,255,0));
|
|
|
|
color1 &= D3DCOLOR_RGBA(0,0,0,255);
|
|
|
|
|
|
|
|
if (style.Flags & STYLEF_RedIsAlpha)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
// Note that if the source texture is paletted, the palette is ignored.
|
|
|
|
quad.Flags = 0;
|
|
|
|
quad.ShaderNum = BQS_RedToAlpha;
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
else if (fmt == D3DFMT_L8)
|
2007-12-27 04:30:12 +00:00
|
|
|
{
|
2008-01-06 04:03:33 +00:00
|
|
|
quad.Flags = BQF_GamePalette;
|
|
|
|
quad.ShaderNum = BQS_PalTex;
|
2007-12-27 04:30:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-01-06 04:03:33 +00:00
|
|
|
quad.Flags = 0;
|
|
|
|
quad.ShaderNum = BQS_Plain;
|
2007-12-27 04:30:12 +00:00
|
|
|
}
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
if (style.Flags & STYLEF_RedIsAlpha)
|
|
|
|
{
|
|
|
|
quad.Flags = 0;
|
|
|
|
quad.ShaderNum = BQS_RedToAlpha;
|
|
|
|
}
|
|
|
|
else if (fmt == D3DFMT_L8)
|
2007-12-20 04:36:43 +00:00
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
if (parms.remap != NULL)
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
quad.Flags = BQF_CustomPalette;
|
|
|
|
quad.Palette = reinterpret_cast<D3DPal *>(parms.remap->GetNative());
|
|
|
|
quad.ShaderNum = BQS_PalTex;
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
}
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
else if (tex->IsGray)
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
{
|
2008-01-06 04:03:33 +00:00
|
|
|
quad.Flags = 0;
|
|
|
|
quad.ShaderNum = BQS_Plain;
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
}
|
2007-12-27 04:30:12 +00:00
|
|
|
else
|
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
quad.Flags = BQF_GamePalette;
|
|
|
|
quad.ShaderNum = BQS_PalTex;
|
2007-12-27 04:30:12 +00:00
|
|
|
}
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
quad.Flags = 0;
|
|
|
|
quad.ShaderNum = BQS_Plain;
|
|
|
|
}
|
|
|
|
if (style.Flags & STYLEF_InvertSource)
|
|
|
|
{
|
|
|
|
quad.Flags |= BQF_InvertSource;
|
|
|
|
}
|
2009-09-22 02:54:19 +00:00
|
|
|
|
|
|
|
if (parms.specialcolormap != NULL)
|
|
|
|
{ // Emulate an invulnerability or similar colormap.
|
|
|
|
float *start, *end;
|
|
|
|
start = parms.specialcolormap->ColorizeStart;
|
|
|
|
end = parms.specialcolormap->ColorizeEnd;
|
|
|
|
if (quad.Flags & BQF_InvertSource)
|
|
|
|
{
|
|
|
|
quad.Flags &= ~BQF_InvertSource;
|
2010-07-23 21:19:59 +00:00
|
|
|
swapvalues(start, end);
|
2009-09-22 02:54:19 +00:00
|
|
|
}
|
|
|
|
quad.ShaderNum = BQS_SpecialColormap;
|
|
|
|
color0 = D3DCOLOR_RGBA(DWORD(start[0]/2*255), DWORD(start[1]/2*255), DWORD(start[2]/2*255), color0 >> 24);
|
|
|
|
color1 = D3DCOLOR_RGBA(DWORD(end[0]/2*255), DWORD(end[1]/2*255), DWORD(end[2]/2*255), color1 >> 24);
|
|
|
|
}
|
|
|
|
else if (parms.colormapstyle != NULL)
|
|
|
|
{ // Emulate the fading from an in-game colormap (colorized, faded, and desaturated)
|
|
|
|
if (parms.colormapstyle->Desaturate != 0)
|
|
|
|
{
|
|
|
|
quad.Flags |= BQF_Desaturated;
|
|
|
|
}
|
|
|
|
quad.ShaderNum = BQS_InGameColormap;
|
2011-05-15 22:30:20 +00:00
|
|
|
quad.Desat = parms.colormapstyle->Desaturate;
|
|
|
|
color0 = D3DCOLOR_ARGB(color1 >> 24,
|
2009-09-22 02:54:19 +00:00
|
|
|
parms.colormapstyle->Color.r,
|
|
|
|
parms.colormapstyle->Color.g,
|
|
|
|
parms.colormapstyle->Color.b);
|
|
|
|
double fadelevel = parms.colormapstyle->FadeLevel;
|
|
|
|
color1 = D3DCOLOR_ARGB(DWORD((1 - fadelevel) * 255),
|
|
|
|
DWORD(parms.colormapstyle->Fade.r * fadelevel),
|
|
|
|
DWORD(parms.colormapstyle->Fade.g * fadelevel),
|
|
|
|
DWORD(parms.colormapstyle->Fade.b * fadelevel));
|
|
|
|
}
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// For unmasked images, force the alpha from the image data to be ignored.
|
2009-09-22 02:54:19 +00:00
|
|
|
if (!parms.masked && quad.ShaderNum != BQS_InGameColormap)
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
{
|
|
|
|
color0 = (color0 & D3DCOLOR_RGBA(255, 255, 255, 0)) | D3DCOLOR_COLORVALUE(0, 0, 0, alpha);
|
|
|
|
color1 &= D3DCOLOR_RGBA(255, 255, 255, 0);
|
|
|
|
|
|
|
|
// If our alpha is one and we are doing normal adding, then we can turn the blend off completely.
|
|
|
|
if (quad.BlendOp == D3DBLENDOP_ADD &&
|
|
|
|
((alpha == 1 && quad.SrcBlend == D3DBLEND_SRCALPHA) || quad.SrcBlend == D3DBLEND_ONE) &&
|
|
|
|
((alpha == 1 && quad.DestBlend == D3DBLEND_INVSRCALPHA) || quad.DestBlend == D3DBLEND_ZERO))
|
|
|
|
{
|
|
|
|
quad.BlendOp = D3DBLENDOP(0);
|
|
|
|
}
|
|
|
|
quad.Flags |= BQF_DisableAlphaTest;
|
2007-12-20 04:36:43 +00:00
|
|
|
}
|
|
|
|
return true;
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
}
|
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
D3DBLEND D3DFB::GetStyleAlpha(int type)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case STYLEALPHA_Zero: return D3DBLEND_ZERO;
|
|
|
|
case STYLEALPHA_One: return D3DBLEND_ONE;
|
|
|
|
case STYLEALPHA_Src: return D3DBLEND_SRCALPHA;
|
|
|
|
case STYLEALPHA_InvSrc: return D3DBLEND_INVSRCALPHA;
|
|
|
|
default: return D3DBLEND_ZERO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-04 05:22:30 +00:00
|
|
|
void D3DFB::SetColorOverlay(DWORD color, float alpha, D3DCOLOR &color0, D3DCOLOR &color1)
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
{
|
|
|
|
if (APART(color) != 0)
|
|
|
|
{
|
2008-01-04 05:22:30 +00:00
|
|
|
int a = APART(color) * 256 / 255;
|
|
|
|
color0 = D3DCOLOR_RGBA(
|
|
|
|
(RPART(color) * a) >> 8,
|
|
|
|
(GPART(color) * a) >> 8,
|
|
|
|
(BPART(color) * a) >> 8,
|
|
|
|
0);
|
|
|
|
a = 256 - a;
|
|
|
|
color1 = D3DCOLOR_RGBA(a, a, a, int(alpha * 255));
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-01-04 05:22:30 +00:00
|
|
|
color0 = 0;
|
|
|
|
color1 = D3DCOLOR_COLORVALUE(1, 1, 1, alpha);
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
void D3DFB::EnableAlphaTest(BOOL enabled)
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
if (enabled != AlphaTestEnabled)
|
|
|
|
{
|
|
|
|
AlphaTestEnabled = enabled;
|
|
|
|
D3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, enabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void D3DFB::SetAlphaBlend(D3DBLENDOP op, D3DBLEND srcblend, D3DBLEND destblend)
|
|
|
|
{
|
|
|
|
if (op == 0)
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
{ // Disable alpha blend
|
|
|
|
if (AlphaBlendEnabled)
|
|
|
|
{
|
|
|
|
AlphaBlendEnabled = FALSE;
|
|
|
|
D3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Enable alpha blend
|
|
|
|
assert(srcblend != 0);
|
|
|
|
assert(destblend != 0);
|
|
|
|
|
|
|
|
if (!AlphaBlendEnabled)
|
|
|
|
{
|
|
|
|
AlphaBlendEnabled = TRUE;
|
|
|
|
D3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
|
|
|
}
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
if (AlphaBlendOp != op)
|
|
|
|
{
|
|
|
|
AlphaBlendOp = op;
|
|
|
|
D3DDevice->SetRenderState(D3DRS_BLENDOP, op);
|
|
|
|
}
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
if (AlphaSrcBlend != srcblend)
|
|
|
|
{
|
|
|
|
AlphaSrcBlend = srcblend;
|
|
|
|
D3DDevice->SetRenderState(D3DRS_SRCBLEND, srcblend);
|
|
|
|
}
|
|
|
|
if (AlphaDestBlend != destblend)
|
|
|
|
{
|
|
|
|
AlphaDestBlend = destblend;
|
|
|
|
D3DDevice->SetRenderState(D3DRS_DESTBLEND, destblend);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void D3DFB::SetConstant(int cnum, float r, float g, float b, float a)
|
|
|
|
{
|
|
|
|
if (Constant[cnum][0] != r ||
|
|
|
|
Constant[cnum][1] != g ||
|
|
|
|
Constant[cnum][2] != b ||
|
|
|
|
Constant[cnum][3] != a)
|
|
|
|
{
|
|
|
|
Constant[cnum][0] = r;
|
|
|
|
Constant[cnum][1] = g;
|
|
|
|
Constant[cnum][2] = b;
|
|
|
|
Constant[cnum][3] = a;
|
|
|
|
D3DDevice->SetPixelShaderConstantF(cnum, Constant[cnum], 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void D3DFB::SetPixelShader(IDirect3DPixelShader9 *shader)
|
|
|
|
{
|
|
|
|
if (CurPixelShader != shader)
|
|
|
|
{
|
|
|
|
CurPixelShader = shader;
|
|
|
|
D3DDevice->SetPixelShader(shader);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void D3DFB::SetTexture(int tnum, IDirect3DTexture9 *texture)
|
|
|
|
{
|
2009-11-08 02:51:22 +00:00
|
|
|
assert(unsigned(tnum) < countof(Texture));
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
if (Texture[tnum] != texture)
|
|
|
|
{
|
|
|
|
Texture[tnum] = texture;
|
|
|
|
D3DDevice->SetTexture(tnum, texture);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
void D3DFB::SetPaletteTexture(IDirect3DTexture9 *texture, int count, D3DCOLOR border_color)
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
if (SM14)
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
{
|
|
|
|
// Shader Model 1.4 only uses 256-color palettes.
|
2009-09-20 03:50:05 +00:00
|
|
|
SetConstant(PSCONST_PaletteMod, 1.f, 0.5f / 256.f, 0, 0);
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
if (border_color != 0 && CurBorderColor != border_color)
|
|
|
|
{
|
|
|
|
CurBorderColor = border_color;
|
|
|
|
D3DDevice->SetSamplerState(1, D3DSAMP_BORDERCOLOR, border_color);
|
|
|
|
}
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// The pixel shader receives color indexes in the range [0.0,1.0].
|
|
|
|
// The palette texture is also addressed in the range [0.0,1.0],
|
|
|
|
// HOWEVER the coordinate 1.0 is the right edge of the texture and
|
|
|
|
// not actually the texture itself. We need to scale and shift
|
|
|
|
// the palette indexes so they lie exactly in the center of each
|
|
|
|
// texel. For a normal palette with 256 entries, that means the
|
|
|
|
// range we use should be [0.5,255.5], adjusted so the coordinate
|
2008-01-13 05:10:33 +00:00
|
|
|
// is still within [0.0,1.0].
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
//
|
|
|
|
// The constant register c2 is used to hold the multiplier in the
|
|
|
|
// x part and the adder in the y part.
|
|
|
|
float fcount = 1 / float(count);
|
2009-10-08 04:03:32 +00:00
|
|
|
SetConstant(PSCONST_PaletteMod, 255 * fcount, 0.5f * fcount, 0, 0);
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
}
|
|
|
|
SetTexture(1, texture);
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
}
|
|
|
|
|
2016-01-09 02:08:10 +00:00
|
|
|
void D3DFB::SetPalTexBilinearConstants(Atlas *tex)
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
{
|
2009-09-20 03:50:05 +00:00
|
|
|
#if 0
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
float con[8];
|
|
|
|
|
|
|
|
// Don't bother doing anything if the constants won't be used.
|
|
|
|
if (PalTexShader == PalTexBilinearShader)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
con[0] = float(tex->Width);
|
|
|
|
con[1] = float(tex->Height);
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
con[2] = 0;
|
|
|
|
con[3] = 1 / con[0];
|
|
|
|
con[4] = 0;
|
|
|
|
con[5] = 1 / con[1];
|
|
|
|
con[6] = con[5];
|
|
|
|
con[7] = con[3];
|
|
|
|
|
|
|
|
D3DDevice->SetPixelShaderConstantF(3, con, 2);
|
2009-09-20 03:50:05 +00:00
|
|
|
#endif
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
}
|