~ubuntu-branches/ubuntu/raring/mame/raring-proposed

« back to all changes in this revision

Viewing changes to mess/src/osd/windows/d3dhlsl.h

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Jordi Mallach, Emmanuel Kasper
  • Date: 2011-12-19 22:56:27 UTC
  • mfrom: (0.1.2)
  • Revision ID: package-import@ubuntu.com-20111219225627-ub5oga1oys4ogqzm
Tags: 0.144-1
[ Jordi Mallach ]
* Fix syntax errors in DEP5 copyright file (lintian).
* Use a versioned copyright Format specification field.
* Update Vcs-* URLs.
* Move transitional packages to the new metapackages section, and make
  them priority extra.
* Remove references to GNU/Linux and MESS sources from copyright.
* Add build variables for s390x.
* Use .xz tarballs as it cuts 4MB for the upstream sources.
* Add nplayers.ini as a patch. Update copyright file to add CC-BY-SA-3.0.

[ Emmanuel Kasper ]
* New upstream release. Closes: #651538.
* Add Free Desktop compliant png icons of various sizes taken from
  the hydroxygen iconset
* Mess is now built from a new source package, to avoid possible source
  incompatibilities between mame and the mess overlay.
* Mame-tools are not built from the mame source package anymore, but
  from the mess source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//============================================================
2
 
//
3
 
//  drawd3d.c - Win32 Direct3D HLSL-specific header
4
 
//
5
 
//============================================================
6
 
//
7
 
//  Copyright Aaron Giles
8
 
//  All rights reserved.
9
 
//
10
 
//  Redistribution and use in source and binary forms, with or
11
 
//  without modification, are permitted provided that the
12
 
//  following conditions are met:
13
 
//
14
 
//    * Redistributions of source code must retain the above
15
 
//      copyright notice, this list of conditions and the
16
 
//      following disclaimer.
17
 
//    * Redistributions in binary form must reproduce the
18
 
//      above copyright notice, this list of conditions and
19
 
//      the following disclaimer in the documentation and/or
20
 
//      other materials provided with the distribution.
21
 
//    * Neither the name 'MAME' nor the names of its
22
 
//      contributors may be used to endorse or promote
23
 
//      products derived from this software without specific
24
 
//      prior written permission.
25
 
//
26
 
//  THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND
27
 
//  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28
 
//  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
29
 
//  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
30
 
//  EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
31
 
//  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32
 
//  DAMAGE (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33
 
//  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
34
 
//  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
35
 
//  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36
 
//  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37
 
//  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
38
 
//  IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
 
//
40
 
//============================================================
41
 
 
42
 
#ifndef __WIN_D3DHLSL__
43
 
#define __WIN_D3DHLSL__
44
 
 
45
 
 
46
 
#include "aviio.h"
47
 
 
48
 
 
49
 
//============================================================
50
 
//  TYPE DEFINITIONS
51
 
//============================================================
52
 
 
53
 
/* hlsl_options is the information about runtime-mutable Direct3D HLSL options */
54
 
/* in the future this will be moved into an OSD/emu shared buffer */
55
 
typedef struct _hlsl_options hlsl_options;
56
 
struct _hlsl_options
57
 
{
58
 
        bool                                    params_dirty;
59
 
        float                                   shadow_mask_alpha;
60
 
        char                                    shadow_mask_texture[1024];
61
 
        int                                             shadow_mask_count_x;
62
 
        int                                             shadow_mask_count_y;
63
 
        float                                   shadow_mask_u_size;
64
 
        float                                   shadow_mask_v_size;
65
 
        float                                   curvature;
66
 
        float                                   pincushion;
67
 
        float                                   scanline_alpha;
68
 
        float                                   scanline_scale;
69
 
        float                                   scanline_height;
70
 
        float                                   scanline_bright_scale;
71
 
        float                                   scanline_bright_offset;
72
 
        float                                   scanline_offset;
73
 
        float                                   defocus[4];
74
 
        float                                   converge_x[3];
75
 
        float                                   converge_y[3];
76
 
        float                                   radial_converge_x[3];
77
 
        float                                   radial_converge_y[3];
78
 
        float                                   red_ratio[3];
79
 
        float                                   grn_ratio[3];
80
 
        float                                   blu_ratio[3];
81
 
        float                                   offset[3];
82
 
        float                                   scale[3];
83
 
        float                                   power[3];
84
 
        float                                   floor[3];
85
 
        float                                   phosphor[3];
86
 
        float                                   saturation;
87
 
        bool                                    yiq_enable;
88
 
        float                                   yiq_cc;
89
 
        float                                   yiq_a;
90
 
        float                                   yiq_b;
91
 
        float                                   yiq_o;
92
 
        float                                   yiq_p;
93
 
        float                                   yiq_n;
94
 
        float                                   yiq_y;
95
 
        float                                   yiq_i;
96
 
        float                                   yiq_q;
97
 
        float                                   yiq_scan_time;
98
 
        int                                             yiq_phase_count;
99
 
};
100
 
 
101
 
class hlsl_info
102
 
{
103
 
public:
104
 
        // construction/destruction
105
 
        hlsl_info();
106
 
        ~hlsl_info();
107
 
 
108
 
        void init(d3d *d3dintf, win_window_info *window);
109
 
        void init_fsfx_quad(void *vertbuf);
110
 
 
111
 
        bool enabled() { return master_enable; }
112
 
 
113
 
        void begin();
114
 
        void init_effect_info(d3d_poly_info *poly);
115
 
        void render_quad(d3d_poly_info *poly, int vertnum);
116
 
        void end();
117
 
 
118
 
        int register_texture(d3d_texture_info *texture);
119
 
        int register_prescaled_texture(d3d_texture_info *texture, int scwidth, int scheight);
120
 
 
121
 
        void window_save();
122
 
        void window_record();
123
 
        bool recording() { return avi_output_file != NULL; }
124
 
 
125
 
        void avi_update_snap(d3d_surface *surface);
126
 
        void render_snapshot(d3d_surface *surface);
127
 
        void record_texture();
128
 
 
129
 
        void frame_complete();
130
 
 
131
 
        void set_texture(d3d_texture_info *texture);
132
 
 
133
 
        int create_resources();
134
 
        void delete_resources();
135
 
 
136
 
        // slider-related functions
137
 
        slider_state *init_slider_list();
138
 
 
139
 
private:
140
 
        void                                    end_avi_recording();
141
 
        void                                    begin_avi_recording(const char *name);
142
 
 
143
 
        bool                                    screen_encountered[9];          // whether a given screen was encountered this frame
144
 
 
145
 
        d3d *                   d3dintf;                                        // D3D interface
146
 
        win_window_info *       window;                                         // D3D window info
147
 
 
148
 
        bool                                    master_enable;                          // overall enable flag
149
 
        bool                                    external_ini;                           // external ini flag
150
 
        int                                             prescale_force_x;                       // prescale force x
151
 
        int                                             prescale_force_y;                       // prescale force y
152
 
        int                                             prescale_size_x;                        // prescale size x
153
 
        int                                             prescale_size_y;                        // prescale size y
154
 
        int                                             preset;                                         // preset, if relevant
155
 
        bitmap_t *                              shadow_bitmap;                          // shadow mask bitmap for post-processing shader
156
 
        d3d_texture_info *              shadow_texture;                         // shadow mask texture for post-processing shader
157
 
        int                                             registered_targets;                     // number of registered HLSL targets (i.e., screens)
158
 
        hlsl_options *                  options;                                        // current uniform state
159
 
        avi_file *                              avi_output_file;                        // AVI file
160
 
        bitmap_t *                              avi_snap;                                       // AVI snapshot
161
 
        int                                             avi_frame;                                      // AVI frame
162
 
        attotime                                avi_frame_period;                       // AVI frame period
163
 
        attotime                                avi_next_frame_time;            // AVI next frame time
164
 
        d3d_surface *           avi_copy_surface;                       // AVI destination surface in system memory
165
 
        d3d_texture *           avi_copy_texture;                       // AVI destination texture in system memory
166
 
        d3d_surface *           avi_final_target;                       // AVI upscaled surface
167
 
        d3d_texture *           avi_final_texture;                      // AVI upscaled texture
168
 
        bool                                    render_snap;                            // whether or not to take HLSL post-render snapshot
169
 
        bool                                    snap_rendered;                          // whether we just rendered our HLSL post-render shot or not
170
 
        d3d_surface *           snap_copy_target;                       // snapshot destination surface in system memory
171
 
        d3d_texture *           snap_copy_texture;                      // snapshot destination surface in system memory
172
 
        d3d_surface *           snap_target;                            // snapshot upscaled surface
173
 
        d3d_texture *           snap_texture;                           // snapshot upscaled texture
174
 
        int                                             snap_width;                                     // snapshot width
175
 
        int                                             snap_height;                            // snapshot height
176
 
 
177
 
        // HLSL effects
178
 
        d3d_surface *                   backbuffer;                                     // pointer to our device's backbuffer
179
 
        d3d_effect *                    curr_effect;                            // pointer to the currently active effect object
180
 
        d3d_effect *                    effect;                                         // pointer to the current primary-effect object
181
 
        d3d_effect *                    prescale_effect;                        // pointer to the current prescale-effect object
182
 
        d3d_effect *                    post_effect;                            // pointer to the current post-effect object
183
 
        d3d_effect *                    pincushion_effect;                      // pointer to the current pincushion-effect object
184
 
        d3d_effect *                    focus_effect;                           // pointer to the current focus-effect object
185
 
        d3d_effect *                    phosphor_effect;                        // pointer to the current phosphor-effect object
186
 
        d3d_effect *                    deconverge_effect;                      // pointer to the current deconvergence-effect object
187
 
        d3d_effect *                    color_effect;                           // pointer to the current color-effect object
188
 
        d3d_effect *                    yiq_encode_effect;                      // pointer to the current YIQ encoder effect object
189
 
        d3d_effect *                    yiq_decode_effect;                      // pointer to the current YIQ decoder effect object
190
 
        d3d_vertex *                    fsfx_vertices;                          // pointer to our full-screen-quad object
191
 
 
192
 
        // render targets
193
 
        int                                             target_use_count[9];            // Whether or not a target has been used yet
194
 
        d3d_texture_info *              target_in_use[9];                       // Target texture that is currently in use
195
 
        d3d_surface *                   last_target[9];                         // Render target surface pointer for each screen's previous frame
196
 
        d3d_texture *                   last_texture[9];                        // Render target texture pointer for each screen's previous frame
197
 
        d3d_surface *                   prescaletarget0[9];                     // Render target surface pointer (prescale, if necessary)
198
 
        d3d_surface *                   target0[9];                                     // Render target surface pointer (pass 0, if necessary)
199
 
        d3d_surface *                   target1[9];                                     // Render target surface pointer (pass 1, if necessary)
200
 
        d3d_surface *                   target2[9];                                     // Render target surface pointer (pass 2, if necessary)
201
 
        d3d_surface *                   target3[9];                                     // Render target surface pointer (pass 3, if necessary)
202
 
        d3d_surface *                   target4[9];                                     // Render target surface pointer (pass 4, if necessary)
203
 
        d3d_surface *                   smalltarget0[9];                        // Render target surface pointer (small pass 0, if necessary)
204
 
        d3d_texture *                   prescaletexture0[9];            // Render target surface pointer (prescale, if necessary)
205
 
        d3d_texture *                   texture0[9];                            // Render target texture pointer (pass 0, if necessary)
206
 
        d3d_texture *                   texture1[9];                            // Render target texture pointer (pass 1, if necessary)
207
 
        d3d_texture *                   texture2[9];                            // Render target texture pointer (pass 2, if necessary)
208
 
        d3d_texture *                   texture3[9];                            // Render target texture pointer (pass 3, if necessary)
209
 
        d3d_texture *                   texture4[9];                            // Render target texture pointer (pass 4, if necessary)
210
 
        d3d_texture *                   smalltexture0[9];                       // Render target texture pointer (small pass 0, if necessary)
211
 
};
212
 
 
213
 
#endif