summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author couriersud <couriersud@arcor.de>2015-02-12 00:28:42 +0100
committer couriersud <couriersud@arcor.de>2015-02-12 00:28:42 +0100
commitb7b984766eda6fa000ddecaf6161d9827dc08498 (patch)
tree650fbdbae77d849f31d71790f0411c9bdb5eaee3
parent17204d6f3678d43d1bc48a1bc5f412643a48600c (diff)
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)
-rw-r--r--src/emu/render.c4
-rw-r--r--src/emu/render.h1
-rw-r--r--src/osd/sdl/drawogl.c31
3 files changed, 13 insertions, 23 deletions
diff --git a/src/emu/render.c b/src/emu/render.c
index 2370d015a35..1fa8bcb5f16 100644
--- a/src/emu/render.c
+++ b/src/emu/render.c
@@ -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)
diff --git a/src/emu/render.h b/src/emu/render.h
index 618c03552ba..1e518d99651 100644
--- a/src/emu/render.h
+++ b/src/emu/render.h
@@ -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
diff --git a/src/osd/sdl/drawogl.c b/src/osd/sdl/drawogl.c
index 3de7d632e87..15825e00dfc 100644
--- a/src/osd/sdl/drawogl.c
+++ b/src/osd/sdl/drawogl.c
@@ -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);