Previous 199869 Revisions Next

r34978 Wednesday 11th February, 2015 at 23:28:42 UTC by Couriersud
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)
[src/emu]render.c render.h
[src/osd/sdl]drawogl.c

trunk/src/emu/render.c
r243489r243490
279279{
280280   // public state
281281   type = INVALID;
282   container = NULL;
282283   bounds.x0 = 0;
283284   bounds.y0 = 0;
284285   bounds.x1 = 0;
r243489r243490
17541755
17551756      // allocate the primitive and set the transformed bounds/color data
17561757      render_primitive *prim = list.alloc(render_primitive::INVALID);
1758
1759      prim->container = &container; /* pass the container along for access to user_settings */
1760
17571761      prim->bounds.x0 = render_round_nearest(container_xform.xoffs + bounds.x0 * container_xform.xscale);
17581762      prim->bounds.y0 = render_round_nearest(container_xform.yoffs + bounds.y0 * container_xform.yscale);
17591763      if (curitem->internal() & INTERNAL_FLAG_CHAR)
trunk/src/emu/render.h
r243489r243490
369369   float               width;              // width (for line primitives)
370370   render_texinfo      texture;            // texture info (for quad primitives)
371371   render_quad_texuv   texcoords;          // texture coordinates (for quad primitives)
372   render_container *   container;         // the render container we belong to
372373
373374private:
374375   // internal state
trunk/src/osd/sdl/drawogl.c
r243489r243490
285285   texture_info *texture_find(const render_primitive *prim);
286286   void texture_coord_update(texture_info *texture, const render_primitive *prim, int shaderIdx);
287287   void texture_mpass_flip(texture_info *texture, int shaderIdx);
288   void texture_shader_update(texture_info *texture, int shaderIdx);
288   void texture_shader_update(texture_info *texture, render_container *container,  int shaderIdx);
289289   texture_info * texture_update(const render_primitive *prim, int shaderIdx);
290290   void texture_disable(texture_info * texture);
291291   void texture_all_disable();
r243489r243490
28522852   }
28532853}
28542854
2855void sdl_info_ogl::texture_shader_update(texture_info *texture, int shaderIdx)
2855void sdl_info_ogl::texture_shader_update(texture_info *texture, render_container *container, int shaderIdx)
28562856{
2857   int uniform_location, scrnum;
2858   render_container *container;
2857   int uniform_location;
28592858   GLfloat vid_attributes[4];
28602859
2861   scrnum = 0;
2862   container = (render_container *)NULL;
2863   screen_device_iterator iter(window().machine().root_device());
2864   for (screen_device *screen = iter.first(); screen != NULL; screen = iter.next())
2865   {
2866      if (scrnum == window().m_start_viewscreen)
2867      {
2868         container = &screen->container();
2869      }
2870
2871      scrnum++;
2872   }
2873
28742860   if (container!=NULL)
28752861   {
28762862      render_container::user_settings settings;
28772863      container->get_user_settings(settings);
2878      //FIXME: Intended behaviour
2864      /* FIXME: the code below is in just for illustration issue on
2865       * how to set shader variables. gamma, contrast and brightness are
2866       * handled already by the core
2867       */
28792868#if 1
28802869      vid_attributes[0] = window().machine().options().gamma();
28812870      vid_attributes[1] = window().machine().options().contrast();
r243489r243490
28922881         osd_printf_verbose("GLSL: could not set 'vid_attributes' for shader prog idx %d\n", shaderIdx);
28932882      }
28942883   }
2895   else
2896   {
2897      osd_printf_verbose("GLSL: could not get render container for screen %d\n", window().m_start_viewscreen);
2898   }
28992884}
29002885
29012886texture_info * sdl_info_ogl::texture_update(const render_primitive *prim, int shaderIdx)
r243489r243490
29302915   {
29312916      if ( texture->type == TEXTURE_TYPE_SHADER )
29322917      {
2933         texture_shader_update(texture, shaderIdx);
2918         texture_shader_update(texture, prim->container, shaderIdx);
29342919         if ( m_glsl_program_num>1 )
29352920         {
29362921            texture_mpass_flip(texture, shaderIdx);


Previous 199869 Revisions Next


© 1997-2024 The MAME Team