mirror of
https://github.com/holub/mame
synced 2025-06-26 22:29:10 +03:00
Add a pointer to the render_container to quad_primitives. This can be
used to pick up user_settings for gamma, brightness and contrast in case they will ever be supported by the OSD layer. (nw)
This commit is contained in:
parent
17204d6f36
commit
b7b984766e
@ -279,6 +279,7 @@ void render_primitive::reset()
|
||||
{
|
||||
// public state
|
||||
type = INVALID;
|
||||
container = NULL;
|
||||
bounds.x0 = 0;
|
||||
bounds.y0 = 0;
|
||||
bounds.x1 = 0;
|
||||
@ -1754,6 +1755,9 @@ void render_target::add_container_primitives(render_primitive_list &list, const
|
||||
|
||||
// allocate the primitive and set the transformed bounds/color data
|
||||
render_primitive *prim = list.alloc(render_primitive::INVALID);
|
||||
|
||||
prim->container = &container; /* pass the container along for access to user_settings */
|
||||
|
||||
prim->bounds.x0 = render_round_nearest(container_xform.xoffs + bounds.x0 * container_xform.xscale);
|
||||
prim->bounds.y0 = render_round_nearest(container_xform.yoffs + bounds.y0 * container_xform.yscale);
|
||||
if (curitem->internal() & INTERNAL_FLAG_CHAR)
|
||||
|
@ -369,6 +369,7 @@ public:
|
||||
float width; // width (for line primitives)
|
||||
render_texinfo texture; // texture info (for quad primitives)
|
||||
render_quad_texuv texcoords; // texture coordinates (for quad primitives)
|
||||
render_container * container; // the render container we belong to
|
||||
|
||||
private:
|
||||
// internal state
|
||||
|
@ -285,7 +285,7 @@ private:
|
||||
texture_info *texture_find(const render_primitive *prim);
|
||||
void texture_coord_update(texture_info *texture, const render_primitive *prim, int shaderIdx);
|
||||
void texture_mpass_flip(texture_info *texture, int shaderIdx);
|
||||
void texture_shader_update(texture_info *texture, int shaderIdx);
|
||||
void texture_shader_update(texture_info *texture, render_container *container, int shaderIdx);
|
||||
texture_info * texture_update(const render_primitive *prim, int shaderIdx);
|
||||
void texture_disable(texture_info * texture);
|
||||
void texture_all_disable();
|
||||
@ -2852,30 +2852,19 @@ void sdl_info_ogl::texture_mpass_flip(texture_info *texture, int shaderIdx)
|
||||
}
|
||||
}
|
||||
|
||||
void sdl_info_ogl::texture_shader_update(texture_info *texture, int shaderIdx)
|
||||
void sdl_info_ogl::texture_shader_update(texture_info *texture, render_container *container, int shaderIdx)
|
||||
{
|
||||
int uniform_location, scrnum;
|
||||
render_container *container;
|
||||
int uniform_location;
|
||||
GLfloat vid_attributes[4];
|
||||
|
||||
scrnum = 0;
|
||||
container = (render_container *)NULL;
|
||||
screen_device_iterator iter(window().machine().root_device());
|
||||
for (screen_device *screen = iter.first(); screen != NULL; screen = iter.next())
|
||||
{
|
||||
if (scrnum == window().m_start_viewscreen)
|
||||
{
|
||||
container = &screen->container();
|
||||
}
|
||||
|
||||
scrnum++;
|
||||
}
|
||||
|
||||
if (container!=NULL)
|
||||
{
|
||||
render_container::user_settings settings;
|
||||
container->get_user_settings(settings);
|
||||
//FIXME: Intended behaviour
|
||||
/* FIXME: the code below is in just for illustration issue on
|
||||
* how to set shader variables. gamma, contrast and brightness are
|
||||
* handled already by the core
|
||||
*/
|
||||
#if 1
|
||||
vid_attributes[0] = window().machine().options().gamma();
|
||||
vid_attributes[1] = window().machine().options().contrast();
|
||||
@ -2892,10 +2881,6 @@ void sdl_info_ogl::texture_shader_update(texture_info *texture, int shaderIdx)
|
||||
osd_printf_verbose("GLSL: could not set 'vid_attributes' for shader prog idx %d\n", shaderIdx);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
osd_printf_verbose("GLSL: could not get render container for screen %d\n", window().m_start_viewscreen);
|
||||
}
|
||||
}
|
||||
|
||||
texture_info * sdl_info_ogl::texture_update(const render_primitive *prim, int shaderIdx)
|
||||
@ -2930,7 +2915,7 @@ texture_info * sdl_info_ogl::texture_update(const render_primitive *prim, int sh
|
||||
{
|
||||
if ( texture->type == TEXTURE_TYPE_SHADER )
|
||||
{
|
||||
texture_shader_update(texture, shaderIdx);
|
||||
texture_shader_update(texture, prim->container, shaderIdx);
|
||||
if ( m_glsl_program_num>1 )
|
||||
{
|
||||
texture_mpass_flip(texture, shaderIdx);
|
||||
|
Loading…
Reference in New Issue
Block a user