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:
couriersud 2015-02-12 00:28:42 +01:00
parent 17204d6f36
commit b7b984766e
3 changed files with 13 additions and 23 deletions

View File

@ -279,6 +279,7 @@ void render_primitive::reset()
{ {
// public state // public state
type = INVALID; type = INVALID;
container = NULL;
bounds.x0 = 0; bounds.x0 = 0;
bounds.y0 = 0; bounds.y0 = 0;
bounds.x1 = 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 // allocate the primitive and set the transformed bounds/color data
render_primitive *prim = list.alloc(render_primitive::INVALID); 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.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); prim->bounds.y0 = render_round_nearest(container_xform.yoffs + bounds.y0 * container_xform.yscale);
if (curitem->internal() & INTERNAL_FLAG_CHAR) if (curitem->internal() & INTERNAL_FLAG_CHAR)

View File

@ -369,6 +369,7 @@ public:
float width; // width (for line primitives) float width; // width (for line primitives)
render_texinfo texture; // texture info (for quad primitives) render_texinfo texture; // texture info (for quad primitives)
render_quad_texuv texcoords; // texture coordinates (for quad primitives) render_quad_texuv texcoords; // texture coordinates (for quad primitives)
render_container * container; // the render container we belong to
private: private:
// internal state // internal state

View File

@ -285,7 +285,7 @@ private:
texture_info *texture_find(const render_primitive *prim); texture_info *texture_find(const render_primitive *prim);
void texture_coord_update(texture_info *texture, const render_primitive *prim, int shaderIdx); void texture_coord_update(texture_info *texture, const render_primitive *prim, int shaderIdx);
void texture_mpass_flip(texture_info *texture, 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); texture_info * texture_update(const render_primitive *prim, int shaderIdx);
void texture_disable(texture_info * texture); void texture_disable(texture_info * texture);
void texture_all_disable(); 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; int uniform_location;
render_container *container;
GLfloat vid_attributes[4]; 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) if (container!=NULL)
{ {
render_container::user_settings settings; render_container::user_settings settings;
container->get_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 #if 1
vid_attributes[0] = window().machine().options().gamma(); vid_attributes[0] = window().machine().options().gamma();
vid_attributes[1] = window().machine().options().contrast(); 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); 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) 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 ) if ( texture->type == TEXTURE_TYPE_SHADER )
{ {
texture_shader_update(texture, shaderIdx); texture_shader_update(texture, prim->container, shaderIdx);
if ( m_glsl_program_num>1 ) if ( m_glsl_program_num>1 )
{ {
texture_mpass_flip(texture, shaderIdx); texture_mpass_flip(texture, shaderIdx);