summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd
diff options
context:
space:
mode:
author Westley M. Martinez <anikom15@gmail.com>2016-12-13 10:27:55 -0800
committer Westley M. Martinez <anikom15@gmail.com>2016-12-13 10:27:55 -0800
commit70a9637eb548859f07aee2b05ad7677987b0dcab (patch)
treed27d887578bb48364fb5315b60695e2316220dd1 /src/osd
parentfb747b6ca4f173d39121f596ca23b07512814aa0 (diff)
Simplify implementation of delta_time.
src/osd/modules/render/d3d/d3dhlsl.cpp: Move time members calculation to shaders::begin_draw. src/osd/modules/render/d3d/d3dhlsl.h: Remove update_t.
Diffstat (limited to 'src/osd')
-rw-r--r--src/osd/modules/render/d3d/d3dhlsl.cpp40
-rw-r--r--src/osd/modules/render/d3d/d3dhlsl.h3
2 files changed, 16 insertions, 27 deletions
diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp
index 5e390868f19..a6cfad8cae9 100644
--- a/src/osd/modules/render/d3d/d3dhlsl.cpp
+++ b/src/osd/modules/render/d3d/d3dhlsl.cpp
@@ -164,15 +164,15 @@ private:
shaders::shaders() :
d3dintf(nullptr), machine(nullptr), d3d(nullptr), post_fx_enable(false), oversampling_enable(false),
- update_t(true), num_screens(0), curr_screen(0), acc_t(0), delta_t(0), shadow_texture(nullptr),
- options(nullptr), black_surface(nullptr), black_texture(nullptr), recording_movie(false),
- render_snap(false), snap_copy_target(nullptr), snap_copy_texture(nullptr), snap_target(nullptr),
- snap_texture(nullptr), snap_width(0), snap_height(0), initialized(false), backbuffer(nullptr),
- curr_effect(nullptr), default_effect(nullptr), prescale_effect(nullptr), post_effect(nullptr),
- distortion_effect(nullptr), focus_effect(nullptr), phosphor_effect(nullptr),
- deconverge_effect(nullptr), color_effect(nullptr), ntsc_effect(nullptr), bloom_effect(nullptr),
- downsample_effect(nullptr), vector_effect(nullptr), curr_texture(nullptr),
- curr_render_target(nullptr), curr_poly(nullptr), d3dx_create_effect_from_file_ptr(nullptr)
+ num_screens(0), curr_screen(0), acc_t(0), delta_t(0), shadow_texture(nullptr), options(nullptr),
+ black_surface(nullptr), black_texture(nullptr), recording_movie(false), render_snap(false),
+ snap_copy_target(nullptr), snap_copy_texture(nullptr), snap_target(nullptr), snap_texture(nullptr),
+ snap_width(0), snap_height(0), initialized(false), backbuffer(nullptr), curr_effect(nullptr),
+ default_effect(nullptr), prescale_effect(nullptr), post_effect(nullptr), distortion_effect(nullptr),
+ focus_effect(nullptr), phosphor_effect(nullptr), deconverge_effect(nullptr), color_effect(nullptr),
+ ntsc_effect(nullptr), bloom_effect(nullptr), downsample_effect(nullptr), vector_effect(nullptr),
+ curr_texture(nullptr), curr_render_target(nullptr), curr_poly(nullptr),
+ d3dx_create_effect_from_file_ptr(nullptr)
{
}
@@ -820,6 +820,8 @@ int shaders::create_resources()
void shaders::begin_draw()
{
+ double t;
+
if (!enabled())
{
return;
@@ -827,6 +829,10 @@ void shaders::begin_draw()
curr_screen = 0;
curr_effect = default_effect;
+ // Update for delta_time
+ t = machine->time().as_double();
+ delta_t = t - acc_t;
+ acc_t = t;
default_effect->set_technique("ScreenTechnique");
post_effect->set_technique("DefaultTechnique");
@@ -901,20 +907,6 @@ void shaders::blit(
curr_effect->end();
}
-double shaders::delta_time()
-{
- double t;
-
- if (update_t) {
- t = machine->time().as_double();
- delta_t = t - acc_t;
- acc_t = t;
- update_t = false;
- }
- return delta_t;
-}
-
-
//============================================================
// shaders::find_render_target
//============================================================
@@ -1429,8 +1421,6 @@ void shaders::render_quad(poly_info *poly, int vertnum)
else if (PRIMFLAG_GET_VECTORBUF(poly->flags()))
{
curr_screen = curr_screen < num_screens ? curr_screen : 0;
- if (curr_screen == 0)
- update_t = true;
int source_width = int(poly->prim_width() + 0.5f);
int source_height = int(poly->prim_height() + 0.5f);
diff --git a/src/osd/modules/render/d3d/d3dhlsl.h b/src/osd/modules/render/d3d/d3dhlsl.h
index 914cf4eaeae..ed25d2c52e8 100644
--- a/src/osd/modules/render/d3d/d3dhlsl.h
+++ b/src/osd/modules/render/d3d/d3dhlsl.h
@@ -320,7 +320,7 @@ private:
void render_snapshot(IDirect3DSurface9 *surface);
// Time since last call, only updates once per render of all screens
- double delta_time();
+ double delta_time() { return delta_t; }
d3d_render_target* find_render_target(int source_width, int source_height, uint32_t screen_index);
rgb_t apply_color_convolution(rgb_t color);
@@ -348,7 +348,6 @@ private:
bool post_fx_enable; // overall enable flag
bool oversampling_enable; // oversampling enable flag
- bool update_t; // signal for delta_t to be updated
int num_screens; // number of emulated physical screens
int curr_screen; // current screen for render target operations
double acc_t; // accumulated machine time