Commit Graph

23 Commits

Author SHA1 Message Date
Randy Heit 5d9d2a9088 - 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
Randy Heit 59c8faa7df - The mouse is no longer grabbed at all unless you're actually in a level,
since I couldn't think of any reason why it should be grabbed at any other
  time. (This only applies to windowed mode, where it makes sense to let the
  OS have control of the pointer.)


SVN r661 (trunk)
2008-01-02 05:21:48 +00:00
Randy Heit dc98279403 - Removed the screenshot parameter from D_Display(), since it was a relic of
a long-abandoned experiment to write directly to video memory instead of
  to a temporary buffer in system meroy.
- Added Direct3D versions of the melt and burn screenwipes.
- Fixed the strip sizes for the melt screenwipe to match what Doom would have
  produced on a 320x200 screen, rather than producing more, thinner strips
  for wider screens.


SVN r659 (trunk)
2008-01-01 03:07:05 +00:00
Randy Heit db54c43175 - Started writing Direct3D-friendly wipe code. It's just a Q&D crossfade for
now. More to come later.
- What is it about updaterevision.vcproj that makes it keep changing?

SVN r658 (trunk)
2007-12-30 04:18:39 +00:00
Randy Heit 37f9c50b4e - Fixed cases where a larger power-of-2-sized native texture had to be
allocated. (I wonder if D3D actually handles this automatically when you use
  D3DPOOL_MANAGED, because I'm pretty sure my laptops's x300 doesn't support
  non-power-of-2 texture sizes, yet it worked just fine before.) 
- Fixed vertical positioning of 2D elements in letterboxed modes.

SVN r653 (trunk)
2007-12-28 03:30:05 +00:00
Randy Heit 522e7fe07f - Removed DCanvas::Blit(), as it's no longer used.
- Added a function to create a texture from a stand-alone PNG file. The save/
  load menus now use this to get their thumbnails.


SVN r652 (trunk)
2007-12-28 01:54:14 +00:00
Randy Heit 834e4bef32 - Changed the way gamma works for D3DFB: In windowed mode, the display is
drawn to a texture, then that texture is copied to the real back buffer
  using a gamma-correcting pixel shader. In fullscreen mode, SetGammaRamp
  is used.
- Fixed flashing of vid_fps display when fps > 1000.
- Fixed loading of RGB textures for native 2D mode.
- Changed the first rotozoomer's data because it just became too obvious when
  the backdrop is drawn with a full 256 distinct colors available.
- Set the player backdrop to update no more frequently than 35 FPS, so opening
  the player setup menu before starting a game won't produce a very fast
  moving backdrop.
- Changed the player backdrop into a texture so that it can be drawn like
  anything else.


SVN r648 (trunk)
2007-12-27 04:30:12 +00:00
Christoph Oelckers 0535d15df3 - Split off the entire translation code from r_draw.cpp into r_translate.cpp.
- Moved the common code of ACS and DECORATE translation generation into the
  FRemapTable class.
- Fixed: The DECORATE translation code was not changed for the new data structures.
- Expanded range of ACS and DECORATE translations to 65535. 
- Fixed: R_CopyTranslation was not altered for the new functionality.
  I removed the function and replaced the one use with a simple assignment.


SVN r644 (trunk)
2007-12-26 16:06:03 +00:00
Randy Heit 1acc3d00c4 - 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
Randy Heit dddc781f18 - Added versions of Dim and Clear to D3DFB for use in 2D mode.
- Added a new color parameter to DCanvas::Clear() that specifies the
  ARGB value of the color. This is used if the old color parameter,
  which specifies a palette entry, is -1.


SVN r617 (trunk)
2007-12-22 04:52:51 +00:00
Randy Heit e84bece8eb - Fixed: TEAMINFO broke bot parsing for bots with invalid team names by
redefining TEAM_None from 255 to -1.


SVN r616 (trunk)
2007-12-22 04:00:25 +00:00
Christoph Oelckers 28db2d9f15 - Fixed: FTexture::~FTexture() must destroy the associated native texture
if present.
- Modified GZDoom's true color texture copy functions and added them
  to generate 32 bit D3D textures. Paletted TGAs and PCXs are also handled
  this way but I don't think these 2 formats are worth some more special
  handling.
  (Question: Is it worth it to implement special handling for paletted PNGs
   so that they are used as 8 bit textures internally?)


SVN r608 (trunk)
2007-12-20 18:53:35 +00:00
Randy Heit 111853e623 - Added a framework for drawing the 2D screen elements with Direct3D textures.
They are not actually drawn with it yet, nor is it complete, but it's
  something to start with.
- Split up DCanvas::DrawTexture() into more pieces to make it easier to
  virtualize.
- Removed support for non-32-bit palette textures from D3DFB. What kind of
  card supports pixel shaders but not 32-bit textures?


SVN r605 (trunk)
2007-12-20 04:36:43 +00:00
Randy Heit c087e4d411 - New: When using the D3D9 framebuffer, palette blending is now applied only
to the 3D area of the screen. This means the console and (the primary
  rectangular area of) the status bar are no longer blended.


SVN r601 (trunk)
2007-12-18 01:50:08 +00:00
Randy Heit dea5cf9ba4 - Added two new cvars (win_x and win_y) that keep track of the window
position when not playing in fullscreen mode.
- Changed the upper-left window positioning that was always used in debug
  builds into a command line option (-0), so debug and release builds behave
  the same.


SVN r482 (trunk)
2007-02-13 00:10:16 +00:00
Randy Heit 4f845508cc - Added D3DCREATE_FPU_PRESERVE to the IDirect3D9::CreateDevice() call.
Normally Direct3D sets the FPU to single precision. We don't want that,
  since it can mean going out of sync with machines that are using the
  standard precision. Additionally, the nodebuilder requires the extra
  precision that single precision lacks.


SVN r455 (trunk)
2007-01-19 02:45:26 +00:00
Randy Heit 82ba0fb189 SVN r446 (trunk) 2007-01-09 04:40:58 +00:00
Randy Heit e1bd63e876 - Turned on warning level 4 just to see what it would produce: a lot of
warnings. At first, I was going to try and clean them all up. Then I decided
  that was a worthless cause and went about just acting on the ones that
  might actually be helpful:
   C4189 (local variable is initialized but not referenced)
   C4702 (unreachable code)
   C4512 (assignment operator could not be generated)


SVN r420 (trunk)
2006-12-21 04:34:43 +00:00
Randy Heit c8d07f3883 - Fixed: D3DFB::Reset() also needs to restore the texture border color,
otherwise it gets reset to black and unused. 
- Fixed: I_SetWndProc() needs to be called before any of the DirectX
  interfaces are initialized, because DirectX subclasses the window itself,
  and I_SetWndProc() undoes that subclassing.


SVN r419 (trunk)
2006-12-20 02:20:59 +00:00
Randy Heit 83373fba88 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
Randy Heit 2dcc70dd31 - The DSimpleCanvas constructor now fills MemBuffer with zeros.
- Fixed: If the FBTexture wasn't exactly the same size as the screen,
  D3DFB::PaintToWindow() would still lock it with D3DLOCK_DISCARD. Alas,
  I saw no speedup for using a dirty region. (Side note: The Radeons are
  apparently slower compared to DirectDraw because they must do
  power-of-2 textures. If they ever add non-power-of-2 support like nvidia,
  I assume they will also see a speed gain.)
- Changed fb_d3d9.cpp so that instead of trying to compensate for Geforce
  off-by-one errors in the pixel shader, it automatically detects where
  the error occurs and modifies the way the palette is uploaded to
  compensate. Palette color 255 is then represented using the texture
  border color instead of actually being part of the palette. This should
  work correctly with all cards, since I had a report of an FX where the
  off-by-one occurred in a different spot from the place where I observed
  it on a 6 and 7 series cards. Since the shader now has one fewer
  instruction, I notice a very marginal speedup. (Interestingly, removing
  the flash blending from the shader had no perceivable performance gain.)


SVN r399 (trunk)
2006-12-01 01:17:45 +00:00
Randy Heit 48bb782b19 - Fixed: Polyobjects are serialized before players, which means that a call
to PO_MovePolyobj() from P_SerializePolyobjs() for a crushing polyobject
  that touches a player actor will not have a valid actor->player->mo chain
  for P_DamageMobj and crash if it happens to touch the player. Since the
  polyobject was presumably in a good spot when the game was saved, we can
  just skip this step entirely and let it take care of itself the next time
  it moves (by which time, the players will be valid).
- Fixed: When transitioning from fullscreen to windowed mode with D3DFB, the
  window kept the WS_EX_TOPMOST style.
- Slight correctness fix: When in fullscreen, the window should have WS_POPUP
  style.
- Added a NULL target check to P_SpawnMissileXYZ(), A_DemonAttack1(),
  A_DemonAttack2_1(), and A_DemonAttack2_2().


SVN r384 (trunk)
2006-11-21 05:43:34 +00:00
Randy Heit 93b18c3bfa SVN r383 (trunk) 2006-11-19 02:10:25 +00:00