trunk/src/osd/sdl/drawogl.c
| r31852 | r31853 | |
| 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 | | int lut_table_width; // LUT table width |
| 191 | | int lut_table_height; // LUT table height |
| 192 | | |
| 193 | 190 | UINT32 pbo; // pixel buffer object for this texture (DYNAMIC only!) |
| 194 | 191 | UINT32 *data; // pixels for the texture |
| 195 | 192 | int data_own; // do we own / allocated it ? |
| r31852 | r31853 | |
| 1895 | 1892 | { |
| 1896 | 1893 | sdl_info *sdl = (sdl_info *) window->dxdata; |
| 1897 | 1894 | int uniform_location; |
| 1898 | | int lut_table_width_pow2=0; |
| 1899 | | int lut_table_height_pow2=0; |
| 1900 | 1895 | int i; |
| 1901 | 1896 | int surf_w_pow2 = get_valid_pow2_value (window->blitwidth, texture->texpow2); |
| 1902 | 1897 | int surf_h_pow2 = get_valid_pow2_value (window->blitheight, texture->texpow2); |
| 1903 | 1898 | |
| 1904 | 1899 | assert ( texture->type==TEXTURE_TYPE_SHADER ); |
| 1905 | 1900 | |
| 1906 | | texture->lut_table_height = 1; // default .. |
| 1907 | | |
| 1908 | | switch(texture->format) |
| 1909 | | { |
| 1910 | | case SDL_TEXFORMAT_RGB32_PALETTED: |
| 1911 | | case SDL_TEXFORMAT_RGB32: |
| 1912 | | texture->lut_table_width = 1 << 8; // 8 bits per component |
| 1913 | | texture->lut_table_width *= 3; // BGR .. |
| 1914 | | break; |
| 1915 | | |
| 1916 | | case SDL_TEXFORMAT_RGB15_PALETTED: |
| 1917 | | case SDL_TEXFORMAT_RGB15: |
| 1918 | | texture->lut_table_width = 1 << 5; // 5 bits per component |
| 1919 | | texture->lut_table_width *= 3; // BGR .. |
| 1920 | | break; |
| 1921 | | |
| 1922 | | case SDL_TEXFORMAT_PALETTE16: |
| 1923 | | texture->lut_table_width = (1 << 8) * 3; |
| 1924 | | break; |
| 1925 | | |
| 1926 | | default: |
| 1927 | | // should never happen |
| 1928 | | assert(0); |
| 1929 | | exit(1); |
| 1930 | | } |
| 1931 | | |
| 1932 | | texture->lut_table_height = 1; |
| 1933 | | |
| 1934 | | /** |
| 1935 | | * always use pow2 for LUT, to minimize the chance for floating point arithmetic errors |
| 1936 | | * (->buggy GLSL engine) |
| 1937 | | */ |
| 1938 | | lut_table_height_pow2 = get_valid_pow2_value (texture->lut_table_height, 1 /* texture->texpow2 */); |
| 1939 | | lut_table_width_pow2 = get_valid_pow2_value (texture->lut_table_width, 1 /* texture->texpow2 */); |
| 1940 | | |
| 1941 | | if ( lut_table_width_pow2 > sdl->texture_max_width || lut_table_height_pow2 > sdl->texture_max_height ) |
| 1942 | | { |
| 1943 | | osd_printf_error("Need lut size %dx%d, but max text size is %dx%d, bail out\n", |
| 1944 | | lut_table_width_pow2, lut_table_height_pow2, |
| 1945 | | sdl->texture_max_width, sdl->texture_max_height); |
| 1946 | | return -1; |
| 1947 | | } |
| 1948 | | |
| 1949 | 1901 | GL_CHECK_ERROR_QUIET(); |
| 1950 | 1902 | |
| 1951 | 1903 | if( sdl->glsl_program_num > 1 ) |