trunk/src/osd/sdl/drawogl.c
| r30935 | r30936 | |
| 187 | 187 | UINT32 mpass_texture_scrn[2]; // Multipass OpenGL texture "name"/ID for the shader |
| 188 | 188 | UINT32 mpass_fbo_scrn[2]; // framebuffer object for this texture, multipass |
| 189 | 189 | |
| 190 | | UINT32 lut_texture; // LUT OpenGL texture "name"/ID for the shader |
| 191 | 190 | int lut_table_width; // LUT table width |
| 192 | 191 | int lut_table_height; // LUT table height |
| 193 | 192 | |
| r30935 | r30936 | |
| 1624 | 1623 | texsource->rowpixels <= sdl->texture_max_width ) |
| 1625 | 1624 | { |
| 1626 | 1625 | texture->type = TEXTURE_TYPE_SHADER; |
| 1627 | | texture->nocopy = TRUE; |
| 1628 | 1626 | texture->texTarget = GL_TEXTURE_2D; |
| 1629 | 1627 | texture->texpow2 = sdl->texpoweroftwo; |
| 1630 | 1628 | } |
| r30935 | r30936 | |
| 2600 | 2598 | |
| 2601 | 2599 | if ( texture->type == TEXTURE_TYPE_SHADER ) |
| 2602 | 2600 | { |
| 2603 | | if ( texture->lut_texture ) |
| 2604 | | { |
| 2605 | | pfn_glActiveTexture(GL_TEXTURE1); |
| 2606 | | glBindTexture(texture->texTarget, texture->lut_texture); |
| 2607 | | |
| 2608 | | glPixelStorei(GL_UNPACK_ROW_LENGTH, texture->lut_table_width); |
| 2609 | | |
| 2610 | | // give the card a hint |
| 2611 | | glTexSubImage2D(texture->texTarget, 0, 0, 0, texture->lut_table_width, texture->lut_table_height, |
| 2612 | | GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, texsource->palette ); |
| 2613 | | } |
| 2614 | 2601 | pfn_glActiveTexture(GL_TEXTURE0); |
| 2615 | 2602 | glBindTexture(texture->texTarget, texture->texture); |
| 2616 | 2603 | |
| 2617 | | glPixelStorei(GL_UNPACK_ROW_LENGTH, texture->texinfo.rowpixels); |
| 2604 | if (texture->nocopy) |
| 2605 | glPixelStorei(GL_UNPACK_ROW_LENGTH, texture->texinfo.rowpixels); |
| 2606 | else |
| 2607 | glPixelStorei(GL_UNPACK_ROW_LENGTH, texture->rawwidth); |
| 2618 | 2608 | |
| 2619 | 2609 | // and upload the image |
| 2620 | 2610 | glTexSubImage2D(texture->texTarget, 0, 0, 0, texture->rawwidth, texture->rawheight, |
| r30935 | r30936 | |
| 2843 | 2833 | static void texture_shader_update(sdl_window_info *window, texture_info *texture, int shaderIdx) |
| 2844 | 2834 | { |
| 2845 | 2835 | sdl_info *sdl = (sdl_info *) window->dxdata; |
| 2846 | | if ( !texture->lut_texture ) |
| 2847 | | { |
| 2848 | | int uniform_location, scrnum; |
| 2849 | | render_container *container; |
| 2850 | | GLfloat vid_attributes[4]; // gamma, contrast, brightness, effect |
| 2836 | int uniform_location, scrnum; |
| 2837 | render_container *container; |
| 2838 | GLfloat vid_attributes[4]; |
| 2851 | 2839 | |
| 2852 | | scrnum = 0; |
| 2853 | | container = (render_container *)NULL; |
| 2854 | | screen_device_iterator iter(window->machine().root_device()); |
| 2855 | | for (screen_device *screen = iter.first(); screen != NULL; screen = iter.next()) |
| 2840 | scrnum = 0; |
| 2841 | container = (render_container *)NULL; |
| 2842 | screen_device_iterator iter(window->machine().root_device()); |
| 2843 | for (screen_device *screen = iter.first(); screen != NULL; screen = iter.next()) |
| 2844 | { |
| 2845 | if (scrnum == window->start_viewscreen) |
| 2856 | 2846 | { |
| 2857 | | if (scrnum == window->start_viewscreen) |
| 2858 | | { |
| 2859 | | container = &screen->container(); |
| 2860 | | } |
| 2861 | | |
| 2862 | | scrnum++; |
| 2847 | container = &screen->container(); |
| 2863 | 2848 | } |
| 2864 | 2849 | |
| 2865 | | if (container!=NULL) |
| 2866 | | { |
| 2867 | | render_container::user_settings settings; |
| 2868 | | container->get_user_settings(settings); |
| 2869 | | //FIXME: Intended behaviour |
| 2850 | scrnum++; |
| 2851 | } |
| 2852 | |
| 2853 | if (container!=NULL) |
| 2854 | { |
| 2855 | render_container::user_settings settings; |
| 2856 | container->get_user_settings(settings); |
| 2857 | //FIXME: Intended behaviour |
| 2870 | 2858 | #if 1 |
| 2871 | | vid_attributes[0] = window->machine().options().gamma(); |
| 2872 | | vid_attributes[1] = window->machine().options().contrast(); |
| 2873 | | vid_attributes[2] = window->machine().options().brightness(); |
| 2859 | vid_attributes[0] = window->machine().options().gamma(); |
| 2860 | vid_attributes[1] = window->machine().options().contrast(); |
| 2861 | vid_attributes[2] = window->machine().options().brightness(); |
| 2874 | 2862 | #else |
| 2875 | | vid_attributes[0] = settings.gamma; |
| 2876 | | vid_attributes[1] = settings.contrast; |
| 2877 | | vid_attributes[2] = settings.brightness; |
| 2863 | vid_attributes[0] = settings.gamma; |
| 2864 | vid_attributes[1] = settings.contrast; |
| 2865 | vid_attributes[2] = settings.brightness; |
| 2878 | 2866 | #endif |
| 2879 | | vid_attributes[3] = 0.0f; |
| 2880 | | uniform_location = pfn_glGetUniformLocationARB(sdl->glsl_program[shaderIdx], "vid_attributes"); |
| 2881 | | pfn_glUniform4fvARB(uniform_location, 1, &(vid_attributes[shaderIdx])); |
| 2882 | | if ( GL_CHECK_ERROR_QUIET() ) { |
| 2883 | | osd_printf_verbose("GLSL: could not set 'vid_attributes' for shader prog idx %d\n", shaderIdx); |
| 2884 | | } |
| 2867 | vid_attributes[3] = 0.0f; |
| 2868 | uniform_location = pfn_glGetUniformLocationARB(sdl->glsl_program[shaderIdx], "vid_attributes"); |
| 2869 | pfn_glUniform4fvARB(uniform_location, 1, &(vid_attributes[shaderIdx])); |
| 2870 | if ( GL_CHECK_ERROR_QUIET() ) { |
| 2871 | osd_printf_verbose("GLSL: could not set 'vid_attributes' for shader prog idx %d\n", shaderIdx); |
| 2885 | 2872 | } |
| 2886 | | else |
| 2887 | | { |
| 2888 | | osd_printf_verbose("GLSL: could not get render container for screen %d\n", window->start_viewscreen); |
| 2889 | | } |
| 2890 | 2873 | } |
| 2874 | else |
| 2875 | { |
| 2876 | osd_printf_verbose("GLSL: could not get render container for screen %d\n", window->start_viewscreen); |
| 2877 | } |
| 2891 | 2878 | } |
| 2892 | 2879 | |
| 2893 | 2880 | static texture_info * texture_update(sdl_window_info *window, const render_primitive *prim, int shaderIdx) |
| r30935 | r30936 | |
| 3079 | 3066 | glDeleteTextures(2, (GLuint *)&texture->mpass_texture_scrn[0]); |
| 3080 | 3067 | } |
| 3081 | 3068 | |
| 3082 | | if(texture->lut_texture) |
| 3083 | | glDeleteTextures(1, (GLuint *)&texture->lut_texture); |
| 3084 | | |
| 3085 | 3069 | glDeleteTextures(1, (GLuint *)&texture->texture); |
| 3086 | 3070 | if ( texture->data_own ) |
| 3087 | 3071 | { |