{
struct gl_context fakeCtx;
fakeCtx.Const.GLSLVersion = 130;
- fakeCtx.Extensions.ARB_ES2_compatibility = true;
gl_shader *sh = _mesa_new_shader(NULL, 0, target);
struct _mesa_glsl_parse_state *st =
new(sh) _mesa_glsl_parse_state(&fakeCtx, target, sh);
st->language_version = 130;
st->symbols->language_version = 130;
- st->ARB_texture_rectangle_enable = true;
st->EXT_texture_array_enable = true;
_mesa_glsl_initialize_types(st);
builtin_texture3DProjGradARB,
builtin_textureCubeGradARB,
};
-static const char prototypes_for_ARB_texture_rectangle_frag[] =
- "(\n"
- "(function texture2DRect\n"
- " (signature vec4\n"
- " (parameters\n"
- " (declare (in) sampler2DRect sampler)\n"
- " (declare (in) vec2 coord))\n"
- " ()))\n"
- "(function texture2DRectProj\n"
- " (signature vec4\n"
- " (parameters\n"
- " (declare (in) sampler2DRect sampler)\n"
- " (declare (in) vec3 coord))\n"
- " ())\n"
- " (signature vec4\n"
- " (parameters\n"
- " (declare (in) sampler2DRect sampler)\n"
- " (declare (in) vec4 coord))\n"
- " ()))\n"
- "(function shadow2DRect\n"
- " (signature vec4\n"
- " (parameters\n"
- " (declare (in) sampler2DRectShadow sampler)\n"
- " (declare (in) vec3 coord))\n"
- " ()))\n"
- "(function shadow2DRectProj\n"
- " (signature vec4\n"
- " (parameters\n"
- " (declare (in) sampler2DRectShadow sampler)\n"
- " (declare (in) vec4 coord))\n"
- " ())))"
-;
-static const char *functions_for_ARB_texture_rectangle_frag [] = {
- builtin_shadow2DRect,
- builtin_shadow2DRectProj,
- builtin_texture2DRect,
- builtin_texture2DRectProj,
-};
-static const char prototypes_for_ARB_texture_rectangle_vert[] =
- "(\n"
- "(function texture2DRect\n"
- " (signature vec4\n"
- " (parameters\n"
- " (declare (in) sampler2DRect sampler)\n"
- " (declare (in) vec2 coord))\n"
- " ()))\n"
- "(function texture2DRectProj\n"
- " (signature vec4\n"
- " (parameters\n"
- " (declare (in) sampler2DRect sampler)\n"
- " (declare (in) vec3 coord))\n"
- " ())\n"
- " (signature vec4\n"
- " (parameters\n"
- " (declare (in) sampler2DRect sampler)\n"
- " (declare (in) vec4 coord))\n"
- " ()))\n"
- "(function shadow2DRect\n"
- " (signature vec4\n"
- " (parameters\n"
- " (declare (in) sampler2DRectShadow sampler)\n"
- " (declare (in) vec3 coord))\n"
- " ()))\n"
- "(function shadow2DRectProj\n"
- " (signature vec4\n"
- " (parameters\n"
- " (declare (in) sampler2DRectShadow sampler)\n"
- " (declare (in) vec4 coord))\n"
- " ())))"
-;
-static const char *functions_for_ARB_texture_rectangle_vert [] = {
- builtin_shadow2DRect,
- builtin_shadow2DRectProj,
- builtin_texture2DRect,
- builtin_texture2DRectProj,
-};
static const char prototypes_for_EXT_texture_array_frag[] =
"(\n"
"(function texture1DArray\n"
Elements(functions_for_ARB_shader_texture_lod_vert));
}
- if (state->target == fragment_shader && state->ARB_texture_rectangle_enable) {
- _mesa_read_profile(state, 10,
- prototypes_for_ARB_texture_rectangle_frag,
- functions_for_ARB_texture_rectangle_frag,
- Elements(functions_for_ARB_texture_rectangle_frag));
- }
-
- if (state->target == vertex_shader && state->ARB_texture_rectangle_enable) {
- _mesa_read_profile(state, 11,
- prototypes_for_ARB_texture_rectangle_vert,
- functions_for_ARB_texture_rectangle_vert,
- Elements(functions_for_ARB_texture_rectangle_vert));
- }
-
if (state->target == fragment_shader && state->EXT_texture_array_enable) {
_mesa_read_profile(state, 12,
prototypes_for_EXT_texture_array_frag,
/* Add pre-defined macros. */
add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
- add_builtin_define(parser, "GL_ARB_texture_rectangle", 1);
if (extensions != NULL) {
if (extensions->EXT_texture_array) {
} \
} while (0)
-/* The ES macro can be used in KEYWORD checks:
- *
- * word KEYWORD(110 || ES, 400, TOKEN)
- * ...means the word is reserved in GLSL ES 1.00, while
- *
- * word KEYWORD(110, 130 || ES, TOKEN)
- * ...means the word is a legal keyword in GLSL ES 1.00.
- */
-#define ES yyextra->es_shader
-
static int
literal_integer(char *text, int len, struct _mesa_glsl_parse_state *state,
YYSTYPE *lval, YYLTYPE *lloc, int base)
case 67:
YY_RULE_SETUP
#line 270 "src/glsl/glsl_lexer.ll"
-KEYWORD(120 || ES, 120 || ES, INVARIANT);
+KEYWORD(120, 120, INVARIANT);
YY_BREAK
case 68:
YY_RULE_SETUP
#line 271 "src/glsl/glsl_lexer.ll"
-KEYWORD(130 || ES, 130, FLAT);
+KEYWORD(130, 130, FLAT);
YY_BREAK
case 69:
YY_RULE_SETUP
case 129:
YY_RULE_SETUP
#line 388 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, ASM);
+KEYWORD(110, 999, ASM);
YY_BREAK
case 130:
YY_RULE_SETUP
#line 389 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, CLASS);
+KEYWORD(110, 999, CLASS);
YY_BREAK
case 131:
YY_RULE_SETUP
#line 390 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, UNION);
+KEYWORD(110, 999, UNION);
YY_BREAK
case 132:
YY_RULE_SETUP
#line 391 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, ENUM);
+KEYWORD(110, 999, ENUM);
YY_BREAK
case 133:
YY_RULE_SETUP
#line 392 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, TYPEDEF);
+KEYWORD(110, 999, TYPEDEF);
YY_BREAK
case 134:
YY_RULE_SETUP
#line 393 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, TEMPLATE);
+KEYWORD(110, 999, TEMPLATE);
YY_BREAK
case 135:
YY_RULE_SETUP
#line 394 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, THIS);
+KEYWORD(110, 999, THIS);
YY_BREAK
case 136:
YY_RULE_SETUP
#line 395 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, PACKED_TOK);
+KEYWORD(110, 999, PACKED_TOK);
YY_BREAK
case 137:
YY_RULE_SETUP
#line 396 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, GOTO);
+KEYWORD(110, 999, GOTO);
YY_BREAK
case 138:
YY_RULE_SETUP
#line 397 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 130, SWITCH);
+KEYWORD(110, 130, SWITCH);
YY_BREAK
case 139:
YY_RULE_SETUP
#line 398 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 130, DEFAULT);
+KEYWORD(110, 130, DEFAULT);
YY_BREAK
case 140:
YY_RULE_SETUP
#line 399 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, INLINE_TOK);
+KEYWORD(110, 999, INLINE_TOK);
YY_BREAK
case 141:
YY_RULE_SETUP
#line 400 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, NOINLINE);
+KEYWORD(110, 999, NOINLINE);
YY_BREAK
case 142:
YY_RULE_SETUP
#line 401 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, VOLATILE);
+KEYWORD(110, 999, VOLATILE);
YY_BREAK
case 143:
YY_RULE_SETUP
#line 402 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, PUBLIC_TOK);
+KEYWORD(110, 999, PUBLIC_TOK);
YY_BREAK
case 144:
YY_RULE_SETUP
#line 403 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, STATIC);
+KEYWORD(110, 999, STATIC);
YY_BREAK
case 145:
YY_RULE_SETUP
#line 404 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, EXTERN);
+KEYWORD(110, 999, EXTERN);
YY_BREAK
case 146:
YY_RULE_SETUP
#line 405 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, EXTERNAL);
+KEYWORD(110, 999, EXTERNAL);
YY_BREAK
case 147:
YY_RULE_SETUP
#line 406 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, INTERFACE);
+KEYWORD(110, 999, INTERFACE);
YY_BREAK
case 148:
YY_RULE_SETUP
#line 407 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, LONG_TOK);
+KEYWORD(110, 999, LONG_TOK);
YY_BREAK
case 149:
YY_RULE_SETUP
#line 408 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, SHORT_TOK);
+KEYWORD(110, 999, SHORT_TOK);
YY_BREAK
case 150:
YY_RULE_SETUP
#line 409 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 400, DOUBLE_TOK);
+KEYWORD(110, 400, DOUBLE_TOK);
YY_BREAK
case 151:
YY_RULE_SETUP
#line 410 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, HALF);
+KEYWORD(110, 999, HALF);
YY_BREAK
case 152:
YY_RULE_SETUP
#line 411 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, FIXED_TOK);
+KEYWORD(110, 999, FIXED_TOK);
YY_BREAK
case 153:
YY_RULE_SETUP
#line 412 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, UNSIGNED);
+KEYWORD(110, 999, UNSIGNED);
YY_BREAK
case 154:
YY_RULE_SETUP
#line 413 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, INPUT_TOK);
+KEYWORD(110, 999, INPUT_TOK);
YY_BREAK
case 155:
YY_RULE_SETUP
#line 414 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, OUTPUT);
+KEYWORD(110, 999, OUTPUT);
YY_BREAK
case 156:
YY_RULE_SETUP
#line 415 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, HVEC2);
+KEYWORD(110, 999, HVEC2);
YY_BREAK
case 157:
YY_RULE_SETUP
#line 416 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, HVEC3);
+KEYWORD(110, 999, HVEC3);
YY_BREAK
case 158:
YY_RULE_SETUP
#line 417 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, HVEC4);
+KEYWORD(110, 999, HVEC4);
YY_BREAK
case 159:
YY_RULE_SETUP
#line 418 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 400, DVEC2);
+KEYWORD(110, 400, DVEC2);
YY_BREAK
case 160:
YY_RULE_SETUP
#line 419 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 400, DVEC3);
+KEYWORD(110, 400, DVEC3);
YY_BREAK
case 161:
YY_RULE_SETUP
#line 420 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 400, DVEC4);
+KEYWORD(110, 400, DVEC4);
YY_BREAK
case 162:
YY_RULE_SETUP
#line 421 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, FVEC2);
+KEYWORD(110, 999, FVEC2);
YY_BREAK
case 163:
YY_RULE_SETUP
#line 422 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, FVEC3);
+KEYWORD(110, 999, FVEC3);
YY_BREAK
case 164:
YY_RULE_SETUP
#line 423 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, FVEC4);
+KEYWORD(110, 999, FVEC4);
YY_BREAK
case 165:
YY_RULE_SETUP
case 166:
YY_RULE_SETUP
#line 425 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, SAMPLER3DRECT);
+KEYWORD(110, 999, SAMPLER3DRECT);
YY_BREAK
case 167:
YY_RULE_SETUP
case 168:
YY_RULE_SETUP
#line 427 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, SIZEOF);
+KEYWORD(110, 999, SIZEOF);
YY_BREAK
case 169:
YY_RULE_SETUP
#line 428 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, CAST);
+KEYWORD(110, 999, CAST);
YY_BREAK
case 170:
YY_RULE_SETUP
#line 429 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, NAMESPACE);
+KEYWORD(110, 999, NAMESPACE);
YY_BREAK
case 171:
YY_RULE_SETUP
#line 430 "src/glsl/glsl_lexer.ll"
-KEYWORD(110 || ES, 999, USING);
+KEYWORD(110, 999, USING);
YY_BREAK
/* Additional reserved words in GLSL 1.20. */
case 172:
YY_RULE_SETUP
#line 433 "src/glsl/glsl_lexer.ll"
-KEYWORD(120, 130 || ES, LOWP);
+KEYWORD(120, 130, LOWP);
YY_BREAK
case 173:
YY_RULE_SETUP
#line 434 "src/glsl/glsl_lexer.ll"
-KEYWORD(120, 130 || ES, MEDIUMP);
+KEYWORD(120, 130, MEDIUMP);
YY_BREAK
case 174:
YY_RULE_SETUP
#line 435 "src/glsl/glsl_lexer.ll"
-KEYWORD(120, 130 || ES, HIGHP);
+KEYWORD(120, 130, HIGHP);
YY_BREAK
case 175:
YY_RULE_SETUP
#line 436 "src/glsl/glsl_lexer.ll"
-KEYWORD(120, 130 || ES, PRECISION);
+KEYWORD(120, 130, PRECISION);
YY_BREAK
/* Additional reserved words in GLSL 1.30. */
case 176:
case 180:
YY_RULE_SETUP
#line 443 "src/glsl/glsl_lexer.ll"
-KEYWORD(130 || ES, 999, SUPERP);
+KEYWORD(130, 999, SUPERP);
YY_BREAK
case 181:
YY_RULE_SETUP
bool supported = false;
switch ((yyvsp[(2) - (3)].n)) {
- case 100:
- state->es_shader = true;
- supported = state->Const.GLSL_100ES;
- break;
case 110:
supported = state->Const.GLSL_110;
break;
state->language_version = (yyvsp[(2) - (3)].n);
state->version_string =
- ralloc_asprintf(state, "GLSL%s %d.%02d",
- state->es_shader ? " ES" : "",
+ ralloc_asprintf(state, "GLSL %d.%02d",
state->language_version / 100,
state->language_version % 100);
/* Line 1806 of yacc.c */
#line 1420 "src/glsl/glsl_parser.yy"
{
- if (!state->es_shader && state->language_version < 130)
+ if (state->language_version < 130)
_mesa_glsl_error(& (yylsp[(1) - (1)]), state,
"precision qualifier forbidden "
"in %s (1.30 or later "
/* Line 1806 of yacc.c */
#line 1430 "src/glsl/glsl_parser.yy"
{
- if (!state->es_shader && state->language_version < 130)
+ if (state->language_version < 130)
_mesa_glsl_error(& (yylsp[(1) - (1)]), state,
"precision qualifier forbidden "
"in %s (1.30 or later "
/* Line 1806 of yacc.c */
#line 1440 "src/glsl/glsl_parser.yy"
{
- if (!state->es_shader && state->language_version < 130)
+ if (state->language_version < 130)
_mesa_glsl_error(& (yylsp[(1) - (1)]), state,
"precision qualifier forbidden "
"in %s (1.30 or later "
#define require_ARB_fp (yyextra->mode == ARB_fragment)
#define require_NV_fp (yyextra->option.NV_fragment)
#define require_shadow (yyextra->option.Shadow)
-#define require_rect (yyextra->option.TexRect)
#define require_texarray (yyextra->option.TexArray)
#ifndef HAVE_UNISTD_H
case 131:
YY_RULE_SETUP
#line 321 "src/mesa/program/program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); }
+{ return_token_or_IDENTIFIER(GL_FALSE, TEX_RECT); }
YY_BREAK
case 132:
YY_RULE_SETUP
case 134:
YY_RULE_SETUP
#line 324 "src/mesa/program/program_lexer.l"
-{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); }
+{ return_token_or_IDENTIFIER(GL_FALSE, TEX_SHADOWRECT); }
YY_BREAK
case 135:
YY_RULE_SETUP
yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex program header");
}
state->mode = ARB_fragment;
-
- state->option.TexRect =
- (state->ctx->Extensions.NV_texture_rectangle != GL_FALSE);
}
break;
{ (yyval.integer) = TEXTURE_CUBE_INDEX; }
break;
- case 39:
-
-/* Line 1806 of yacc.c */
-#line 528 "src/mesa/program/program_parse.y"
- { (yyval.integer) = TEXTURE_RECT_INDEX; }
- break;
-
case 40:
/* Line 1806 of yacc.c */
{ (yyval.integer) = -TEXTURE_2D_INDEX; }
break;
- case 42:
-
-/* Line 1806 of yacc.c */
-#line 531 "src/mesa/program/program_parse.y"
- { (yyval.integer) = -TEXTURE_RECT_INDEX; }
- break;
-
case 43:
/* Line 1806 of yacc.c */
if (is_exact)
goto done;
- if (!state->es_shader && f->has_user_signature()) {
+ if (f->has_user_signature()) {
/* In desktop GL, the presence of a user-defined signature hides any
* built-in signatures, so we must ignore them. In contrast, in ES2
* user-defined signatures add new overloads, so we must proceed.
}
}
}
- } else if (state->es_shader) {
- /* Section 10.17 of the GLSL ES 1.00 specification states that unsized
- * array declarations have been removed from the language.
- */
- _mesa_glsl_error(loc, state, "unsized array declarations are not "
- "allowed in GLSL ES 1.00.");
}
return glsl_type::get_array_instance(base, length);
if (this->type->specifier->precision != ast_precision_none
&& !var->type->is_float()
&& !var->type->is_integer()
- && !(var->type->is_sampler() && state->es_shader)
&& !(var->type->is_array()
&& (var->type->fields.array->is_float()
|| var->type->fields.array->is_integer()))) {
_mesa_glsl_error(&loc, state,
"precision qualifiers apply only to floating point"
- "%s types", state->es_shader ? ", integer, and sampler"
- : "and integer");
+ "and integer types");
}
/* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
* that the previously seen signature does not have an associated definition.
*/
f = state->symbols->get_function(name);
- if (f != NULL && (state->es_shader || f->has_user_signature())) {
+ if (f != NULL && f->has_user_signature()) {
sig = f->exact_matching_signature(&hir_parameters);
if (sig != NULL) {
const char *badvar = sig->qualifiers_match(&hir_parameters);
decl_list->type->specifier->hir(instructions, state);
- /* Section 10.9 of the GLSL ES 1.00 specification states that
- * embedded structure definitions have been removed from the language.
- */
- if (state->es_shader && decl_list->type->specifier->structure != NULL) {
- YYLTYPE loc = this->get_location();
- _mesa_glsl_error(&loc, state, "Embedded structure definitions are "
- "not allowed in GLSL ES 1.00.");
- }
-
const glsl_type *decl_type =
decl_list->type->specifier->glsl_type(& type_name, state);
const glsl_type *const glsl_type::uvec4_type = & builtin_130_types[3];
/*@}*/
-/** \name Sampler types added by GL_ARB_texture_rectangle
- */
-/*@{*/
-
-const glsl_type glsl_type::builtin_ARB_texture_rectangle_types[] = {
- glsl_type(GL_SAMPLER_2D_RECT,
- GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT, "sampler2DRect"),
- glsl_type(GL_SAMPLER_2D_RECT_SHADOW,
- GLSL_SAMPLER_DIM_RECT, 1, 0, GLSL_TYPE_FLOAT, "sampler2DRectShadow"),
-};
-/*@}*/
-
/** \name Sampler types added by GL_EXT_texture_array
*/
/*@{*/
/* Add pre-defined macros. */
add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
- add_builtin_define(parser, "GL_ARB_texture_rectangle", 1);
if (extensions != NULL) {
if (extensions->EXT_texture_array) {
/* Set default language version and extensions */
this->language_version = 110;
- this->es_shader = false;
- this->ARB_texture_rectangle_enable = true;
this->extensions = &ctx->Extensions;
* Core context is supported, this logic will need change. Older versions of
* GLSL are no longer supported outside the compatibility contexts of 3.x.
*/
- this->Const.GLSL_100ES = ctx->Extensions.ARB_ES2_compatibility;
this->Const.GLSL_110 = true;
this->Const.GLSL_120 = (ctx->Const.GLSLVersion >= 120);
this->Const.GLSL_130 = (ctx->Const.GLSLVersion >= 130);
- const unsigned lowest_version = ctx->Extensions.ARB_ES2_compatibility ? 100 : 110;
+ const unsigned lowest_version = 110;
const unsigned highest_version = ctx->Const.GLSLVersion;
char *supported = ralloc_strdup(this, "");
EXT(ARB_conservative_depth, false, false, true, true, false, ARB_conservative_depth),
EXT(ARB_draw_buffers, false, false, true, true, false, dummy_true),
EXT(ARB_draw_instanced, true, false, false, true, false, ARB_draw_instanced),
- EXT(ARB_texture_rectangle, true, false, true, true, false, dummy_true),
EXT(EXT_texture_array, true, false, true, true, false, EXT_texture_array),
EXT(ARB_shader_texture_lod, true, false, true, true, false, ARB_shader_texture_lod),
EXT(ARB_shader_stencil_export, false, false, true, true, false, ARB_shader_stencil_export),
/* Check that this extension matches whether we are compiling
* for desktop GL or GLES.
*/
- if (state->es_shader) {
- if (!this->avail_in_ES) return false;
- } else {
- if (!this->avail_in_GL) return false;
- }
+ if (!this->avail_in_GL) return false;
/* Check that this extension is supported by the OpenGL
* implementation.
exec_list translation_unit;
glsl_symbol_table *symbols;
- bool es_shader;
unsigned language_version;
const char *version_string;
enum _mesa_glsl_parser_targets target;
* supported.
*/
/*@{*/
- unsigned GLSL_100ES:1;
unsigned GLSL_110:1;
unsigned GLSL_120:1;
unsigned GLSL_130:1;
bool ARB_draw_buffers_warn;
bool ARB_draw_instanced_enable;
bool ARB_draw_instanced_warn;
- bool ARB_texture_rectangle_enable;
- bool ARB_texture_rectangle_warn;
bool EXT_texture_array_enable;
bool EXT_texture_array_warn;
bool ARB_shader_texture_lod_enable;
return TEXTURE_3D_INDEX;
case GLSL_SAMPLER_DIM_CUBE:
return TEXTURE_CUBE_INDEX;
- case GLSL_SAMPLER_DIM_RECT:
- return TEXTURE_RECT_INDEX;
case GLSL_SAMPLER_DIM_BUF:
assert(!"FINISHME: Implement ARB_texture_buffer_object");
return TEXTURE_BUFFER_INDEX;
}
-void
-glsl_type::generate_ARB_texture_rectangle_types(glsl_symbol_table *symtab,
- bool warn)
-{
- add_types_to_symbol_table(symtab, builtin_ARB_texture_rectangle_types,
- Elements(builtin_ARB_texture_rectangle_types),
- warn);
-}
-
-
void
glsl_type::generate_EXT_texture_array_types(glsl_symbol_table *symtab,
bool warn)
_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
{
switch (state->language_version) {
- case 100:
- assert(state->es_shader);
- glsl_type::generate_100ES_types(state->symbols);
- break;
case 110:
glsl_type::generate_110_types(state->symbols);
break;
break;
}
- if (state->ARB_texture_rectangle_enable) {
- glsl_type::generate_ARB_texture_rectangle_types(state->symbols,
- state->ARB_texture_rectangle_warn);
- }
if (state->OES_texture_3D_enable && state->language_version == 100) {
glsl_type::generate_OES_texture_3D_types(state->symbols,
state->OES_texture_3D_warn);
static const glsl_type builtin_110_types[];
static const glsl_type builtin_120_types[];
static const glsl_type builtin_130_types[];
- static const glsl_type builtin_ARB_texture_rectangle_types[];
static const glsl_type builtin_EXT_texture_array_types[];
static const glsl_type builtin_EXT_texture_buffer_object_types[];
/*@}*/
static void generate_110_types(glsl_symbol_table *);
static void generate_120_types(glsl_symbol_table *);
static void generate_130_types(glsl_symbol_table *);
- static void generate_ARB_texture_rectangle_types(glsl_symbol_table *, bool);
static void generate_EXT_texture_array_types(glsl_symbol_table *, bool);
static void generate_OES_texture_3D_types(glsl_symbol_table *, bool);
/*@}*/
ctx->Extensions.dummy_false = false;
ctx->Extensions.dummy_true = true;
- ctx->Extensions.ARB_ES2_compatibility = true;
ctx->Extensions.ARB_draw_instanced = true;
ctx->Extensions.EXT_texture_array = true;
- ctx->Extensions.NV_texture_rectangle = true;
ctx->Extensions.EXT_texture3D = true;
ctx->Const.GLSLVersion = 120;
+++ /dev/null
-#######################################################################
-# SConscript for Mesa
-
-
-Import('*')
-import filecmp
-import os
-import subprocess
-
-env = env.Clone()
-
-env.Append(CPPPATH = [
- '#/src/mapi',
- '#/src/glsl',
- '#/src/mesa',
-])
-
-env.Append(CPPDEFINES = [
- 'FEATURE_GL=1',
-])
-
-if env['platform'] == 'windows':
- env.Append(CPPDEFINES = [
- '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
- 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
- ])
- if not env['gles']:
- # prevent _glapi_* from being declared __declspec(dllimport)
- env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
-else:
- env.Append(CPPDEFINES = [
- 'IN_DRI_DRIVER', # enable the remap table (for DRI drivers)
- ])
-
-#
-# Source files
-#
-
-main_sources = [
- 'main/api_arrayelt.c',
- 'main/api_exec.c',
- 'main/api_loopback.c',
- 'main/api_validate.c',
- 'main/accum.c',
- 'main/arbprogram.c',
- 'main/atifragshader.c',
- 'main/attrib.c',
- 'main/arrayobj.c',
- 'main/blend.c',
- 'main/bufferobj.c',
- 'main/buffers.c',
- 'main/clear.c',
- 'main/clip.c',
- 'main/colortab.c',
- 'main/condrender.c',
- 'main/context.c',
- 'main/convolve.c',
- 'main/cpuinfo.c',
- 'main/debug.c',
- 'main/depth.c',
- 'main/dlist.c',
- 'main/dlopen.c',
- 'main/drawpix.c',
- 'main/drawtex.c',
- 'main/enable.c',
- 'main/enums.c',
- 'main/eval.c',
- 'main/execmem.c',
- 'main/extensions.c',
- 'main/fbobject.c',
- 'main/feedback.c',
- 'main/ff_fragment_shader.cpp',
- 'main/ffvertex_prog.c',
- 'main/fog.c',
- 'main/formats.c',
- 'main/format_pack.c',
- 'main/format_unpack.c',
- 'main/framebuffer.c',
- 'main/get.c',
- 'main/getstring.c',
- 'main/hash.c',
- 'main/hint.c',
- 'main/histogram.c',
- 'main/image.c',
- 'main/imports.c',
- 'main/light.c',
- 'main/lines.c',
- 'main/matrix.c',
- 'main/mipmap.c',
- 'main/mm.c',
- 'main/multisample.c',
- 'main/nvprogram.c',
- 'main/pack.c',
- 'main/pbo.c',
- 'main/pixel.c',
- 'main/pixelstore.c',
- 'main/pixeltransfer.c',
- 'main/points.c',
- 'main/polygon.c',
- 'main/querymatrix.c',
- 'main/queryobj.c',
- 'main/rastpos.c',
- 'main/readpix.c',
- 'main/remap.c',
- 'main/renderbuffer.c',
- 'main/samplerobj.c',
- 'main/scissor.c',
- 'main/shaderapi.c',
- 'main/shaderobj.c',
- 'main/shader_query.cpp',
- 'main/shared.c',
- 'main/state.c',
- 'main/stencil.c',
- 'main/syncobj.c',
- 'main/texcompress.c',
- 'main/texcompress_rgtc.c',
- 'main/texcompress_s3tc.c',
- 'main/texcompress_fxt1.c',
- 'main/texcompress_etc.c',
- 'main/texenv.c',
- 'main/texformat.c',
- 'main/texgen.c',
- 'main/texgetimage.c',
- 'main/teximage.c',
- 'main/texobj.c',
- 'main/texpal.c',
- 'main/texparam.c',
- 'main/texstate.c',
- 'main/texstorage.c',
- 'main/texstore.c',
- 'main/texturebarrier.c',
- 'main/transformfeedback.c',
- 'main/uniform_query.cpp',
- 'main/uniforms.c',
- 'main/varray.c',
- 'main/version.c',
- 'main/viewport.c',
- 'main/vtxfmt.c',
-]
-
-math_sources = [
- 'math/m_debug_clip.c',
- 'math/m_debug_norm.c',
- 'math/m_debug_xform.c',
- 'math/m_eval.c',
- 'math/m_matrix.c',
- 'math/m_translate.c',
- 'math/m_vector.c',
- 'math/m_xform.c',
-]
-
-swrast_sources = [
- 'swrast/s_aaline.c',
- 'swrast/s_aatriangle.c',
- 'swrast/s_alpha.c',
- 'swrast/s_atifragshader.c',
- 'swrast/s_bitmap.c',
- 'swrast/s_blend.c',
- 'swrast/s_blit.c',
- 'swrast/s_clear.c',
- 'swrast/s_copypix.c',
- 'swrast/s_context.c',
- 'swrast/s_depth.c',
- 'swrast/s_drawpix.c',
- 'swrast/s_feedback.c',
- 'swrast/s_fog.c',
- 'swrast/s_fragprog.c',
- 'swrast/s_lines.c',
- 'swrast/s_logic.c',
- 'swrast/s_masking.c',
- 'swrast/s_points.c',
- 'swrast/s_renderbuffer.c',
- 'swrast/s_span.c',
- 'swrast/s_stencil.c',
- 'swrast/s_texcombine.c',
- 'swrast/s_texfetch.c',
- 'swrast/s_texfilter.c',
- 'swrast/s_texrender.c',
- 'swrast/s_texture.c',
- 'swrast/s_triangle.c',
- 'swrast/s_zoom.c',
-]
-
-swrast_setup_sources = [
- 'swrast_setup/ss_context.c',
- 'swrast_setup/ss_triangle.c',
-]
-
-tnl_sources = [
- 'tnl/t_context.c',
- 'tnl/t_pipeline.c',
- 'tnl/t_draw.c',
- 'tnl/t_rasterpos.c',
- 'tnl/t_vb_program.c',
- 'tnl/t_vb_render.c',
- 'tnl/t_vb_texgen.c',
- 'tnl/t_vb_texmat.c',
- 'tnl/t_vb_vertex.c',
- 'tnl/t_vb_fog.c',
- 'tnl/t_vb_light.c',
- 'tnl/t_vb_normals.c',
- 'tnl/t_vb_points.c',
- 'tnl/t_vp_build.c',
- 'tnl/t_vertex.c',
- 'tnl/t_vertex_sse.c',
- 'tnl/t_vertex_generic.c',
-]
-
-vbo_sources = [
- 'vbo/vbo_context.c',
- 'vbo/vbo_exec.c',
- 'vbo/vbo_exec_api.c',
- 'vbo/vbo_exec_array.c',
- 'vbo/vbo_exec_draw.c',
- 'vbo/vbo_exec_eval.c',
- 'vbo/vbo_noop.c',
- 'vbo/vbo_rebase.c',
- 'vbo/vbo_split.c',
- 'vbo/vbo_split_copy.c',
- 'vbo/vbo_split_inplace.c',
- 'vbo/vbo_save.c',
- 'vbo/vbo_save_api.c',
- 'vbo/vbo_save_draw.c',
- 'vbo/vbo_save_loopback.c',
-]
-
-statetracker_sources = [
- 'state_tracker/st_atom.c',
- 'state_tracker/st_atom_blend.c',
- 'state_tracker/st_atom_clip.c',
- 'state_tracker/st_atom_constbuf.c',
- 'state_tracker/st_atom_depth.c',
- 'state_tracker/st_atom_framebuffer.c',
- 'state_tracker/st_atom_msaa.c',
- 'state_tracker/st_atom_pixeltransfer.c',
- 'state_tracker/st_atom_sampler.c',
- 'state_tracker/st_atom_scissor.c',
- 'state_tracker/st_atom_shader.c',
- 'state_tracker/st_atom_rasterizer.c',
- 'state_tracker/st_atom_stipple.c',
- 'state_tracker/st_atom_texture.c',
- 'state_tracker/st_atom_viewport.c',
- 'state_tracker/st_cb_bitmap.c',
- 'state_tracker/st_cb_blit.c',
- 'state_tracker/st_cb_bufferobjects.c',
- 'state_tracker/st_cb_clear.c',
- 'state_tracker/st_cb_condrender.c',
- 'state_tracker/st_cb_flush.c',
- 'state_tracker/st_cb_drawpixels.c',
- 'state_tracker/st_cb_drawtex.c',
- 'state_tracker/st_cb_eglimage.c',
- 'state_tracker/st_cb_fbo.c',
- 'state_tracker/st_cb_feedback.c',
- 'state_tracker/st_cb_program.c',
- 'state_tracker/st_cb_queryobj.c',
- 'state_tracker/st_cb_rasterpos.c',
- 'state_tracker/st_cb_readpixels.c',
- 'state_tracker/st_cb_syncobj.c',
- 'state_tracker/st_cb_strings.c',
- 'state_tracker/st_cb_texture.c',
- 'state_tracker/st_cb_texturebarrier.c',
- 'state_tracker/st_cb_viewport.c',
- 'state_tracker/st_cb_xformfb.c',
- 'state_tracker/st_context.c',
- 'state_tracker/st_debug.c',
- 'state_tracker/st_draw.c',
- 'state_tracker/st_draw_feedback.c',
- 'state_tracker/st_extensions.c',
- 'state_tracker/st_format.c',
- 'state_tracker/st_glsl_to_tgsi.cpp',
- 'state_tracker/st_gen_mipmap.c',
- 'state_tracker/st_manager.c',
- 'state_tracker/st_mesa_to_tgsi.c',
- 'state_tracker/st_program.c',
- 'state_tracker/st_texture.c',
-]
-
-env.Append(YACCFLAGS = '-d')
-program_lex = env.CFile('program/lex.yy.c', 'program/program_lexer.l')
-program_parse = env.CFile('program/program_parse.tab.c',
- 'program/program_parse.y')
-
-# Make program/program_parse.tab.h reacheable from the include path
-env.Append(CPPPATH = [Dir('.').abspath])
-
-program_sources = [
- 'program/arbprogparse.c',
- 'program/hash_table.c',
- 'program/ir_to_mesa.cpp',
- 'program/nvfragparse.c',
- 'program/nvvertparse.c',
- 'program/program.c',
- 'program/program_parse_extra.c',
- 'program/prog_cache.c',
- 'program/prog_execute.c',
- 'program/prog_instruction.c',
- 'program/prog_noise.c',
- 'program/prog_optimize.c',
- 'program/prog_opt_constant_fold.c',
- 'program/prog_parameter.c',
- 'program/prog_parameter_layout.c',
- 'program/prog_print.c',
- 'program/prog_statevars.c',
- 'program/programopt.c',
- 'program/sampler.cpp',
- 'program/symbol_table.c',
- 'program/string_to_uint_map.cpp',
- program_lex,
- program_parse[0],
-]
-
-common_driver_sources = [
- 'drivers/common/driverfuncs.c',
- 'drivers/common/meta.c',
-]
-
-mesa_sources = (
- main_sources +
- math_sources +
- program_sources +
- vbo_sources +
- tnl_sources +
- swrast_sources +
- swrast_setup_sources +
- common_driver_sources +
- statetracker_sources
-)
-
-if env['gles']:
- from sys import executable as python_cmd
-
- env.Append(CPPDEFINES = ['FEATURE_ES1=1', 'FEATURE_ES2=1'])
-
- # generate GLES sources
- gles_sources = []
- gles_sources += env.CodeGenerate(
- target = 'main/api_exec_es1.c',
- script = 'main/es_generator.py',
- source = 'main/APIspec.xml',
- command = python_cmd + ' $SCRIPT -S $SOURCE -V GLES1.1 > $TARGET'
- )
- gles_sources += env.CodeGenerate(
- target = 'main/api_exec_es2.c',
- script = 'main/es_generator.py',
- source = 'main/APIspec.xml',
- command = python_cmd + ' $SCRIPT -S $SOURCE -V GLES2.0 > $TARGET'
- )
-
- # generate GLES headers
- GLAPI = '#src/mapi/glapi/'
- gles_headers = []
- gles_headers += env.CodeGenerate(
- target = 'main/api_exec_es1_dispatch.h',
- script = GLAPI + 'gen/gl_table.py',
- source = GLAPI + 'gen/gl_and_es_API.xml',
- command = python_cmd + ' $SCRIPT -c es1 -m remap_table -f $SOURCE > $TARGET',
- )
- gles_headers += env.CodeGenerate(
- target = 'main/api_exec_es1_remap_helper.h',
- script = GLAPI + 'gen/remap_helper.py',
- source = GLAPI + 'gen/gl_and_es_API.xml',
- command = python_cmd + ' $SCRIPT -c es1 -f $SOURCE > $TARGET',
- )
- gles_headers += env.CodeGenerate(
- target = 'main/api_exec_es2_dispatch.h',
- script = GLAPI + 'gen/gl_table.py',
- source = GLAPI + 'gen/gl_and_es_API.xml',
- command = python_cmd + ' $SCRIPT -c es2 -m remap_table -f $SOURCE > $TARGET',
- )
- gles_headers += env.CodeGenerate(
- target = 'main/api_exec_es2_remap_helper.h',
- script = GLAPI + 'gen/remap_helper.py',
- source = GLAPI + 'gen/gl_and_es_API.xml',
- command = python_cmd + ' $SCRIPT -c es2 -f $SOURCE > $TARGET',
- )
-
- env.Depends(gles_sources, gles_headers)
-
- # gles_sources #include gles_headers with full path
- env.Append(CPPPATH = [gles_headers[0].dir.up().up()])
-
- mesa_sources += gles_sources
-
-#
-# Assembly sources
-#
-if env['gcc'] and env['platform'] != 'windows':
- if env['machine'] == 'x86':
- env.Append(CPPDEFINES = [
- 'USE_X86_ASM',
- 'USE_MMX_ASM',
- 'USE_3DNOW_ASM',
- 'USE_SSE_ASM',
- ])
- mesa_sources += [
- 'x86/common_x86.c',
- 'x86/x86_xform.c',
- 'x86/3dnow.c',
- 'x86/sse.c',
- 'x86/common_x86_asm.S',
- 'x86/x86_xform2.S',
- 'x86/x86_xform3.S',
- 'x86/x86_xform4.S',
- 'x86/x86_cliptest.S',
- 'x86/mmx_blend.S',
- 'x86/3dnow_xform1.S',
- 'x86/3dnow_xform2.S',
- 'x86/3dnow_xform3.S',
- 'x86/3dnow_xform4.S',
- 'x86/3dnow_normal.S',
- 'x86/sse_xform1.S',
- 'x86/sse_xform2.S',
- 'x86/sse_xform3.S',
- 'x86/sse_xform4.S',
- 'x86/sse_normal.S',
- 'x86/read_rgba_span_x86.S',
- ]
- elif env['machine'] == 'x86_64':
- env.Append(CPPDEFINES = [
- 'USE_X86_64_ASM',
- ])
- mesa_sources += [
- 'x86-64/x86-64.c',
- 'x86-64/xform4.S',
- ]
- elif env['machine'] == 'ppc':
- env.Append(CPPDEFINES = [
- 'USE_PPC_ASM',
- 'USE_VMX_ASM',
- ])
- mesa_sources += [
- 'ppc/common_ppc.c',
- ]
- elif env['machine'] == 'sparc':
- mesa_sources += [
- 'sparc/sparc.c',
- 'sparc/clip.S',
- 'sparc/norm.S',
- 'sparc/xform.S',
- ]
- else:
- pass
-
- # Generate matypes.h
- if env['machine'] in ('x86', 'x86_64'):
- # See http://www.scons.org/wiki/UsingCodeGenerators
- gen_matypes = env.Program(
- target = 'gen_matypes',
- source = 'x86/gen_matypes.c',
- )
- matypes = env.Command(
- 'matypes.h',
- gen_matypes,
- gen_matypes[0].abspath + ' > $TARGET',
- )
- # Add the dir containing the generated header (somewhere inside the
- # build dir) to the include path
- env.Append(CPPPATH = [matypes[0].dir])
-
-
-
-
-def write_git_sha1_h_file(filename):
- """Mesa looks for a git_sha1.h file at compile time in order to display
- the current git hash id in the GL_VERSION string. This function tries
- to retrieve the git hashid and write the header file. An empty file
- will be created if anything goes wrong."""
-
- args = [ 'git', 'log', '-n', '1', '--oneline' ]
- try:
- (commit, foo) = subprocess.Popen(args, stdout=subprocess.PIPE).communicate()
- except:
- # git log command didn't work
- if not os.path.exists(filename):
- # create an empty file if none already exists
- f = open(filename, "w")
- f.close()
- return
-
- commit = '#define MESA_GIT_SHA1 "git-%s"\n' % commit[0:7]
- tempfile = "git_sha1.h.tmp"
- f = open(tempfile, "w")
- f.write(commit)
- f.close()
- if not os.path.exists(filename) or not filecmp.cmp(tempfile, filename):
- # The filename does not exist or it's different from the new file,
- # so replace old file with new.
- if os.path.exists(filename):
- os.remove(filename)
- os.rename(tempfile, filename)
- return
-
-
-# Create the git_sha1.h header file
-write_git_sha1_h_file("main/git_sha1.h")
-# and update CPPPATH so the git_sha1.h header can be found
-env.Append(CPPPATH = ["#" + env['build_dir'] + "/mesa/main"])
-
-
-#
-# Libraries
-#
-
-mesa = env.ConvenienceLibrary(
- target = 'mesa',
- source = mesa_sources,
-)
-
-env.Alias('mesa', mesa)
-
-Export('mesa')
-
-SConscript('drivers/SConscript')
#include "main/readpix.h"
#include "main/renderbuffer.h"
#include "main/shaderobj.h"
-#include "main/texcompress.h"
#include "main/texformat.h"
#include "main/texgetimage.h"
#include "main/teximage.h"
driver->TexSubImage1D = _mesa_store_texsubimage1d;
driver->TexSubImage2D = _mesa_store_texsubimage2d;
driver->TexSubImage3D = _mesa_store_texsubimage3d;
- driver->GetTexImage = _mesa_meta_GetTexImage;
+ driver->GetTexImage = _mesa_get_teximage;
driver->CopyTexSubImage1D = _mesa_meta_CopyTexSubImage1D;
driver->CopyTexSubImage2D = _mesa_meta_CopyTexSubImage2D;
driver->CopyTexSubImage3D = _mesa_meta_CopyTexSubImage3D;
driver->GenerateMipmap = _mesa_meta_GenerateMipmap;
driver->TestProxyTexImage = _mesa_test_proxy_teximage;
- driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d;
- driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d;
- driver->CompressedTexImage3D = _mesa_store_compressed_teximage3d;
- driver->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d;
- driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d;
- driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d;
- driver->GetCompressedTexImage = _mesa_get_compressed_teximage;
driver->BindTexture = NULL;
driver->NewTextureObject = _mesa_new_texture_object;
driver->DeleteTexture = _mesa_delete_texture_object;
ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled);
ctx->Driver.Enable(ctx, GL_TEXTURE_1D, GL_FALSE);
ctx->Driver.Enable(ctx, GL_TEXTURE_2D, GL_FALSE);
- ctx->Driver.Enable(ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE);
ctx->Driver.Enable(ctx, GL_TEXTURE_3D, GL_FALSE);
ctx->Driver.Enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
struct temp_texture
{
GLuint TexObj;
- GLenum Target; /**< GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE */
+ GLenum Target; /**< GL_TEXTURE_2D */
GLsizei MinSize; /**< Min texture size to allocate */
GLsizei MaxSize; /**< Max possible texture size */
GLboolean NPOT; /**< Non-power of two size OK? */
_mesa_set_enable(ctx, GL_TEXTURE_3D, GL_FALSE);
if (ctx->Extensions.ARB_texture_cube_map)
_mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
- if (ctx->Extensions.NV_texture_rectangle)
- _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE);
_mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE);
_mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_FALSE);
_mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_FALSE);
static void
init_temp_texture(struct gl_context *ctx, struct temp_texture *tex)
{
- /* prefer texture rectangle */
- if (ctx->Extensions.NV_texture_rectangle) {
- tex->Target = GL_TEXTURE_RECTANGLE;
- tex->MaxSize = ctx->Const.MaxTextureRectSize;
- tex->NPOT = GL_TRUE;
- }
- else {
- /* use 2D texture, NPOT if possible */
- tex->Target = GL_TEXTURE_2D;
- tex->MaxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
- tex->NPOT = ctx->Extensions.ARB_texture_non_power_of_two;
- }
+ /* use 2D texture, NPOT if possible */
+ tex->Target = GL_TEXTURE_2D;
+ tex->MaxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
+ tex->NPOT = ctx->Extensions.ARB_texture_non_power_of_two;
tex->MinSize = 16; /* 16 x 16 at least */
assert(tex->MaxSize > 0);
}
/* compute texcoords */
- if (tex->Target == GL_TEXTURE_RECTANGLE) {
- tex->Sright = (GLfloat) width;
- tex->Ttop = (GLfloat) height;
- }
- else {
- tex->Sright = (GLfloat) width / tex->Width;
- tex->Ttop = (GLfloat) height / tex->Height;
- }
+ tex->Sright = (GLfloat) width / tex->Width;
+ tex->Ttop = (GLfloat) height / tex->Height;
return newTex;
}
"END \n";
char program2[200];
struct blit_state *blit = &ctx->Meta->Blit;
- struct temp_texture *tex = get_temp_texture(ctx);
const char *texTarget;
assert(blit->DepthFP == 0);
/* replace %s with "RECT" or "2D" */
assert(strlen(program) + 4 < sizeof(program2));
- if (tex->Target == GL_TEXTURE_RECTANGLE)
- texTarget = "RECT";
- else
- texTarget = "2D";
+ texTarget = "2D";
_mesa_snprintf(program2, sizeof(program2), program, texTarget);
_mesa_GenPrograms(1, &blit->DepthFP);
return mask;
}
- if (target != GL_TEXTURE_2D && target != GL_TEXTURE_RECTANGLE_ARB) {
+ if (target != GL_TEXTURE_2D) {
/* Can't handle other texture types at this time */
return mask;
}
_mesa_BindTexture(target, texObj->Name);
_mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, filter);
_mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, filter);
- if (target != GL_TEXTURE_RECTANGLE_ARB) {
- _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, srcLevel);
- _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel);
- }
+ _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, srcLevel);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
struct vertex verts[4];
GLfloat s0, t0, s1, t1;
- if (target == GL_TEXTURE_2D) {
- const struct gl_texture_image *texImage
- = _mesa_select_tex_image(ctx, texObj, target, srcLevel);
- s0 = srcX0 / (float) texImage->Width;
- s1 = srcX1 / (float) texImage->Width;
- t0 = srcY0 / (float) texImage->Height;
- t1 = srcY1 / (float) texImage->Height;
- }
- else {
- assert(target == GL_TEXTURE_RECTANGLE_ARB);
- s0 = srcX0;
- s1 = srcX1;
- t0 = srcY0;
- t1 = srcY1;
- }
+ const struct gl_texture_image *texImage
+ = _mesa_select_tex_image(ctx, texObj, target, srcLevel);
+ s0 = srcX0 / (float) texImage->Width;
+ s1 = srcX1 / (float) texImage->Width;
+ t0 = srcY0 / (float) texImage->Height;
+ t1 = srcY1 / (float) texImage->Height;
verts[0].x = (GLfloat) dstX0;
verts[0].y = (GLfloat) dstY0;
*/
_mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilterSave);
_mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilterSave);
- if (target != GL_TEXTURE_RECTANGLE_ARB) {
- _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave);
- _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
- }
+ _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, wrapSSave);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, wrapTSave);
if (ctx->Extensions.EXT_framebuffer_sRGB && fbo_srgb_save) {
"END \n";
char program2[1000];
struct drawpix_state *drawpix = &ctx->Meta->DrawPix;
- struct temp_texture *tex = get_temp_texture(ctx);
const char *texTarget;
assert(drawpix->StencilFP == 0);
/* replace %s with "RECT" or "2D" */
assert(strlen(program) + 4 < sizeof(program2));
- if (tex->Target == GL_TEXTURE_RECTANGLE)
- texTarget = "RECT";
- else
- texTarget = "2D";
+ texTarget = "2D";
_mesa_snprintf(program2, sizeof(program2), program, texTarget);
_mesa_GenPrograms(1, &drawpix->StencilFP);
"END \n";
char program2[200];
struct drawpix_state *drawpix = &ctx->Meta->DrawPix;
- struct temp_texture *tex = get_temp_texture(ctx);
const char *texTarget;
assert(drawpix->DepthFP == 0);
/* replace %s with "RECT" or "2D" */
assert(strlen(program) + 4 < sizeof(program2));
- if (tex->Target == GL_TEXTURE_RECTANGLE)
- texTarget = "RECT";
- else
- texTarget = "2D";
+ texTarget = "2D";
_mesa_snprintf(program2, sizeof(program2), program, texTarget);
_mesa_GenPrograms(1, &drawpix->DepthFP);
srcLevel = texObj->BaseLevel;
baseImage = _mesa_select_tex_image(ctx, texObj, target, srcLevel);
- if (!baseImage || _mesa_is_format_compressed(baseImage->TexFormat)) {
+ if (!baseImage) {
return GL_TRUE;
}
coords3[1] = 1.0F;
coords3[2] = r;
break;
- case GL_TEXTURE_RECTANGLE_ARB:
- coords0[0] = 0.0F; /* s */
- coords0[1] = 0.0F; /* t */
- coords0[2] = 0.0F; /* r */
- coords1[0] = width;
- coords1[1] = 0.0F;
- coords1[2] = 0.0F;
- coords2[0] = width;
- coords2[1] = height;
- coords2[2] = 0.0F;
- coords3[0] = 0.0F;
- coords3[1] = height;
- coords3[2] = 0.0F;
- break;
case GL_TEXTURE_1D_ARRAY:
coords0[0] = 0.0F; /* s */
coords0[1] = slice; /* t */
copy_tex_sub_image(ctx, 3, texImage, xoffset, yoffset, zoffset,
rb, x, y, width, height);
}
-
-
-/**
- * Decompress a texture image by drawing a quad with the compressed
- * texture and reading the pixels out of the color buffer.
- * \param slice which slice of a 3D texture or layer of a 1D/2D texture
- * \param destFormat format, ala glReadPixels
- * \param destType type, ala glReadPixels
- * \param dest destination buffer
- * \param destRowLength dest image rowLength (ala GL_PACK_ROW_LENGTH)
- */
-static void
-decompress_texture_image(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- GLuint slice,
- GLenum destFormat, GLenum destType,
- GLvoid *dest)
-{
- struct decompress_state *decompress = &ctx->Meta->Decompress;
- struct gl_texture_object *texObj = texImage->TexObject;
- const GLint width = texImage->Width;
- const GLint height = texImage->Height;
- const GLenum target = texObj->Target;
- GLenum faceTarget;
- struct vertex {
- GLfloat x, y, tex[3];
- };
- struct vertex verts[4];
- GLuint fboDrawSave, fboReadSave;
- GLuint rbSave;
-
- if (slice > 0) {
- assert(target == GL_TEXTURE_3D ||
- target == GL_TEXTURE_2D_ARRAY);
- }
-
- if (target == GL_TEXTURE_CUBE_MAP) {
- faceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage->Face;
- }
- else {
- faceTarget = target;
- }
-
- /* save fbo bindings (not saved by _mesa_meta_begin()) */
- fboDrawSave = ctx->DrawBuffer->Name;
- fboReadSave = ctx->ReadBuffer->Name;
- rbSave = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0;
-
- _mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_PIXEL_STORE);
-
- /* Create/bind FBO/renderbuffer */
- if (decompress->FBO == 0) {
- _mesa_GenFramebuffersEXT(1, &decompress->FBO);
- _mesa_GenRenderbuffersEXT(1, &decompress->RBO);
- _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, decompress->FBO);
- _mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, decompress->RBO);
- _mesa_FramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
- GL_COLOR_ATTACHMENT0_EXT,
- GL_RENDERBUFFER_EXT,
- decompress->RBO);
- }
- else {
- _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, decompress->FBO);
- }
-
- /* alloc dest surface */
- if (width > decompress->Width || height > decompress->Height) {
- _mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, decompress->RBO);
- _mesa_RenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA,
- width, height);
- decompress->Width = width;
- decompress->Height = height;
- }
-
- /* setup VBO data */
- if (decompress->ArrayObj == 0) {
- /* create vertex array object */
- _mesa_GenVertexArrays(1, &decompress->ArrayObj);
- _mesa_BindVertexArray(decompress->ArrayObj);
-
- /* create vertex array buffer */
- _mesa_GenBuffersARB(1, &decompress->VBO);
- _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, decompress->VBO);
- _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts),
- NULL, GL_DYNAMIC_DRAW_ARB);
-
- /* setup vertex arrays */
- _mesa_VertexPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
- _mesa_TexCoordPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(tex));
- _mesa_EnableClientState(GL_VERTEX_ARRAY);
- _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
- }
- else {
- _mesa_BindVertexArray(decompress->ArrayObj);
- _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, decompress->VBO);
- }
-
- setup_texture_coords(faceTarget, slice, width, height,
- verts[0].tex,
- verts[1].tex,
- verts[2].tex,
- verts[3].tex);
-
- /* setup vertex positions */
- verts[0].x = 0.0F;
- verts[0].y = 0.0F;
- verts[1].x = width;
- verts[1].y = 0.0F;
- verts[2].x = width;
- verts[2].y = height;
- verts[3].x = 0.0F;
- verts[3].y = height;
-
- /* upload new vertex data */
- _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
-
- /* setup texture state */
- _mesa_BindTexture(target, texObj->Name);
- _mesa_set_enable(ctx, target, GL_TRUE);
-
- {
- /* save texture object state */
- const GLenum minFilterSave = texObj->Sampler.MinFilter;
- const GLenum magFilterSave = texObj->Sampler.MagFilter;
- const GLint baseLevelSave = texObj->BaseLevel;
- const GLint maxLevelSave = texObj->MaxLevel;
- const GLenum wrapSSave = texObj->Sampler.WrapS;
- const GLenum wrapTSave = texObj->Sampler.WrapT;
-
- /* restrict sampling to the texture level of interest */
- _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, texImage->Level);
- _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, texImage->Level);
- /* nearest filtering */
- _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-
- if (ctx->Extensions.EXT_framebuffer_sRGB) {
- _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
- }
-
- /* render quad w/ texture into renderbuffer */
- _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- /* Restore texture object state, the texture binding will
- * be restored by _mesa_meta_end().
- */
- _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilterSave);
- _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilterSave);
- if (target != GL_TEXTURE_RECTANGLE_ARB) {
- _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave);
- _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
- }
- _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, wrapSSave);
- _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, wrapTSave);
- }
-
- /* read pixels from renderbuffer */
- {
- GLenum baseTexFormat = texImage->_BaseFormat;
-
- /* The pixel transfer state will be set to default values at this point
- * (see MESA_META_PIXEL_TRANSFER) so pixel transfer ops are effectively
- * turned off (as required by glGetTexImage) but we need to handle some
- * special cases. In particular, single-channel texture values are
- * returned as red and two-channel texture values are returned as
- * red/alpha.
- */
- if (baseTexFormat == GL_LUMINANCE ||
- baseTexFormat == GL_LUMINANCE_ALPHA ||
- baseTexFormat == GL_INTENSITY) {
- /* Green and blue must be zero */
- _mesa_PixelTransferf(GL_GREEN_SCALE, 0.0f);
- _mesa_PixelTransferf(GL_BLUE_SCALE, 0.0f);
- }
-
- _mesa_ReadPixels(0, 0, width, height, destFormat, destType, dest);
- }
-
- /* disable texture unit */
- _mesa_set_enable(ctx, target, GL_FALSE);
-
- _mesa_meta_end(ctx);
-
- /* restore fbo bindings */
- if (fboDrawSave == fboReadSave) {
- _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboDrawSave);
- }
- else {
- _mesa_BindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fboDrawSave);
- _mesa_BindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, fboReadSave);
- }
- _mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, rbSave);
-}
-
-
-/**
- * This is just a wrapper around _mesa_get_tex_image() and
- * decompress_texture_image(). Meta functions should not be directly called
- * from core Mesa.
- */
-void
-_mesa_meta_GetTexImage(struct gl_context *ctx,
- GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_image *texImage)
-{
- /* We can only use the decompress-with-blit method here if the texels are
- * unsigned, normalized values. We could handle signed and unnormalized
- * with floating point renderbuffers...
- */
- if (_mesa_is_format_compressed(texImage->TexFormat) &&
- _mesa_get_format_datatype(texImage->TexFormat)
- == GL_UNSIGNED_NORMALIZED) {
- struct gl_texture_object *texObj = texImage->TexObject;
- const GLuint slice = 0; /* only 2D compressed textures for now */
- /* Need to unlock the texture here to prevent deadlock... */
- _mesa_unlock_texture(ctx, texObj);
- decompress_texture_image(ctx, texImage, slice, format, type, pixels);
- /* ... and relock it */
- _mesa_lock_texture(ctx, texObj);
- }
- else {
- _mesa_get_teximage(ctx, format, type, pixels, texImage);
- }
-}
GLint x, GLint y,
GLsizei width, GLsizei height);
-extern void
-_mesa_meta_GetTexImage(struct gl_context *ctx,
- GLenum format, GLenum type, GLvoid *pixels,
- struct gl_texture_image *texImage);
-
#endif /* META_H */
shared.c
state.c
stencil.c
- texcompress.c
- texcompress_rgtc.c
- texcompress_s3tc.c
- texcompress_fxt1.c
texenv.c
texformat.c
texgen.c
const struct _glapi_table * const disp = GET_DISPATCH();
GLboolean do_map;
- /* If PrimitiveRestart is enabled and the index is the RestartIndex
- * then we call PrimitiveRestartNV and return.
- */
- if (ctx->Array.PrimitiveRestart && (elt == ctx->Array.RestartIndex)) {
- CALL_PrimitiveRestartNV((struct _glapi_table *)disp, ());
- return;
- }
-
if (actx->NewState) {
assert(!actx->mapped_vbos);
_ae_update_state( ctx );
SET_PointParameterfvEXT(exec, _mesa_PointParameterfv);
#endif
- /* 95. GL_ARB_ES2_compatibility */
- SET_ClearDepthf(exec, _mesa_ClearDepthf);
- SET_DepthRangef(exec, _mesa_DepthRangef);
-
/* 97. GL_EXT_compiled_vertex_array */
#if _HAVE_FULL_GL
SET_LockArraysEXT(exec, _mesa_LockArraysEXT);
SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT);
#endif
- /* 285. GL_NV_primitive_restart */
- SET_PrimitiveRestartIndexNV(exec, _mesa_PrimitiveRestartIndex);
-
/* ???. GL_EXT_depth_bounds_test */
SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
SET_SampleCoverageARB(exec, _mesa_SampleCoverageARB);
#endif
- /* ARB 12. GL_ARB_texture_compression */
-#if _HAVE_FULL_GL
- SET_CompressedTexImage3DARB(exec, _mesa_CompressedTexImage3DARB);
- SET_CompressedTexImage2DARB(exec, _mesa_CompressedTexImage2DARB);
- SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB);
- SET_CompressedTexSubImage3DARB(exec, _mesa_CompressedTexSubImage3DARB);
- SET_CompressedTexSubImage2DARB(exec, _mesa_CompressedTexSubImage2DARB);
- SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB);
- SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB);
-
- /* ARB 104. GL_ARB_robustness */
- SET_GetnCompressedTexImageARB(exec, _mesa_GetnCompressedTexImageARB);
-#endif
-
/* ARB 14. GL_ARB_point_parameters */
/* reuse EXT_point_parameters functions */
_mesa_set_enable(ctx, GL_TEXTURE_1D, !!(enabled & TEXTURE_1D_BIT));
_mesa_set_enable(ctx, GL_TEXTURE_2D, !!(enabled & TEXTURE_2D_BIT));
_mesa_set_enable(ctx, GL_TEXTURE_3D, !!(enabled & TEXTURE_3D_BIT));
- if (ctx->Extensions.NV_texture_rectangle) {
- _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_ARB,
- !!(enabled & TEXTURE_RECT_BIT));
- }
if (ctx->Extensions.ARB_texture_cube_map) {
_mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP,
!!(enabled & TEXTURE_CUBE_BIT));
_mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB,
!!(unit->Enabled & TEXTURE_CUBE_BIT));
}
- if (ctx->Extensions.NV_texture_rectangle) {
- _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_NV,
- !!(unit->Enabled & TEXTURE_RECT_BIT));
- }
if (ctx->Extensions.MESA_texture_array) {
_mesa_set_enable(ctx, GL_TEXTURE_1D_ARRAY_EXT,
!!(unit->Enabled & TEXTURE_1D_ARRAY_BIT));
!ctx->Extensions.ARB_texture_cube_map) {
continue;
}
- else if (obj->Target == GL_TEXTURE_RECTANGLE_NV &&
- !ctx->Extensions.NV_texture_rectangle) {
- continue;
- }
else if ((obj->Target == GL_TEXTURE_1D_ARRAY_EXT ||
obj->Target == GL_TEXTURE_2D_ARRAY_EXT) &&
!ctx->Extensions.MESA_texture_array) {
_mesa_TexParameterf(target, GL_TEXTURE_LOD_BIAS, samp->LodBias);
_mesa_TexParameterf(target, GL_TEXTURE_PRIORITY, obj->Priority);
_mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, obj->BaseLevel);
- if (target != GL_TEXTURE_RECTANGLE_ARB)
- _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, obj->MaxLevel);
+ _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, obj->MaxLevel);
if (ctx->Extensions.EXT_texture_filter_anisotropic) {
_mesa_TexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT,
samp->MaxAnisotropy);
dest->ActiveTexture = src->ActiveTexture;
dest->LockFirst = src->LockFirst;
dest->LockCount = src->LockCount;
- dest->PrimitiveRestart = src->PrimitiveRestart;
- dest->RestartIndex = src->RestartIndex;
/* skip NewState */
/* skip RebindArrays */
static void
updated_drawbuffers(struct gl_context *ctx)
{
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
- if (!ctx->Extensions.ARB_ES2_compatibility) {
- struct gl_framebuffer *fb = ctx->DrawBuffer;
-
- /* Flag the FBO as requiring validation. */
- if (fb->Name != 0) {
- fb->_Status = 0;
- }
+ /* Flag the FBO as requiring validation. */
+ if (fb->Name != 0) {
+ fb->_Status = 0;
}
}
/** Number of cube texture mipmap levels - GL_ARB_texture_cube_map */
#define MAX_CUBE_TEXTURE_LEVELS 15
-/** Maximum rectangular texture size - GL_NV_texture_rectangle */
-#define MAX_TEXTURE_RECT_SIZE 16384
-
/** Maximum number of layers in a 1D or 2D array texture - GL_MESA_texture_array */
#define MAX_ARRAY_TEXTURE_LAYERS 64
#define MAX_TEXTURE_LEVELS 13
#define MAX_3D_TEXTURE_LEVELS 9
#define MAX_CUBE_TEXTURE_LEVELS 13
-#define MAX_TEXTURE_RECT_SIZE 4096
#define MAX_WIDTH 4096
#define MAX_HEIGHT 4096
#endif
#include "simple_list.h"
#include "state.h"
#include "stencil.h"
-#include "texcompress_s3tc.h"
#include "texstate.h"
#include "mtypes.h"
#include "varray.h"
prog->MaxNativeTemps = 0;
prog->MaxNativeAddressRegs = 0;
prog->MaxNativeParameters = 0;
-
- /* Set GLSL datatype range/precision info assuming IEEE float values.
- * Drivers should override these defaults as needed.
- */
- prog->MediumFloat.RangeMin = 127;
- prog->MediumFloat.RangeMax = 127;
- prog->MediumFloat.Precision = 23;
- prog->LowFloat = prog->HighFloat = prog->MediumFloat;
-
- /* Assume ints are stored as floats for now, since this is the least-common
- * denominator. The OpenGL ES spec implies (page 132) that the precision
- * of integer types should be 0. Practically speaking, IEEE
- * single-precision floating point values can only store integers in the
- * range [-0x01000000, 0x01000000] without loss of precision.
- */
- prog->MediumInt.RangeMin = 24;
- prog->MediumInt.RangeMax = 24;
- prog->MediumInt.Precision = 0;
- prog->LowInt = prog->HighInt = prog->MediumInt;
}
ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS;
ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS;
ctx->Const.MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS;
- ctx->Const.MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE;
ctx->Const.MaxArrayTextureLayers = MAX_ARRAY_TEXTURE_LAYERS;
ctx->Const.MaxTextureCoordUnits = MAX_TEXTURE_COORD_UNITS;
ctx->Const.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
assert(ctx->Const.MaxTextureLevels <= MAX_TEXTURE_LEVELS);
assert(ctx->Const.Max3DTextureLevels <= MAX_3D_TEXTURE_LEVELS);
assert(ctx->Const.MaxCubeTextureLevels <= MAX_CUBE_TEXTURE_LEVELS);
- assert(ctx->Const.MaxTextureRectSize <= MAX_TEXTURE_RECT_SIZE);
/* make sure largest texture image is <= MAX_WIDTH in size */
assert((1 << (ctx->Const.MaxTextureLevels - 1)) <= MAX_WIDTH);
if (!_mesa_init_texture( ctx ))
return GL_FALSE;
- _mesa_init_texture_s3tc( ctx );
-
/* Miscellaneous */
ctx->NewState = _NEW_ALL;
ctx->ErrorValue = (GLenum) GL_NO_ERROR;
void (GLAPIENTRYP CallLists)( GLsizei, GLenum, const GLvoid * );
void (GLAPIENTRYP Begin)( GLenum );
void (GLAPIENTRYP End)( void );
- void (GLAPIENTRYP PrimitiveRestartNV)( void );
/* GL_NV_vertex_program */
void (GLAPIENTRYP VertexAttrib1fNV)( GLuint index, GLfloat x );
void (GLAPIENTRYP VertexAttrib1fvNV)( GLuint index, const GLfloat *v );
{ GL_TEXTURE_2D, "GL_TEXTURE_2D" },
{ GL_TEXTURE_3D, "GL_TEXTURE_3D" },
{ GL_TEXTURE_CUBE_MAP, "GL_TEXTURE_CUBE_MAP" },
- { GL_TEXTURE_RECTANGLE, "GL_TEXTURE_RECTANGLE" },
{ GL_TEXTURE_1D_ARRAY_EXT, "GL_TEXTURE_1D_ARRAY" },
{ GL_TEXTURE_2D_ARRAY_EXT, "GL_TEXTURE_2D_ARRAY" }
};
}
-void GLAPIENTRY
-_mesa_ClearDepthf( GLclampf depth )
-{
- _mesa_ClearDepth(depth);
-}
-
-
void GLAPIENTRY
_mesa_DepthFunc( GLenum func )
{
extern void GLAPIENTRY
_mesa_ClearDepth( GLclampd depth );
-extern void GLAPIENTRY
-_mesa_ClearDepthf( GLclampf depth );
-
extern void GLAPIENTRY
_mesa_DepthFunc( GLenum func );
#define _gloffset_MultTransposeMatrixdARB 443
#define _gloffset_MultTransposeMatrixfARB 444
#define _gloffset_SampleCoverageARB 445
-#define _gloffset_CompressedTexImage1DARB 446
-#define _gloffset_CompressedTexImage2DARB 447
-#define _gloffset_CompressedTexImage3DARB 448
-#define _gloffset_CompressedTexSubImage1DARB 449
-#define _gloffset_CompressedTexSubImage2DARB 450
-#define _gloffset_CompressedTexSubImage3DARB 451
-#define _gloffset_GetCompressedTexImageARB 452
#define _gloffset_DisableVertexAttribArrayARB 453
#define _gloffset_EnableVertexAttribArrayARB 454
#define _gloffset_GetProgramEnvParameterdvARB 455
#define _gloffset_BlendEquationiARB 598
#define _gloffset_BlendFuncSeparateiARB 599
#define _gloffset_BlendFunciARB 600
-#define _gloffset_ClearDepthf 660
-#define _gloffset_DepthRangef 661
-#define _gloffset_GetShaderPrecisionFormat 662
-#define _gloffset_ReleaseShaderCompiler 663
-#define _gloffset_ShaderBinary 664
#define _gloffset_GetGraphicsResetStatusARB 665
#define _gloffset_GetnColorTableARB 666
-#define _gloffset_GetnCompressedTexImageARB 667
#define _gloffset_GetnConvolutionFilterARB 668
#define _gloffset_GetnHistogramARB 669
#define _gloffset_GetnMapdvARB 670
#define _gloffset_ProgramNamedParameter4dvNV 873
#define _gloffset_ProgramNamedParameter4fNV 874
#define _gloffset_ProgramNamedParameter4fvNV 875
-#define _gloffset_PrimitiveRestartIndexNV 876
-#define _gloffset_PrimitiveRestartNV 877
#define _gloffset_DepthBoundsEXT 878
#define _gloffset_BlendEquationSeparateEXT 879
#define _gloffset_BindFramebufferEXT 880
#define MultTransposeMatrixdARB_remap_index 35
#define MultTransposeMatrixfARB_remap_index 36
#define SampleCoverageARB_remap_index 37
-#define CompressedTexImage1DARB_remap_index 38
-#define CompressedTexImage2DARB_remap_index 39
-#define CompressedTexImage3DARB_remap_index 40
-#define CompressedTexSubImage1DARB_remap_index 41
-#define CompressedTexSubImage2DARB_remap_index 42
-#define CompressedTexSubImage3DARB_remap_index 43
-#define GetCompressedTexImageARB_remap_index 44
#define DisableVertexAttribArrayARB_remap_index 45
#define EnableVertexAttribArrayARB_remap_index 46
#define GetProgramEnvParameterdvARB_remap_index 47
#define BlendEquationiARB_remap_index 190
#define BlendFuncSeparateiARB_remap_index 191
#define BlendFunciARB_remap_index 192
-#define ClearDepthf_remap_index 252
-#define DepthRangef_remap_index 253
-#define GetShaderPrecisionFormat_remap_index 254
-#define ReleaseShaderCompiler_remap_index 255
-#define ShaderBinary_remap_index 256
#define GetGraphicsResetStatusARB_remap_index 257
#define GetnColorTableARB_remap_index 258
-#define GetnCompressedTexImageARB_remap_index 259
#define GetnConvolutionFilterARB_remap_index 260
#define GetnHistogramARB_remap_index 261
#define GetnMapdvARB_remap_index 262
#define ProgramNamedParameter4dvNV_remap_index 465
#define ProgramNamedParameter4fNV_remap_index 466
#define ProgramNamedParameter4fvNV_remap_index 467
-#define PrimitiveRestartIndexNV_remap_index 468
-#define PrimitiveRestartNV_remap_index 469
#define DepthBoundsEXT_remap_index 470
#define BlendEquationSeparateEXT_remap_index 471
#define BindFramebufferEXT_remap_index 472
#define _gloffset_MultTransposeMatrixdARB driDispatchRemapTable[MultTransposeMatrixdARB_remap_index]
#define _gloffset_MultTransposeMatrixfARB driDispatchRemapTable[MultTransposeMatrixfARB_remap_index]
#define _gloffset_SampleCoverageARB driDispatchRemapTable[SampleCoverageARB_remap_index]
-#define _gloffset_CompressedTexImage1DARB driDispatchRemapTable[CompressedTexImage1DARB_remap_index]
-#define _gloffset_CompressedTexImage2DARB driDispatchRemapTable[CompressedTexImage2DARB_remap_index]
-#define _gloffset_CompressedTexImage3DARB driDispatchRemapTable[CompressedTexImage3DARB_remap_index]
-#define _gloffset_CompressedTexSubImage1DARB driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index]
-#define _gloffset_CompressedTexSubImage2DARB driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index]
-#define _gloffset_CompressedTexSubImage3DARB driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index]
-#define _gloffset_GetCompressedTexImageARB driDispatchRemapTable[GetCompressedTexImageARB_remap_index]
#define _gloffset_DisableVertexAttribArrayARB driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index]
#define _gloffset_EnableVertexAttribArrayARB driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index]
#define _gloffset_GetProgramEnvParameterdvARB driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index]
#define _gloffset_BlendEquationiARB driDispatchRemapTable[BlendEquationiARB_remap_index]
#define _gloffset_BlendFuncSeparateiARB driDispatchRemapTable[BlendFuncSeparateiARB_remap_index]
#define _gloffset_BlendFunciARB driDispatchRemapTable[BlendFunciARB_remap_index]
-#define _gloffset_ClearDepthf driDispatchRemapTable[ClearDepthf_remap_index]
-#define _gloffset_DepthRangef driDispatchRemapTable[DepthRangef_remap_index]
-#define _gloffset_GetShaderPrecisionFormat driDispatchRemapTable[GetShaderPrecisionFormat_remap_index]
-#define _gloffset_ReleaseShaderCompiler driDispatchRemapTable[ReleaseShaderCompiler_remap_index]
-#define _gloffset_ShaderBinary driDispatchRemapTable[ShaderBinary_remap_index]
#define _gloffset_GetGraphicsResetStatusARB driDispatchRemapTable[GetGraphicsResetStatusARB_remap_index]
#define _gloffset_GetnColorTableARB driDispatchRemapTable[GetnColorTableARB_remap_index]
-#define _gloffset_GetnCompressedTexImageARB driDispatchRemapTable[GetnCompressedTexImageARB_remap_index]
#define _gloffset_GetnConvolutionFilterARB driDispatchRemapTable[GetnConvolutionFilterARB_remap_index]
#define _gloffset_GetnHistogramARB driDispatchRemapTable[GetnHistogramARB_remap_index]
#define _gloffset_GetnMapdvARB driDispatchRemapTable[GetnMapdvARB_remap_index]
#define _gloffset_ProgramNamedParameter4dvNV driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index]
#define _gloffset_ProgramNamedParameter4fNV driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index]
#define _gloffset_ProgramNamedParameter4fvNV driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index]
-#define _gloffset_PrimitiveRestartIndexNV driDispatchRemapTable[PrimitiveRestartIndexNV_remap_index]
-#define _gloffset_PrimitiveRestartNV driDispatchRemapTable[PrimitiveRestartNV_remap_index]
#define _gloffset_DepthBoundsEXT driDispatchRemapTable[DepthBoundsEXT_remap_index]
#define _gloffset_BlendEquationSeparateEXT driDispatchRemapTable[BlendEquationSeparateEXT_remap_index]
#define _gloffset_BindFramebufferEXT driDispatchRemapTable[BindFramebufferEXT_remap_index]
SET_by_offset(disp, _gloffset_SampleCoverageARB, fn);
}
-typedef void (GLAPIENTRYP _glptr_CompressedTexImage1DARB)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
-#define CALL_CompressedTexImage1DARB(disp, parameters) \
- (* GET_CompressedTexImage1DARB(disp)) parameters
-static inline _glptr_CompressedTexImage1DARB GET_CompressedTexImage1DARB(struct _glapi_table *disp) {
- return (_glptr_CompressedTexImage1DARB) (GET_by_offset(disp, _gloffset_CompressedTexImage1DARB));
-}
-
-static inline void SET_CompressedTexImage1DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_CompressedTexImage1DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexImage2DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-#define CALL_CompressedTexImage2DARB(disp, parameters) \
- (* GET_CompressedTexImage2DARB(disp)) parameters
-static inline _glptr_CompressedTexImage2DARB GET_CompressedTexImage2DARB(struct _glapi_table *disp) {
- return (_glptr_CompressedTexImage2DARB) (GET_by_offset(disp, _gloffset_CompressedTexImage2DARB));
-}
-
-static inline void SET_CompressedTexImage2DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_CompressedTexImage2DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexImage3DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-#define CALL_CompressedTexImage3DARB(disp, parameters) \
- (* GET_CompressedTexImage3DARB(disp)) parameters
-static inline _glptr_CompressedTexImage3DARB GET_CompressedTexImage3DARB(struct _glapi_table *disp) {
- return (_glptr_CompressedTexImage3DARB) (GET_by_offset(disp, _gloffset_CompressedTexImage3DARB));
-}
-
-static inline void SET_CompressedTexImage3DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_CompressedTexImage3DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexSubImage1DARB)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
-#define CALL_CompressedTexSubImage1DARB(disp, parameters) \
- (* GET_CompressedTexSubImage1DARB(disp)) parameters
-static inline _glptr_CompressedTexSubImage1DARB GET_CompressedTexSubImage1DARB(struct _glapi_table *disp) {
- return (_glptr_CompressedTexSubImage1DARB) (GET_by_offset(disp, _gloffset_CompressedTexSubImage1DARB));
-}
-
-static inline void SET_CompressedTexSubImage1DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_CompressedTexSubImage1DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexSubImage2DARB)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-#define CALL_CompressedTexSubImage2DARB(disp, parameters) \
- (* GET_CompressedTexSubImage2DARB(disp)) parameters
-static inline _glptr_CompressedTexSubImage2DARB GET_CompressedTexSubImage2DARB(struct _glapi_table *disp) {
- return (_glptr_CompressedTexSubImage2DARB) (GET_by_offset(disp, _gloffset_CompressedTexSubImage2DARB));
-}
-
-static inline void SET_CompressedTexSubImage2DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_CompressedTexSubImage2DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_CompressedTexSubImage3DARB)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-#define CALL_CompressedTexSubImage3DARB(disp, parameters) \
- (* GET_CompressedTexSubImage3DARB(disp)) parameters
-static inline _glptr_CompressedTexSubImage3DARB GET_CompressedTexSubImage3DARB(struct _glapi_table *disp) {
- return (_glptr_CompressedTexSubImage3DARB) (GET_by_offset(disp, _gloffset_CompressedTexSubImage3DARB));
-}
-
-static inline void SET_CompressedTexSubImage3DARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)) {
- SET_by_offset(disp, _gloffset_CompressedTexSubImage3DARB, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetCompressedTexImageARB)(GLenum, GLint, GLvoid *);
-#define CALL_GetCompressedTexImageARB(disp, parameters) \
- (* GET_GetCompressedTexImageARB(disp)) parameters
-static inline _glptr_GetCompressedTexImageARB GET_GetCompressedTexImageARB(struct _glapi_table *disp) {
- return (_glptr_GetCompressedTexImageARB) (GET_by_offset(disp, _gloffset_GetCompressedTexImageARB));
-}
-
-static inline void SET_GetCompressedTexImageARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetCompressedTexImageARB, fn);
-}
-
typedef void (GLAPIENTRYP _glptr_DisableVertexAttribArrayARB)(GLuint);
#define CALL_DisableVertexAttribArrayARB(disp, parameters) \
(* GET_DisableVertexAttribArrayARB(disp)) parameters
SET_by_offset(disp, _gloffset_BlendFunciARB, fn);
}
-typedef void (GLAPIENTRYP _glptr_ClearDepthf)(GLclampf);
-#define CALL_ClearDepthf(disp, parameters) \
- (* GET_ClearDepthf(disp)) parameters
-static inline _glptr_ClearDepthf GET_ClearDepthf(struct _glapi_table *disp) {
- return (_glptr_ClearDepthf) (GET_by_offset(disp, _gloffset_ClearDepthf));
-}
-
-static inline void SET_ClearDepthf(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampf)) {
- SET_by_offset(disp, _gloffset_ClearDepthf, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_DepthRangef)(GLclampf, GLclampf);
-#define CALL_DepthRangef(disp, parameters) \
- (* GET_DepthRangef(disp)) parameters
-static inline _glptr_DepthRangef GET_DepthRangef(struct _glapi_table *disp) {
- return (_glptr_DepthRangef) (GET_by_offset(disp, _gloffset_DepthRangef));
-}
-
-static inline void SET_DepthRangef(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLclampf, GLclampf)) {
- SET_by_offset(disp, _gloffset_DepthRangef, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_GetShaderPrecisionFormat)(GLenum, GLenum, GLint *, GLint *);
-#define CALL_GetShaderPrecisionFormat(disp, parameters) \
- (* GET_GetShaderPrecisionFormat(disp)) parameters
-static inline _glptr_GetShaderPrecisionFormat GET_GetShaderPrecisionFormat(struct _glapi_table *disp) {
- return (_glptr_GetShaderPrecisionFormat) (GET_by_offset(disp, _gloffset_GetShaderPrecisionFormat));
-}
-
-static inline void SET_GetShaderPrecisionFormat(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLenum, GLint *, GLint *)) {
- SET_by_offset(disp, _gloffset_GetShaderPrecisionFormat, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ReleaseShaderCompiler)(void);
-#define CALL_ReleaseShaderCompiler(disp, parameters) \
- (* GET_ReleaseShaderCompiler(disp)) parameters
-static inline _glptr_ReleaseShaderCompiler GET_ReleaseShaderCompiler(struct _glapi_table *disp) {
- return (_glptr_ReleaseShaderCompiler) (GET_by_offset(disp, _gloffset_ReleaseShaderCompiler));
-}
-
-static inline void SET_ReleaseShaderCompiler(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_ReleaseShaderCompiler, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_ShaderBinary)(GLsizei, const GLuint *, GLenum, const GLvoid *, GLsizei);
-#define CALL_ShaderBinary(disp, parameters) \
- (* GET_ShaderBinary(disp)) parameters
-static inline _glptr_ShaderBinary GET_ShaderBinary(struct _glapi_table *disp) {
- return (_glptr_ShaderBinary) (GET_by_offset(disp, _gloffset_ShaderBinary));
-}
-
-static inline void SET_ShaderBinary(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLsizei, const GLuint *, GLenum, const GLvoid *, GLsizei)) {
- SET_by_offset(disp, _gloffset_ShaderBinary, fn);
-}
-
typedef GLenum (GLAPIENTRYP _glptr_GetGraphicsResetStatusARB)(void);
#define CALL_GetGraphicsResetStatusARB(disp, parameters) \
(* GET_GetGraphicsResetStatusARB(disp)) parameters
SET_by_offset(disp, _gloffset_GetnColorTableARB, fn);
}
-typedef void (GLAPIENTRYP _glptr_GetnCompressedTexImageARB)(GLenum, GLint, GLsizei, GLvoid *);
-#define CALL_GetnCompressedTexImageARB(disp, parameters) \
- (* GET_GetnCompressedTexImageARB(disp)) parameters
-static inline _glptr_GetnCompressedTexImageARB GET_GetnCompressedTexImageARB(struct _glapi_table *disp) {
- return (_glptr_GetnCompressedTexImageARB) (GET_by_offset(disp, _gloffset_GetnCompressedTexImageARB));
-}
-
-static inline void SET_GetnCompressedTexImageARB(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLenum, GLint, GLsizei, GLvoid *)) {
- SET_by_offset(disp, _gloffset_GetnCompressedTexImageARB, fn);
-}
-
typedef void (GLAPIENTRYP _glptr_GetnConvolutionFilterARB)(GLenum, GLenum, GLenum, GLsizei, GLvoid *);
#define CALL_GetnConvolutionFilterARB(disp, parameters) \
(* GET_GetnConvolutionFilterARB(disp)) parameters
SET_by_offset(disp, _gloffset_ProgramNamedParameter4fvNV, fn);
}
-typedef void (GLAPIENTRYP _glptr_PrimitiveRestartIndexNV)(GLuint);
-#define CALL_PrimitiveRestartIndexNV(disp, parameters) \
- (* GET_PrimitiveRestartIndexNV(disp)) parameters
-static inline _glptr_PrimitiveRestartIndexNV GET_PrimitiveRestartIndexNV(struct _glapi_table *disp) {
- return (_glptr_PrimitiveRestartIndexNV) (GET_by_offset(disp, _gloffset_PrimitiveRestartIndexNV));
-}
-
-static inline void SET_PrimitiveRestartIndexNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
- SET_by_offset(disp, _gloffset_PrimitiveRestartIndexNV, fn);
-}
-
-typedef void (GLAPIENTRYP _glptr_PrimitiveRestartNV)(void);
-#define CALL_PrimitiveRestartNV(disp, parameters) \
- (* GET_PrimitiveRestartNV(disp)) parameters
-static inline _glptr_PrimitiveRestartNV GET_PrimitiveRestartNV(struct _glapi_table *disp) {
- return (_glptr_PrimitiveRestartNV) (GET_by_offset(disp, _gloffset_PrimitiveRestartNV));
-}
-
-static inline void SET_PrimitiveRestartNV(struct _glapi_table *disp, void (GLAPIENTRYP fn)(void)) {
- SET_by_offset(disp, _gloffset_PrimitiveRestartNV, fn);
-}
-
typedef void (GLAPIENTRYP _glptr_DepthBoundsEXT)(GLclampd, GLclampd);
#define CALL_DepthBoundsEXT(disp, parameters) \
(* GET_DepthBoundsEXT(disp)) parameters
OPCODE_WINDOW_POS,
/* GL_ARB_multitexture */
OPCODE_ACTIVE_TEXTURE,
- /* GL_ARB_texture_compression */
- OPCODE_COMPRESSED_TEX_IMAGE_1D,
- OPCODE_COMPRESSED_TEX_IMAGE_2D,
- OPCODE_COMPRESSED_TEX_IMAGE_3D,
- OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
- OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
- OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
/* GL_ARB_multisample */
OPCODE_SAMPLE_COVERAGE,
/* GL_ARB_window_pos */
free(n[11].data);
n += InstSize[n[0].opcode];
break;
- case OPCODE_COMPRESSED_TEX_IMAGE_1D:
- free(n[7].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COMPRESSED_TEX_IMAGE_2D:
- free(n[8].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COMPRESSED_TEX_IMAGE_3D:
- free(n[9].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
- free(n[7].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
- free(n[9].data);
- n += InstSize[n[0].opcode];
- break;
- case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
- free(n[11].data);
- n += InstSize[n[0].opcode];
- break;
#if FEATURE_NV_vertex_program
case OPCODE_LOAD_PROGRAM_NV:
free(n[4].data); /* program string */
save_MultMatrixf(tm);
}
-static GLvoid *copy_data(const GLvoid *data, GLsizei size, const char *func)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLvoid *image;
-
- if (!data)
- return NULL;
-
- image = malloc(size);
- if (!image) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
- return NULL;
- }
- memcpy(image, data, size);
-
- return image;
-}
-
-
-/* GL_ARB_texture_compression */
-static void GLAPIENTRY
-save_CompressedTexImage1DARB(GLenum target, GLint level,
- GLenum internalFormat, GLsizei width,
- GLint border, GLsizei imageSize,
- const GLvoid * data)
-{
- GET_CURRENT_CONTEXT(ctx);
- if (target == GL_PROXY_TEXTURE_1D) {
- /* don't compile, execute immediately */
- CALL_CompressedTexImage1DARB(ctx->Exec, (target, level, internalFormat,
- width, border, imageSize,
- data));
- }
- else {
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].e = internalFormat;
- n[4].i = (GLint) width;
- n[5].i = border;
- n[6].i = imageSize;
- n[7].data = copy_data(data, imageSize, "glCompressedTexImage1DARB");
- }
- if (ctx->ExecuteFlag) {
- CALL_CompressedTexImage1DARB(ctx->Exec,
- (target, level, internalFormat, width,
- border, imageSize, data));
- }
- }
-}
-
-
-static void GLAPIENTRY
-save_CompressedTexImage2DARB(GLenum target, GLint level,
- GLenum internalFormat, GLsizei width,
- GLsizei height, GLint border, GLsizei imageSize,
- const GLvoid * data)
-{
- GET_CURRENT_CONTEXT(ctx);
- if (target == GL_PROXY_TEXTURE_2D) {
- /* don't compile, execute immediately */
- CALL_CompressedTexImage2DARB(ctx->Exec, (target, level, internalFormat,
- width, height, border,
- imageSize, data));
- }
- else {
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].e = internalFormat;
- n[4].i = (GLint) width;
- n[5].i = (GLint) height;
- n[6].i = border;
- n[7].i = imageSize;
- n[8].data = copy_data(data, imageSize, "glCompressedTexImage2DARB");
- }
- if (ctx->ExecuteFlag) {
- CALL_CompressedTexImage2DARB(ctx->Exec,
- (target, level, internalFormat, width,
- height, border, imageSize, data));
- }
- }
-}
-
-
-static void GLAPIENTRY
-save_CompressedTexImage3DARB(GLenum target, GLint level,
- GLenum internalFormat, GLsizei width,
- GLsizei height, GLsizei depth, GLint border,
- GLsizei imageSize, const GLvoid * data)
-{
- GET_CURRENT_CONTEXT(ctx);
- if (target == GL_PROXY_TEXTURE_3D) {
- /* don't compile, execute immediately */
- CALL_CompressedTexImage3DARB(ctx->Exec, (target, level, internalFormat,
- width, height, depth, border,
- imageSize, data));
- }
- else {
- Node *n;
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].e = internalFormat;
- n[4].i = (GLint) width;
- n[5].i = (GLint) height;
- n[6].i = (GLint) depth;
- n[7].i = border;
- n[8].i = imageSize;
- n[9].data = copy_data(data, imageSize, "glCompressedTexImage3DARB");
- }
- if (ctx->ExecuteFlag) {
- CALL_CompressedTexImage3DARB(ctx->Exec,
- (target, level, internalFormat, width,
- height, depth, border, imageSize,
- data));
- }
- }
-}
-
-
-static void GLAPIENTRY
-save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
- GLsizei width, GLenum format,
- GLsizei imageSize, const GLvoid * data)
-{
- Node *n;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = xoffset;
- n[4].i = (GLint) width;
- n[5].e = format;
- n[6].i = imageSize;
- n[7].data = copy_data(data, imageSize, "glCompressedTexSubImage1DARB");
- }
- if (ctx->ExecuteFlag) {
- CALL_CompressedTexSubImage1DARB(ctx->Exec, (target, level, xoffset,
- width, format, imageSize,
- data));
- }
-}
-
-
-static void GLAPIENTRY
-save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
- GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize,
- const GLvoid * data)
-{
- Node *n;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = xoffset;
- n[4].i = yoffset;
- n[5].i = (GLint) width;
- n[6].i = (GLint) height;
- n[7].e = format;
- n[8].i = imageSize;
- n[9].data = copy_data(data, imageSize, "glCompressedTexSubImage2DARB");
- }
- if (ctx->ExecuteFlag) {
- CALL_CompressedTexSubImage2DARB(ctx->Exec,
- (target, level, xoffset, yoffset, width,
- height, format, imageSize, data));
- }
-}
-
-
-static void GLAPIENTRY
-save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
- GLint yoffset, GLint zoffset, GLsizei width,
- GLsizei height, GLsizei depth, GLenum format,
- GLsizei imageSize, const GLvoid * data)
-{
- Node *n;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-
- n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11);
- if (n) {
- n[1].e = target;
- n[2].i = level;
- n[3].i = xoffset;
- n[4].i = yoffset;
- n[5].i = zoffset;
- n[6].i = (GLint) width;
- n[7].i = (GLint) height;
- n[8].i = (GLint) depth;
- n[9].e = format;
- n[10].i = imageSize;
- n[11].data = copy_data(data, imageSize, "glCompressedTexSubImage3DARB");
- }
- if (ctx->ExecuteFlag) {
- CALL_CompressedTexSubImage3DARB(ctx->Exec,
- (target, level, xoffset, yoffset,
- zoffset, width, height, depth, format,
- imageSize, data));
- }
-}
-
/* GL_ARB_multisample */
static void GLAPIENTRY
case OPCODE_ACTIVE_TEXTURE: /* GL_ARB_multitexture */
CALL_ActiveTextureARB(ctx->Exec, (n[1].e));
break;
- case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
- CALL_CompressedTexImage1DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
- n[4].i, n[5].i, n[6].i,
- n[7].data));
- break;
- case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
- CALL_CompressedTexImage2DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
- n[4].i, n[5].i, n[6].i,
- n[7].i, n[8].data));
- break;
- case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
- CALL_CompressedTexImage3DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
- n[4].i, n[5].i, n[6].i,
- n[7].i, n[8].i,
- n[9].data));
- break;
- case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
- CALL_CompressedTexSubImage1DARB(ctx->Exec,
- (n[1].e, n[2].i, n[3].i, n[4].i,
- n[5].e, n[6].i, n[7].data));
- break;
- case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
- CALL_CompressedTexSubImage2DARB(ctx->Exec,
- (n[1].e, n[2].i, n[3].i, n[4].i,
- n[5].i, n[6].i, n[7].e, n[8].i,
- n[9].data));
- break;
- case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
- CALL_CompressedTexSubImage3DARB(ctx->Exec,
- (n[1].e, n[2].i, n[3].i, n[4].i,
- n[5].i, n[6].i, n[7].i, n[8].i,
- n[9].e, n[10].i, n[11].data));
- break;
case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
CALL_SampleCoverageARB(ctx->Exec, (n[1].f, n[2].b));
break;
CALL_TexCoordPointer(ctx->Exec, (size, type, stride, ptr));
}
-static void GLAPIENTRY
-exec_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid * img)
-{
- GET_CURRENT_CONTEXT(ctx);
- FLUSH_VERTICES(ctx, 0);
- CALL_GetCompressedTexImageARB(ctx->Exec, (target, level, img));
-}
-
static void GLAPIENTRY
exec_VertexPointer(GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr)
/* ARB 5. GL_ARB_multisample */
SET_SampleCoverageARB(table, save_SampleCoverageARB);
- /* ARB 12. GL_ARB_texture_compression */
- SET_CompressedTexImage3DARB(table, save_CompressedTexImage3DARB);
- SET_CompressedTexImage2DARB(table, save_CompressedTexImage2DARB);
- SET_CompressedTexImage1DARB(table, save_CompressedTexImage1DARB);
- SET_CompressedTexSubImage3DARB(table, save_CompressedTexSubImage3DARB);
- SET_CompressedTexSubImage2DARB(table, save_CompressedTexSubImage2DARB);
- SET_CompressedTexSubImage1DARB(table, save_CompressedTexSubImage1DARB);
- SET_GetCompressedTexImageARB(table, exec_GetCompressedTexImageARB);
-
/* ARB 14. GL_ARB_point_parameters */
/* aliased with EXT_point_parameters functions */
vfmt->DrawElements = 0;
vfmt->DrawRangeElements = 0;
vfmt->MultiDrawElemementsEXT = 0;
- vfmt->DrawElementsBaseVertex = 0;
- vfmt->DrawRangeElementsBaseVertex = 0;
vfmt->MultiDrawElemementsBaseVertex = 0;
#endif
}
break;
#endif /* FEATURE_NV_vertex_program */
- /* GL_NV_primitive_restart */
- case GL_PRIMITIVE_RESTART_NV:
- if (!ctx->Extensions.NV_primitive_restart) {
- goto invalid_enum_error;
- }
- var = &ctx->Array.PrimitiveRestart;
- flag = 0;
- break;
-
default:
goto invalid_enum_error;
}
break;
#endif /* FEATURE_NV_fragment_program */
- /* GL_NV_texture_rectangle */
- case GL_TEXTURE_RECTANGLE_NV:
- CHECK_EXTENSION(NV_texture_rectangle, cap);
- if (!enable_texture(ctx, state, TEXTURE_RECT_BIT)) {
- return;
- }
- break;
-
/* GL_EXT_stencil_two_side */
case GL_STENCIL_TEST_TWO_SIDE_EXT:
CHECK_EXTENSION(EXT_stencil_two_side, cap);
}
break;
- /* GL 3.1 primitive restart. Note: this enum is different from
- * GL_PRIMITIVE_RESTART_NV (which is client state).
- */
- case GL_PRIMITIVE_RESTART:
- if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
- goto invalid_enum_error;
- }
- if (ctx->Array.PrimitiveRestart != state) {
- FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
- ctx->Array.PrimitiveRestart = state;
- }
- break;
-
/* GL3.0 - GL_framebuffer_sRGB */
case GL_FRAMEBUFFER_SRGB_EXT:
CHECK_EXTENSION(EXT_framebuffer_sRGB, cap);
return ctx->FragmentProgram.Enabled;
#endif /* FEATURE_NV_fragment_program */
- /* GL_NV_texture_rectangle */
- case GL_TEXTURE_RECTANGLE_NV:
- CHECK_EXTENSION(NV_texture_rectangle);
- return is_texture_enabled(ctx, TEXTURE_RECT_BIT);
-
/* GL_EXT_stencil_two_side */
case GL_STENCIL_TEST_TWO_SIDE_EXT:
CHECK_EXTENSION(EXT_stencil_two_side);
CHECK_EXTENSION(EXT_depth_bounds_test);
return ctx->Depth.BoundsTest;
- /* GL_NV_primitive_restart */
- case GL_PRIMITIVE_RESTART_NV:
- if (!ctx->Extensions.NV_primitive_restart) {
- goto invalid_enum_error;
- }
- return ctx->Array.PrimitiveRestart;
-
- /* GL 3.1 primitive restart */
- case GL_PRIMITIVE_RESTART:
- if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
- goto invalid_enum_error;
- }
- return ctx->Array.PrimitiveRestart;
-
/* GL3.0 - GL_framebuffer_sRGB */
case GL_FRAMEBUFFER_SRGB_EXT:
CHECK_EXTENSION(EXT_framebuffer_sRGB);
*/
static const struct extension extension_table[] = {
/* ARB Extensions */
- { "GL_ARB_ES2_compatibility", o(ARB_ES2_compatibility), 2009 },
{ "GL_ARB_color_buffer_float", o(ARB_color_buffer_float), 2004 },
{ "GL_ARB_copy_buffer", o(ARB_copy_buffer), 2008 },
{ "GL_ARB_conservative_depth", o(ARB_conservative_depth), 2011 },
{ "GL_ARB_shading_language_100", o(ARB_shading_language_100), 2003 },
{ "GL_ARB_texture_border_clamp", o(ARB_texture_border_clamp), 2000 },
{ "GL_ARB_texture_buffer_object", o(ARB_texture_buffer_object), 2008 },
- { "GL_ARB_texture_compression", o(dummy_true), 2000 },
- { "GL_ARB_texture_compression_rgtc", o(ARB_texture_compression_rgtc), 2004 },
{ "GL_ARB_texture_cube_map", o(ARB_texture_cube_map), 1999 },
{ "GL_ARB_texture_env_add", o(dummy_true), 1999 },
{ "GL_ARB_texture_env_combine", o(ARB_texture_env_combine), 2001 },
{ "GL_ARB_texture_float", o(ARB_texture_float), 2004 },
{ "GL_ARB_texture_mirrored_repeat", o(dummy_true), 2001 },
{ "GL_ARB_texture_non_power_of_two", o(ARB_texture_non_power_of_two), 2003 },
- { "GL_ARB_texture_rectangle", o(NV_texture_rectangle), 2004 },
- { "GL_ARB_texture_rg", o(ARB_texture_rg), 2008 },
{ "GL_ARB_texture_storage", o(ARB_texture_storage), 2011 },
{ "GL_ARB_transpose_matrix", o(ARB_transpose_matrix), 1999 },
{ "GL_ARB_uniform_buffer_object", o(ARB_uniform_buffer_object), 2002 },
{ "GL_EXT_subtexture", o(dummy_true), 1995 },
{ "GL_EXT_texture3D", o(EXT_texture3D), 1996 },
{ "GL_EXT_texture_array", o(EXT_texture_array), 2006 },
- { "GL_EXT_texture_compression_dxt1", o(EXT_texture_compression_s3tc), 2004 },
- { "GL_EXT_texture_compression_latc", o(EXT_texture_compression_latc), 2006 },
- { "GL_EXT_texture_compression_rgtc", o(ARB_texture_compression_rgtc), 2004 },
- { "GL_EXT_texture_compression_s3tc", o(EXT_texture_compression_s3tc), 2000 },
{ "GL_EXT_texture_cube_map", o(ARB_texture_cube_map), 2001 },
{ "GL_EXT_texture_edge_clamp", o(dummy_true), 1997 },
{ "GL_EXT_texture_env_add", o(dummy_true), 1999 },
{ "GL_EXT_texture_mirror_clamp", o(EXT_texture_mirror_clamp), 2004 },
{ "GL_EXT_texture_object", o(dummy_true), 1995 },
{ "GL_EXT_texture", o(dummy_true), 1996 },
- { "GL_EXT_texture_rectangle", o(NV_texture_rectangle), 2004 },
- { "GL_EXT_texture_snorm", o(EXT_texture_snorm), 2009 },
{ "GL_EXT_texture_sRGB", o(EXT_texture_sRGB), 2004 },
{ "GL_EXT_vertex_array", o(dummy_true), 1995 },
/* Vendor extensions */
- { "GL_3DFX_texture_compression_FXT1", o(TDFX_texture_compression_FXT1), 1999 },
{ "GL_AMD_conservative_depth", o(ARB_conservative_depth), 2009 },
{ "GL_AMD_draw_buffers_blend", o(ARB_draw_buffers_blend), 2009 },
{ "GL_AMD_shader_stencil_export", o(ARB_shader_stencil_export), 2009 },
{ "GL_ATI_draw_buffers", o(dummy_true), 2002 },
{ "GL_ATI_envmap_bumpmap", o(ATI_envmap_bumpmap), 2001 },
{ "GL_ATI_separate_stencil", o(ATI_separate_stencil), 2006 },
- { "GL_ATI_texture_compression_3dc", o(ATI_texture_compression_3dc), 2004 },
{ "GL_ATI_texture_env_combine3", o(ATI_texture_env_combine3), 2002 },
{ "GL_ATI_texture_float", o(ARB_texture_float), 2002 },
{ "GL_ATI_texture_mirror_once", o(ATI_texture_mirror_once), 2006 },
{ "GL_MESA_pack_invert", o(MESA_pack_invert), 2002 },
{ "GL_MESA_resize_buffers", o(MESA_resize_buffers), 1999 },
{ "GL_MESA_texture_array", o(MESA_texture_array), 2007 },
- { "GL_MESA_texture_signed_rgba", o(EXT_texture_snorm), 2009 },
{ "GL_MESA_window_pos", o(ARB_window_pos), 2000 },
{ "GL_MESA_ycbcr_texture", o(MESA_ycbcr_texture), 2002 },
{ "GL_NV_blend_square", o(NV_blend_square), 1999 },
{ "GL_NV_light_max_exponent", o(NV_light_max_exponent), 1999 },
{ "GL_NV_packed_depth_stencil", o(EXT_packed_depth_stencil), 2000 },
{ "GL_NV_point_sprite", o(NV_point_sprite), 2001 },
- { "GL_NV_primitive_restart", o(NV_primitive_restart), 2002 },
{ "GL_NV_texgen_reflection", o(NV_texgen_reflection), 1999 },
{ "GL_NV_texture_barrier", o(NV_texture_barrier), 2009 },
{ "GL_NV_texture_env_combine4", o(NV_texture_env_combine4), 1999 },
- { "GL_NV_texture_rectangle", o(NV_texture_rectangle), 2000 },
{ "GL_NV_vertex_program1_1", o(NV_vertex_program1_1), 2001 },
{ "GL_NV_vertex_program", o(NV_vertex_program), 2000 },
- { "GL_S3_s3tc", o(S3_s3tc), 1999 },
{ "GL_SGIS_generate_mipmap", o(dummy_true), 1997 },
{ "GL_SGIS_texture_border_clamp", o(ARB_texture_border_clamp), 1997 },
{ "GL_SGIS_texture_edge_clamp", o(dummy_true), 1997 },
ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
/*ctx->Extensions.ARB_texture_float = GL_TRUE;*/
ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
- ctx->Extensions.ARB_texture_rg = GL_TRUE;
- ctx->Extensions.ARB_texture_compression_rgtc = GL_TRUE;
ctx->Extensions.ARB_texture_storage = GL_TRUE;
ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
#if FEATURE_ARB_vertex_program
ctx->Extensions.APPLE_object_purgeable = GL_TRUE;
#endif
ctx->Extensions.ATI_envmap_bumpmap = GL_TRUE;
- ctx->Extensions.ATI_texture_compression_3dc = GL_TRUE;
ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE;
ctx->Extensions.ATI_texture_mirror_once = GL_TRUE;
ctx->Extensions.ATI_separate_stencil = GL_TRUE;
ctx->Extensions.EXT_secondary_color = GL_TRUE;
ctx->Extensions.EXT_stencil_two_side = GL_TRUE;
ctx->Extensions.EXT_texture_array = GL_TRUE;
- ctx->Extensions.EXT_texture_compression_latc = GL_TRUE;
ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
ctx->Extensions.EXT_texture_filter_anisotropic = GL_TRUE;
ctx->Extensions.EXT_texture_mirror_clamp = GL_TRUE;
/*ctx->Extensions.NV_light_max_exponent = GL_TRUE;*/
ctx->Extensions.NV_point_sprite = GL_TRUE;
ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
- ctx->Extensions.NV_texture_rectangle = GL_TRUE;
/*ctx->Extensions.NV_texgen_reflection = GL_TRUE;*/
#if FEATURE_NV_vertex_program
ctx->Extensions.NV_vertex_program = GL_TRUE;
case GL_INTENSITY:
case GL_ALPHA:
return ctx->Extensions.ARB_framebuffer_object;
- case GL_RED:
- case GL_RG:
- return ctx->Extensions.ARB_texture_rg;
default:
return GL_FALSE;
}
att->Complete = GL_FALSE;
return;
}
- if (_mesa_is_format_compressed(texImage->TexFormat)) {
- att_incomplete("compressed internalformat");
- att->Complete = GL_FALSE;
- return;
- }
}
else if (format == GL_DEPTH) {
if (baseFormat == GL_DEPTH_COMPONENT) {
}
}
- if (!ctx->Extensions.ARB_ES2_compatibility) {
/* Check that all DrawBuffers are present */
for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) {
if (fb->ColorDrawBuffer[j] != GL_NONE) {
return;
}
}
- }
if (numImages == 0) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT;
return GL_DEPTH_STENCIL;
else
return 0;
- case GL_RED:
- case GL_R8:
- case GL_R16:
- return ctx->Extensions.ARB_texture_rg ? GL_RED : 0;
- case GL_RG:
- case GL_RG8:
- case GL_RG16:
- return ctx->Extensions.ARB_texture_rg ? GL_RG : 0;
- /* signed normalized texture formats */
- case GL_RED_SNORM:
- case GL_R8_SNORM:
- case GL_R16_SNORM:
- return ctx->Extensions.EXT_texture_snorm ? GL_RED : 0;
- case GL_RG_SNORM:
- case GL_RG8_SNORM:
- case GL_RG16_SNORM:
- return ctx->Extensions.EXT_texture_snorm ? GL_RG : 0;
- case GL_RGB_SNORM:
- case GL_RGB8_SNORM:
- case GL_RGB16_SNORM:
- return ctx->Extensions.EXT_texture_snorm ? GL_RGB : 0;
- case GL_RGBA_SNORM:
- case GL_RGBA8_SNORM:
- case GL_RGBA16_SNORM:
- return ctx->Extensions.EXT_texture_snorm ? GL_RGBA : 0;
- case GL_ALPHA_SNORM:
- case GL_ALPHA8_SNORM:
- case GL_ALPHA16_SNORM:
- return ctx->Extensions.EXT_texture_snorm &&
- ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
- case GL_LUMINANCE_SNORM:
- case GL_LUMINANCE8_SNORM:
- case GL_LUMINANCE16_SNORM:
- return ctx->Extensions.EXT_texture_snorm &&
- ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
- case GL_LUMINANCE_ALPHA_SNORM:
- case GL_LUMINANCE8_ALPHA8_SNORM:
- case GL_LUMINANCE16_ALPHA16_SNORM:
- return ctx->Extensions.EXT_texture_snorm &&
- ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
- case GL_INTENSITY_SNORM:
- case GL_INTENSITY8_SNORM:
- case GL_INTENSITY16_SNORM:
- return ctx->Extensions.EXT_texture_snorm &&
- ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
- case GL_R16F:
- case GL_R32F:
- return ctx->Extensions.ARB_texture_rg &&
- ctx->Extensions.ARB_texture_float ? GL_RED : 0;
- case GL_RG16F:
- case GL_RG32F:
- return ctx->Extensions.ARB_texture_rg &&
- ctx->Extensions.ARB_texture_float ? GL_RG : 0;
case GL_RGB16F:
case GL_RGB32F:
return ctx->Extensions.ARB_texture_float ? GL_RGB : 0;
return ctx->VersionMajor >= 3 ||
ctx->Extensions.EXT_texture_integer ? GL_RGB : 0;
- case GL_R8UI:
- case GL_R8I:
- case GL_R16UI:
- case GL_R16I:
- case GL_R32UI:
- case GL_R32I:
- return ctx->VersionMajor >= 3 ||
- (ctx->Extensions.ARB_texture_rg &&
- ctx->Extensions.EXT_texture_integer) ? GL_RED : 0;
-
- case GL_RG8UI:
- case GL_RG8I:
- case GL_RG16UI:
- case GL_RG16I:
- case GL_RG32UI:
- case GL_RG32I:
- return ctx->VersionMajor >= 3 ||
- (ctx->Extensions.ARB_texture_rg &&
- ctx->Extensions.EXT_texture_integer) ? GL_RG : 0;
-
case GL_INTENSITY8I_EXT:
case GL_INTENSITY8UI_EXT:
case GL_INTENSITY16I_EXT:
case GL_TEXTURE_2D:
error = GL_FALSE;
break;
- case GL_TEXTURE_RECTANGLE:
- error = !ctx->Extensions.NV_texture_rectangle;
- break;
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
}
-/* MESA_FORMAT_R8 */
-
-static void
-pack_ubyte_R8(const GLubyte src[4], void *dst)
-{
- GLubyte *d = ((GLubyte *) dst);
- *d = src[RCOMP];
-}
-
-static void
-pack_float_R8(const GLfloat src[4], void *dst)
-{
- GLubyte *d = ((GLubyte *) dst);
- GLubyte r;
- UNCLAMPED_FLOAT_TO_UBYTE(r, src[RCOMP]);
- d[0] = r;
-}
-
-
-/* MESA_FORMAT_GR88 */
-
-static void
-pack_ubyte_GR88(const GLubyte src[4], void *dst)
-{
- GLubyte *d = ((GLubyte *) dst);
- *d = PACK_COLOR_88(src[GCOMP], src[RCOMP]);
-}
-
-static void
-pack_float_GR88(const GLfloat src[4], void *dst)
-{
- GLushort *d = ((GLushort *) dst);
- GLubyte r, g;
- UNCLAMPED_FLOAT_TO_UBYTE(r, src[RCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(g, src[GCOMP]);
- *d = PACK_COLOR_88(g, r);
-}
-
-
-/* MESA_FORMAT_RG88 */
-
-static void
-pack_ubyte_RG88(const GLubyte src[4], void *dst)
-{
- GLubyte *d = ((GLubyte *) dst);
- *d = PACK_COLOR_88(src[RCOMP], src[GCOMP]);
-}
-
-static void
-pack_float_RG88(const GLfloat src[4], void *dst)
-{
- GLushort *d = ((GLushort *) dst);
- GLubyte r, g;
- UNCLAMPED_FLOAT_TO_UBYTE(r, src[RCOMP]);
- UNCLAMPED_FLOAT_TO_UBYTE(g, src[GCOMP]);
- *d = PACK_COLOR_88(r, g);
-}
-
-
-/* MESA_FORMAT_R16 */
-
-static void
-pack_ubyte_R16(const GLubyte src[4], void *dst)
-{
- GLushort *d = ((GLushort *) dst);
- *d = UBYTE_TO_USHORT(src[RCOMP]);
-}
-
-static void
-pack_float_R16(const GLfloat src[4], void *dst)
-{
- GLushort *d = ((GLushort *) dst);
- UNCLAMPED_FLOAT_TO_USHORT(d[0], src[RCOMP]);
-}
-
-
-/* MESA_FORMAT_RG1616 */
-
-static void
-pack_ubyte_RG1616(const GLubyte src[4], void *dst)
-{
- GLuint *d = ((GLuint *) dst);
- GLushort r = UBYTE_TO_USHORT(src[RCOMP]);
- GLushort g = UBYTE_TO_USHORT(src[GCOMP]);
- *d = PACK_COLOR_1616(g, r);
-}
-
-static void
-pack_float_RG1616(const GLfloat src[4], void *dst)
-{
- GLuint *d = ((GLuint *) dst);
- GLushort r, g;
- UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
- UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
- *d = PACK_COLOR_1616(g, r);
-}
-
-
-/* MESA_FORMAT_RG1616_REV */
-
-static void
-pack_ubyte_RG1616_REV(const GLubyte src[4], void *dst)
-{
- GLuint *d = ((GLuint *) dst);
- GLushort r = UBYTE_TO_USHORT(src[RCOMP]);
- GLushort g = UBYTE_TO_USHORT(src[GCOMP]);
- *d = PACK_COLOR_1616(r, g);
-}
-
-
-static void
-pack_float_RG1616_REV(const GLfloat src[4], void *dst)
-{
- GLuint *d = ((GLuint *) dst);
- GLushort r, g;
- UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
- UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
- *d = PACK_COLOR_1616(r, g);
-}
-
-
/* MESA_FORMAT_SRGB8 */
static void
}
-/* MESA_FORMAT_RG_FLOAT32 */
-
-static void
-pack_ubyte_RG_FLOAT32(const GLubyte src[4], void *dst)
-{
- GLfloat *d = ((GLfloat *) dst);
- d[0] = UBYTE_TO_FLOAT(src[RCOMP]);
- d[1] = UBYTE_TO_FLOAT(src[GCOMP]);
-}
-
-static void
-pack_float_RG_FLOAT32(const GLfloat src[4], void *dst)
-{
- GLfloat *d = ((GLfloat *) dst);
- d[0] = src[RCOMP];
- d[1] = src[GCOMP];
-}
-
-
-/* MESA_FORMAT_RG_FLOAT16 */
-
-static void
-pack_ubyte_RG_FLOAT16(const GLubyte src[4], void *dst)
-{
- GLhalfARB *d = ((GLhalfARB *) dst);
- d[0] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[RCOMP]));
- d[1] = _mesa_float_to_half(UBYTE_TO_FLOAT(src[GCOMP]));
-}
-
-static void
-pack_float_RG_FLOAT16(const GLfloat src[4], void *dst)
-{
- GLhalfARB *d = ((GLhalfARB *) dst);
- d[0] = _mesa_float_to_half(src[RCOMP]);
- d[1] = _mesa_float_to_half(src[GCOMP]);
-}
-
-
/* MESA_FORMAT_DUDV8 */
static void
UNCLAMPED_FLOAT_TO_USHORT(d[3], src[ACOMP]);
}
-
-
-/*
- * MESA_FORMAT_SIGNED_R8
- */
-
-static void
-pack_float_SIGNED_R8(const GLfloat src[4], void *dst)
-{
- GLbyte *d = (GLbyte *) dst;
- *d = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f));
-}
-
-
-/*
- * MESA_FORMAT_SIGNED_RG88_REV
- */
-
-static void
-pack_float_SIGNED_RG88_REV(const GLfloat src[4], void *dst)
-{
- GLushort *d = (GLushort *) dst;
- GLbyte r = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f));
- GLbyte g = FLOAT_TO_BYTE(CLAMP(src[GCOMP], -1.0f, 1.0f));
- *d = (g << 8) | r;
-}
-
-
-/*
- * MESA_FORMAT_SIGNED_RGBX8888
- */
-
-static void
-pack_float_SIGNED_RGBX8888(const GLfloat src[4], void *dst)
-{
- GLuint *d = (GLuint *) dst;
- GLbyte r = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f));
- GLbyte g = FLOAT_TO_BYTE(CLAMP(src[GCOMP], -1.0f, 1.0f));
- GLbyte b = FLOAT_TO_BYTE(CLAMP(src[BCOMP], -1.0f, 1.0f));
- GLbyte a = 127;
- *d = PACK_COLOR_8888(r, g, b, a);
-}
-
-
-/*
- * MESA_FORMAT_SIGNED_RGBA8888
- */
-
-static void
-pack_float_SIGNED_RGBA8888(const GLfloat src[4], void *dst)
-{
- GLuint *d = (GLuint *) dst;
- GLbyte r = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f));
- GLbyte g = FLOAT_TO_BYTE(CLAMP(src[GCOMP], -1.0f, 1.0f));
- GLbyte b = FLOAT_TO_BYTE(CLAMP(src[BCOMP], -1.0f, 1.0f));
- GLbyte a = FLOAT_TO_BYTE(CLAMP(src[ACOMP], -1.0f, 1.0f));
- *d = PACK_COLOR_8888(r, g, b, a);
-}
-
-
-/*
- * MESA_FORMAT_SIGNED_RGBA8888_REV
- */
-
-static void
-pack_float_SIGNED_RGBA8888_REV(const GLfloat src[4], void *dst)
-{
- GLuint *d = (GLuint *) dst;
- GLbyte r = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f));
- GLbyte g = FLOAT_TO_BYTE(CLAMP(src[GCOMP], -1.0f, 1.0f));
- GLbyte b = FLOAT_TO_BYTE(CLAMP(src[BCOMP], -1.0f, 1.0f));
- GLbyte a = FLOAT_TO_BYTE(CLAMP(src[ACOMP], -1.0f, 1.0f));
- *d = PACK_COLOR_8888(a, b, g, r);
-}
-
-
-/*
- * MESA_FORMAT_SIGNED_R16
- */
-
-static void
-pack_float_SIGNED_R16(const GLfloat src[4], void *dst)
-{
- GLshort *d = (GLshort *) dst;
- *d = FLOAT_TO_SHORT(CLAMP(src[RCOMP], -1.0f, 1.0f));
-}
-
-
-/*
- * MESA_FORMAT_SIGNED_GR1616
- */
-
-static void
-pack_float_SIGNED_GR1616(const GLfloat src[4], void *dst)
-{
- GLuint *d = (GLuint *) dst;
- GLshort r = FLOAT_TO_SHORT(CLAMP(src[RCOMP], -1.0f, 1.0f));
- GLshort g = FLOAT_TO_SHORT(CLAMP(src[GCOMP], -1.0f, 1.0f));
- *d = (g << 16) | (r & 0xffff);
-}
-
-
-/*
- * MESA_FORMAT_SIGNED_RGB_16
- */
-
-static void
-pack_float_SIGNED_RGB_16(const GLfloat src[4], void *dst)
-{
- GLshort *d = (GLshort *) dst;
- d[0] = FLOAT_TO_SHORT(CLAMP(src[RCOMP], -1.0f, 1.0f));
- d[1] = FLOAT_TO_SHORT(CLAMP(src[GCOMP], -1.0f, 1.0f));
- d[2] = FLOAT_TO_SHORT(CLAMP(src[BCOMP], -1.0f, 1.0f));
-}
-
-
/*
* MESA_FORMAT_SIGNED_RGBA_16
*/
}
-/*
- * MESA_FORMAT_SIGNED_A8
- */
-
-static void
-pack_float_SIGNED_A8(const GLfloat src[4], void *dst)
-{
- GLbyte *d = (GLbyte *) dst;
- *d = FLOAT_TO_BYTE(CLAMP(src[ACOMP], -1.0f, 1.0f));
-}
-
-
-/*
- * MESA_FORMAT_SIGNED_L8
- */
-
-static void
-pack_float_SIGNED_L8(const GLfloat src[4], void *dst)
-{
- GLbyte *d = (GLbyte *) dst;
- *d = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f));
-}
-
-
-/*
- * MESA_FORMAT_SIGNED_AL88
- */
-
-static void
-pack_float_SIGNED_AL88(const GLfloat src[4], void *dst)
-{
- GLushort *d = (GLushort *) dst;
- GLbyte l = FLOAT_TO_BYTE(CLAMP(src[RCOMP], -1.0f, 1.0f));
- GLbyte a = FLOAT_TO_BYTE(CLAMP(src[ACOMP], -1.0f, 1.0f));
- *d = (a << 8) | l;
-}
-
-
-/*
- * MESA_FORMAT_SIGNED_A16
- */
-
-static void
-pack_float_SIGNED_A16(const GLfloat src[4], void *dst)
-{
- GLshort *d = (GLshort *) dst;
- *d = FLOAT_TO_SHORT(CLAMP(src[ACOMP], -1.0f, 1.0f));
-}
-
-
-/*
- * MESA_FORMAT_SIGNED_L16
- */
-
-static void
-pack_float_SIGNED_L16(const GLfloat src[4], void *dst)
-{
- GLshort *d = (GLshort *) dst;
- *d = FLOAT_TO_SHORT(CLAMP(src[RCOMP], -1.0f, 1.0f));
-}
-
-
-/*
- * MESA_FORMAT_SIGNED_AL1616
- */
-
-static void
-pack_float_SIGNED_AL1616(const GLfloat src[4], void *dst)
-{
- GLuint *d = (GLuint *) dst;
- GLshort l = FLOAT_TO_SHORT(CLAMP(src[RCOMP], -1.0f, 1.0f));
- GLshort a = FLOAT_TO_SHORT(CLAMP(src[ACOMP], -1.0f, 1.0f));
- *d = PACK_COLOR_1616(a, l);
-}
-
-
/**
* Return a function that can pack a GLubyte rgba[4] color.
table[MESA_FORMAT_I16] = pack_ubyte_L16; /* reuse pack_ubyte_L16 */
table[MESA_FORMAT_YCBCR] = pack_ubyte_YCBCR;
table[MESA_FORMAT_YCBCR_REV] = pack_ubyte_YCBCR_REV;
- table[MESA_FORMAT_R8] = pack_ubyte_R8;
- table[MESA_FORMAT_GR88] = pack_ubyte_GR88;
- table[MESA_FORMAT_RG88] = pack_ubyte_RG88;
- table[MESA_FORMAT_R16] = pack_ubyte_R16;
- table[MESA_FORMAT_RG1616] = pack_ubyte_RG1616;
- table[MESA_FORMAT_RG1616_REV] = pack_ubyte_RG1616_REV;
/* should never convert RGBA to these formats */
table[MESA_FORMAT_Z24_S8] = NULL;
table[MESA_FORMAT_SL8] = pack_ubyte_SL8;
table[MESA_FORMAT_SLA8] = pack_ubyte_SLA8;
- /* n/a */
- table[MESA_FORMAT_SRGB_DXT1] = NULL; /* pack_ubyte_SRGB_DXT1; */
- table[MESA_FORMAT_SRGBA_DXT1] = NULL; /* pack_ubyte_SRGBA_DXT1; */
- table[MESA_FORMAT_SRGBA_DXT3] = NULL; /* pack_ubyte_SRGBA_DXT3; */
- table[MESA_FORMAT_SRGBA_DXT5] = NULL; /* pack_ubyte_SRGBA_DXT5; */
-
- table[MESA_FORMAT_RGB_FXT1] = NULL; /* pack_ubyte_RGB_FXT1; */
- table[MESA_FORMAT_RGBA_FXT1] = NULL; /* pack_ubyte_RGBA_FXT1; */
- table[MESA_FORMAT_RGB_DXT1] = NULL; /* pack_ubyte_RGB_DXT1; */
- table[MESA_FORMAT_RGBA_DXT1] = NULL; /* pack_ubyte_RGBA_DXT1; */
- table[MESA_FORMAT_RGBA_DXT3] = NULL; /* pack_ubyte_RGBA_DXT3; */
- table[MESA_FORMAT_RGBA_DXT5] = NULL; /* pack_ubyte_RGBA_DXT5; */
-
table[MESA_FORMAT_RGBA_FLOAT32] = pack_ubyte_RGBA_FLOAT32;
table[MESA_FORMAT_RGBA_FLOAT16] = pack_ubyte_RGBA_FLOAT16;
table[MESA_FORMAT_RGB_FLOAT32] = pack_ubyte_RGB_FLOAT32;
table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16] = pack_ubyte_LUMINANCE_ALPHA_FLOAT16;
table[MESA_FORMAT_INTENSITY_FLOAT32] = pack_ubyte_LUMINANCE_FLOAT32;
table[MESA_FORMAT_INTENSITY_FLOAT16] = pack_ubyte_LUMINANCE_FLOAT16;
- table[MESA_FORMAT_R_FLOAT32] = pack_ubyte_LUMINANCE_FLOAT32;
- table[MESA_FORMAT_R_FLOAT16] = pack_ubyte_LUMINANCE_FLOAT16;
- table[MESA_FORMAT_RG_FLOAT32] = pack_ubyte_RG_FLOAT32;
- table[MESA_FORMAT_RG_FLOAT16] = pack_ubyte_RG_FLOAT16;
/* n/a */
table[MESA_FORMAT_RGBA_INT8] = NULL; /* pack_ubyte_RGBA_INT8 */
table[MESA_FORMAT_RGBA_16] = pack_ubyte_RGBA_16;
- /* n/a */
- table[MESA_FORMAT_SIGNED_R8] = NULL;
- table[MESA_FORMAT_SIGNED_RG88_REV] = NULL;
- table[MESA_FORMAT_SIGNED_RGBX8888] = NULL;
- table[MESA_FORMAT_SIGNED_RGBA8888] = NULL;
- table[MESA_FORMAT_SIGNED_RGBA8888_REV] = NULL;
- table[MESA_FORMAT_SIGNED_R16] = NULL;
- table[MESA_FORMAT_SIGNED_GR1616] = NULL;
- table[MESA_FORMAT_SIGNED_RGB_16] = NULL;
table[MESA_FORMAT_SIGNED_RGBA_16] = NULL;
- table[MESA_FORMAT_SIGNED_A8] = NULL;
- table[MESA_FORMAT_SIGNED_L8] = NULL;
- table[MESA_FORMAT_SIGNED_AL88] = NULL;
- table[MESA_FORMAT_SIGNED_I8] = NULL;
- table[MESA_FORMAT_SIGNED_A16] = NULL;
- table[MESA_FORMAT_SIGNED_L16] = NULL;
- table[MESA_FORMAT_SIGNED_AL1616] = NULL;
- table[MESA_FORMAT_SIGNED_I16] = NULL;
table[MESA_FORMAT_RGBA_16] = pack_ubyte_RGBA_16;
table[MESA_FORMAT_I16] = pack_float_L16; /* reuse pack_float_L16 */
table[MESA_FORMAT_YCBCR] = pack_float_YCBCR;
table[MESA_FORMAT_YCBCR_REV] = pack_float_YCBCR_REV;
- table[MESA_FORMAT_R8] = pack_float_R8;
- table[MESA_FORMAT_GR88] = pack_float_GR88;
- table[MESA_FORMAT_RG88] = pack_float_RG88;
- table[MESA_FORMAT_R16] = pack_float_R16;
- table[MESA_FORMAT_RG1616] = pack_float_RG1616;
- table[MESA_FORMAT_RG1616_REV] = pack_float_RG1616_REV;
/* should never convert RGBA to these formats */
table[MESA_FORMAT_Z24_S8] = NULL;
table[MESA_FORMAT_SL8] = pack_float_SL8;
table[MESA_FORMAT_SLA8] = pack_float_SLA8;
- /* n/a */
- table[MESA_FORMAT_SRGB_DXT1] = NULL;
- table[MESA_FORMAT_SRGBA_DXT1] = NULL;
- table[MESA_FORMAT_SRGBA_DXT3] = NULL;
- table[MESA_FORMAT_SRGBA_DXT5] = NULL;
-
- table[MESA_FORMAT_RGB_FXT1] = NULL;
- table[MESA_FORMAT_RGBA_FXT1] = NULL;
- table[MESA_FORMAT_RGB_DXT1] = NULL;
- table[MESA_FORMAT_RGBA_DXT1] = NULL;
- table[MESA_FORMAT_RGBA_DXT3] = NULL;
- table[MESA_FORMAT_RGBA_DXT5] = NULL;
-
table[MESA_FORMAT_RGBA_FLOAT32] = pack_float_RGBA_FLOAT32;
table[MESA_FORMAT_RGBA_FLOAT16] = pack_float_RGBA_FLOAT16;
table[MESA_FORMAT_RGB_FLOAT32] = pack_float_RGB_FLOAT32;
table[MESA_FORMAT_INTENSITY_FLOAT32] = pack_float_LUMINANCE_FLOAT32;
table[MESA_FORMAT_INTENSITY_FLOAT16] = pack_float_LUMINANCE_FLOAT16;
- table[MESA_FORMAT_R_FLOAT32] = pack_float_LUMINANCE_FLOAT32;
- table[MESA_FORMAT_R_FLOAT16] = pack_float_LUMINANCE_FLOAT16;
- table[MESA_FORMAT_RG_FLOAT32] = pack_float_RG_FLOAT32;
- table[MESA_FORMAT_RG_FLOAT16] = pack_float_RG_FLOAT16;
/* n/a */
table[MESA_FORMAT_RGBA_INT8] = NULL;
table[MESA_FORMAT_RGBA_16] = pack_float_RGBA_16;
- table[MESA_FORMAT_SIGNED_R8] = pack_float_SIGNED_R8;
- table[MESA_FORMAT_SIGNED_RG88_REV] = pack_float_SIGNED_RG88_REV;
- table[MESA_FORMAT_SIGNED_RGBX8888] = pack_float_SIGNED_RGBX8888;
- table[MESA_FORMAT_SIGNED_RGBA8888] = pack_float_SIGNED_RGBA8888;
- table[MESA_FORMAT_SIGNED_RGBA8888_REV] = pack_float_SIGNED_RGBA8888_REV;
- table[MESA_FORMAT_SIGNED_R16] = pack_float_SIGNED_R16;
- table[MESA_FORMAT_SIGNED_GR1616] = pack_float_SIGNED_GR1616;
- table[MESA_FORMAT_SIGNED_RGB_16] = pack_float_SIGNED_RGB_16;
table[MESA_FORMAT_SIGNED_RGBA_16] = pack_float_SIGNED_RGBA_16;
- table[MESA_FORMAT_SIGNED_A8] = pack_float_SIGNED_A8;
- table[MESA_FORMAT_SIGNED_L8] = pack_float_SIGNED_L8;
- table[MESA_FORMAT_SIGNED_AL88] = pack_float_SIGNED_AL88;
- table[MESA_FORMAT_SIGNED_I8] = pack_float_SIGNED_L8; /* reused */
- table[MESA_FORMAT_SIGNED_A16] = pack_float_SIGNED_A16;
- table[MESA_FORMAT_SIGNED_L16] = pack_float_SIGNED_L16;
- table[MESA_FORMAT_SIGNED_AL1616] = pack_float_SIGNED_AL1616;
- table[MESA_FORMAT_SIGNED_I16] = pack_float_SIGNED_L16; /* reused */
initialized = GL_TRUE;
}
}
-static void
-unpack_R8(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLubyte *s = ((const GLubyte *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][0] = UBYTE_TO_FLOAT(s[i]);
- dst[i][1] =
- dst[i][2] = 0.0F;
- dst[i][3] = 1.0F;
- }
-}
-
-static void
-unpack_GR88(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLushort *s = ((const GLushort *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = UBYTE_TO_FLOAT( s[i] & 0xff );
- dst[i][GCOMP] = UBYTE_TO_FLOAT( s[i] >> 8 );
- dst[i][BCOMP] = 0.0;
- dst[i][ACOMP] = 1.0;
- }
-}
-
-static void
-unpack_RG88(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLushort *s = ((const GLushort *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = UBYTE_TO_FLOAT( s[i] >> 8 );
- dst[i][GCOMP] = UBYTE_TO_FLOAT( s[i] & 0xff );
- dst[i][BCOMP] = 0.0;
- dst[i][ACOMP] = 1.0;
- }
-}
-
-static void
-unpack_R16(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLushort *s = ((const GLushort *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = USHORT_TO_FLOAT(s[i]);
- dst[i][GCOMP] = 0.0;
- dst[i][BCOMP] = 0.0;
- dst[i][ACOMP] = 1.0;
- }
-}
-
-static void
-unpack_RG1616(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLuint *s = ((const GLuint *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = USHORT_TO_FLOAT( s[i] & 0xffff );
- dst[i][GCOMP] = USHORT_TO_FLOAT( s[i] >> 16 );
- dst[i][BCOMP] = 0.0;
- dst[i][ACOMP] = 1.0;
- }
-}
-
-static void
-unpack_RG1616_REV(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLuint *s = ((const GLuint *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = USHORT_TO_FLOAT( s[i] >> 16 );
- dst[i][GCOMP] = USHORT_TO_FLOAT( s[i] & 0xffff );
- dst[i][BCOMP] = 0.0;
- dst[i][ACOMP] = 1.0;
- }
-}
-
static void
unpack_Z24_S8(const void *src, GLfloat dst[][4], GLuint n)
}
}
-static void
-unpack_SL8(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLubyte *s = ((const GLubyte *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] =
- dst[i][GCOMP] =
- dst[i][BCOMP] = nonlinear_to_linear(s[i]);
- dst[i][ACOMP] = 1.0F;
- }
-}
-
-static void
-unpack_SLA8(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLushort *s = (const GLushort *) src;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] =
- dst[i][GCOMP] =
- dst[i][BCOMP] = nonlinear_to_linear(s[i] & 0xff);
- dst[i][ACOMP] = UBYTE_TO_FLOAT(s[i] >> 8); /* linear! */
- }
-}
-
-static void
-unpack_SRGB_DXT1(const void *src, GLfloat dst[][4], GLuint n)
-{
-}
-
-static void
-unpack_SRGBA_DXT1(const void *src, GLfloat dst[][4], GLuint n)
-{
-}
-
-static void
-unpack_SRGBA_DXT3(const void *src, GLfloat dst[][4], GLuint n)
-{
-}
-
-static void
-unpack_SRGBA_DXT5(const void *src, GLfloat dst[][4], GLuint n)
-{
-}
-
-static void
-unpack_RGB_FXT1(const void *src, GLfloat dst[][4], GLuint n)
-{
-}
-
-static void
-unpack_RGBA_FXT1(const void *src, GLfloat dst[][4], GLuint n)
-{
-}
-
-static void
-unpack_RGB_DXT1(const void *src, GLfloat dst[][4], GLuint n)
-{
-}
-
-static void
-unpack_RGBA_DXT1(const void *src, GLfloat dst[][4], GLuint n)
-{
-}
-
-static void
-unpack_RGBA_DXT3(const void *src, GLfloat dst[][4], GLuint n)
-{
-}
-
-static void
-unpack_RGBA_DXT5(const void *src, GLfloat dst[][4], GLuint n)
-{
-}
-
static void
unpack_RGBA_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
}
}
-static void
-unpack_R_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLfloat *s = (const GLfloat *) src;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = s[i];
- dst[i][GCOMP] = 0.0F;
- dst[i][BCOMP] = 0.0F;
- dst[i][ACOMP] = 1.0F;
- }
-}
-
-static void
-unpack_R_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLhalfARB *s = (const GLhalfARB *) src;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = _mesa_half_to_float(s[i]);
- dst[i][GCOMP] = 0.0F;
- dst[i][BCOMP] = 0.0F;
- dst[i][ACOMP] = 1.0F;
- }
-}
-
-static void
-unpack_RG_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLfloat *s = (const GLfloat *) src;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = s[i*2+0];
- dst[i][GCOMP] = s[i*2+1];
- dst[i][BCOMP] = 0.0F;
- dst[i][ACOMP] = 1.0F;
- }
-}
-
-static void
-unpack_RG_FLOAT16(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLhalfARB *s = (const GLhalfARB *) src;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = _mesa_half_to_float(s[i*2+0]);
- dst[i][GCOMP] = _mesa_half_to_float(s[i*2+1]);
- dst[i][BCOMP] = 0.0F;
- dst[i][ACOMP] = 1.0F;
- }
-}
-
-
static void
unpack_RGBA_INT8(const void *src, GLfloat dst[][4], GLuint n)
{
}
}
-static void
-unpack_SIGNED_R8(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLbyte *s = ((const GLbyte *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = BYTE_TO_FLOAT_TEX( s[i] );
- dst[i][GCOMP] = 0.0F;
- dst[i][BCOMP] = 0.0F;
- dst[i][ACOMP] = 1.0F;
- }
-}
-
-static void
-unpack_SIGNED_RG88_REV(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLushort *s = ((const GLushort *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] & 0xff) );
- dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
- dst[i][BCOMP] = 0.0F;
- dst[i][ACOMP] = 1.0F;
- }
-}
-
-static void
-unpack_SIGNED_RGBX8888(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLuint *s = ((const GLuint *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 24) );
- dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 16) );
- dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
- dst[i][ACOMP] = 1.0f;
- }
-}
-
-static void
-unpack_SIGNED_RGBA8888(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLuint *s = ((const GLuint *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 24) );
- dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 16) );
- dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
- dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] ) );
- }
-}
-
-static void
-unpack_SIGNED_RGBA8888_REV(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLuint *s = ((const GLuint *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] ) );
- dst[i][GCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
- dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 16) );
- dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 24) );
- }
-}
-
-static void
-unpack_SIGNED_R16(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLshort *s = ((const GLshort *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = SHORT_TO_FLOAT_TEX( s[i] );
- dst[i][GCOMP] = 0.0F;
- dst[i][BCOMP] = 0.0F;
- dst[i][ACOMP] = 1.0F;
- }
-}
-
-static void
-unpack_SIGNED_GR1616(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLuint *s = ((const GLuint *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = SHORT_TO_FLOAT_TEX( (GLshort) (s[i] & 0xffff) );
- dst[i][GCOMP] = SHORT_TO_FLOAT_TEX( (GLshort) (s[i] >> 16) );
- dst[i][BCOMP] = 0.0F;
- dst[i][ACOMP] = 1.0F;
- }
-}
-
-static void
-unpack_SIGNED_RGB_16(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLshort *s = (const GLshort *) src;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = SHORT_TO_FLOAT_TEX( s[i*3+0] );
- dst[i][GCOMP] = SHORT_TO_FLOAT_TEX( s[i*3+1] );
- dst[i][BCOMP] = SHORT_TO_FLOAT_TEX( s[i*3+2] );
- dst[i][ACOMP] = 1.0F;
- }
-}
-
static void
unpack_SIGNED_RGBA_16(const void *src, GLfloat dst[][4], GLuint n)
{
}
}
-static void
-unpack_RED_RGTC1(const void *src, GLfloat dst[][4], GLuint n)
-{
- /* XXX to do */
-}
-
-static void
-unpack_SIGNED_RED_RGTC1(const void *src, GLfloat dst[][4], GLuint n)
-{
- /* XXX to do */
-}
-
-static void
-unpack_RG_RGTC2(const void *src, GLfloat dst[][4], GLuint n)
-{
- /* XXX to do */
-}
-
-static void
-unpack_SIGNED_RG_RGTC2(const void *src, GLfloat dst[][4], GLuint n)
-{
- /* XXX to do */
-}
-
-static void
-unpack_L_LATC1(const void *src, GLfloat dst[][4], GLuint n)
-{
- /* XXX to do */
-}
-
-static void
-unpack_SIGNED_L_LATC1(const void *src, GLfloat dst[][4], GLuint n)
-{
- /* XXX to do */
-}
-
-static void
-unpack_LA_LATC2(const void *src, GLfloat dst[][4], GLuint n)
-{
- /* XXX to do */
-}
-
-static void
-unpack_SIGNED_LA_LATC2(const void *src, GLfloat dst[][4], GLuint n)
-{
- /* XXX to do */
-}
-
-static void
-unpack_SIGNED_A8(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLbyte *s = ((const GLbyte *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = 0.0F;
- dst[i][GCOMP] = 0.0F;
- dst[i][BCOMP] = 0.0F;
- dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( s[i] );
- }
-}
-
-static void
-unpack_SIGNED_L8(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLbyte *s = ((const GLbyte *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] =
- dst[i][GCOMP] =
- dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( s[i] );
- dst[i][ACOMP] = 1.0F;
- }
-}
-
-static void
-unpack_SIGNED_AL88(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLshort *s = ((const GLshort *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] =
- dst[i][GCOMP] =
- dst[i][BCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] & 0xff) );
- dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s[i] >> 8) );
- }
-}
-
-static void
-unpack_SIGNED_I8(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLbyte *s = ((const GLbyte *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] =
- dst[i][GCOMP] =
- dst[i][BCOMP] =
- dst[i][ACOMP] = BYTE_TO_FLOAT_TEX( s[i] );
- }
-}
-
-static void
-unpack_SIGNED_A16(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLshort *s = ((const GLshort *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = 0.0F;
- dst[i][GCOMP] = 0.0F;
- dst[i][BCOMP] = 0.0F;
- dst[i][ACOMP] = SHORT_TO_FLOAT_TEX( s[i] );
- }
-}
-
-static void
-unpack_SIGNED_L16(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLshort *s = ((const GLshort *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] =
- dst[i][GCOMP] =
- dst[i][BCOMP] = SHORT_TO_FLOAT_TEX( s[i] );
- dst[i][ACOMP] = 1.0F;
- }
-}
-
-static void
-unpack_SIGNED_AL1616(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLshort *s = (const GLshort *) src;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] =
- dst[i][GCOMP] =
- dst[i][BCOMP] = SHORT_TO_FLOAT_TEX( s[i*2+0] );
- dst[i][ACOMP] = SHORT_TO_FLOAT_TEX( s[i*2+1] );
- }
-}
-
-static void
-unpack_SIGNED_I16(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLshort *s = ((const GLshort *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] =
- dst[i][GCOMP] =
- dst[i][BCOMP] =
- dst[i][ACOMP] = SHORT_TO_FLOAT_TEX( s[i] );
- }
-}
-
/**
* Return the unpacker function for the given format.
table[MESA_FORMAT_I16] = unpack_I16;
table[MESA_FORMAT_YCBCR] = unpack_YCBCR;
table[MESA_FORMAT_YCBCR_REV] = unpack_YCBCR_REV;
- table[MESA_FORMAT_R8] = unpack_R8;
- table[MESA_FORMAT_GR88] = unpack_GR88;
- table[MESA_FORMAT_RG88] = unpack_RG88;
- table[MESA_FORMAT_R16] = unpack_R16;
- table[MESA_FORMAT_RG1616] = unpack_RG1616;
- table[MESA_FORMAT_RG1616_REV] = unpack_RG1616_REV;
table[MESA_FORMAT_Z24_S8] = unpack_Z24_S8;
table[MESA_FORMAT_S8_Z24] = unpack_S8_Z24;
table[MESA_FORMAT_Z16] = unpack_Z16;
table[MESA_FORMAT_SRGB8] = unpack_SRGB8;
table[MESA_FORMAT_SRGBA8] = unpack_SRGBA8;
table[MESA_FORMAT_SARGB8] = unpack_SARGB8;
- table[MESA_FORMAT_SL8] = unpack_SL8;
- table[MESA_FORMAT_SLA8] = unpack_SLA8;
- table[MESA_FORMAT_SRGB_DXT1] = unpack_SRGB_DXT1;
- table[MESA_FORMAT_SRGBA_DXT1] = unpack_SRGBA_DXT1;
- table[MESA_FORMAT_SRGBA_DXT3] = unpack_SRGBA_DXT3;
- table[MESA_FORMAT_SRGBA_DXT5] = unpack_SRGBA_DXT5;
-
- table[MESA_FORMAT_RGB_FXT1] = unpack_RGB_FXT1;
- table[MESA_FORMAT_RGBA_FXT1] = unpack_RGBA_FXT1;
- table[MESA_FORMAT_RGB_DXT1] = unpack_RGB_DXT1;
- table[MESA_FORMAT_RGBA_DXT1] = unpack_RGBA_DXT1;
- table[MESA_FORMAT_RGBA_DXT3] = unpack_RGBA_DXT3;
- table[MESA_FORMAT_RGBA_DXT5] = unpack_RGBA_DXT5;
table[MESA_FORMAT_RGBA_FLOAT32] = unpack_RGBA_FLOAT32;
table[MESA_FORMAT_RGBA_FLOAT16] = unpack_RGBA_FLOAT16;
table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16] = unpack_LUMINANCE_ALPHA_FLOAT16;
table[MESA_FORMAT_INTENSITY_FLOAT32] = unpack_INTENSITY_FLOAT32;
table[MESA_FORMAT_INTENSITY_FLOAT16] = unpack_INTENSITY_FLOAT16;
- table[MESA_FORMAT_R_FLOAT32] = unpack_R_FLOAT32;
- table[MESA_FORMAT_R_FLOAT16] = unpack_R_FLOAT16;
- table[MESA_FORMAT_RG_FLOAT32] = unpack_RG_FLOAT32;
- table[MESA_FORMAT_RG_FLOAT16] = unpack_RG_FLOAT16;
table[MESA_FORMAT_RGBA_INT8] = unpack_RGBA_INT8;
table[MESA_FORMAT_RGBA_INT16] = unpack_RGBA_INT16;
table[MESA_FORMAT_RGBA_UINT32] = unpack_RGBA_UINT32;
table[MESA_FORMAT_DUDV8] = unpack_DUDV8;
- table[MESA_FORMAT_SIGNED_R8] = unpack_SIGNED_R8;
- table[MESA_FORMAT_SIGNED_RG88_REV] = unpack_SIGNED_RG88_REV;
- table[MESA_FORMAT_SIGNED_RGBX8888] = unpack_SIGNED_RGBX8888;
- table[MESA_FORMAT_SIGNED_RGBA8888] = unpack_SIGNED_RGBA8888;
- table[MESA_FORMAT_SIGNED_RGBA8888_REV] = unpack_SIGNED_RGBA8888_REV;
- table[MESA_FORMAT_SIGNED_R16] = unpack_SIGNED_R16;
- table[MESA_FORMAT_SIGNED_GR1616] = unpack_SIGNED_GR1616;
- table[MESA_FORMAT_SIGNED_RGB_16] = unpack_SIGNED_RGB_16;
table[MESA_FORMAT_SIGNED_RGBA_16] = unpack_SIGNED_RGBA_16;
table[MESA_FORMAT_RGBA_16] = unpack_RGBA_16;
- table[MESA_FORMAT_RED_RGTC1] = unpack_RED_RGTC1;
- table[MESA_FORMAT_SIGNED_RED_RGTC1] = unpack_SIGNED_RED_RGTC1;
- table[MESA_FORMAT_RG_RGTC2] = unpack_RG_RGTC2;
- table[MESA_FORMAT_SIGNED_RG_RGTC2] = unpack_SIGNED_RG_RGTC2;
-
- table[MESA_FORMAT_L_LATC1] = unpack_L_LATC1;
- table[MESA_FORMAT_SIGNED_L_LATC1] = unpack_SIGNED_L_LATC1;
- table[MESA_FORMAT_LA_LATC2] = unpack_LA_LATC2;
- table[MESA_FORMAT_SIGNED_LA_LATC2] = unpack_SIGNED_LA_LATC2;
-
- table[MESA_FORMAT_SIGNED_A8] = unpack_SIGNED_A8;
- table[MESA_FORMAT_SIGNED_L8] = unpack_SIGNED_L8;
- table[MESA_FORMAT_SIGNED_AL88] = unpack_SIGNED_AL88;
- table[MESA_FORMAT_SIGNED_I8] = unpack_SIGNED_I8;
- table[MESA_FORMAT_SIGNED_A16] = unpack_SIGNED_A16;
- table[MESA_FORMAT_SIGNED_L16] = unpack_SIGNED_L16;
- table[MESA_FORMAT_SIGNED_AL1616] = unpack_SIGNED_AL1616;
- table[MESA_FORMAT_SIGNED_I16] = unpack_SIGNED_I16;
-
table[MESA_FORMAT_Z32_FLOAT] = unpack_Z32_FLOAT;
table[MESA_FORMAT_Z32_FLOAT_X24S8] = unpack_Z32_FLOAT_X24S8;
}
}
-static void
-unpack_ubyte_R8(const void *src, GLubyte dst[][4], GLuint n)
-{
- const GLubyte *s = ((const GLubyte *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][0] = s[i];
- dst[i][1] =
- dst[i][2] = 0;
- dst[i][3] = 0xff;
- }
-}
-
-static void
-unpack_ubyte_GR88(const void *src, GLubyte dst[][4], GLuint n)
-{
- const GLushort *s = ((const GLushort *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = s[i] & 0xff;
- dst[i][GCOMP] = s[i] >> 8;
- dst[i][BCOMP] = 0;
- dst[i][ACOMP] = 0xff;
- }
-}
-
-static void
-unpack_ubyte_RG88(const void *src, GLubyte dst[][4], GLuint n)
-{
- const GLushort *s = ((const GLushort *) src);
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = s[i] >> 8;
- dst[i][GCOMP] = s[i] & 0xff;
- dst[i][BCOMP] = 0;
- dst[i][ACOMP] = 0xff;
- }
-}
-
/**
* Unpack rgba colors, returning as GLubyte values. This should usually
case MESA_FORMAT_I8:
unpack_ubyte_I8(src, dst, n);
break;
- case MESA_FORMAT_R8:
- unpack_ubyte_R8(src, dst, n);
- break;
- case MESA_FORMAT_GR88:
- unpack_ubyte_GR88(src, dst, n);
- break;
- case MESA_FORMAT_RG88:
- unpack_ubyte_RG88(src, dst, n);
- break;
default:
/* get float values, convert to ubyte */
{
}
}
-static void
-unpack_int_rgba_RG_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
-{
- unsigned int i;
-
- for (i = 0; i < n; i++) {
- dst[i][0] = src[i * 2 + 0];
- dst[i][1] = src[i * 2 + 1];
- dst[i][2] = 0;
- dst[i][3] = 1;
- }
-}
-
-static void
-unpack_int_rgba_RG_UINT16(const GLushort *src, GLuint dst[][4], GLuint n)
-{
- unsigned int i;
-
- for (i = 0; i < n; i++) {
- dst[i][0] = src[i * 2 + 0];
- dst[i][1] = src[i * 2 + 1];
- dst[i][2] = 0;
- dst[i][3] = 1;
- }
-}
-
-static void
-unpack_int_rgba_RG_INT16(const GLshort *src, GLuint dst[][4], GLuint n)
-{
- unsigned int i;
-
- for (i = 0; i < n; i++) {
- dst[i][0] = src[i * 2 + 0];
- dst[i][1] = src[i * 2 + 1];
- dst[i][2] = 0;
- dst[i][3] = 1;
- }
-}
-
-static void
-unpack_int_rgba_RG_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n)
-{
- unsigned int i;
-
- for (i = 0; i < n; i++) {
- dst[i][0] = src[i * 2 + 0];
- dst[i][1] = src[i * 2 + 1];
- dst[i][2] = 0;
- dst[i][3] = 1;
- }
-}
-
-static void
-unpack_int_rgba_RG_INT8(const GLbyte *src, GLuint dst[][4], GLuint n)
-{
- unsigned int i;
-
- for (i = 0; i < n; i++) {
- dst[i][0] = src[i * 2 + 0];
- dst[i][1] = src[i * 2 + 1];
- dst[i][2] = 0;
- dst[i][3] = 1;
- }
-}
-
-static void
-unpack_int_rgba_R_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
-{
- unsigned int i;
-
- for (i = 0; i < n; i++) {
- dst[i][0] = src[i];
- dst[i][1] = 0;
- dst[i][2] = 0;
- dst[i][3] = 1;
- }
-}
-
-static void
-unpack_int_rgba_R_UINT16(const GLushort *src, GLuint dst[][4], GLuint n)
-{
- unsigned int i;
-
- for (i = 0; i < n; i++) {
- dst[i][0] = src[i];
- dst[i][1] = 0;
- dst[i][2] = 0;
- dst[i][3] = 1;
- }
-}
-
-static void
-unpack_int_rgba_R_INT16(const GLshort *src, GLuint dst[][4], GLuint n)
-{
- unsigned int i;
-
- for (i = 0; i < n; i++) {
- dst[i][0] = src[i];
- dst[i][1] = 0;
- dst[i][2] = 0;
- dst[i][3] = 1;
- }
-}
-
-static void
-unpack_int_rgba_R_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n)
-{
- unsigned int i;
-
- for (i = 0; i < n; i++) {
- dst[i][0] = src[i];
- dst[i][1] = 0;
- dst[i][2] = 0;
- dst[i][3] = 1;
- }
-}
-
-static void
-unpack_int_rgba_R_INT8(const GLbyte *src, GLuint dst[][4], GLuint n)
-{
- unsigned int i;
-
- for (i = 0; i < n; i++) {
- dst[i][0] = src[i];
- dst[i][1] = 0;
- dst[i][2] = 0;
- dst[i][3] = 1;
- }
-}
-
static void
unpack_int_rgba_ALPHA_UINT32(const GLuint *src, GLuint dst[][4], GLuint n)
{
unpack_int_rgba_RGB_INT8(src, dst, n);
break;
- case MESA_FORMAT_RG_UINT32:
- case MESA_FORMAT_RG_INT32:
- unpack_int_rgba_RG_UINT32(src, dst, n);
- break;
-
- case MESA_FORMAT_RG_UINT16:
- unpack_int_rgba_RG_UINT16(src, dst, n);
- break;
- case MESA_FORMAT_RG_INT16:
- unpack_int_rgba_RG_INT16(src, dst, n);
- break;
-
- case MESA_FORMAT_RG_UINT8:
- unpack_int_rgba_RG_UINT8(src, dst, n);
- break;
- case MESA_FORMAT_RG_INT8:
- unpack_int_rgba_RG_INT8(src, dst, n);
- break;
-
- case MESA_FORMAT_R_UINT32:
- case MESA_FORMAT_R_INT32:
- unpack_int_rgba_R_UINT32(src, dst, n);
- break;
-
- case MESA_FORMAT_R_UINT16:
- unpack_int_rgba_R_UINT16(src, dst, n);
- break;
- case MESA_FORMAT_R_INT16:
- unpack_int_rgba_R_INT16(src, dst, n);
- break;
-
- case MESA_FORMAT_R_UINT8:
- unpack_int_rgba_R_UINT8(src, dst, n);
- break;
- case MESA_FORMAT_R_INT8:
- unpack_int_rgba_R_INT8(src, dst, n);
- break;
-
case MESA_FORMAT_ALPHA_UINT32:
case MESA_FORMAT_ALPHA_INT32:
unpack_int_rgba_ALPHA_UINT32(src, dst, n);
0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
1, 1, 2 /* BlockWidth/Height,Bytes */
},
- {
- MESA_FORMAT_R8,
- "MESA_FORMAT_R8",
- GL_RED,
- GL_UNSIGNED_NORMALIZED,
- 8, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1
- },
- {
- MESA_FORMAT_GR88,
- "MESA_FORMAT_GR88",
- GL_RG,
- GL_UNSIGNED_NORMALIZED,
- 8, 8, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_RG88,
- "MESA_FORMAT_RG88",
- GL_RG,
- GL_UNSIGNED_NORMALIZED,
- 8, 8, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_R16,
- "MESA_FORMAT_R16",
- GL_RED,
- GL_UNSIGNED_NORMALIZED,
- 16, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_RG1616,
- "MESA_FORMAT_RG1616",
- GL_RG,
- GL_UNSIGNED_NORMALIZED,
- 16, 16, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_RG1616_REV,
- "MESA_FORMAT_RG1616_REV",
- GL_RG,
- GL_UNSIGNED_NORMALIZED,
- 16, 16, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
{
MESA_FORMAT_Z24_S8, /* Name */
"MESA_FORMAT_Z24_S8", /* StrName */
8, 0, 0, 0, 0,
1, 1, 2
},
- {
- MESA_FORMAT_SRGB_DXT1, /* Name */
- "MESA_FORMAT_SRGB_DXT1", /* StrName */
- GL_RGB, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 4, 4, 8 /* 8 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_SRGBA_DXT1,
- "MESA_FORMAT_SRGBA_DXT1",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 4,
- 0, 0, 0, 0, 0,
- 4, 4, 8 /* 8 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_SRGBA_DXT3,
- "MESA_FORMAT_SRGBA_DXT3",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 4,
- 0, 0, 0, 0, 0,
- 4, 4, 16 /* 16 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_SRGBA_DXT5,
- "MESA_FORMAT_SRGBA_DXT5",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 4,
- 0, 0, 0, 0, 0,
- 4, 4, 16 /* 16 bytes per 4x4 block */
- },
-
- {
- MESA_FORMAT_RGB_FXT1,
- "MESA_FORMAT_RGB_FXT1",
- GL_RGB,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 0, /* approx Red/Green/BlueBits */
- 0, 0, 0, 0, 0,
- 8, 4, 16 /* 16 bytes per 8x4 block */
- },
- {
- MESA_FORMAT_RGBA_FXT1,
- "MESA_FORMAT_RGBA_FXT1",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 1, /* approx Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0,
- 8, 4, 16 /* 16 bytes per 8x4 block */
- },
-
- {
- MESA_FORMAT_RGB_DXT1, /* Name */
- "MESA_FORMAT_RGB_DXT1", /* StrName */
- GL_RGB, /* BaseFormat */
- GL_UNSIGNED_NORMALIZED, /* DataType */
- 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 4, 4, 8 /* 8 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_RGBA_DXT1,
- "MESA_FORMAT_RGBA_DXT1",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 4,
- 0, 0, 0, 0, 0,
- 4, 4, 8 /* 8 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_RGBA_DXT3,
- "MESA_FORMAT_RGBA_DXT3",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 4,
- 0, 0, 0, 0, 0,
- 4, 4, 16 /* 16 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_RGBA_DXT5,
- "MESA_FORMAT_RGBA_DXT5",
- GL_RGBA,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 4, 4,
- 0, 0, 0, 0, 0,
- 4, 4, 16 /* 16 bytes per 4x4 block */
- },
{
MESA_FORMAT_RGBA_FLOAT32,
"MESA_FORMAT_RGBA_FLOAT32",
0, 16, 0, 0, 0,
1, 1, 2
},
- {
- MESA_FORMAT_R_FLOAT32,
- "MESA_FORMAT_R_FLOAT32",
- GL_RED,
- GL_FLOAT,
- 32, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_R_FLOAT16,
- "MESA_FORMAT_R_FLOAT16",
- GL_RED,
- GL_FLOAT,
- 16, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_RG_FLOAT32,
- "MESA_FORMAT_RG_FLOAT32",
- GL_RG,
- GL_FLOAT,
- 32, 32, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 8
- },
- {
- MESA_FORMAT_RG_FLOAT16,
- "MESA_FORMAT_RG_FLOAT16",
- GL_RG,
- GL_FLOAT,
- 16, 16, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
/* unnormalized signed int formats */
/* unnormalized unsigned int formats */
32, 0, 0, 0, 0,
1, 1, 8
},
-
- {
- MESA_FORMAT_R_INT8,
- "MESA_FORMAT_R_INT8",
- GL_RED,
- GL_INT,
- 8, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1
- },
- {
- MESA_FORMAT_RG_INT8,
- "MESA_FORMAT_RG_INT8",
- GL_RG,
- GL_INT,
- 8, 8, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
{
MESA_FORMAT_RGB_INT8,
"MESA_FORMAT_RGB_INT8",
0, 0, 0, 0, 0,
1, 1, 4
},
- {
- MESA_FORMAT_R_INT16,
- "MESA_FORMAT_R_INT16",
- GL_RED,
- GL_INT,
- 16, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_RG_INT16,
- "MESA_FORMAT_RG_INT16",
- GL_RG,
- GL_INT,
- 16, 16, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
{
MESA_FORMAT_RGB_INT16,
"MESA_FORMAT_RGB_INT16",
0, 0, 0, 0, 0,
1, 1, 8
},
- {
- MESA_FORMAT_R_INT32,
- "MESA_FORMAT_R_INT32",
- GL_RED,
- GL_INT,
- 32, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_RG_INT32,
- "MESA_FORMAT_RG_INT32",
- GL_RG,
- GL_INT,
- 32, 32, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 8
- },
{
MESA_FORMAT_RGB_INT32,
"MESA_FORMAT_RGB_INT32",
0, 0, 0, 0, 0,
1, 1, 16
},
- {
- MESA_FORMAT_R_UINT8,
- "MESA_FORMAT_R_UINT8",
- GL_RED,
- GL_UNSIGNED_INT,
- 8, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 1
- },
- {
- MESA_FORMAT_RG_UINT8,
- "MESA_FORMAT_RG_UINT8",
- GL_RG,
- GL_UNSIGNED_INT,
- 8, 8, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
{
MESA_FORMAT_RGB_UINT8,
"MESA_FORMAT_RGB_UINT8",
0, 0, 0, 0, 0,
1, 1, 4
},
- {
- MESA_FORMAT_R_UINT16,
- "MESA_FORMAT_R_UINT16",
- GL_RED,
- GL_UNSIGNED_INT,
- 16, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_RG_UINT16,
- "MESA_FORMAT_RG_UINT16",
- GL_RG,
- GL_UNSIGNED_INT,
- 16, 16, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
{
MESA_FORMAT_RGB_UINT16,
"MESA_FORMAT_RGB_UINT16",
0, 0, 0, 0, 0,
1, 1, 8
},
- {
- MESA_FORMAT_R_UINT32,
- "MESA_FORMAT_R_UINT32",
- GL_RED,
- GL_UNSIGNED_INT,
- 32, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_RG_UINT32,
- "MESA_FORMAT_RG_UINT32",
- GL_RG,
- GL_UNSIGNED_INT,
- 32, 32, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 8
- },
{
MESA_FORMAT_RGB_UINT32,
"MESA_FORMAT_RGB_UINT32",
0, 0, 0, 0, 0,
1, 1, 2
},
-
- /* Signed 8 bits / channel */
- {
- MESA_FORMAT_SIGNED_R8, /* Name */
- "MESA_FORMAT_SIGNED_R8", /* StrName */
- GL_RED, /* BaseFormat */
- GL_SIGNED_NORMALIZED, /* DataType */
- 8, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
- 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
- 1, 1, 1 /* BlockWidth/Height,Bytes */
- },
- {
- MESA_FORMAT_SIGNED_RG88_REV,
- "MESA_FORMAT_SIGNED_RG88_REV",
- GL_RG,
- GL_SIGNED_NORMALIZED,
- 8, 8, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_SIGNED_RGBX8888,
- "MESA_FORMAT_SIGNED_RGBX8888",
- GL_RGB,
- GL_SIGNED_NORMALIZED,
- 8, 8, 8, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 4 /* 4 bpp, but no alpha */
- },
- {
- MESA_FORMAT_SIGNED_RGBA8888,
- "MESA_FORMAT_SIGNED_RGBA8888",
- GL_RGBA,
- GL_SIGNED_NORMALIZED,
- 8, 8, 8, 8,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_SIGNED_RGBA8888_REV,
- "MESA_FORMAT_SIGNED_RGBA8888_REV",
- GL_RGBA,
- GL_SIGNED_NORMALIZED,
- 8, 8, 8, 8,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
-
- /* Signed 16 bits / channel */
- {
- MESA_FORMAT_SIGNED_R16,
- "MESA_FORMAT_SIGNED_R16",
- GL_RED,
- GL_SIGNED_NORMALIZED,
- 16, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_SIGNED_GR1616,
- "MESA_FORMAT_SIGNED_GR1616",
- GL_RG,
- GL_SIGNED_NORMALIZED,
- 16, 16, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_SIGNED_RGB_16,
- "MESA_FORMAT_SIGNED_RGB_16",
- GL_RGB,
- GL_SIGNED_NORMALIZED,
- 16, 16, 16, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 6
- },
{
MESA_FORMAT_SIGNED_RGBA_16,
"MESA_FORMAT_SIGNED_RGBA_16",
0, 0, 0, 0, 0,
1, 1, 8
},
- {
- MESA_FORMAT_RED_RGTC1,
- "MESA_FORMAT_RED_RGTC1",
- GL_RED,
- GL_UNSIGNED_NORMALIZED,
- 4, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 4, 4, 8 /* 8 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_SIGNED_RED_RGTC1,
- "MESA_FORMAT_SIGNED_RED_RGTC1",
- GL_RED,
- GL_SIGNED_NORMALIZED,
- 4, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 4, 4, 8 /* 8 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_RG_RGTC2,
- "MESA_FORMAT_RG_RGTC2",
- GL_RG,
- GL_UNSIGNED_NORMALIZED,
- 4, 4, 0, 0,
- 0, 0, 0, 0, 0,
- 4, 4, 16 /* 16 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_SIGNED_RG_RGTC2,
- "MESA_FORMAT_SIGNED_RG_RGTC2",
- GL_RG,
- GL_SIGNED_NORMALIZED,
- 4, 4, 0, 0,
- 0, 0, 0, 0, 0,
- 4, 4, 16 /* 16 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_L_LATC1,
- "MESA_FORMAT_L_LATC1",
- GL_LUMINANCE,
- GL_UNSIGNED_NORMALIZED,
- 0, 0, 0, 0,
- 4, 0, 0, 0, 0,
- 4, 4, 8 /* 8 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_SIGNED_L_LATC1,
- "MESA_FORMAT_SIGNED_L_LATC1",
- GL_LUMINANCE,
- GL_SIGNED_NORMALIZED,
- 0, 0, 0, 0,
- 4, 0, 0, 0, 0,
- 4, 4, 8 /* 8 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_LA_LATC2,
- "MESA_FORMAT_LA_LATC2",
- GL_LUMINANCE_ALPHA,
- GL_UNSIGNED_NORMALIZED,
- 0, 0, 0, 4,
- 4, 0, 0, 0, 0,
- 4, 4, 16 /* 16 bytes per 4x4 block */
- },
- {
- MESA_FORMAT_SIGNED_LA_LATC2,
- "MESA_FORMAT_SIGNED_LA_LATC2",
- GL_LUMINANCE_ALPHA,
- GL_SIGNED_NORMALIZED,
- 0, 0, 0, 4,
- 4, 0, 0, 0, 0,
- 4, 4, 16 /* 16 bytes per 4x4 block */
- },
-
- /* Signed formats from EXT_texture_snorm that are not in GL3.1 */
- {
- MESA_FORMAT_SIGNED_A8,
- "MESA_FORMAT_SIGNED_A8",
- GL_ALPHA,
- GL_SIGNED_NORMALIZED,
- 0, 0, 0, 8,
- 0, 0, 0, 0, 0,
- 1, 1, 1
- },
- {
- MESA_FORMAT_SIGNED_L8,
- "MESA_FORMAT_SIGNED_L8",
- GL_LUMINANCE,
- GL_SIGNED_NORMALIZED,
- 0, 0, 0, 0,
- 8, 0, 0, 0, 0,
- 1, 1, 1
- },
- {
- MESA_FORMAT_SIGNED_AL88,
- "MESA_FORMAT_SIGNED_AL88",
- GL_LUMINANCE_ALPHA,
- GL_SIGNED_NORMALIZED,
- 0, 0, 0, 8,
- 8, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_SIGNED_I8,
- "MESA_FORMAT_SIGNED_I8",
- GL_INTENSITY,
- GL_SIGNED_NORMALIZED,
- 0, 0, 0, 0,
- 0, 8, 0, 0, 0,
- 1, 1, 1
- },
- {
- MESA_FORMAT_SIGNED_A16,
- "MESA_FORMAT_SIGNED_A16",
- GL_ALPHA,
- GL_SIGNED_NORMALIZED,
- 0, 0, 0, 16,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_SIGNED_L16,
- "MESA_FORMAT_SIGNED_L16",
- GL_LUMINANCE,
- GL_SIGNED_NORMALIZED,
- 0, 0, 0, 0,
- 16, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
- MESA_FORMAT_SIGNED_AL1616,
- "MESA_FORMAT_SIGNED_AL1616",
- GL_LUMINANCE_ALPHA,
- GL_SIGNED_NORMALIZED,
- 0, 0, 0, 16,
- 16, 0, 0, 0, 0,
- 1, 1, 4
- },
- {
- MESA_FORMAT_SIGNED_I16,
- "MESA_FORMAT_SIGNED_I16",
- GL_INTENSITY,
- GL_SIGNED_NORMALIZED,
- 0, 0, 0, 0,
- 0, 16, 0, 0, 0,
- 1, 1, 2
- },
/* ARB_depth_buffer_float */
{
MESA_FORMAT_Z32_FLOAT, /* Name */
{
const struct gl_format_info *info = _mesa_get_format_info(format);
ASSERT(info->BytesPerBlock);
- ASSERT(info->BytesPerBlock <= MAX_PIXEL_BYTES ||
- _mesa_is_format_compressed(format));
+ ASSERT(info->BytesPerBlock <= MAX_PIXEL_BYTES);
return info->BytesPerBlock;
}
}
-/** Is the given format a compressed format? */
-GLboolean
-_mesa_is_format_compressed(gl_format format)
-{
- const struct gl_format_info *info = _mesa_get_format_info(format);
- return info->BlockWidth > 1 || info->BlockHeight > 1;
-}
-
-
/**
* Determine if the given format represents a packed depth/stencil buffer.
*/
case MESA_FORMAT_SARGB8:
case MESA_FORMAT_SL8:
case MESA_FORMAT_SLA8:
- case MESA_FORMAT_SRGB_DXT1:
- case MESA_FORMAT_SRGBA_DXT1:
- case MESA_FORMAT_SRGBA_DXT3:
- case MESA_FORMAT_SRGBA_DXT5:
return GL_SRGB;
default:
return GL_LINEAR;
case MESA_FORMAT_SLA8:
format = MESA_FORMAT_AL88;
break;
- case MESA_FORMAT_SRGB_DXT1:
- format = MESA_FORMAT_RGB_DXT1;
- break;
- case MESA_FORMAT_SRGBA_DXT1:
- format = MESA_FORMAT_RGBA_DXT1;
- break;
- case MESA_FORMAT_SRGBA_DXT3:
- format = MESA_FORMAT_RGBA_DXT3;
- break;
- case MESA_FORMAT_SRGBA_DXT5:
- format = MESA_FORMAT_RGBA_DXT5;
- break;
default:
break;
}
}
-/**
- * If the given format is a compressed format, return a corresponding
- * uncompressed format.
- */
-gl_format
-_mesa_get_uncompressed_format(gl_format format)
-{
- switch (format) {
- case MESA_FORMAT_RGB_FXT1:
- return MESA_FORMAT_RGB888;
- case MESA_FORMAT_RGBA_FXT1:
- return MESA_FORMAT_RGBA8888;
- case MESA_FORMAT_RGB_DXT1:
- case MESA_FORMAT_SRGB_DXT1:
- return MESA_FORMAT_RGB888;
- case MESA_FORMAT_RGBA_DXT1:
- case MESA_FORMAT_SRGBA_DXT1:
- return MESA_FORMAT_RGBA8888;
- case MESA_FORMAT_RGBA_DXT3:
- case MESA_FORMAT_SRGBA_DXT3:
- return MESA_FORMAT_RGBA8888;
- case MESA_FORMAT_RGBA_DXT5:
- case MESA_FORMAT_SRGBA_DXT5:
- return MESA_FORMAT_RGBA8888;
- case MESA_FORMAT_RED_RGTC1:
- return MESA_FORMAT_R8;
- case MESA_FORMAT_SIGNED_RED_RGTC1:
- return MESA_FORMAT_SIGNED_R8;
- case MESA_FORMAT_RG_RGTC2:
- return MESA_FORMAT_GR88;
- case MESA_FORMAT_SIGNED_RG_RGTC2:
- return MESA_FORMAT_SIGNED_RG88_REV;
- case MESA_FORMAT_L_LATC1:
- return MESA_FORMAT_L8;
- case MESA_FORMAT_SIGNED_L_LATC1:
- return MESA_FORMAT_SIGNED_L8;
- case MESA_FORMAT_LA_LATC2:
- return MESA_FORMAT_AL88;
- case MESA_FORMAT_SIGNED_LA_LATC2:
- return MESA_FORMAT_SIGNED_AL88;
- default:
-#ifdef DEBUG
- assert(!_mesa_is_format_compressed(format));
-#endif
- return format;
- }
-}
-
-
GLuint
_mesa_format_num_components(gl_format format)
{
case MESA_FORMAT_AL88:
case MESA_FORMAT_AL88_REV:
- case MESA_FORMAT_GR88:
- case MESA_FORMAT_RG88:
*datatype = GL_UNSIGNED_BYTE;
*comps = 2;
return;
case MESA_FORMAT_AL1616:
case MESA_FORMAT_AL1616_REV:
- case MESA_FORMAT_RG1616:
- case MESA_FORMAT_RG1616_REV:
*datatype = GL_UNSIGNED_SHORT;
*comps = 2;
return;
- case MESA_FORMAT_R16:
case MESA_FORMAT_A16:
case MESA_FORMAT_L16:
case MESA_FORMAT_I16:
case MESA_FORMAT_A8:
case MESA_FORMAT_L8:
case MESA_FORMAT_I8:
- case MESA_FORMAT_R8:
case MESA_FORMAT_S8:
*datatype = GL_UNSIGNED_BYTE;
*comps = 1;
*comps = 2;
return;
- case MESA_FORMAT_SIGNED_R8:
- case MESA_FORMAT_SIGNED_A8:
- case MESA_FORMAT_SIGNED_L8:
- case MESA_FORMAT_SIGNED_I8:
- *datatype = GL_BYTE;
- *comps = 1;
- return;
- case MESA_FORMAT_SIGNED_RG88_REV:
- case MESA_FORMAT_SIGNED_AL88:
- *datatype = GL_BYTE;
- *comps = 2;
- return;
- case MESA_FORMAT_SIGNED_RGBA8888:
- case MESA_FORMAT_SIGNED_RGBA8888_REV:
- case MESA_FORMAT_SIGNED_RGBX8888:
- *datatype = GL_BYTE;
- *comps = 4;
- return;
-
case MESA_FORMAT_RGBA_16:
*datatype = GL_UNSIGNED_SHORT;
*comps = 4;
return;
- case MESA_FORMAT_SIGNED_R16:
- case MESA_FORMAT_SIGNED_A16:
- case MESA_FORMAT_SIGNED_L16:
- case MESA_FORMAT_SIGNED_I16:
- *datatype = GL_SHORT;
- *comps = 1;
- return;
- case MESA_FORMAT_SIGNED_GR1616:
- case MESA_FORMAT_SIGNED_AL1616:
- *datatype = GL_SHORT;
- *comps = 2;
- return;
- case MESA_FORMAT_SIGNED_RGB_16:
- *datatype = GL_SHORT;
- *comps = 3;
- return;
case MESA_FORMAT_SIGNED_RGBA_16:
*datatype = GL_SHORT;
*comps = 4;
return;
#endif
-#if FEATURE_texture_fxt1
- case MESA_FORMAT_RGB_FXT1:
- case MESA_FORMAT_RGBA_FXT1:
-#endif
-#if FEATURE_texture_s3tc
- case MESA_FORMAT_RGB_DXT1:
- case MESA_FORMAT_RGBA_DXT1:
- case MESA_FORMAT_RGBA_DXT3:
- case MESA_FORMAT_RGBA_DXT5:
-#if FEATURE_EXT_texture_sRGB
- case MESA_FORMAT_SRGB_DXT1:
- case MESA_FORMAT_SRGBA_DXT1:
- case MESA_FORMAT_SRGBA_DXT3:
- case MESA_FORMAT_SRGBA_DXT5:
-#endif
-#endif
- case MESA_FORMAT_RED_RGTC1:
- case MESA_FORMAT_SIGNED_RED_RGTC1:
- case MESA_FORMAT_RG_RGTC2:
- case MESA_FORMAT_SIGNED_RG_RGTC2:
- case MESA_FORMAT_L_LATC1:
- case MESA_FORMAT_SIGNED_L_LATC1:
- case MESA_FORMAT_LA_LATC2:
- case MESA_FORMAT_SIGNED_LA_LATC2:
- /* XXX generate error instead? */
- *datatype = GL_UNSIGNED_BYTE;
- *comps = 0;
- return;
-
case MESA_FORMAT_RGBA_FLOAT32:
*datatype = GL_FLOAT;
*comps = 4;
*comps = 3;
return;
case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32:
- case MESA_FORMAT_RG_FLOAT32:
*datatype = GL_FLOAT;
*comps = 2;
return;
case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16:
- case MESA_FORMAT_RG_FLOAT16:
*datatype = GL_HALF_FLOAT_ARB;
*comps = 2;
return;
case MESA_FORMAT_ALPHA_FLOAT32:
case MESA_FORMAT_LUMINANCE_FLOAT32:
case MESA_FORMAT_INTENSITY_FLOAT32:
- case MESA_FORMAT_R_FLOAT32:
*datatype = GL_FLOAT;
*comps = 1;
return;
case MESA_FORMAT_ALPHA_FLOAT16:
case MESA_FORMAT_LUMINANCE_FLOAT16:
case MESA_FORMAT_INTENSITY_FLOAT16:
- case MESA_FORMAT_R_FLOAT16:
*datatype = GL_HALF_FLOAT_ARB;
*comps = 1;
return;
*comps = 2;
return;
- case MESA_FORMAT_R_INT8:
- *datatype = GL_BYTE;
- *comps = 1;
- return;
- case MESA_FORMAT_RG_INT8:
- *datatype = GL_BYTE;
- *comps = 2;
- return;
case MESA_FORMAT_RGB_INT8:
*datatype = GL_BYTE;
*comps = 3;
*datatype = GL_BYTE;
*comps = 4;
return;
- case MESA_FORMAT_R_INT16:
- *datatype = GL_SHORT;
- *comps = 1;
- return;
- case MESA_FORMAT_RG_INT16:
- *datatype = GL_SHORT;
- *comps = 2;
- return;
case MESA_FORMAT_RGB_INT16:
*datatype = GL_SHORT;
*comps = 3;
*datatype = GL_SHORT;
*comps = 4;
return;
- case MESA_FORMAT_R_INT32:
- *datatype = GL_INT;
- *comps = 1;
- return;
- case MESA_FORMAT_RG_INT32:
- *datatype = GL_INT;
- *comps = 2;
- return;
case MESA_FORMAT_RGB_INT32:
*datatype = GL_INT;
*comps = 3;
/**
* \name Non-normalized unsigned integer formats.
*/
- case MESA_FORMAT_R_UINT8:
- *datatype = GL_UNSIGNED_BYTE;
- *comps = 1;
- return;
- case MESA_FORMAT_RG_UINT8:
- *datatype = GL_UNSIGNED_BYTE;
- *comps = 2;
- return;
case MESA_FORMAT_RGB_UINT8:
*datatype = GL_UNSIGNED_BYTE;
*comps = 3;
*datatype = GL_UNSIGNED_BYTE;
*comps = 4;
return;
- case MESA_FORMAT_R_UINT16:
- *datatype = GL_UNSIGNED_SHORT;
- *comps = 1;
- return;
- case MESA_FORMAT_RG_UINT16:
- *datatype = GL_UNSIGNED_SHORT;
- *comps = 2;
- return;
case MESA_FORMAT_RGB_UINT16:
*datatype = GL_UNSIGNED_SHORT;
*comps = 3;
*datatype = GL_UNSIGNED_SHORT;
*comps = 4;
return;
- case MESA_FORMAT_R_UINT32:
- *datatype = GL_UNSIGNED_INT;
- *comps = 1;
- return;
- case MESA_FORMAT_RG_UINT32:
- *datatype = GL_UNSIGNED_INT;
- *comps = 2;
- return;
case MESA_FORMAT_RGB_UINT32:
*datatype = GL_UNSIGNED_INT;
*comps = 3;
case MESA_FORMAT_YCBCR_REV:
return GL_FALSE;
- case MESA_FORMAT_R8:
- return format == GL_RED && type == GL_UNSIGNED_BYTE;
- case MESA_FORMAT_GR88:
- return format == GL_RG && type == GL_UNSIGNED_BYTE && littleEndian;
- case MESA_FORMAT_RG88:
- return GL_FALSE;
-
- case MESA_FORMAT_R16:
- return format == GL_RED && type == GL_UNSIGNED_SHORT && littleEndian;
- case MESA_FORMAT_RG1616:
- return format == GL_RG && type == GL_UNSIGNED_SHORT && littleEndian;
- case MESA_FORMAT_RG1616_REV:
- return GL_FALSE;
-
case MESA_FORMAT_Z24_S8:
return format == GL_DEPTH_STENCIL && type == GL_UNSIGNED_INT_24_8;
case MESA_FORMAT_Z24_X8:
case MESA_FORMAT_SARGB8:
case MESA_FORMAT_SL8:
case MESA_FORMAT_SLA8:
- case MESA_FORMAT_SRGB_DXT1:
- case MESA_FORMAT_SRGBA_DXT1:
- case MESA_FORMAT_SRGBA_DXT3:
- case MESA_FORMAT_SRGBA_DXT5:
- return GL_FALSE;
-
- case MESA_FORMAT_RGB_FXT1:
- case MESA_FORMAT_RGBA_FXT1:
- case MESA_FORMAT_RGB_DXT1:
- case MESA_FORMAT_RGBA_DXT1:
- case MESA_FORMAT_RGBA_DXT3:
- case MESA_FORMAT_RGBA_DXT5:
return GL_FALSE;
case MESA_FORMAT_RGBA_FLOAT32:
case MESA_FORMAT_INTENSITY_FLOAT16:
return format == GL_INTENSITY && type == GL_HALF_FLOAT;
- case MESA_FORMAT_R_FLOAT32:
- return format == GL_RED && type == GL_FLOAT;
- case MESA_FORMAT_R_FLOAT16:
- return format == GL_RED && type == GL_HALF_FLOAT;
-
- case MESA_FORMAT_RG_FLOAT32:
- return format == GL_RG && type == GL_FLOAT;
- case MESA_FORMAT_RG_FLOAT16:
- return format == GL_RG && type == GL_HALF_FLOAT;
-
/* FINISHME: What do we want to do for GL_EXT_texture_integer? */
case MESA_FORMAT_ALPHA_UINT8:
case MESA_FORMAT_ALPHA_UINT16:
case MESA_FORMAT_LUMINANCE_ALPHA_INT32:
return GL_FALSE;
- case MESA_FORMAT_R_INT8:
- case MESA_FORMAT_RG_INT8:
case MESA_FORMAT_RGB_INT8:
case MESA_FORMAT_RGBA_INT8:
- case MESA_FORMAT_R_INT16:
- case MESA_FORMAT_RG_INT16:
case MESA_FORMAT_RGB_INT16:
case MESA_FORMAT_RGBA_INT16:
- case MESA_FORMAT_R_INT32:
- case MESA_FORMAT_RG_INT32:
case MESA_FORMAT_RGB_INT32:
case MESA_FORMAT_RGBA_INT32:
return GL_FALSE;
- case MESA_FORMAT_R_UINT8:
- case MESA_FORMAT_RG_UINT8:
case MESA_FORMAT_RGB_UINT8:
case MESA_FORMAT_RGBA_UINT8:
- case MESA_FORMAT_R_UINT16:
- case MESA_FORMAT_RG_UINT16:
case MESA_FORMAT_RGB_UINT16:
case MESA_FORMAT_RGBA_UINT16:
- case MESA_FORMAT_R_UINT32:
- case MESA_FORMAT_RG_UINT32:
case MESA_FORMAT_RGB_UINT32:
case MESA_FORMAT_RGBA_UINT32:
return GL_FALSE;
case MESA_FORMAT_DUDV8:
- case MESA_FORMAT_SIGNED_R8:
- case MESA_FORMAT_SIGNED_RG88_REV:
- case MESA_FORMAT_SIGNED_RGBX8888:
- case MESA_FORMAT_SIGNED_RGBA8888:
- case MESA_FORMAT_SIGNED_RGBA8888_REV:
- case MESA_FORMAT_SIGNED_R16:
- case MESA_FORMAT_SIGNED_GR1616:
- case MESA_FORMAT_SIGNED_RGB_16:
case MESA_FORMAT_SIGNED_RGBA_16:
case MESA_FORMAT_RGBA_16:
/* FINISHME: SNORM */
return GL_FALSE;
- case MESA_FORMAT_RED_RGTC1:
- case MESA_FORMAT_SIGNED_RED_RGTC1:
- case MESA_FORMAT_RG_RGTC2:
- case MESA_FORMAT_SIGNED_RG_RGTC2:
- return GL_FALSE;
-
- case MESA_FORMAT_L_LATC1:
- case MESA_FORMAT_SIGNED_L_LATC1:
- case MESA_FORMAT_LA_LATC2:
- case MESA_FORMAT_SIGNED_LA_LATC2:
- return GL_FALSE;
-
- case MESA_FORMAT_SIGNED_A8:
- case MESA_FORMAT_SIGNED_L8:
- case MESA_FORMAT_SIGNED_AL88:
- case MESA_FORMAT_SIGNED_I8:
- case MESA_FORMAT_SIGNED_A16:
- case MESA_FORMAT_SIGNED_L16:
- case MESA_FORMAT_SIGNED_AL1616:
- case MESA_FORMAT_SIGNED_I16:
- /* FINISHME: SNORM */
- return GL_FALSE;
-
case MESA_FORMAT_Z32_FLOAT:
return format == GL_DEPTH_COMPONENT && type == GL_FLOAT;
MESA_FORMAT_I16, /* IIII IIII IIII IIII */
MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */
MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */
- MESA_FORMAT_R8, /* RRRR RRRR */
- MESA_FORMAT_GR88, /* GGGG GGGG RRRR RRRR */
- MESA_FORMAT_RG88, /* RRRR RRRR GGGG GGGG */
- MESA_FORMAT_R16, /* RRRR RRRR RRRR RRRR */
- MESA_FORMAT_RG1616, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
- MESA_FORMAT_RG1616_REV, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */
MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */
MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */
MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */
MESA_FORMAT_SARGB8, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */
MESA_FORMAT_SL8, /* LLLL LLLL */
MESA_FORMAT_SLA8, /* AAAA AAAA LLLL LLLL */
- MESA_FORMAT_SRGB_DXT1,
- MESA_FORMAT_SRGBA_DXT1,
- MESA_FORMAT_SRGBA_DXT3,
- MESA_FORMAT_SRGBA_DXT5,
- /*@}*/
-
- /**
- * \name Compressed texture formats.
- */
- /*@{*/
- MESA_FORMAT_RGB_FXT1,
- MESA_FORMAT_RGBA_FXT1,
- MESA_FORMAT_RGB_DXT1,
- MESA_FORMAT_RGBA_DXT1,
- MESA_FORMAT_RGBA_DXT3,
- MESA_FORMAT_RGBA_DXT5,
/*@}*/
/**
MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16,
MESA_FORMAT_INTENSITY_FLOAT32,
MESA_FORMAT_INTENSITY_FLOAT16,
- MESA_FORMAT_R_FLOAT32,
- MESA_FORMAT_R_FLOAT16,
- MESA_FORMAT_RG_FLOAT32,
- MESA_FORMAT_RG_FLOAT16,
/*@}*/
/**
MESA_FORMAT_LUMINANCE_ALPHA_INT16,
MESA_FORMAT_LUMINANCE_ALPHA_INT32,
- MESA_FORMAT_R_INT8,
- MESA_FORMAT_RG_INT8,
MESA_FORMAT_RGB_INT8,
MESA_FORMAT_RGBA_INT8,
- MESA_FORMAT_R_INT16,
- MESA_FORMAT_RG_INT16,
MESA_FORMAT_RGB_INT16,
MESA_FORMAT_RGBA_INT16,
- MESA_FORMAT_R_INT32,
- MESA_FORMAT_RG_INT32,
MESA_FORMAT_RGB_INT32,
MESA_FORMAT_RGBA_INT32,
/**
* \name Non-normalized unsigned integer formats.
*/
- MESA_FORMAT_R_UINT8,
- MESA_FORMAT_RG_UINT8,
MESA_FORMAT_RGB_UINT8,
MESA_FORMAT_RGBA_UINT8,
- MESA_FORMAT_R_UINT16,
- MESA_FORMAT_RG_UINT16,
MESA_FORMAT_RGB_UINT16,
MESA_FORMAT_RGBA_UINT16,
- MESA_FORMAT_R_UINT32,
- MESA_FORMAT_RG_UINT32,
MESA_FORMAT_RGB_UINT32,
MESA_FORMAT_RGBA_UINT32,
*/
/*@{*/
MESA_FORMAT_DUDV8, /* DUDU DUDU DVDV DVDV */
- MESA_FORMAT_SIGNED_R8, /* RRRR RRRR */
- MESA_FORMAT_SIGNED_RG88_REV, /* GGGG GGGG RRRR RRRR */
- MESA_FORMAT_SIGNED_RGBX8888, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */
- MESA_FORMAT_SIGNED_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */
- MESA_FORMAT_SIGNED_RGBA8888_REV,/*AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */
- MESA_FORMAT_SIGNED_R16, /* RRRR RRRR RRRR RRRR */
- MESA_FORMAT_SIGNED_GR1616, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */
- MESA_FORMAT_SIGNED_RGB_16, /* ushort[0]=R, ushort[1]=G, ushort[2]=B */
MESA_FORMAT_SIGNED_RGBA_16, /* ... */
MESA_FORMAT_RGBA_16, /* ... */
/*@}*/
- /*@{*/
- MESA_FORMAT_RED_RGTC1,
- MESA_FORMAT_SIGNED_RED_RGTC1,
- MESA_FORMAT_RG_RGTC2,
- MESA_FORMAT_SIGNED_RG_RGTC2,
- /*@}*/
-
- /*@{*/
- MESA_FORMAT_L_LATC1,
- MESA_FORMAT_SIGNED_L_LATC1,
- MESA_FORMAT_LA_LATC2,
- MESA_FORMAT_SIGNED_LA_LATC2,
- /*@}*/
-
- MESA_FORMAT_SIGNED_A8, /* AAAA AAAA */
- MESA_FORMAT_SIGNED_L8, /* LLLL LLLL */
- MESA_FORMAT_SIGNED_AL88, /* AAAA AAAA LLLL LLLL */
- MESA_FORMAT_SIGNED_I8, /* IIII IIII */
- MESA_FORMAT_SIGNED_A16, /* AAAA AAAA AAAA AAAA */
- MESA_FORMAT_SIGNED_L16, /* LLLL LLLL LLLL LLLL */
- MESA_FORMAT_SIGNED_AL1616, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */
- MESA_FORMAT_SIGNED_I16, /* IIII IIII IIII IIII */
-
MESA_FORMAT_Z32_FLOAT,
MESA_FORMAT_Z32_FLOAT_X24S8,
extern void
_mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh);
-extern GLboolean
-_mesa_is_format_compressed(gl_format format);
-
extern GLboolean
_mesa_is_format_packed_depth_stencil(gl_format format);
extern gl_format
_mesa_get_srgb_format_linear(gl_format format);
-extern gl_format
-_mesa_get_uncompressed_format(gl_format format);
-
extern GLuint
_mesa_format_num_components(gl_format format);
#include "mfeatures.h"
#include "mtypes.h"
#include "state.h"
-#include "texcompress.h"
#include "framebuffer.h"
/* This is a table driven implemetation of the glGet*v() functions.
};
-EXTRA_EXT(ARB_ES2_compatibility);
EXTRA_EXT(ARB_texture_cube_map);
EXTRA_EXT(MESA_texture_array);
EXTRA_EXT2(EXT_secondary_color, ARB_vertex_program);
EXTRA_EXT(NV_point_sprite);
EXTRA_EXT(NV_vertex_program);
EXTRA_EXT(NV_fragment_program);
-EXTRA_EXT(NV_texture_rectangle);
EXTRA_EXT(EXT_stencil_two_side);
EXTRA_EXT(NV_light_max_exponent);
EXTRA_EXT(EXT_depth_bounds_test);
EXTRA_END
};
-static const int
-extra_NV_primitive_restart[] = {
- EXT(NV_primitive_restart),
- EXTRA_END
-};
-
static const int extra_version_30[] = { EXTRA_VERSION_30, EXTRA_END };
static const int extra_version_31[] = { EXTRA_VERSION_31, EXTRA_END };
static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END };
{ GL_TEXTURE_COORD_ARRAY_STRIDE,
LOC_CUSTOM, TYPE_INT, offsetof(struct gl_client_array, Stride), NO_EXTRA },
- /* GL_ARB_ES2_compatibility */
- { GL_SHADER_COMPILER, CONST(1), extra_ARB_ES2_compatibility },
- { GL_MAX_VARYING_VECTORS, CONTEXT_INT(Const.MaxVarying),
- extra_ARB_ES2_compatibility },
- { GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0,
- extra_ARB_ES2_compatibility },
- { GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT, 0,
- extra_ARB_ES2_compatibility },
-
/* GL_ARB_multitexture */
{ GL_MAX_TEXTURE_UNITS, CONTEXT_INT(Const.MaxTextureUnits), NO_EXTRA },
{ GL_CLIENT_ACTIVE_TEXTURE, LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA },
CONST(MAX_NV_FRAGMENT_PROGRAM_PARAMS),
extra_NV_fragment_program },
- /* GL_NV_texture_rectangle */
- { GL_TEXTURE_RECTANGLE_NV,
- LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_NV_texture_rectangle },
- { GL_TEXTURE_BINDING_RECTANGLE_NV,
- LOC_CUSTOM, TYPE_INT, TEXTURE_RECT_INDEX, extra_NV_texture_rectangle },
- { GL_MAX_RECTANGLE_TEXTURE_SIZE_NV,
- CONTEXT_INT(Const.MaxTextureRectSize), extra_NV_texture_rectangle },
-
/* GL_EXT_stencil_two_side */
{ GL_STENCIL_TEST_TWO_SIDE_EXT, CONTEXT_BOOL(Stencil.TestTwoSide),
extra_EXT_stencil_two_side },
extra_NV_light_max_exponent },
{ GL_MAX_SPOT_EXPONENT_NV, CONTEXT_FLOAT(Const.MaxSpotExponent),
extra_NV_light_max_exponent },
-
- /* GL_NV_primitive_restart */
- { GL_PRIMITIVE_RESTART_NV, CONTEXT_BOOL(Array.PrimitiveRestart),
- extra_NV_primitive_restart },
- { GL_PRIMITIVE_RESTART_INDEX_NV, CONTEXT_INT(Array.RestartIndex),
- extra_NV_primitive_restart },
/* GL_ARB_vertex_buffer_object */
{ GL_INDEX_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
/* GL3.0 / GL_EXT_framebuffer_sRGB */
{ GL_FRAMEBUFFER_SRGB_EXT, CONTEXT_BOOL(Color.sRGBEnabled), extra_EXT_framebuffer_sRGB },
{ GL_FRAMEBUFFER_SRGB_CAPABLE_EXT, BUFFER_INT(Visual.sRGBCapable), extra_EXT_framebuffer_sRGB },
-
- /* GL 3.1 */
- /* NOTE: different enum values for GL_PRIMITIVE_RESTART_NV
- * vs. GL_PRIMITIVE_RESTART!
- */
- { GL_PRIMITIVE_RESTART, CONTEXT_BOOL(Array.PrimitiveRestart),
- extra_version_31 },
- { GL_PRIMITIVE_RESTART_INDEX, CONTEXT_INT(Array.RestartIndex),
- extra_version_31 },
/* GL 3.2 */
case GL_TEXTURE_1D_ARRAY_EXT:
case GL_TEXTURE_2D_ARRAY_EXT:
case GL_TEXTURE_CUBE_MAP_ARB:
- case GL_TEXTURE_RECTANGLE_NV:
v->value_bool = _mesa_IsEnabled(d->pname);
break;
v->value_matrix = ctx->CurrentStack->Top;
break;
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB:
- v->value_int = _mesa_get_compressed_formats(ctx, NULL);
- break;
- case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
- v->value_int_n.n =
- _mesa_get_compressed_formats(ctx, v->value_int_n.ints);
- ASSERT(v->value_int_n.n <= 100);
- break;
-
case GL_MAX_VARYING_FLOATS_ARB:
v->value_int = ctx->Const.MaxVarying * 4;
break;
return GL_INVALID_ENUM;
}
- case GL_RG:
- if (!ctx->Extensions.ARB_texture_rg)
- return GL_INVALID_ENUM;
- switch (type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- return GL_NO_ERROR;
- case GL_HALF_FLOAT:
- return ctx->Extensions.ARB_half_float_pixel
- ? GL_NO_ERROR : GL_INVALID_ENUM;
- default:
- return GL_INVALID_ENUM;
- }
-
case GL_RGB:
switch (type) {
case GL_BYTE:
case GL_RGB32F_ARB:
case GL_RGBA16F_ARB:
case GL_RGBA32F_ARB:
- /* compressed formats */
- case GL_COMPRESSED_ALPHA:
- case GL_COMPRESSED_LUMINANCE:
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- case GL_COMPRESSED_INTENSITY:
- case GL_COMPRESSED_RED:
- case GL_COMPRESSED_RG:
- case GL_COMPRESSED_RGB:
- case GL_COMPRESSED_RGBA:
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
#if FEATURE_EXT_texture_sRGB
case GL_SRGB_EXT:
case GL_SRGB8_EXT:
case GL_SLUMINANCE8_ALPHA8_EXT:
case GL_SLUMINANCE_EXT:
case GL_SLUMINANCE8_EXT:
- case GL_COMPRESSED_SRGB_EXT:
- case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- case GL_COMPRESSED_SLUMINANCE_EXT:
- case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
#endif /* FEATURE_EXT_texture_sRGB */
- case GL_COMPRESSED_RED_RGTC1:
- case GL_COMPRESSED_SIGNED_RED_RGTC1:
- case GL_COMPRESSED_RG_RGTC2:
- case GL_COMPRESSED_SIGNED_RG_RGTC2:
- case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
- case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
- case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
- case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
- case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
/* generic integer formats */
case GL_RED_INTEGER_EXT:
case GL_GREEN_INTEGER_EXT:
case GL_RGBA_INTEGER_EXT:
case GL_BGR_INTEGER_EXT:
case GL_BGRA_INTEGER_EXT:
- case GL_RG_INTEGER:
case GL_LUMINANCE_INTEGER_EXT:
case GL_LUMINANCE_ALPHA_INTEGER_EXT:
/* sized integer formats */
case GL_RGBA32UI_EXT:
case GL_RGB32UI_EXT:
- case GL_RG32UI:
- case GL_R32UI:
case GL_ALPHA32UI_EXT:
case GL_INTENSITY32UI_EXT:
case GL_LUMINANCE32UI_EXT:
case GL_LUMINANCE_ALPHA32UI_EXT:
case GL_RGBA16UI_EXT:
case GL_RGB16UI_EXT:
- case GL_RG16UI:
- case GL_R16UI:
case GL_ALPHA16UI_EXT:
case GL_INTENSITY16UI_EXT:
case GL_LUMINANCE16UI_EXT:
case GL_LUMINANCE_ALPHA16UI_EXT:
case GL_RGBA8UI_EXT:
case GL_RGB8UI_EXT:
- case GL_RG8UI:
- case GL_R8UI:
case GL_ALPHA8UI_EXT:
case GL_INTENSITY8UI_EXT:
case GL_LUMINANCE8UI_EXT:
case GL_LUMINANCE_ALPHA8UI_EXT:
case GL_RGBA32I_EXT:
case GL_RGB32I_EXT:
- case GL_RG32I:
- case GL_R32I:
case GL_ALPHA32I_EXT:
case GL_INTENSITY32I_EXT:
case GL_LUMINANCE32I_EXT:
case GL_LUMINANCE_ALPHA32I_EXT:
case GL_RGBA16I_EXT:
case GL_RGB16I_EXT:
- case GL_RG16I:
- case GL_R16I:
case GL_ALPHA16I_EXT:
case GL_INTENSITY16I_EXT:
case GL_LUMINANCE16I_EXT:
case GL_LUMINANCE_ALPHA16I_EXT:
case GL_RGBA8I_EXT:
case GL_RGB8I_EXT:
- case GL_RG8I:
- case GL_R8I:
case GL_ALPHA8I_EXT:
case GL_INTENSITY8I_EXT:
case GL_LUMINANCE8I_EXT:
case GL_LUMINANCE_ALPHA8I_EXT:
- /* signed, normalized texture formats */
- case GL_RED_SNORM:
- case GL_R8_SNORM:
- case GL_R16_SNORM:
- case GL_RG_SNORM:
- case GL_RG8_SNORM:
- case GL_RG16_SNORM:
- case GL_RGB_SNORM:
- case GL_RGB8_SNORM:
- case GL_RGB16_SNORM:
- case GL_RGBA_SNORM:
- case GL_RGBA8_SNORM:
- case GL_RGBA16_SNORM:
- case GL_ALPHA_SNORM:
- case GL_ALPHA8_SNORM:
- case GL_ALPHA16_SNORM:
- case GL_LUMINANCE_SNORM:
- case GL_LUMINANCE8_SNORM:
- case GL_LUMINANCE16_SNORM:
- case GL_LUMINANCE_ALPHA_SNORM:
- case GL_LUMINANCE8_ALPHA8_SNORM:
- case GL_LUMINANCE16_ALPHA16_SNORM:
- case GL_INTENSITY_SNORM:
- case GL_INTENSITY8_SNORM:
- case GL_INTENSITY16_SNORM:
case GL_R11F_G11F_B10F:
case GL_RGB10_A2UI:
return GL_TRUE;
}
-/**
- * Test if an image format is a supported compressed format.
- * \param format the internal format token provided by the user.
- * \return GL_TRUE if compressed, GL_FALSE if uncompressed
- */
-GLboolean
-_mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
-{
- switch (format) {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return ctx->Extensions.EXT_texture_compression_s3tc;
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- return ctx->Extensions.S3_s3tc;
- case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- return ctx->Extensions.EXT_texture_sRGB
- && ctx->Extensions.EXT_texture_compression_s3tc;
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return ctx->Extensions.TDFX_texture_compression_FXT1;
- case GL_COMPRESSED_RED_RGTC1:
- case GL_COMPRESSED_SIGNED_RED_RGTC1:
- case GL_COMPRESSED_RG_RGTC2:
- case GL_COMPRESSED_SIGNED_RG_RGTC2:
- return ctx->Extensions.ARB_texture_compression_rgtc;
- case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
- case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
- case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
- case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
- return ctx->Extensions.EXT_texture_compression_latc;
- case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
- return ctx->Extensions.ATI_texture_compression_3dc;
- default:
- return GL_FALSE;
- }
-}
-
-
/**
* Does the given base texture/renderbuffer format have the channel
* named by 'pname'?
extern GLboolean
_mesa_is_integer_format(GLenum format);
-extern GLboolean
-_mesa_is_compressed_format(struct gl_context *ctx, GLenum format);
-
extern GLboolean
_mesa_base_format_has_channel(GLenum base_format, GLenum pname);
dstWidth, dstHeight, dstData[i], dstRowStride);
}
break;
- case GL_TEXTURE_RECTANGLE_NV:
- /* no mipmaps, do nothing */
- break;
default:
_mesa_problem(NULL, "bad tex target in _mesa_generate_mipmaps");
return;
} /* loop over mipmap levels */
}
-
-static void
-generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
- struct gl_texture_object *texObj,
- struct gl_texture_image *srcImage,
- GLuint maxLevel)
-{
- GLint level;
- gl_format temp_format;
- GLint components;
- GLuint temp_src_stride; /* in bytes */
- GLubyte *temp_src = NULL, *temp_dst = NULL;
- GLenum temp_datatype;
- GLenum temp_base_format;
-
- /* only two types of compressed textures at this time */
- assert(texObj->Target == GL_TEXTURE_2D ||
- texObj->Target == GL_TEXTURE_CUBE_MAP_ARB);
-
- /*
- * Choose a format for the temporary, uncompressed base image.
- * Then, get number of components, choose temporary image datatype,
- * and get base format.
- */
- temp_format = _mesa_get_uncompressed_format(srcImage->TexFormat);
-
- components = _mesa_format_num_components(temp_format);
-
- /* Revisit this if we get compressed formats with >8 bits per component */
- if (_mesa_get_format_datatype(srcImage->TexFormat)
- == GL_SIGNED_NORMALIZED) {
- temp_datatype = GL_BYTE;
- }
- else {
- temp_datatype = GL_UNSIGNED_BYTE;
- }
-
- temp_base_format = _mesa_get_format_base_format(temp_format);
-
-
- /* allocate storage for the temporary, uncompressed image */
- /* 20 extra bytes, just be safe when calling last FetchTexel */
- temp_src_stride = _mesa_format_row_stride(temp_format, srcImage->Width);
- temp_src = (GLubyte *) malloc(temp_src_stride * srcImage->Height + 20);
- if (!temp_src) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
- return;
- }
-
- /* decompress base image to the temporary */
- {
- /* save pixel packing mode */
- struct gl_pixelstore_attrib save = ctx->Pack;
- /* use default/tight packing parameters */
- ctx->Pack = ctx->DefaultPacking;
-
- /* Get the uncompressed image */
- assert(srcImage->Level == texObj->BaseLevel);
- ctx->Driver.GetTexImage(ctx,
- temp_base_format, temp_datatype,
- temp_src, srcImage);
- /* restore packing mode */
- ctx->Pack = save;
- }
-
-
- for (level = texObj->BaseLevel; level < maxLevel; level++) {
- /* generate image[level+1] from image[level] */
- const struct gl_texture_image *srcImage;
- struct gl_texture_image *dstImage;
- GLint srcWidth, srcHeight, srcDepth;
- GLint dstWidth, dstHeight, dstDepth;
- GLint border;
- GLboolean nextLevel;
- GLuint temp_dst_stride; /* in bytes */
-
- /* get src image parameters */
- srcImage = _mesa_select_tex_image(ctx, texObj, target, level);
- ASSERT(srcImage);
- srcWidth = srcImage->Width;
- srcHeight = srcImage->Height;
- srcDepth = srcImage->Depth;
- border = srcImage->Border;
-
- nextLevel = next_mipmap_level_size(target, border,
- srcWidth, srcHeight, srcDepth,
- &dstWidth, &dstHeight, &dstDepth);
- if (!nextLevel)
- break;
-
- temp_dst_stride = _mesa_format_row_stride(temp_format, dstWidth);
- if (!temp_dst) {
- temp_dst = (GLubyte *) malloc(temp_dst_stride * dstHeight);
- if (!temp_dst) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
- break;
- }
- }
-
- /* get dest gl_texture_image */
- dstImage = _mesa_get_tex_image(ctx, texObj, target, level + 1);
- if (!dstImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
- free(temp_dst);
- return;
- }
-
- /* rescale src image to dest image */
- _mesa_generate_mipmap_level(target, temp_datatype, components, border,
- srcWidth, srcHeight, srcDepth,
- (const GLubyte **) &temp_src,
- temp_src_stride,
- dstWidth, dstHeight, dstDepth,
- &temp_dst, temp_dst_stride);
-
- if (!_mesa_prepare_mipmap_level(ctx, texObj, level + 1,
- dstWidth, dstHeight, dstDepth,
- border, srcImage->InternalFormat,
- srcImage->TexFormat)) {
- free(temp_dst);
- return;
- }
-
- /* The image space was allocated above so use glTexSubImage now */
- ctx->Driver.TexSubImage2D(ctx, dstImage,
- 0, 0, dstWidth, dstHeight,
- temp_base_format, temp_datatype,
- temp_dst, &ctx->DefaultPacking);
-
- /* swap src and dest pointers */
- {
- GLubyte *temp = temp_src;
- temp_src = temp_dst;
- temp_dst = temp;
- temp_src_stride = temp_dst_stride;
- }
- } /* loop over mipmap levels */
-
- free(temp_src);
- free(temp_dst);
-}
-
/**
* Automatic mipmap generation.
* This is the fallback/default function for ctx->Driver.GenerateMipmap().
maxLevel = MIN2(maxLevel, texObj->MaxLevel);
- if (_mesa_is_format_compressed(srcImage->TexFormat)) {
- generate_mipmap_compressed(ctx, target, texObj, srcImage, maxLevel);
- } else {
- generate_mipmap_uncompressed(ctx, target, texObj, srcImage, maxLevel);
- }
+ generate_mipmap_uncompressed(ctx, target, texObj, srcImage, maxLevel);
}
TEXTURE_1D_ARRAY_INDEX,
TEXTURE_CUBE_INDEX,
TEXTURE_3D_INDEX,
- TEXTURE_RECT_INDEX,
TEXTURE_2D_INDEX,
TEXTURE_1D_INDEX,
NUM_TEXTURE_TARGETS
#define TEXTURE_1D_ARRAY_BIT (1 << TEXTURE_1D_ARRAY_INDEX)
#define TEXTURE_CUBE_BIT (1 << TEXTURE_CUBE_INDEX)
#define TEXTURE_3D_BIT (1 << TEXTURE_3D_INDEX)
-#define TEXTURE_RECT_BIT (1 << TEXTURE_RECT_INDEX)
#define TEXTURE_2D_BIT (1 << TEXTURE_2D_INDEX)
#define TEXTURE_1D_BIT (1 << TEXTURE_1D_INDEX)
/*@}*/
GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */
GLuint LockCount; /**< GL_EXT_compiled_vertex_array */
- /** GL 3.1 (slightly different from GL_NV_primitive_restart) */
- GLboolean PrimitiveRestart;
- GLuint RestartIndex;
-
GLbitfield64 NewState; /**< mask of VERT_BIT_* values */
GLboolean RebindArrays; /**< whether the VBO module should rebind arrays */
GLuint MaxNativeParameters;
/* For shaders */
GLuint MaxUniformComponents; /**< Usually == MaxParameters * 4 */
- /* ES 2.0 and GL_ARB_ES2_compatibility */
- struct gl_precision LowFloat, MediumFloat, HighFloat;
- struct gl_precision LowInt, MediumInt, HighInt;
};
GLint Max3DTextureLevels; /**< Max mipmap levels for 3D textures */
GLint MaxCubeTextureLevels; /**< Max mipmap levels for cube textures */
GLint MaxArrayTextureLayers; /**< Max layers in array textures */
- GLint MaxTextureRectSize; /**< Max rectangle texture size, in pixes */
GLuint MaxTextureCoordUnits;
GLuint MaxTextureImageUnits;
GLuint MaxVertexTextureImageUnits;
GLboolean dummy; /* don't remove this! */
GLboolean dummy_true; /* Set true by _mesa_init_extensions(). */
GLboolean dummy_false; /* Set false by _mesa_init_extensions(). */
- GLboolean ARB_ES2_compatibility;
GLboolean ARB_color_buffer_float;
GLboolean ARB_conservative_depth;
GLboolean ARB_copy_buffer;
GLboolean ARB_shading_language_100;
GLboolean ARB_texture_border_clamp;
GLboolean ARB_texture_buffer_object;
- GLboolean ARB_texture_compression_rgtc;
GLboolean ARB_texture_cube_map;
GLboolean ARB_texture_env_combine;
GLboolean ARB_texture_env_crossbar;
GLboolean ARB_texture_env_dot3;
GLboolean ARB_texture_float;
GLboolean ARB_texture_non_power_of_two;
- GLboolean ARB_texture_rg;
GLboolean ARB_texture_storage;
GLboolean ARB_transpose_matrix;
GLboolean ARB_uniform_buffer_object;
GLboolean EXT_stencil_two_side;
GLboolean EXT_texture3D;
GLboolean EXT_texture_array;
- GLboolean EXT_texture_compression_latc;
- GLboolean EXT_texture_compression_s3tc;
GLboolean EXT_texture_env_dot3;
GLboolean EXT_texture_filter_anisotropic;
GLboolean EXT_texture_integer;
GLboolean EXT_texture_mirror_clamp;
- GLboolean EXT_texture_snorm;
GLboolean EXT_texture_sRGB;
/* vendor extensions */
GLboolean APPLE_packed_pixels;
GLboolean APPLE_vertex_array_object;
GLboolean APPLE_object_purgeable;
GLboolean ATI_envmap_bumpmap;
- GLboolean ATI_texture_compression_3dc;
GLboolean ATI_texture_mirror_once;
GLboolean ATI_texture_env_combine3;
GLboolean ATI_separate_stencil;
GLboolean NV_fragment_program_option;
GLboolean NV_light_max_exponent;
GLboolean NV_point_sprite;
- GLboolean NV_primitive_restart;
GLboolean NV_texture_barrier;
GLboolean NV_texgen_reflection;
GLboolean NV_texture_env_combine4;
- GLboolean NV_texture_rectangle;
GLboolean NV_vertex_program;
GLboolean NV_vertex_program1_1;
GLboolean SGIS_texture_lod;
- GLboolean TDFX_texture_compression_FXT1;
- GLboolean S3_s3tc;
GLboolean extension_sentinel;
/** The extension string */
const GLubyte *String;
validate_program(ctx, program);
}
-#ifdef FEATURE_ES2
-
-void GLAPIENTRY
-_mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype,
- GLint* range, GLint* precision)
-{
- const struct gl_program_constants *limits;
- const struct gl_precision *p;
- GET_CURRENT_CONTEXT(ctx);
-
- switch (shadertype) {
- case GL_VERTEX_SHADER:
- limits = &ctx->Const.VertexProgram;
- break;
- case GL_FRAGMENT_SHADER:
- limits = &ctx->Const.FragmentProgram;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetShaderPrecisionFormat(shadertype)");
- return;
- }
-
- switch (precisiontype) {
- case GL_LOW_FLOAT:
- p = &limits->LowFloat;
- break;
- case GL_MEDIUM_FLOAT:
- p = &limits->MediumFloat;
- break;
- case GL_HIGH_FLOAT:
- p = &limits->HighFloat;
- break;
- case GL_LOW_INT:
- p = &limits->LowInt;
- break;
- case GL_MEDIUM_INT:
- p = &limits->MediumInt;
- break;
- case GL_HIGH_INT:
- p = &limits->HighInt;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetShaderPrecisionFormat(precisiontype)");
- return;
- }
-
- range[0] = p->RangeMin;
- range[1] = p->RangeMax;
- precision[0] = p->Precision;
-}
-
-
-void GLAPIENTRY
-_mesa_ReleaseShaderCompiler(void)
-{
- _mesa_destroy_shader_compiler_caches();
-}
-
-
-void GLAPIENTRY
-_mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat,
- const void* binary, GLint length)
-{
- GET_CURRENT_CONTEXT(ctx);
- (void) n;
- (void) shaders;
- (void) binaryformat;
- (void) binary;
- (void) length;
- _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
-}
-
-#endif /* FEATURE_ES2 */
-
void
_mesa_use_shader_program(struct gl_context *ctx, GLenum type,
SET_BindFragDataLocationEXT(exec, _mesa_BindFragDataLocation);
SET_GetFragDataLocationEXT(exec, _mesa_GetFragDataLocation);
- /* GL_ARB_ES2_compatibility */
- SET_ReleaseShaderCompiler(exec, _mesa_ReleaseShaderCompiler);
- SET_GetShaderPrecisionFormat(exec, _mesa_GetShaderPrecisionFormat);
-
#endif /* FEATURE_GL */
}
_mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize,
GLsizei *length, GLchar *infoLog);
-
-extern void GLAPIENTRY
-_mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype,
- GLint *range, GLint *precision);
-
-extern void GLAPIENTRY
-_mesa_ReleaseShaderCompiler(void);
-
-extern void GLAPIENTRY
-_mesa_ShaderBinary(GLint n, const GLuint *shaders, GLenum binaryformat,
- const void* binary, GLint length);
-
extern void GLAPIENTRY
_mesa_ProgramParameteriARB(GLuint program, GLenum pname,
GLint value);
GL_TEXTURE_1D_ARRAY_EXT,
GL_TEXTURE_CUBE_MAP,
GL_TEXTURE_3D,
- GL_TEXTURE_RECTANGLE_NV,
GL_TEXTURE_2D,
GL_TEXTURE_1D
};
#include "shaderobj.h"
#include "state.h"
#include "stencil.h"
-#include "texenvprogram.h"
#include "texobj.h"
#include "texstate.h"
#include "varray.h"
+++ /dev/null
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.1
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- * Copyright (c) 2008 VMware, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * \file texcompress.c
- * Helper functions for texture compression.
- */
-
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "formats.h"
-#include "mfeatures.h"
-#include "mtypes.h"
-#include "texcompress.h"
-#include "texcompress_fxt1.h"
-#include "texcompress_rgtc.h"
-#include "texcompress_s3tc.h"
-#include "swrast/s_context.h"
-
-
-/**
- * Get the GL base format of a specified GL compressed texture format
- *
- * From page 232 of the OpenGL 3.3 (Compatiblity Profile) spec:
- *
- * "Compressed Internal Format Base Internal Format Type
- * --------------------------- -------------------- ---------
- * COMPRESSED_ALPHA ALPHA Generic
- * COMPRESSED_LUMINANCE LUMINANCE Generic
- * COMPRESSED_LUMINANCE_ALPHA LUMINANCE_ALPHA Generic
- * COMPRESSED_INTENSITY INTENSITY Generic
- * COMPRESSED_RED RED Generic
- * COMPRESSED_RG RG Generic
- * COMPRESSED_RGB RGB Generic
- * COMPRESSED_RGBA RGBA Generic
- * COMPRESSED_SRGB RGB Generic
- * COMPRESSED_SRGB_ALPHA RGBA Generic
- * COMPRESSED_SLUMINANCE LUMINANCE Generic
- * COMPRESSED_SLUMINANCE_ALPHA LUMINANCE_ALPHA Generic
- * COMPRESSED_RED_RGTC1 RED Specific
- * COMPRESSED_SIGNED_RED_RGTC1 RED Specific
- * COMPRESSED_RG_RGTC2 RG Specific
- * COMPRESSED_SIGNED_RG_RGTC2 RG Specific"
- *
- * \return
- * The base format of \c format if \c format is a compressed format (either
- * generic or specific. Otherwise 0 is returned.
- */
-GLenum
-_mesa_gl_compressed_format_base_format(GLenum format)
-{
- switch (format) {
- case GL_COMPRESSED_RED:
- case GL_COMPRESSED_RED_RGTC1:
- case GL_COMPRESSED_SIGNED_RED_RGTC1:
- return GL_RED;
-
- case GL_COMPRESSED_RG:
- case GL_COMPRESSED_RG_RGTC2:
- case GL_COMPRESSED_SIGNED_RG_RGTC2:
- return GL_RG;
-
- case GL_COMPRESSED_RGB:
- case GL_COMPRESSED_SRGB:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- return GL_RGB;
-
- case GL_COMPRESSED_RGBA:
- case GL_COMPRESSED_SRGB_ALPHA:
- case GL_COMPRESSED_RGBA_BPTC_UNORM_ARB:
- case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB:
- case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB:
- case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- return GL_RGBA;
-
- case GL_COMPRESSED_ALPHA:
- return GL_ALPHA;
-
- case GL_COMPRESSED_LUMINANCE:
- case GL_COMPRESSED_SLUMINANCE:
- case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
- case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
- return GL_LUMINANCE;
-
- case GL_COMPRESSED_LUMINANCE_ALPHA:
- case GL_COMPRESSED_SLUMINANCE_ALPHA:
- case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
- case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
- case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
- return GL_LUMINANCE_ALPHA;
-
- case GL_COMPRESSED_INTENSITY:
- return GL_INTENSITY;
-
- default:
- return 0;
- }
-}
-
-/**
- * Return list of (and count of) all specific texture compression
- * formats that are supported.
- *
- * Some formats are \b not returned by this function. The
- * \c GL_COMPRESSED_TEXTURE_FORMATS query only returns formats that are
- * "suitable for general-purpose usage." All texture compression extensions
- * have taken this to mean either linear RGB or linear RGBA.
- *
- * The GL_ARB_texture_compress_rgtc spec says:
- *
- * "19) Should the GL_NUM_COMPRESSED_TEXTURE_FORMATS and
- * GL_COMPRESSED_TEXTURE_FORMATS queries return the RGTC formats?
- *
- * RESOLVED: No.
- *
- * The OpenGL 2.1 specification says "The only values returned
- * by this query [GL_COMPRESSED_TEXTURE_FORMATS"] are those
- * corresponding to formats suitable for general-purpose usage.
- * The renderer will not enumerate formats with restrictions that
- * need to be specifically understood prior to use."
- *
- * Compressed textures with just red or red-green components are
- * not general-purpose so should not be returned by these queries
- * because they have restrictions.
- *
- * Applications that seek to use the RGTC formats should do so
- * by looking for this extension's name in the string returned by
- * glGetString(GL_EXTENSIONS) rather than
- * what GL_NUM_COMPRESSED_TEXTURE_FORMATS and
- * GL_COMPRESSED_TEXTURE_FORMATS return."
- *
- * There is nearly identical wording in the GL_EXT_texture_compression_rgtc
- * spec.
- *
- * The GL_EXT_texture_rRGB spec says:
- *
- * "22) Should the new COMPRESSED_SRGB_* formats be listed in an
- * implementation's GL_COMPRESSED_TEXTURE_FORMATS list?
- *
- * RESOLVED: No. Section 3.8.1 says formats listed by
- * GL_COMPRESSED_TEXTURE_FORMATS are "suitable for general-purpose
- * usage." The non-linear distribution of red, green, and
- * blue for these sRGB compressed formats makes them not really
- * general-purpose."
- *
- * The GL_EXT_texture_compression_latc spec says:
- *
- * "16) Should the GL_NUM_COMPRESSED_TEXTURE_FORMATS and
- * GL_COMPRESSED_TEXTURE_FORMATS queries return the LATC formats?
- *
- * RESOLVED: No.
- *
- * The OpenGL 2.1 specification says "The only values returned
- * by this query [GL_COMPRESSED_TEXTURE_FORMATS"] are those
- * corresponding to formats suitable for general-purpose usage.
- * The renderer will not enumerate formats with restrictions that
- * need to be specifically understood prior to use."
- *
- * Historically, OpenGL implementation have advertised the RGB and
- * RGBA versions of the S3TC extensions compressed format tokens
- * through this mechanism.
- *
- * The specification is not sufficiently clear about what "suitable
- * for general-purpose usage" means. Historically that seems to mean
- * unsigned RGB or unsigned RGBA. The DXT1 format supporting alpha
- * (GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) is not exposed in the list (at
- * least for NVIDIA drivers) because the alpha is always 1.0 expect
- * when it is 0.0 when RGB is required to be black. NVIDIA's even
- * limits itself to true linear RGB or RGBA formats, specifically
- * not including EXT_texture_sRGB's sRGB S3TC compressed formats.
- *
- * Adding luminance and luminance-alpha texture formats (and
- * certainly signed versions of luminance and luminance-alpha
- * formats!) invites potential comptaibility problems with old
- * applications using this mechanism since old applications are
- * unlikely to expect non-RGB or non-RGBA formats to be advertised
- * through this mechanism. However no specific misinteractions
- * with old applications is known.
- *
- * Applications that seek to use the LATC formats should do so
- * by looking for this extension's name in the string returned by
- * glGetString(GL_EXTENSIONS) rather than
- * what GL_NUM_COMPRESSED_TEXTURE_FORMATS and
- * GL_COMPRESSED_TEXTURE_FORMATS return."
- *
- * There is no formal spec for GL_ATI_texture_compression_3dc. Since the
- * formats added by this extension are luminance-alpha formats, it is
- * reasonable to expect them to follow the same rules as
- * GL_EXT_texture_compression_latc. At the very least, Catalyst 11.6 does not
- * expose the 3dc formats through this mechanism.
- *
- * \param ctx the GL context
- * \param formats the resulting format list (may be NULL).
- *
- * \return number of formats.
- */
-GLuint
-_mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats)
-{
- GLuint n = 0;
- if (ctx->Extensions.TDFX_texture_compression_FXT1) {
- if (formats) {
- formats[n++] = GL_COMPRESSED_RGB_FXT1_3DFX;
- formats[n++] = GL_COMPRESSED_RGBA_FXT1_3DFX;
- }
- else {
- n += 2;
- }
- }
-
- if (ctx->Extensions.EXT_texture_compression_s3tc) {
- if (formats) {
- formats[n++] = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
- formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
- formats[n++] = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
- }
- else {
- n += 3;
- }
- }
- if (ctx->Extensions.S3_s3tc) {
- if (formats) {
- formats[n++] = GL_RGB_S3TC;
- formats[n++] = GL_RGB4_S3TC;
- formats[n++] = GL_RGBA_S3TC;
- formats[n++] = GL_RGBA4_S3TC;
- }
- else {
- n += 4;
- }
- }
-
- return n;
-}
-
-
-/**
- * Convert a compressed MESA_FORMAT_x to a GLenum.
- */
-gl_format
-_mesa_glenum_to_compressed_format(GLenum format)
-{
- switch (format) {
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- return MESA_FORMAT_RGB_FXT1;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return MESA_FORMAT_RGBA_FXT1;
-
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_RGB_S3TC:
- return MESA_FORMAT_RGB_DXT1;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_RGB4_S3TC:
- return MESA_FORMAT_RGBA_DXT1;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- case GL_RGBA_S3TC:
- return MESA_FORMAT_RGBA_DXT3;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case GL_RGBA4_S3TC:
- return MESA_FORMAT_RGBA_DXT5;
-
- case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- return MESA_FORMAT_SRGB_DXT1;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- return MESA_FORMAT_SRGBA_DXT1;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- return MESA_FORMAT_SRGBA_DXT3;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- return MESA_FORMAT_SRGBA_DXT5;
-
- case GL_COMPRESSED_RED_RGTC1:
- return MESA_FORMAT_RED_RGTC1;
- case GL_COMPRESSED_SIGNED_RED_RGTC1:
- return MESA_FORMAT_SIGNED_RED_RGTC1;
- case GL_COMPRESSED_RG_RGTC2:
- return MESA_FORMAT_RG_RGTC2;
- case GL_COMPRESSED_SIGNED_RG_RGTC2:
- return MESA_FORMAT_SIGNED_RG_RGTC2;
-
- case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
- return MESA_FORMAT_L_LATC1;
- case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
- return MESA_FORMAT_SIGNED_L_LATC1;
- case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
- case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
- return MESA_FORMAT_LA_LATC2;
- case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
- return MESA_FORMAT_SIGNED_LA_LATC2;
-
- default:
- return MESA_FORMAT_NONE;
- }
-}
-
-
-/**
- * Given a compressed MESA_FORMAT_x value, return the corresponding
- * GLenum for that format.
- * This is needed for glGetTexLevelParameter(GL_TEXTURE_INTERNAL_FORMAT)
- * which must return the specific texture format used when the user might
- * have originally specified a generic compressed format in their
- * glTexImage2D() call.
- * For non-compressed textures, we always return the user-specified
- * internal format unchanged.
- */
-GLenum
-_mesa_compressed_format_to_glenum(struct gl_context *ctx, GLuint mesaFormat)
-{
- switch (mesaFormat) {
-#if FEATURE_texture_fxt1
- case MESA_FORMAT_RGB_FXT1:
- return GL_COMPRESSED_RGB_FXT1_3DFX;
- case MESA_FORMAT_RGBA_FXT1:
- return GL_COMPRESSED_RGBA_FXT1_3DFX;
-#endif
-#if FEATURE_texture_s3tc
- case MESA_FORMAT_RGB_DXT1:
- return GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
- case MESA_FORMAT_RGBA_DXT1:
- return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
- case MESA_FORMAT_RGBA_DXT3:
- return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
- case MESA_FORMAT_RGBA_DXT5:
- return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
-#if FEATURE_EXT_texture_sRGB
- case MESA_FORMAT_SRGB_DXT1:
- return GL_COMPRESSED_SRGB_S3TC_DXT1_EXT;
- case MESA_FORMAT_SRGBA_DXT1:
- return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
- case MESA_FORMAT_SRGBA_DXT3:
- return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
- case MESA_FORMAT_SRGBA_DXT5:
- return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
-#endif
-#endif
-
- case MESA_FORMAT_RED_RGTC1:
- return GL_COMPRESSED_RED_RGTC1;
- case MESA_FORMAT_SIGNED_RED_RGTC1:
- return GL_COMPRESSED_SIGNED_RED_RGTC1;
- case MESA_FORMAT_RG_RGTC2:
- return GL_COMPRESSED_RG_RGTC2;
- case MESA_FORMAT_SIGNED_RG_RGTC2:
- return GL_COMPRESSED_SIGNED_RG_RGTC2;
-
- case MESA_FORMAT_L_LATC1:
- return GL_COMPRESSED_LUMINANCE_LATC1_EXT;
- case MESA_FORMAT_SIGNED_L_LATC1:
- return GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT;
- case MESA_FORMAT_LA_LATC2:
- return GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT;
- case MESA_FORMAT_SIGNED_LA_LATC2:
- return GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT;
-
- default:
- _mesa_problem(ctx, "Unexpected mesa texture format in"
- " _mesa_compressed_format_to_glenum()");
- return 0;
- }
-}
-
-
-/*
- * Return the address of the pixel at (col, row, img) in a
- * compressed texture image.
- * \param col, row, img - image position (3D), should be a multiple of the
- * format's block size.
- * \param format - compressed image format
- * \param width - image width (stride) in pixels
- * \param image - the image address
- * \return address of pixel at (row, col, img)
- */
-GLubyte *
-_mesa_compressed_image_address(GLint col, GLint row, GLint img,
- gl_format mesaFormat,
- GLsizei width, const GLubyte *image)
-{
- /* XXX only 2D images implemented, not 3D */
- const GLuint blockSize = _mesa_get_format_bytes(mesaFormat);
- GLuint bw, bh;
- GLint offset;
-
- _mesa_get_format_block_size(mesaFormat, &bw, &bh);
-
- ASSERT(col % bw == 0);
- ASSERT(row % bh == 0);
-
- offset = ((width + bw - 1) / bw) * (row / bh) + col / bw;
- offset *= blockSize;
-
- return (GLubyte *) image + offset;
-}
-
-
-/**
- * Decompress a compressed texture image, returning a GL_RGBA/GL_FLOAT image.
- */
-void
-_mesa_decompress_image(gl_format format, GLuint width, GLuint height,
- const GLubyte *src, GLint srcRowStride,
- GLfloat *dest)
-{
- void (*fetch)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
- struct swrast_texture_image texImage; /* dummy teximage */
- GLuint i, j;
-
- /* setup dummy texture image info */
- memset(&texImage, 0, sizeof(texImage));
- texImage.Map = (void *) src;
- texImage.RowStride = srcRowStride;
-
- switch (format) {
- /* DXT formats */
- case MESA_FORMAT_RGB_DXT1:
- fetch = _mesa_fetch_texel_2d_f_rgb_dxt1;
- break;
- case MESA_FORMAT_RGBA_DXT1:
- fetch = _mesa_fetch_texel_2d_f_rgba_dxt1;
- break;
- case MESA_FORMAT_RGBA_DXT3:
- fetch = _mesa_fetch_texel_2d_f_rgba_dxt3;
- break;
- case MESA_FORMAT_RGBA_DXT5:
- fetch = _mesa_fetch_texel_2d_f_rgba_dxt5;
- break;
-
- /* FXT1 formats */
- case MESA_FORMAT_RGB_FXT1:
- fetch = _mesa_fetch_texel_2d_f_rgb_fxt1;
- break;
- case MESA_FORMAT_RGBA_FXT1:
- fetch = _mesa_fetch_texel_2d_f_rgba_fxt1;
- break;
-
- /* Red/RG formats */
- case MESA_FORMAT_RED_RGTC1:
- fetch = _mesa_fetch_texel_2d_f_red_rgtc1;
- break;
- case MESA_FORMAT_SIGNED_RED_RGTC1:
- fetch = _mesa_fetch_texel_2d_f_signed_red_rgtc1;
- break;
- case MESA_FORMAT_RG_RGTC2:
- fetch = _mesa_fetch_texel_2d_f_rg_rgtc2;
- break;
- case MESA_FORMAT_SIGNED_RG_RGTC2:
- fetch = _mesa_fetch_texel_2d_f_signed_rg_rgtc2;
- break;
-
- /* L/LA formats */
- case MESA_FORMAT_L_LATC1:
- fetch = _mesa_fetch_texel_2d_f_l_latc1;
- break;
- case MESA_FORMAT_SIGNED_L_LATC1:
- fetch = _mesa_fetch_texel_2d_f_signed_l_latc1;
- break;
- case MESA_FORMAT_LA_LATC2:
- fetch = _mesa_fetch_texel_2d_f_la_latc2;
- break;
- case MESA_FORMAT_SIGNED_LA_LATC2:
- fetch = _mesa_fetch_texel_2d_f_signed_la_latc2;
- break;
-
- default:
- _mesa_problem(NULL, "Unexpected format in _mesa_decompress_image()");
- return;
- }
-
- for (j = 0; j < height; j++) {
- for (i = 0; i < width; i++) {
- fetch(&texImage, i, j, 0, dest);
- dest += 4;
- }
- }
-}
+++ /dev/null
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.1
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef TEXCOMPRESS_H
-#define TEXCOMPRESS_H
-
-#include "formats.h"
-#include "glheader.h"
-#include "mfeatures.h"
-
-struct gl_context;
-
-#if _HAVE_FULL_GL
-
-extern GLenum
-_mesa_gl_compressed_format_base_format(GLenum format);
-
-extern GLuint
-_mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats);
-
-extern gl_format
-_mesa_glenum_to_compressed_format(GLenum format);
-
-extern GLenum
-_mesa_compressed_format_to_glenum(struct gl_context *ctx, GLuint mesaFormat);
-
-extern GLubyte *
-_mesa_compressed_image_address(GLint col, GLint row, GLint img,
- gl_format mesaFormat,
- GLsizei width, const GLubyte *image);
-
-extern void
-_mesa_decompress_image(gl_format format, GLuint width, GLuint height,
- const GLubyte *src, GLint srcRowStride,
- GLfloat *dest);
-
-#else /* _HAVE_FULL_GL */
-
-/* no-op macros */
-#define _mesa_get_compressed_formats( c, f ) 0
-#define _mesa_compressed_image_address(c, r, i, f, w, i2 ) 0
-#define _mesa_compress_teximage( c, w, h, sF, s, sRS, dF, d, drs ) ((void)0)
-
-#endif /* _HAVE_FULL_GL */
-
-#endif /* TEXCOMPRESS_H */
+++ /dev/null
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * \file texcompress_fxt1.c
- * GL_3DFX_texture_compression_FXT1 support.
- */
-
-
-#include "glheader.h"
-#include "imports.h"
-#include "colormac.h"
-#include "image.h"
-#include "macros.h"
-#include "mfeatures.h"
-#include "mipmap.h"
-#include "texcompress.h"
-#include "texcompress_fxt1.h"
-#include "texstore.h"
-#include "swrast/s_context.h"
-
-
-#if FEATURE_texture_fxt1
-
-
-static void
-fxt1_encode (GLuint width, GLuint height, GLint comps,
- const void *source, GLint srcRowStride,
- void *dest, GLint destRowStride);
-
-void
-fxt1_decode_1 (const void *texture, GLint stride,
- GLint i, GLint j, GLubyte *rgba);
-
-
-/**
- * Store user's image in rgb_fxt1 format.
- */
-GLboolean
-_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS)
-{
- const GLubyte *pixels;
- GLint srcRowStride;
- GLubyte *dst;
- const GLubyte *tempImage = NULL;
-
- ASSERT(dstFormat == MESA_FORMAT_RGB_FXT1);
-
- if (srcFormat != GL_RGB ||
- srcType != GL_UNSIGNED_BYTE ||
- ctx->_ImageTransferState ||
- srcPacking->RowLength != srcWidth ||
- srcPacking->SwapBytes) {
- /* convert image to RGB/GLubyte */
- tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
- baseInternalFormat,
- _mesa_get_format_base_format(dstFormat),
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- if (!tempImage)
- return GL_FALSE; /* out of memory */
- pixels = tempImage;
- srcRowStride = 3 * srcWidth;
- srcFormat = GL_RGB;
- }
- else {
- pixels = _mesa_image_address2d(srcPacking, srcAddr, srcWidth, srcHeight,
- srcFormat, srcType, 0, 0);
-
- srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
- srcType) / sizeof(GLubyte);
- }
-
- dst = dstSlices[0];
-
- fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride,
- dst, dstRowStride);
-
- if (tempImage)
- free((void*) tempImage);
-
- return GL_TRUE;
-}
-
-
-/**
- * Store user's image in rgba_fxt1 format.
- */
-GLboolean
-_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
-{
- const GLubyte *pixels;
- GLint srcRowStride;
- GLubyte *dst;
- const GLubyte *tempImage = NULL;
-
- ASSERT(dstFormat == MESA_FORMAT_RGBA_FXT1);
-
- if (srcFormat != GL_RGBA ||
- srcType != GL_UNSIGNED_BYTE ||
- ctx->_ImageTransferState ||
- srcPacking->SwapBytes) {
- /* convert image to RGBA/GLubyte */
- tempImage = _mesa_make_temp_ubyte_image(ctx, dims,
- baseInternalFormat,
- _mesa_get_format_base_format(dstFormat),
- srcWidth, srcHeight, srcDepth,
- srcFormat, srcType, srcAddr,
- srcPacking);
- if (!tempImage)
- return GL_FALSE; /* out of memory */
- pixels = tempImage;
- srcRowStride = 4 * srcWidth;
- srcFormat = GL_RGBA;
- }
- else {
- pixels = _mesa_image_address2d(srcPacking, srcAddr, srcWidth, srcHeight,
- srcFormat, srcType, 0, 0);
-
- srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat,
- srcType) / sizeof(GLubyte);
- }
-
- dst = dstSlices[0];
-
- fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride,
- dst, dstRowStride);
-
- if (tempImage)
- free((void*) tempImage);
-
- return GL_TRUE;
-}
-
-
-void
-_mesa_fetch_texel_2d_f_rgba_fxt1( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- /* just sample as GLubyte and convert to float here */
- GLubyte rgba[4];
- (void) k;
- fxt1_decode_1(texImage->Map, texImage->RowStride, i, j, rgba);
- texel[RCOMP] = UBYTE_TO_FLOAT(rgba[RCOMP]);
- texel[GCOMP] = UBYTE_TO_FLOAT(rgba[GCOMP]);
- texel[BCOMP] = UBYTE_TO_FLOAT(rgba[BCOMP]);
- texel[ACOMP] = UBYTE_TO_FLOAT(rgba[ACOMP]);
-}
-
-
-void
-_mesa_fetch_texel_2d_f_rgb_fxt1( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
-{
- /* just sample as GLubyte and convert to float here */
- GLubyte rgba[4];
- (void) k;
- fxt1_decode_1(texImage->Map, texImage->RowStride, i, j, rgba);
- texel[RCOMP] = UBYTE_TO_FLOAT(rgba[RCOMP]);
- texel[GCOMP] = UBYTE_TO_FLOAT(rgba[GCOMP]);
- texel[BCOMP] = UBYTE_TO_FLOAT(rgba[BCOMP]);
- texel[ACOMP] = 1.0F;
-}
-
-
-
-/***************************************************************************\
- * FXT1 encoder
- *
- * The encoder was built by reversing the decoder,
- * and is vaguely based on Texus2 by 3dfx. Note that this code
- * is merely a proof of concept, since it is highly UNoptimized;
- * moreover, it is sub-optimal due to initial conditions passed
- * to Lloyd's algorithm (the interpolation modes are even worse).
-\***************************************************************************/
-
-
-#define MAX_COMP 4 /* ever needed maximum number of components in texel */
-#define MAX_VECT 4 /* ever needed maximum number of base vectors to find */
-#define N_TEXELS 32 /* number of texels in a block (always 32) */
-#define LL_N_REP 50 /* number of iterations in lloyd's vq */
-#define LL_RMS_D 10 /* fault tolerance (maximum delta) */
-#define LL_RMS_E 255 /* fault tolerance (maximum error) */
-#define ALPHA_TS 2 /* alpha threshold: (255 - ALPHA_TS) deemed opaque */
-#define ISTBLACK(v) (*((GLuint *)(v)) == 0)
-
-
-/*
- * Define a 64-bit unsigned integer type and macros
- */
-#if 1
-
-#define FX64_NATIVE 1
-
-typedef uint64_t Fx64;
-
-#define FX64_MOV32(a, b) a = b
-#define FX64_OR32(a, b) a |= b
-#define FX64_SHL(a, c) a <<= c
-
-#else
-
-#define FX64_NATIVE 0
-
-typedef struct {
- GLuint lo, hi;
-} Fx64;
-
-#define FX64_MOV32(a, b) a.lo = b
-#define FX64_OR32(a, b) a.lo |= b
-
-#define FX64_SHL(a, c) \
- do { \
- if ((c) >= 32) { \
- a.hi = a.lo << ((c) - 32); \
- a.lo = 0; \
- } else { \
- a.hi = (a.hi << (c)) | (a.lo >> (32 - (c))); \
- a.lo <<= (c); \
- } \
- } while (0)
-
-#endif
-
-
-#define F(i) (GLfloat)1 /* can be used to obtain an oblong metric: 0.30 / 0.59 / 0.11 */
-#define SAFECDOT 1 /* for paranoids */
-
-#define MAKEIVEC(NV, NC, IV, B, V0, V1) \
- do { \
- /* compute interpolation vector */ \
- GLfloat d2 = 0.0F; \
- GLfloat rd2; \
- \
- for (i = 0; i < NC; i++) { \
- IV[i] = (V1[i] - V0[i]) * F(i); \
- d2 += IV[i] * IV[i]; \
- } \
- rd2 = (GLfloat)NV / d2; \
- B = 0; \
- for (i = 0; i < NC; i++) { \
- IV[i] *= F(i); \
- B -= IV[i] * V0[i]; \
- IV[i] *= rd2; \
- } \
- B = B * rd2 + 0.5f; \
- } while (0)
-
-#define CALCCDOT(TEXEL, NV, NC, IV, B, V)\
- do { \
- GLfloat dot = 0.0F; \
- for (i = 0; i < NC; i++) { \
- dot += V[i] * IV[i]; \
- } \
- TEXEL = (GLint)(dot + B); \
- if (SAFECDOT) { \
- if (TEXEL < 0) { \
- TEXEL = 0; \
- } else if (TEXEL > NV) { \
- TEXEL = NV; \
- } \
- } \
- } while (0)
-
-
-static GLint
-fxt1_bestcol (GLfloat vec[][MAX_COMP], GLint nv,
- GLubyte input[MAX_COMP], GLint nc)
-{
- GLint i, j, best = -1;
- GLfloat err = 1e9; /* big enough */
-
- for (j = 0; j < nv; j++) {
- GLfloat e = 0.0F;
- for (i = 0; i < nc; i++) {
- e += (vec[j][i] - input[i]) * (vec[j][i] - input[i]);
- }
- if (e < err) {
- err = e;
- best = j;
- }
- }
-
- return best;
-}
-
-
-static GLint
-fxt1_worst (GLfloat vec[MAX_COMP],
- GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
-{
- GLint i, k, worst = -1;
- GLfloat err = -1.0F; /* small enough */
-
- for (k = 0; k < n; k++) {
- GLfloat e = 0.0F;
- for (i = 0; i < nc; i++) {
- e += (vec[i] - input[k][i]) * (vec[i] - input[k][i]);
- }
- if (e > err) {
- err = e;
- worst = k;
- }
- }
-
- return worst;
-}
-
-
-static GLint
-fxt1_variance (GLdouble variance[MAX_COMP],
- GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
-{
- GLint i, k, best = 0;
- GLint sx, sx2;
- GLdouble var, maxvar = -1; /* small enough */
- GLdouble teenth = 1.0 / n;
-
- for (i = 0; i < nc; i++) {
- sx = sx2 = 0;
- for (k = 0; k < n; k++) {
- GLint t = input[k][i];
- sx += t;
- sx2 += t * t;
- }
- var = sx2 * teenth - sx * sx * teenth * teenth;
- if (maxvar < var) {
- maxvar = var;
- best = i;
- }
- if (variance) {
- variance[i] = var;
- }
- }
-
- return best;
-}
-
-
-static GLint
-fxt1_choose (GLfloat vec[][MAX_COMP], GLint nv,
- GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
-{
-#if 0
- /* Choose colors from a grid.
- */
- GLint i, j;
-
- for (j = 0; j < nv; j++) {
- GLint m = j * (n - 1) / (nv - 1);
- for (i = 0; i < nc; i++) {
- vec[j][i] = input[m][i];
- }
- }
-#else
- /* Our solution here is to find the darkest and brightest colors in
- * the 8x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- GLint i, j, k;
- GLint minSum = 2000; /* big enough */
- GLint maxSum = -1; /* small enough */
- GLint minCol = 0; /* phoudoin: silent compiler! */
- GLint maxCol = 0; /* phoudoin: silent compiler! */
-
- struct {
- GLint flag;
- GLint key;
- GLint freq;
- GLint idx;
- } hist[N_TEXELS];
- GLint lenh = 0;
-
- memset(hist, 0, sizeof(hist));
-
- for (k = 0; k < n; k++) {
- GLint l;
- GLint key = 0;
- GLint sum = 0;
- for (i = 0; i < nc; i++) {
- key <<= 8;
- key |= input[k][i];
- sum += input[k][i];
- }
- for (l = 0; l < n; l++) {
- if (!hist[l].flag) {
- /* alloc new slot */
- hist[l].flag = !0;
- hist[l].key = key;
- hist[l].freq = 1;
- hist[l].idx = k;
- lenh = l + 1;
- break;
- } else if (hist[l].key == key) {
- hist[l].freq++;
- break;
- }
- }
- if (minSum > sum) {
- minSum = sum;
- minCol = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxCol = k;
- }
- }
-
- if (lenh <= nv) {
- for (j = 0; j < lenh; j++) {
- for (i = 0; i < nc; i++) {
- vec[j][i] = (GLfloat)input[hist[j].idx][i];
- }
- }
- for (; j < nv; j++) {
- for (i = 0; i < nc; i++) {
- vec[j][i] = vec[0][i];
- }
- }
- return 0;
- }
-
- for (j = 0; j < nv; j++) {
- for (i = 0; i < nc; i++) {
- vec[j][i] = ((nv - 1 - j) * input[minCol][i] + j * input[maxCol][i] + (nv - 1) / 2) / (GLfloat)(nv - 1);
- }
- }
-#endif
-
- return !0;
-}
-
-
-static GLint
-fxt1_lloyd (GLfloat vec[][MAX_COMP], GLint nv,
- GLubyte input[N_TEXELS][MAX_COMP], GLint nc, GLint n)
-{
- /* Use the generalized lloyd's algorithm for VQ:
- * find 4 color vectors.
- *
- * for each sample color
- * sort to nearest vector.
- *
- * replace each vector with the centroid of its matching colors.
- *
- * repeat until RMS doesn't improve.
- *
- * if a color vector has no samples, or becomes the same as another
- * vector, replace it with the color which is farthest from a sample.
- *
- * vec[][MAX_COMP] initial vectors and resulting colors
- * nv number of resulting colors required
- * input[N_TEXELS][MAX_COMP] input texels
- * nc number of components in input / vec
- * n number of input samples
- */
-
- GLint sum[MAX_VECT][MAX_COMP]; /* used to accumulate closest texels */
- GLint cnt[MAX_VECT]; /* how many times a certain vector was chosen */
- GLfloat error, lasterror = 1e9;
-
- GLint i, j, k, rep;
-
- /* the quantizer */
- for (rep = 0; rep < LL_N_REP; rep++) {
- /* reset sums & counters */
- for (j = 0; j < nv; j++) {
- for (i = 0; i < nc; i++) {
- sum[j][i] = 0;
- }
- cnt[j] = 0;
- }
- error = 0;
-
- /* scan whole block */
- for (k = 0; k < n; k++) {
-#if 1
- GLint best = -1;
- GLfloat err = 1e9; /* big enough */
- /* determine best vector */
- for (j = 0; j < nv; j++) {
- GLfloat e = (vec[j][0] - input[k][0]) * (vec[j][0] - input[k][0]) +
- (vec[j][1] - input[k][1]) * (vec[j][1] - input[k][1]) +
- (vec[j][2] - input[k][2]) * (vec[j][2] - input[k][2]);
- if (nc == 4) {
- e += (vec[j][3] - input[k][3]) * (vec[j][3] - input[k][3]);
- }
- if (e < err) {
- err = e;
- best = j;
- }
- }
-#else
- GLint best = fxt1_bestcol(vec, nv, input[k], nc, &err);
-#endif
- assert(best >= 0);
- /* add in closest color */
- for (i = 0; i < nc; i++) {
- sum[best][i] += input[k][i];
- }
- /* mark this vector as used */
- cnt[best]++;
- /* accumulate error */
- error += err;
- }
-
- /* check RMS */
- if ((error < LL_RMS_E) ||
- ((error < lasterror) && ((lasterror - error) < LL_RMS_D))) {
- return !0; /* good match */
- }
- lasterror = error;
-
- /* move each vector to the barycenter of its closest colors */
- for (j = 0; j < nv; j++) {
- if (cnt[j]) {
- GLfloat div = 1.0F / cnt[j];
- for (i = 0; i < nc; i++) {
- vec[j][i] = div * sum[j][i];
- }
- } else {
- /* this vec has no samples or is identical with a previous vec */
- GLint worst = fxt1_worst(vec[j], input, nc, n);
- for (i = 0; i < nc; i++) {
- vec[j][i] = input[worst][i];
- }
- }
- }
- }
-
- return 0; /* could not converge fast enough */
-}
-
-
-static void
-fxt1_quantize_CHROMA (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP])
-{
- const GLint n_vect = 4; /* 4 base vectors to find */
- const GLint n_comp = 3; /* 3 components: R, G, B */
- GLfloat vec[MAX_VECT][MAX_COMP];
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- if (fxt1_choose(vec, n_vect, input, n_comp, N_TEXELS) != 0) {
- fxt1_lloyd(vec, n_vect, input, n_comp, N_TEXELS);
- }
-
- FX64_MOV32(hi, 4); /* cc-chroma = "010" + unused bit */
- for (j = n_vect - 1; j >= 0; j--) {
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F));
- }
- }
- ((Fx64 *)cc)[1] = hi;
-
- lohi = lolo = 0;
- /* right microtile */
- for (k = N_TEXELS - 1; k >= N_TEXELS/2; k--) {
- lohi <<= 2;
- lohi |= fxt1_bestcol(vec, n_vect, input[k], n_comp);
- }
- /* left microtile */
- for (; k >= 0; k--) {
- lolo <<= 2;
- lolo |= fxt1_bestcol(vec, n_vect, input[k], n_comp);
- }
- cc[1] = lohi;
- cc[0] = lolo;
-}
-
-
-static void
-fxt1_quantize_ALPHA0 (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP],
- GLubyte reord[N_TEXELS][MAX_COMP], GLint n)
-{
- const GLint n_vect = 3; /* 3 base vectors to find */
- const GLint n_comp = 4; /* 4 components: R, G, B, A */
- GLfloat vec[MAX_VECT][MAX_COMP];
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- /* the last vector indicates zero */
- for (i = 0; i < n_comp; i++) {
- vec[n_vect][i] = 0;
- }
-
- /* the first n texels in reord are guaranteed to be non-zero */
- if (fxt1_choose(vec, n_vect, reord, n_comp, n) != 0) {
- fxt1_lloyd(vec, n_vect, reord, n_comp, n);
- }
-
- FX64_MOV32(hi, 6); /* alpha = "011" + lerp = 0 */
- for (j = n_vect - 1; j >= 0; j--) {
- /* add in alphas */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][ACOMP] / 8.0F));
- }
- for (j = n_vect - 1; j >= 0; j--) {
- for (i = 0; i < n_comp - 1; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F));
- }
- }
- ((Fx64 *)cc)[1] = hi;
-
- lohi = lolo = 0;
- /* right microtile */
- for (k = N_TEXELS - 1; k >= N_TEXELS/2; k--) {
- lohi <<= 2;
- lohi |= fxt1_bestcol(vec, n_vect + 1, input[k], n_comp);
- }
- /* left microtile */
- for (; k >= 0; k--) {
- lolo <<= 2;
- lolo |= fxt1_bestcol(vec, n_vect + 1, input[k], n_comp);
- }
- cc[1] = lohi;
- cc[0] = lolo;
-}
-
-
-static void
-fxt1_quantize_ALPHA1 (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP])
-{
- const GLint n_vect = 3; /* highest vector number in each microtile */
- const GLint n_comp = 4; /* 4 components: R, G, B, A */
- GLfloat vec[1 + 1 + 1][MAX_COMP]; /* 1.5 extrema for each sub-block */
- GLfloat b, iv[MAX_COMP]; /* interpolation vector */
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- GLint minSum;
- GLint maxSum;
- GLint minColL = 0, maxColL = 0;
- GLint minColR = 0, maxColR = 0;
- GLint sumL = 0, sumR = 0;
- GLint nn_comp;
- /* Our solution here is to find the darkest and brightest colors in
- * the 4x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- nn_comp = n_comp;
- while ((minColL == maxColL) && nn_comp) {
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (k = 0; k < N_TEXELS / 2; k++) {
- GLint sum = 0;
- for (i = 0; i < nn_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColL = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColL = k;
- }
- sumL += sum;
- }
-
- nn_comp--;
- }
-
- nn_comp = n_comp;
- while ((minColR == maxColR) && nn_comp) {
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (k = N_TEXELS / 2; k < N_TEXELS; k++) {
- GLint sum = 0;
- for (i = 0; i < nn_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColR = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColR = k;
- }
- sumR += sum;
- }
-
- nn_comp--;
- }
-
- /* choose the common vector (yuck!) */
- {
- GLint j1, j2;
- GLint v1 = 0, v2 = 0;
- GLfloat err = 1e9; /* big enough */
- GLfloat tv[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
- for (i = 0; i < n_comp; i++) {
- tv[0][i] = input[minColL][i];
- tv[1][i] = input[maxColL][i];
- tv[2][i] = input[minColR][i];
- tv[3][i] = input[maxColR][i];
- }
- for (j1 = 0; j1 < 2; j1++) {
- for (j2 = 2; j2 < 4; j2++) {
- GLfloat e = 0.0F;
- for (i = 0; i < n_comp; i++) {
- e += (tv[j1][i] - tv[j2][i]) * (tv[j1][i] - tv[j2][i]);
- }
- if (e < err) {
- err = e;
- v1 = j1;
- v2 = j2;
- }
- }
- }
- for (i = 0; i < n_comp; i++) {
- vec[0][i] = tv[1 - v1][i];
- vec[1][i] = (tv[v1][i] * sumL + tv[v2][i] * sumR) / (sumL + sumR);
- vec[2][i] = tv[5 - v2][i];
- }
- }
-
- /* left microtile */
- cc[0] = 0;
- if (minColL != maxColL) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]);
-
- /* add in texels */
- lolo = 0;
- for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
- GLint texel;
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- lolo <<= 2;
- lolo |= texel;
- }
-
- cc[0] = lolo;
- }
-
- /* right microtile */
- cc[1] = 0;
- if (minColR != maxColR) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[1]);
-
- /* add in texels */
- lohi = 0;
- for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
- GLint texel;
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- lohi <<= 2;
- lohi |= texel;
- }
-
- cc[1] = lohi;
- }
-
- FX64_MOV32(hi, 7); /* alpha = "011" + lerp = 1 */
- for (j = n_vect - 1; j >= 0; j--) {
- /* add in alphas */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][ACOMP] / 8.0F));
- }
- for (j = n_vect - 1; j >= 0; j--) {
- for (i = 0; i < n_comp - 1; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, (GLuint)(vec[j][i] / 8.0F));
- }
- }
- ((Fx64 *)cc)[1] = hi;
-}
-
-
-static void
-fxt1_quantize_HI (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP],
- GLubyte reord[N_TEXELS][MAX_COMP], GLint n)
-{
- const GLint n_vect = 6; /* highest vector number */
- const GLint n_comp = 3; /* 3 components: R, G, B */
- GLfloat b = 0.0F; /* phoudoin: silent compiler! */
- GLfloat iv[MAX_COMP]; /* interpolation vector */
- GLint i, k;
- GLuint hihi; /* high quadword: hi dword */
-
- GLint minSum = 2000; /* big enough */
- GLint maxSum = -1; /* small enough */
- GLint minCol = 0; /* phoudoin: silent compiler! */
- GLint maxCol = 0; /* phoudoin: silent compiler! */
-
- /* Our solution here is to find the darkest and brightest colors in
- * the 8x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- for (k = 0; k < n; k++) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += reord[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minCol = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxCol = k;
- }
- }
-
- hihi = 0; /* cc-hi = "00" */
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- hihi <<= 5;
- hihi |= reord[maxCol][i] >> 3;
- }
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- hihi <<= 5;
- hihi |= reord[minCol][i] >> 3;
- }
- cc[3] = hihi;
- cc[0] = cc[1] = cc[2] = 0;
-
- /* compute interpolation vector */
- if (minCol != maxCol) {
- MAKEIVEC(n_vect, n_comp, iv, b, reord[minCol], reord[maxCol]);
- }
-
- /* add in texels */
- for (k = N_TEXELS - 1; k >= 0; k--) {
- GLint t = k * 3;
- GLuint *kk = (GLuint *)((char *)cc + t / 8);
- GLint texel = n_vect + 1; /* transparent black */
-
- if (!ISTBLACK(input[k])) {
- if (minCol != maxCol) {
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- kk[0] |= texel << (t & 7);
- }
- } else {
- /* add in texel */
- kk[0] |= texel << (t & 7);
- }
- }
-}
-
-
-static void
-fxt1_quantize_MIXED1 (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP])
-{
- const GLint n_vect = 2; /* highest vector number in each microtile */
- const GLint n_comp = 3; /* 3 components: R, G, B */
- GLubyte vec[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
- GLfloat b, iv[MAX_COMP]; /* interpolation vector */
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- GLint minSum;
- GLint maxSum;
- GLint minColL = 0, maxColL = -1;
- GLint minColR = 0, maxColR = -1;
-
- /* Our solution here is to find the darkest and brightest colors in
- * the 4x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (k = 0; k < N_TEXELS / 2; k++) {
- if (!ISTBLACK(input[k])) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColL = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColL = k;
- }
- }
- }
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (; k < N_TEXELS; k++) {
- if (!ISTBLACK(input[k])) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColR = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColR = k;
- }
- }
- }
-
- /* left microtile */
- if (maxColL == -1) {
- /* all transparent black */
- cc[0] = ~0u;
- for (i = 0; i < n_comp; i++) {
- vec[0][i] = 0;
- vec[1][i] = 0;
- }
- } else {
- cc[0] = 0;
- for (i = 0; i < n_comp; i++) {
- vec[0][i] = input[minColL][i];
- vec[1][i] = input[maxColL][i];
- }
- if (minColL != maxColL) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]);
-
- /* add in texels */
- lolo = 0;
- for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
- GLint texel = n_vect + 1; /* transparent black */
- if (!ISTBLACK(input[k])) {
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- }
- /* add in texel */
- lolo <<= 2;
- lolo |= texel;
- }
- cc[0] = lolo;
- }
- }
-
- /* right microtile */
- if (maxColR == -1) {
- /* all transparent black */
- cc[1] = ~0u;
- for (i = 0; i < n_comp; i++) {
- vec[2][i] = 0;
- vec[3][i] = 0;
- }
- } else {
- cc[1] = 0;
- for (i = 0; i < n_comp; i++) {
- vec[2][i] = input[minColR][i];
- vec[3][i] = input[maxColR][i];
- }
- if (minColR != maxColR) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[3]);
-
- /* add in texels */
- lohi = 0;
- for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
- GLint texel = n_vect + 1; /* transparent black */
- if (!ISTBLACK(input[k])) {
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- }
- /* add in texel */
- lohi <<= 2;
- lohi |= texel;
- }
- cc[1] = lohi;
- }
- }
-
- FX64_MOV32(hi, 9 | (vec[3][GCOMP] & 4) | ((vec[1][GCOMP] >> 1) & 2)); /* chroma = "1" */
- for (j = 2 * 2 - 1; j >= 0; j--) {
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, vec[j][i] >> 3);
- }
- }
- ((Fx64 *)cc)[1] = hi;
-}
-
-
-static void
-fxt1_quantize_MIXED0 (GLuint *cc,
- GLubyte input[N_TEXELS][MAX_COMP])
-{
- const GLint n_vect = 3; /* highest vector number in each microtile */
- const GLint n_comp = 3; /* 3 components: R, G, B */
- GLubyte vec[2 * 2][MAX_COMP]; /* 2 extrema for each sub-block */
- GLfloat b, iv[MAX_COMP]; /* interpolation vector */
- GLint i, j, k;
- Fx64 hi; /* high quadword */
- GLuint lohi, lolo; /* low quadword: hi dword, lo dword */
-
- GLint minColL = 0, maxColL = 0;
- GLint minColR = 0, maxColR = 0;
-#if 0
- GLint minSum;
- GLint maxSum;
-
- /* Our solution here is to find the darkest and brightest colors in
- * the 4x4 tile and use those as the two representative colors.
- * There are probably better algorithms to use (histogram-based).
- */
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (k = 0; k < N_TEXELS / 2; k++) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColL = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColL = k;
- }
- }
- minSum = 2000; /* big enough */
- maxSum = -1; /* small enough */
- for (; k < N_TEXELS; k++) {
- GLint sum = 0;
- for (i = 0; i < n_comp; i++) {
- sum += input[k][i];
- }
- if (minSum > sum) {
- minSum = sum;
- minColR = k;
- }
- if (maxSum < sum) {
- maxSum = sum;
- maxColR = k;
- }
- }
-#else
- GLint minVal;
- GLint maxVal;
- GLint maxVarL = fxt1_variance(NULL, input, n_comp, N_TEXELS / 2);
- GLint maxVarR = fxt1_variance(NULL, &input[N_TEXELS / 2], n_comp, N_TEXELS / 2);
-
- /* Scan the channel with max variance for lo & hi
- * and use those as the two representative colors.
- */
- minVal = 2000; /* big enough */
- maxVal = -1; /* small enough */
- for (k = 0; k < N_TEXELS / 2; k++) {
- GLint t = input[k][maxVarL];
- if (minVal > t) {
- minVal = t;
- minColL = k;
- }
- if (maxVal < t) {
- maxVal = t;
- maxColL = k;
- }
- }
- minVal = 2000; /* big enough */
- maxVal = -1; /* small enough */
- for (; k < N_TEXELS; k++) {
- GLint t = input[k][maxVarR];
- if (minVal > t) {
- minVal = t;
- minColR = k;
- }
- if (maxVal < t) {
- maxVal = t;
- maxColR = k;
- }
- }
-#endif
-
- /* left microtile */
- cc[0] = 0;
- for (i = 0; i < n_comp; i++) {
- vec[0][i] = input[minColL][i];
- vec[1][i] = input[maxColL][i];
- }
- if (minColL != maxColL) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[0], vec[1]);
-
- /* add in texels */
- lolo = 0;
- for (k = N_TEXELS / 2 - 1; k >= 0; k--) {
- GLint texel;
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- lolo <<= 2;
- lolo |= texel;
- }
-
- /* funky encoding for LSB of green */
- if ((GLint)((lolo >> 1) & 1) != (((vec[1][GCOMP] ^ vec[0][GCOMP]) >> 2) & 1)) {
- for (i = 0; i < n_comp; i++) {
- vec[1][i] = input[minColL][i];
- vec[0][i] = input[maxColL][i];
- }
- lolo = ~lolo;
- }
-
- cc[0] = lolo;
- }
-
- /* right microtile */
- cc[1] = 0;
- for (i = 0; i < n_comp; i++) {
- vec[2][i] = input[minColR][i];
- vec[3][i] = input[maxColR][i];
- }
- if (minColR != maxColR) {
- /* compute interpolation vector */
- MAKEIVEC(n_vect, n_comp, iv, b, vec[2], vec[3]);
-
- /* add in texels */
- lohi = 0;
- for (k = N_TEXELS - 1; k >= N_TEXELS / 2; k--) {
- GLint texel;
- /* interpolate color */
- CALCCDOT(texel, n_vect, n_comp, iv, b, input[k]);
- /* add in texel */
- lohi <<= 2;
- lohi |= texel;
- }
-
- /* funky encoding for LSB of green */
- if ((GLint)((lohi >> 1) & 1) != (((vec[3][GCOMP] ^ vec[2][GCOMP]) >> 2) & 1)) {
- for (i = 0; i < n_comp; i++) {
- vec[3][i] = input[minColR][i];
- vec[2][i] = input[maxColR][i];
- }
- lohi = ~lohi;
- }
-
- cc[1] = lohi;
- }
-
- FX64_MOV32(hi, 8 | (vec[3][GCOMP] & 4) | ((vec[1][GCOMP] >> 1) & 2)); /* chroma = "1" */
- for (j = 2 * 2 - 1; j >= 0; j--) {
- for (i = 0; i < n_comp; i++) {
- /* add in colors */
- FX64_SHL(hi, 5);
- FX64_OR32(hi, vec[j][i] >> 3);
- }
- }
- ((Fx64 *)cc)[1] = hi;
-}
-
-
-static void
-fxt1_quantize (GLuint *cc, const GLubyte *lines[], GLint comps)
-{
- GLint trualpha;
- GLubyte reord[N_TEXELS][MAX_COMP];
-
- GLubyte input[N_TEXELS][MAX_COMP];
- GLint i, k, l;
-
- if (comps == 3) {
- /* make the whole block opaque */
- memset(input, -1, sizeof(input));
- }
-
- /* 8 texels each line */
- for (l = 0; l < 4; l++) {
- for (k = 0; k < 4; k++) {
- for (i = 0; i < comps; i++) {
- input[k + l * 4][i] = *lines[l]++;
- }
- }
- for (; k < 8; k++) {
- for (i = 0; i < comps; i++) {
- input[k + l * 4 + 12][i] = *lines[l]++;
- }
- }
- }
-
- /* block layout:
- * 00, 01, 02, 03, 08, 09, 0a, 0b
- * 10, 11, 12, 13, 18, 19, 1a, 1b
- * 04, 05, 06, 07, 0c, 0d, 0e, 0f
- * 14, 15, 16, 17, 1c, 1d, 1e, 1f
- */
-
- /* [dBorca]
- * stupidity flows forth from this
- */
- l = N_TEXELS;
- trualpha = 0;
- if (comps == 4) {
- /* skip all transparent black texels */
- l = 0;
- for (k = 0; k < N_TEXELS; k++) {
- /* test all components against 0 */
- if (!ISTBLACK(input[k])) {
- /* texel is not transparent black */
- COPY_4UBV(reord[l], input[k]);
- if (reord[l][ACOMP] < (255 - ALPHA_TS)) {
- /* non-opaque texel */
- trualpha = !0;
- }
- l++;
- }
- }
- }
-
-#if 0
- if (trualpha) {
- fxt1_quantize_ALPHA0(cc, input, reord, l);
- } else if (l == 0) {
- cc[0] = cc[1] = cc[2] = -1;
- cc[3] = 0;
- } else if (l < N_TEXELS) {
- fxt1_quantize_HI(cc, input, reord, l);
- } else {
- fxt1_quantize_CHROMA(cc, input);
- }
- (void)fxt1_quantize_ALPHA1;
- (void)fxt1_quantize_MIXED1;
- (void)fxt1_quantize_MIXED0;
-#else
- if (trualpha) {
- fxt1_quantize_ALPHA1(cc, input);