diff options
author | marha <marha@users.sourceforge.net> | 2012-11-09 13:27:06 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-11-09 13:27:06 +0100 |
commit | 8d57b7fcb22cf1a52203ee57c745b64bba649249 (patch) | |
tree | aaf65faecb30fbffbe7bb11d4bff43ea3297cf2e /mesalib | |
parent | 1738a6973deb03f33a71c9527594727cb8bb64b4 (diff) | |
download | vcxsrv-8d57b7fcb22cf1a52203ee57c745b64bba649249.tar.gz vcxsrv-8d57b7fcb22cf1a52203ee57c745b64bba649249.tar.bz2 vcxsrv-8d57b7fcb22cf1a52203ee57c745b64bba649249.zip |
mesa git update 9 nov 2012
mesa: 011f8458805e443ac9130865d2840a929a00cabf
Diffstat (limited to 'mesalib')
40 files changed, 303 insertions, 74 deletions
diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt index 28f6ae603..9b87e8b02 100644 --- a/mesalib/docs/GL3.txt +++ b/mesalib/docs/GL3.txt @@ -96,7 +96,7 @@ GL_ARB_sample_shading not started GL_ARB_shader_subroutine not started GL_ARB_tessellation_shader not started GL_ARB_texture_buffer_object_rgb32 not started -GL_ARB_texture_cube_map_array not started +GL_ARB_texture_cube_map_array DONE (softpipe) GL_ARB_texture_gather not started GL_ARB_transform_feedback2 DONE GL_ARB_transform_feedback3 DONE diff --git a/mesalib/docs/relnotes-9.1.html b/mesalib/docs/relnotes-9.1.html index 5bf9d8c13..97247fb3a 100644 --- a/mesalib/docs/relnotes-9.1.html +++ b/mesalib/docs/relnotes-9.1.html @@ -45,6 +45,7 @@ Note: some of the new features are only available with certain drivers. <ul> <li>GL_ARB_map_buffer_alignment</li> +<li>GL_ARB_texture_cube_map_array</li> </ul> diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c index d10ce231c..0c1430e23 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.c +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c @@ -647,9 +647,10 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx, get_texcoords(src, src_width0, src_height0, x1, y1, x2, y2, coord); - if (src->texture->target == PIPE_TEXTURE_CUBE) { + if (src->texture->target == PIPE_TEXTURE_CUBE || + src->texture->target == PIPE_TEXTURE_CUBE_ARRAY) { set_texcoords_in_vertices(coord, &face_coord[0][0], 2); - util_map_texcoords2d_onto_cubemap(layer, + util_map_texcoords2d_onto_cubemap(layer % 6, /* pointer, stride in floats */ &face_coord[0][0], 2, &ctx->vertices[0][1][0], 8); @@ -876,13 +877,15 @@ void util_blitter_cache_all_shaders(struct blitter_context *blitter) struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_screen *screen = blitter->pipe->screen; unsigned num_cbufs, i, target, max_samples; - boolean has_arraytex; + boolean has_arraytex, has_cubearraytex; num_cbufs = MAX2(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS), 1); max_samples = ctx->has_texture_multisample ? 2 : 1; has_arraytex = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS) != 0; + has_cubearraytex = screen->get_param(screen, + PIPE_CAP_CUBE_MAP_ARRAY) != 0; for (i = 0; i < num_cbufs; i++) { blitter_get_fs_col(ctx, i, FALSE); @@ -897,6 +900,9 @@ void util_blitter_cache_all_shaders(struct blitter_context *blitter) target == PIPE_TEXTURE_2D_ARRAY)) { continue; } + if (!has_arraytex && + (target == PIPE_TEXTURE_CUBE_ARRAY)) + continue; blitter_get_fs_texfetch_col(ctx, target, i); blitter_get_fs_texfetch_depth(ctx, target, i); diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h index 3d68cf540..6ef5fecc6 100644 --- a/mesalib/src/gallium/auxiliary/util/u_inlines.h +++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h @@ -523,6 +523,9 @@ util_pipe_tex_to_tgsi_tex(enum pipe_texture_target pipe_tex_target, return nr_samples > 1 ? TGSI_TEXTURE_2D_ARRAY_MSAA : TGSI_TEXTURE_2D_ARRAY; + case PIPE_TEXTURE_CUBE_ARRAY: + return TGSI_TEXTURE_CUBE_ARRAY; + default: assert(0 && "unexpected texture target"); return TGSI_TEXTURE_UNKNOWN; diff --git a/mesalib/src/glsl/builtin_types.h b/mesalib/src/glsl/builtin_types.h index d75c56261..92427d8e7 100644 --- a/mesalib/src/glsl/builtin_types.h +++ b/mesalib/src/glsl/builtin_types.h @@ -327,3 +327,18 @@ const glsl_type glsl_type::builtin_OES_EGL_image_external_types[] = { GLSL_SAMPLER_DIM_EXTERNAL, 0, 0, GLSL_TYPE_FLOAT, "samplerExternalOES"), }; /*@}*/ + +/** \name Sampler types added by GL_ARB_texture_cube_map_array + */ +/*@{*/ +const glsl_type glsl_type::builtin_ARB_texture_cube_map_array_types[] = { + glsl_type(GL_SAMPLER_CUBE_MAP_ARRAY, + GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_FLOAT, "samplerCubeArray"), + glsl_type(GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW, + GLSL_SAMPLER_DIM_CUBE, 1, 1, GLSL_TYPE_FLOAT, "samplerCubeArrayShadow"), + glsl_type(GL_INT_SAMPLER_CUBE_MAP_ARRAY, + GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_INT, "isamplerCubeArray"), + glsl_type(GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY, + GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_UINT, "usamplerCubeArray"), +}; +/*@}*/ diff --git a/mesalib/src/glsl/glcpp/glcpp-parse.y b/mesalib/src/glsl/glcpp/glcpp-parse.y index ffb48e330..40c43c63e 100644 --- a/mesalib/src/glsl/glcpp/glcpp-parse.y +++ b/mesalib/src/glsl/glcpp/glcpp-parse.y @@ -1187,6 +1187,9 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api) if (extensions->ARB_uniform_buffer_object) add_builtin_define(parser, "GL_ARB_uniform_buffer_object", 1); + + if (extensions->ARB_texture_cube_map_array) + add_builtin_define(parser, "GL_ARB_texture_cube_map_array", 1); } language_version = 110; diff --git a/mesalib/src/glsl/glsl_lexer.ll b/mesalib/src/glsl/glsl_lexer.ll index 24cda0c45..c538d7d8e 100644 --- a/mesalib/src/glsl/glsl_lexer.ll +++ b/mesalib/src/glsl/glsl_lexer.ll @@ -296,12 +296,37 @@ usamplerCube KEYWORD(130, 130, USAMPLERCUBE); usampler1DArray KEYWORD(130, 130, USAMPLER1DARRAY); usampler2DArray KEYWORD(130, 130, USAMPLER2DARRAY); -samplerExternalOES { +samplerCubeArray { + if (yyextra->ARB_texture_cube_map_array_enable) + return SAMPLERCUBEARRAY; + else + return IDENTIFIER; + } +isamplerCubeArray { + if (yyextra->ARB_texture_cube_map_array_enable) + return ISAMPLERCUBEARRAY; + else + return IDENTIFIER; + } +usamplerCubeArray { + if (yyextra->ARB_texture_cube_map_array_enable) + return USAMPLERCUBEARRAY; + else + return IDENTIFIER; + } +samplerCubeArrayShadow { + if (yyextra->ARB_texture_cube_map_array_enable) + return SAMPLERCUBEARRAYSHADOW; + else + return IDENTIFIER; + } + +samplerExternalOES { if (yyextra->OES_EGL_image_external_enable) return SAMPLEREXTERNALOES; else return IDENTIFIER; - } + } struct return STRUCT; diff --git a/mesalib/src/glsl/glsl_parser.yy b/mesalib/src/glsl/glsl_parser.yy index ee6a67288..a0665067d 100644 --- a/mesalib/src/glsl/glsl_parser.yy +++ b/mesalib/src/glsl/glsl_parser.yy @@ -101,9 +101,11 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg) %token MAT4X2 MAT4X3 MAT4X4 %token SAMPLER1D SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER1DSHADOW SAMPLER2DSHADOW %token SAMPLERCUBESHADOW SAMPLER1DARRAY SAMPLER2DARRAY SAMPLER1DARRAYSHADOW -%token SAMPLER2DARRAYSHADOW ISAMPLER1D ISAMPLER2D ISAMPLER3D ISAMPLERCUBE -%token ISAMPLER1DARRAY ISAMPLER2DARRAY USAMPLER1D USAMPLER2D USAMPLER3D -%token USAMPLERCUBE USAMPLER1DARRAY USAMPLER2DARRAY +%token SAMPLER2DARRAYSHADOW SAMPLERCUBEARRAY SAMPLERCUBEARRAYSHADOW +%token ISAMPLER1D ISAMPLER2D ISAMPLER3D ISAMPLERCUBE +%token ISAMPLER1DARRAY ISAMPLER2DARRAY ISAMPLERCUBEARRAY +%token USAMPLER1D USAMPLER2D USAMPLER3D USAMPLERCUBE USAMPLER1DARRAY +%token USAMPLER2DARRAY USAMPLERCUBEARRAY %token SAMPLER2DRECT ISAMPLER2DRECT USAMPLER2DRECT SAMPLER2DRECTSHADOW %token SAMPLERBUFFER ISAMPLERBUFFER USAMPLERBUFFER %token SAMPLEREXTERNALOES @@ -1467,6 +1469,8 @@ basic_type_specifier_nonarray: | SAMPLER1DARRAYSHADOW { $$ = "sampler1DArrayShadow"; } | SAMPLER2DARRAYSHADOW { $$ = "sampler2DArrayShadow"; } | SAMPLERBUFFER { $$ = "samplerBuffer"; } + | SAMPLERCUBEARRAY { $$ = "samplerCubeArray"; } + | SAMPLERCUBEARRAYSHADOW { $$ = "samplerCubeArrayShadow"; } | ISAMPLER1D { $$ = "isampler1D"; } | ISAMPLER2D { $$ = "isampler2D"; } | ISAMPLER2DRECT { $$ = "isampler2DRect"; } @@ -1475,6 +1479,7 @@ basic_type_specifier_nonarray: | ISAMPLER1DARRAY { $$ = "isampler1DArray"; } | ISAMPLER2DARRAY { $$ = "isampler2DArray"; } | ISAMPLERBUFFER { $$ = "isamplerBuffer"; } + | ISAMPLERCUBEARRAY { $$ = "isamplerCubeArray"; } | USAMPLER1D { $$ = "usampler1D"; } | USAMPLER2D { $$ = "usampler2D"; } | USAMPLER2DRECT { $$ = "usampler2DRect"; } @@ -1483,6 +1488,7 @@ basic_type_specifier_nonarray: | USAMPLER1DARRAY { $$ = "usampler1DArray"; } | USAMPLER2DARRAY { $$ = "usampler2DArray"; } | USAMPLERBUFFER { $$ = "usamplerBuffer"; } + | USAMPLERCUBEARRAY { $$ = "usamplerCubeArray"; } ; precision_qualifier: diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index 872fcda71..f1fdd3a47 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -289,6 +289,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { EXT(ARB_shader_bit_encoding, true, true, true, true, false, ARB_shader_bit_encoding), EXT(ARB_uniform_buffer_object, true, false, true, true, false, ARB_uniform_buffer_object), EXT(OES_standard_derivatives, false, false, true, false, true, OES_standard_derivatives), + EXT(ARB_texture_cube_map_array, true, false, true, true, false, ARB_texture_cube_map_array), }; #undef EXT diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h index c8c40ab5a..0b208f6ca 100644 --- a/mesalib/src/glsl/glsl_parser_extras.h +++ b/mesalib/src/glsl/glsl_parser_extras.h @@ -205,6 +205,8 @@ struct _mesa_glsl_parse_state { bool ARB_uniform_buffer_object_warn; bool OES_standard_derivatives_enable; bool OES_standard_derivatives_warn; + bool ARB_texture_cube_map_array_enable; + bool ARB_texture_cube_map_array_warn; /*@}*/ /** Extensions supported by the OpenGL implementation. */ diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp index 2aa51f0b3..3940a12a5 100644 --- a/mesalib/src/glsl/glsl_types.cpp +++ b/mesalib/src/glsl/glsl_types.cpp @@ -142,7 +142,7 @@ glsl_type::sampler_index() const case GLSL_SAMPLER_DIM_3D: return TEXTURE_3D_INDEX; case GLSL_SAMPLER_DIM_CUBE: - return TEXTURE_CUBE_INDEX; + return (t->sampler_array) ? TEXTURE_CUBE_ARRAY_INDEX : TEXTURE_CUBE_INDEX; case GLSL_SAMPLER_DIM_RECT: return TEXTURE_RECT_INDEX; case GLSL_SAMPLER_DIM_BUF: @@ -256,6 +256,15 @@ glsl_type::generate_OES_EGL_image_external_types(glsl_symbol_table *symtab, } void +glsl_type::generate_ARB_texture_cube_map_array_types(glsl_symbol_table *symtab, + bool warn) +{ + add_types_to_symbol_table(symtab, builtin_ARB_texture_cube_map_array_types, + Elements(builtin_ARB_texture_cube_map_array_types), + warn); +} + +void _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state) { switch (state->language_version) { @@ -304,6 +313,11 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state) glsl_type::generate_OES_EGL_image_external_types(state->symbols, state->OES_EGL_image_external_warn); } + + if (state->ARB_texture_cube_map_array_enable) { + glsl_type::generate_ARB_texture_cube_map_array_types(state->symbols, + state->ARB_texture_cube_map_array_warn); + } } diff --git a/mesalib/src/glsl/glsl_types.h b/mesalib/src/glsl/glsl_types.h index 915d1a22b..cf954a256 100644 --- a/mesalib/src/glsl/glsl_types.h +++ b/mesalib/src/glsl/glsl_types.h @@ -521,6 +521,7 @@ private: static const glsl_type builtin_EXT_texture_array_types[]; static const glsl_type builtin_EXT_texture_buffer_object_types[]; static const glsl_type builtin_OES_EGL_image_external_types[]; + static const glsl_type builtin_ARB_texture_cube_map_array_types[]; /*@}*/ /** @@ -541,6 +542,7 @@ private: static void generate_EXT_texture_array_types(glsl_symbol_table *, bool); static void generate_OES_texture_3D_types(glsl_symbol_table *, bool); static void generate_OES_EGL_image_external_types(glsl_symbol_table *, bool); + static void generate_ARB_texture_cube_map_array_types(glsl_symbol_table *, bool); /*@}*/ /** diff --git a/mesalib/src/glsl/standalone_scaffolding.cpp b/mesalib/src/glsl/standalone_scaffolding.cpp index 7e37be578..120ee9534 100644 --- a/mesalib/src/glsl/standalone_scaffolding.cpp +++ b/mesalib/src/glsl/standalone_scaffolding.cpp @@ -81,6 +81,7 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api) ctx->Extensions.OES_EGL_image_external = true; ctx->Extensions.ARB_shader_bit_encoding = true; ctx->Extensions.OES_standard_derivatives = true; + ctx->Extensions.ARB_texture_cube_map_array = true; ctx->Const.GLSLVersion = 120; diff --git a/mesalib/src/mapi/glapi/gen/ARB_texture_cube_map_array.xml b/mesalib/src/mapi/glapi/gen/ARB_texture_cube_map_array.xml new file mode 100644 index 000000000..bf101925c --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/ARB_texture_cube_map_array.xml @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> + +<OpenGLAPI> + +<category name="GL_ARB_texture_cube_map_array" number="71"> + + <enum name="TEXTURE_CUBE_MAP_ARRAY_ARB" value="0x9009"/> + <enum name="TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB" value="0x900A"/> + <enum name="PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB" value="0x900B"/> + <enum name="SAMPLER_CUBE_MAP_ARRAY_ARB" value="0x900C"/> + <enum name="SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB" value="0x900D"/> + <enum name="INT_SAMPLER_CUBE_MAP_ARRAY_ARB" value="0x900E"/> + <enum name="UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB" value="0x900F"/> + +</category> + +</OpenGLAPI> diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml index 01d2a9cd2..9645fdb81 100644 --- a/mesalib/src/mapi/glapi/gen/gl_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_API.xml @@ -8174,7 +8174,7 @@ <xi:include href="AMD_draw_buffers_blend.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> <!-- 70. GL_ARB_sample_shading --> -<!-- 71. GL_ARB_texture_cube_map_array --> +<xi:include href="ARB_texture_cube_map_array.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> <!-- 72. GL_ARB_texture_gather --> <!-- 73. GL_ARB_texture_query_lod --> diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript index 11e034f84..4c3355bd9 100644 --- a/mesalib/src/mesa/SConscript +++ b/mesalib/src/mesa/SConscript @@ -65,6 +65,7 @@ main_sources = [ 'main/enable.c', 'main/enums.c', 'main/errors.c', + 'main/es1_conversion.c', 'main/eval.c', 'main/execmem.c', 'main/extensions.c', @@ -338,7 +339,7 @@ if env['gles']: enabled_apis += ['ES1', 'ES2'] # generate GLES sources - gles_sources = ['main/es1_conversion.c',] + gles_sources = [] # generate GLES headers gles_headers = [] diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c index 05db35b8e..0997e5407 100644 --- a/mesalib/src/mesa/main/attrib.c +++ b/mesalib/src/mesa/main/attrib.c @@ -684,7 +684,6 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate) _mesa_set_enable(ctx, GL_TEXTURE_2D_ARRAY_EXT, !!(unit->Enabled & TEXTURE_2D_ARRAY_BIT)); } - _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode); _mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor); _mesa_TexGeni(GL_S, GL_TEXTURE_GEN_MODE, unit->GenS.Mode); @@ -762,7 +761,10 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate) !ctx->Extensions.MESA_texture_array) { continue; } - else if (obj->Target == GL_TEXTURE_BUFFER) + else if (obj->Target == GL_TEXTURE_CUBE_MAP_ARRAY && + !ctx->Extensions.ARB_texture_cube_map_array) { + continue; + } else if (obj->Target == GL_TEXTURE_BUFFER) continue; else if (obj->Target == GL_TEXTURE_EXTERNAL_OES) continue; @@ -1147,8 +1149,11 @@ _mesa_PopAttrib(void) if (ctx->Extensions.NV_point_sprite) _mesa_PointParameteri(GL_POINT_SPRITE_R_MODE_NV, ctx->Point.SpriteRMode); - _mesa_PointParameterf(GL_POINT_SPRITE_COORD_ORIGIN, - (GLfloat)ctx->Point.SpriteOrigin); + + if ((ctx->API == API_OPENGL && ctx->Version >= 20) + || ctx->API == API_OPENGL_CORE) + _mesa_PointParameterf(GL_POINT_SPRITE_COORD_ORIGIN, + (GLfloat)ctx->Point.SpriteOrigin); } } break; diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index f8688cdb9..d5a7886c9 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -129,6 +129,7 @@ static const struct extension extension_table[] = { { "GL_ARB_texture_compression", o(dummy_true), GLL, 2000 }, { "GL_ARB_texture_compression_rgtc", o(ARB_texture_compression_rgtc), GL, 2004 }, { "GL_ARB_texture_cube_map", o(ARB_texture_cube_map), GLL, 1999 }, + { "GL_ARB_texture_cube_map_array", o(ARB_texture_cube_map_array), GLL, 2009 }, { "GL_ARB_texture_env_add", o(dummy_true), GLL, 1999 }, { "GL_ARB_texture_env_combine", o(ARB_texture_env_combine), GLL, 2001 }, { "GL_ARB_texture_env_crossbar", o(ARB_texture_env_crossbar), GLL, 2001 }, diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 0758d5557..0618b7fab 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -2025,7 +2025,8 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, */ err = (texObj->Target != GL_TEXTURE_3D) && (texObj->Target != GL_TEXTURE_1D_ARRAY_EXT) && - (texObj->Target != GL_TEXTURE_2D_ARRAY_EXT); + (texObj->Target != GL_TEXTURE_2D_ARRAY_EXT) && + (texObj->Target != GL_TEXTURE_CUBE_MAP_ARRAY); } else { /* Make sure textarget is consistent with the texture's type */ @@ -2058,7 +2059,8 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, } } else if ((texObj->Target == GL_TEXTURE_1D_ARRAY_EXT) || - (texObj->Target == GL_TEXTURE_2D_ARRAY_EXT)) { + (texObj->Target == GL_TEXTURE_2D_ARRAY_EXT) || + (texObj->Target == GL_TEXTURE_CUBE_MAP_ARRAY)) { if (zoffset < 0 || zoffset >= (GLint) ctx->Const.MaxArrayTextureLayers) { _mesa_error(ctx, GL_INVALID_VALUE, diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index afae08932..39709b808 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -335,6 +335,7 @@ EXTRA_EXT(ARB_blend_func_extended); EXTRA_EXT(ARB_uniform_buffer_object); EXTRA_EXT(ARB_timer_query); EXTRA_EXT(ARB_map_buffer_alignment); +EXTRA_EXT(ARB_texture_cube_map_array); static const int extra_NV_primitive_restart[] = { @@ -667,6 +668,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu case GL_TEXTURE_BINDING_CUBE_MAP_ARB: case GL_TEXTURE_BINDING_RECTANGLE_NV: case GL_TEXTURE_BINDING_EXTERNAL_OES: + case GL_TEXTURE_BINDING_CUBE_MAP_ARRAY: unit = ctx->Texture.CurrentUnit; v->value_int = ctx->Texture.Unit[unit].CurrentTex[d->offset]->Name; diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py index 376df09ee..ac9c79cea 100644 --- a/mesalib/src/mesa/main/get_hash_params.py +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -688,6 +688,9 @@ descriptor=[ # GL_ARB_map_buffer_alignment [ "MIN_MAP_BUFFER_ALIGNMENT", "CONTEXT_INT(Const.MinMapBufferAlignment), extra_ARB_map_buffer_alignment" ], + +# GL_ARB_texture_cube_map_array + [ "TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_CUBE_ARRAY_INDEX, extra_ARB_texture_cube_map_array" ], ]} ] diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index c8f2ca325..b99e71044 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -1146,6 +1146,7 @@ struct gl_stencil_attrib */ typedef enum { + TEXTURE_CUBE_ARRAY_INDEX, TEXTURE_BUFFER_INDEX, TEXTURE_2D_ARRAY_INDEX, TEXTURE_1D_ARRAY_INDEX, @@ -1164,6 +1165,7 @@ typedef enum * Used for Texture.Unit[]._ReallyEnabled flags. */ /*@{*/ +#define TEXTURE_CUBE_ARRAY_BIT (1 << TEXTURE_CUBE_ARRAY_INDEX) #define TEXTURE_BUFFER_BIT (1 << TEXTURE_BUFFER_INDEX) #define TEXTURE_2D_ARRAY_BIT (1 << TEXTURE_2D_ARRAY_INDEX) #define TEXTURE_1D_ARRAY_BIT (1 << TEXTURE_1D_ARRAY_INDEX) @@ -2973,6 +2975,7 @@ struct gl_extensions GLboolean ARB_texture_buffer_object; GLboolean ARB_texture_compression_rgtc; GLboolean ARB_texture_cube_map; + GLboolean ARB_texture_cube_map_array; GLboolean ARB_texture_env_combine; GLboolean ARB_texture_env_crossbar; GLboolean ARB_texture_env_dot3; diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c index 8c5e1b822..a22425ab0 100644 --- a/mesalib/src/mesa/main/queryobj.c +++ b/mesalib/src/mesa/main/queryobj.c @@ -216,7 +216,7 @@ _mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids) FLUSH_VERTICES(ctx, 0); if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glDeleeteQueries(%d)\n", n); + _mesa_debug(ctx, "glDeleteQueries(%d)\n", n); if (n < 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteQueriesARB(n < 0)"); diff --git a/mesalib/src/mesa/main/shared.c b/mesalib/src/mesa/main/shared.c index 2d2f7bd1d..ba82628f3 100644 --- a/mesalib/src/mesa/main/shared.c +++ b/mesalib/src/mesa/main/shared.c @@ -90,6 +90,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx) for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { /* NOTE: the order of these enums matches the TEXTURE_x_INDEX values */ static const GLenum targets[] = { + GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_BUFFER, GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_1D_ARRAY_EXT, diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index b88931743..0f28009b0 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -649,7 +649,7 @@ _mesa_is_proxy_texture(GLenum target) * NUM_TEXTURE_TARGETS should match number of terms below, except there's no * proxy for GL_TEXTURE_BUFFER and GL_TEXTURE_EXTERNAL_OES. */ - assert(NUM_TEXTURE_TARGETS == 7 + 2); + assert(NUM_TEXTURE_TARGETS == 8 + 2); return (target == GL_PROXY_TEXTURE_1D || target == GL_PROXY_TEXTURE_2D || @@ -657,7 +657,8 @@ _mesa_is_proxy_texture(GLenum target) target == GL_PROXY_TEXTURE_CUBE_MAP_ARB || target == GL_PROXY_TEXTURE_RECTANGLE_NV || target == GL_PROXY_TEXTURE_1D_ARRAY_EXT || - target == GL_PROXY_TEXTURE_2D_ARRAY_EXT); + target == GL_PROXY_TEXTURE_2D_ARRAY_EXT || + target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY); } @@ -695,6 +696,9 @@ _mesa_get_proxy_target(GLenum target) case GL_TEXTURE_2D_ARRAY_EXT: case GL_PROXY_TEXTURE_2D_ARRAY_EXT: return GL_PROXY_TEXTURE_2D_ARRAY_EXT; + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + return GL_PROXY_TEXTURE_CUBE_MAP_ARRAY; default: _mesa_problem(NULL, "unexpected target in _mesa_get_proxy_target()"); return 0; @@ -745,6 +749,12 @@ _mesa_select_tex_object(struct gl_context *ctx, case GL_PROXY_TEXTURE_CUBE_MAP_ARB: return ctx->Extensions.ARB_texture_cube_map ? ctx->Texture.ProxyTex[TEXTURE_CUBE_INDEX] : NULL; + case GL_TEXTURE_CUBE_MAP_ARRAY: + return ctx->Extensions.ARB_texture_cube_map_array + ? texUnit->CurrentTex[TEXTURE_CUBE_ARRAY_INDEX] : NULL; + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + return ctx->Extensions.ARB_texture_cube_map_array + ? ctx->Texture.ProxyTex[TEXTURE_CUBE_ARRAY_INDEX] : NULL; case GL_TEXTURE_RECTANGLE_NV: return ctx->Extensions.NV_texture_rectangle ? texUnit->CurrentTex[TEXTURE_RECT_INDEX] : NULL; @@ -891,6 +901,11 @@ get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level) return NULL; texIndex = TEXTURE_2D_ARRAY_INDEX; break; + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + if (level >= ctx->Const.MaxCubeTextureLevels) + return NULL; + texIndex = TEXTURE_CUBE_ARRAY_INDEX; + break; default: return NULL; } @@ -953,6 +968,10 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target) return (ctx->Extensions.MESA_texture_array || ctx->Extensions.EXT_texture_array) ? ctx->Const.MaxTextureLevels : 0; + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + return ctx->Extensions.ARB_texture_cube_map_array + ? ctx->Const.MaxCubeTextureLevels : 0; case GL_TEXTURE_BUFFER: return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_buffer_object @@ -995,6 +1014,8 @@ _mesa_get_texture_dimensions(GLenum target) case GL_PROXY_TEXTURE_3D: case GL_TEXTURE_2D_ARRAY: case GL_PROXY_TEXTURE_2D_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: return 3; case GL_TEXTURE_BUFFER: /* fall-through */ @@ -1174,6 +1195,8 @@ _mesa_init_teximage_fields(struct gl_context *ctx, break; case GL_TEXTURE_2D_ARRAY: case GL_PROXY_TEXTURE_2D_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: img->Height2 = height - 2 * border; /* == 1 << img->HeightLog2; */ img->HeightLog2 = _mesa_logbase2(img->Height2); img->Depth2 = depth; /* no border */ @@ -1341,6 +1364,24 @@ _mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target, } return GL_TRUE; + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1); + if (width < 2 * border || width > 2 * border + maxSize) + return GL_FALSE; + if (height < 2 * border || height > 2 * border + maxSize) + return GL_FALSE; + if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers) + return GL_FALSE; + if (level >= ctx->Const.MaxCubeTextureLevels) + return GL_FALSE; + if (!ctx->Extensions.ARB_texture_non_power_of_two) { + if (width > 0 && !_mesa_is_pow_two(width - 2 * border)) + return GL_FALSE; + if (height > 0 && !_mesa_is_pow_two(height - 2 * border)) + return GL_FALSE; + } + return GL_TRUE; default: _mesa_problem(ctx, "Invalid target in _mesa_legal_texture_dimensions()"); return GL_FALSE; @@ -1549,6 +1590,9 @@ target_can_be_compressed(const struct gl_context *ctx, GLenum target, case GL_TEXTURE_2D_ARRAY_EXT: return (ctx->Extensions.MESA_texture_array || ctx->Extensions.EXT_texture_array); + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: + return ctx->Extensions.ARB_texture_cube_map_array; default: return GL_FALSE; } @@ -1614,6 +1658,9 @@ legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target) return _mesa_is_desktop_gl(ctx) && (ctx->Extensions.MESA_texture_array || ctx->Extensions.EXT_texture_array); + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + return ctx->Extensions.ARB_texture_cube_map_array; default: return GL_FALSE; } @@ -1666,6 +1713,9 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target) && (ctx->Extensions.MESA_texture_array || ctx->Extensions.EXT_texture_array)) || _mesa_is_gles3(ctx); + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + return ctx->Extensions.ARB_texture_cube_map_array; default: return GL_FALSE; } @@ -1782,6 +1832,7 @@ texture_error_check( struct gl_context *ctx, * Formats and types that require additional extensions (e.g., GL_FLOAT * requires GL_OES_texture_float) are filtered elsewhere. */ + if (_mesa_is_gles(ctx) && !_mesa_is_gles3(ctx)) { if (format != internalFormat) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -1810,6 +1861,20 @@ texture_error_check( struct gl_context *ctx, return GL_TRUE; } + if ((target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY || + target == GL_TEXTURE_CUBE_MAP_ARRAY) && width != height) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage3D(cube array width != height)"); + return GL_TRUE; + } + + if ((target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY || + target == GL_TEXTURE_CUBE_MAP_ARRAY) && (depth % 6)) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glTexImage3D(cube array depth not multiple of 6)"); + return GL_TRUE; + } + /* Check internalFormat */ if (_mesa_base_tex_format(ctx, internalFormat) < 0) { _mesa_error(ctx, GL_INVALID_VALUE, @@ -1886,7 +1951,10 @@ texture_error_check( struct gl_context *ctx, target != GL_TEXTURE_RECTANGLE_ARB && target != GL_PROXY_TEXTURE_RECTANGLE_ARB && !((_mesa_is_cube_face(target) || target == GL_PROXY_TEXTURE_CUBE_MAP) && - (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4))) { + (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4)) && + !((target == GL_TEXTURE_CUBE_MAP_ARRAY || + target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY) && + ctx->Extensions.ARB_texture_cube_map_array)) { _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage%dD(bad target for depth texture)", dimensions); @@ -2684,7 +2752,7 @@ strip_texture_border(GLenum target, *height = *height - 2; /* reduce the height by two border pixels */ } - if (*depth >= 3 && target != GL_TEXTURE_2D_ARRAY) { + if (*depth >= 3 && target != GL_TEXTURE_2D_ARRAY && target != GL_TEXTURE_CUBE_MAP_ARRAY) { unpackNew->SkipImages++; /* skip the border */ *depth = *depth - 2; /* reduce the depth by two border pixels */ } diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index 8525ff9fd..c083c72e2 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -108,6 +108,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, target == GL_TEXTURE_1D_ARRAY_EXT || target == GL_TEXTURE_2D_ARRAY_EXT || target == GL_TEXTURE_EXTERNAL_OES || + target == GL_TEXTURE_CUBE_MAP_ARRAY || target == GL_TEXTURE_BUFFER); memset(obj, 0, sizeof(*obj)); @@ -316,6 +317,7 @@ valid_texture_object(const struct gl_texture_object *tex) case GL_TEXTURE_2D_ARRAY_EXT: case GL_TEXTURE_BUFFER: case GL_TEXTURE_EXTERNAL_OES: + case GL_TEXTURE_CUBE_MAP_ARRAY: return GL_TRUE; case 0x99: _mesa_problem(NULL, "invalid reference to a deleted texture object"); @@ -515,6 +517,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, maxLevels = ctx->Const.Max3DTextureLevels; break; case GL_TEXTURE_CUBE_MAP_ARB: + case GL_TEXTURE_CUBE_MAP_ARRAY: maxLog2 = MAX2(baseImage->WidthLog2, baseImage->HeightLog2); maxLevels = ctx->Const.MaxCubeTextureLevels; @@ -599,7 +602,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx, if (height > 1 && t->Target != GL_TEXTURE_1D_ARRAY) { height /= 2; } - if (depth > 1 && t->Target != GL_TEXTURE_2D_ARRAY) { + if (depth > 1 && t->Target != GL_TEXTURE_2D_ARRAY && t->Target != GL_TEXTURE_CUBE_MAP_ARRAY) { depth /= 2; } @@ -768,6 +771,10 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) dims = 0; target = GL_TEXTURE_BUFFER; break; + case TEXTURE_CUBE_ARRAY_INDEX: + dims = 3; + target = GL_TEXTURE_CUBE_MAP_ARRAY; + break; case TEXTURE_EXTERNAL_INDEX: dims = 2; target = GL_TEXTURE_EXTERNAL_OES; @@ -1155,6 +1162,8 @@ target_enum_to_index(struct gl_context *ctx, GLenum target) case GL_TEXTURE_EXTERNAL_OES: return _mesa_is_gles(ctx) && ctx->Extensions.OES_EGL_image_external ? TEXTURE_EXTERNAL_INDEX : -1; + case GL_TEXTURE_CUBE_MAP_ARRAY: + return TEXTURE_CUBE_ARRAY_INDEX; default: return -1; } diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h index f22c58cad..f86b4ebcd 100644 --- a/mesalib/src/mesa/main/texobj.h +++ b/mesalib/src/mesa/main/texobj.h @@ -81,6 +81,8 @@ _mesa_reference_texobj(struct gl_texture_object **ptr, /** * Return number of faces for a texture target. This will be 6 for * cube maps (and cube map arrays) and 1 otherwise. + * NOTE: this function is not used for cube map arrays which operate + * more like 2D arrays than cube maps. */ static inline GLuint _mesa_num_tex_faces(GLenum target) diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c index f73e2b5f0..8ce054618 100644 --- a/mesalib/src/mesa/main/texparam.c +++ b/mesalib/src/mesa/main/texparam.c @@ -170,6 +170,11 @@ get_texobj(struct gl_context *ctx, GLenum target, GLboolean get) return texUnit->CurrentTex[TEXTURE_EXTERNAL_INDEX]; } break; + case GL_TEXTURE_CUBE_MAP_ARRAY: + if (ctx->Extensions.ARB_texture_cube_map_array) { + return texUnit->CurrentTex[TEXTURE_CUBE_ARRAY_INDEX]; + } + break; default: ; } diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c index 0e5ba44ed..1f765086b 100644 --- a/mesalib/src/mesa/main/texstate.c +++ b/mesalib/src/mesa/main/texstate.c @@ -706,6 +706,7 @@ alloc_proxy_textures( struct gl_context *ctx ) * values! */ static const GLenum targets[] = { + GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_BUFFER, GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_1D_ARRAY_EXT, diff --git a/mesalib/src/mesa/main/texstorage.c b/mesalib/src/mesa/main/texstorage.c index 968f6f904..9e0b54317 100644 --- a/mesalib/src/mesa/main/texstorage.c +++ b/mesalib/src/mesa/main/texstorage.c @@ -87,6 +87,9 @@ legal_texobj_target(struct gl_context *ctx, GLuint dims, GLenum target) case GL_PROXY_TEXTURE_2D_ARRAY: return (ctx->Extensions.MESA_texture_array || ctx->Extensions.EXT_texture_array); + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + return ctx->Extensions.ARB_texture_cube_map_array; default: return GL_FALSE; } diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index e6914553c..1c088106f 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -4273,6 +4273,7 @@ store_texsubimage(struct gl_context *ctx, dims = 1; break; case GL_TEXTURE_2D_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: case GL_TEXTURE_3D: dims = 3; break; @@ -4324,6 +4325,12 @@ store_texsubimage(struct gl_context *ctx, srcImageStride = _mesa_image_image_stride(packing, width, height, format, type); break; + case GL_TEXTURE_CUBE_MAP_ARRAY: + numSlices = depth; + sliceOffset = zoffset; + srcImageStride = _mesa_image_image_stride(packing, width, height, + format, type); + break; default: _mesa_warning(ctx, "Unexpected target 0x%x in store_texsubimage()", target); return; diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index 522f5a704..3974787b4 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -701,14 +701,10 @@ _mesa_GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params) ASSERT_OUTSIDE_BEGIN_END(ctx); if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { - const GLfloat *v = + const GLint *v = (const GLint *) get_current_attrib(ctx, index, "glGetVertexAttribIiv"); if (v != NULL) { - /* XXX we don't have true integer-valued vertex attribs yet */ - params[0] = (GLint) v[0]; - params[1] = (GLint) v[1]; - params[2] = (GLint) v[2]; - params[3] = (GLint) v[3]; + COPY_4V(params, v); } } else { @@ -726,14 +722,10 @@ _mesa_GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params) ASSERT_OUTSIDE_BEGIN_END(ctx); if (pname == GL_CURRENT_VERTEX_ATTRIB_ARB) { - const GLfloat *v = + const GLuint *v = (const GLuint *) get_current_attrib(ctx, index, "glGetVertexAttribIuiv"); if (v != NULL) { - /* XXX we don't have true integer-valued vertex attribs yet */ - params[0] = (GLuint) v[0]; - params[1] = (GLuint) v[1]; - params[2] = (GLuint) v[2]; - params[3] = (GLuint) v[3]; + COPY_4V(params, v); } } else { diff --git a/mesalib/src/mesa/program/prog_instruction.c b/mesalib/src/mesa/program/prog_instruction.c index 0bd45b09b..ab93932ef 100644 --- a/mesalib/src/mesa/program/prog_instruction.c +++ b/mesalib/src/mesa/program/prog_instruction.c @@ -171,9 +171,7 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = { { OPCODE_DPH, "DPH", 2, 1 }, { OPCODE_DST, "DST", 2, 1 }, { OPCODE_ELSE, "ELSE", 0, 0 }, - { OPCODE_EMIT_VERTEX, "EMIT_VERTEX", 0, 0 }, { OPCODE_END, "END", 0, 0 }, - { OPCODE_END_PRIMITIVE, "END_PRIMITIVE", 0, 0 }, { OPCODE_ENDIF, "ENDIF", 0, 0 }, { OPCODE_ENDLOOP,"ENDLOOP", 0, 0 }, { OPCODE_ENDSUB, "ENDSUB", 0, 0 }, diff --git a/mesalib/src/mesa/program/prog_instruction.h b/mesalib/src/mesa/program/prog_instruction.h index 8bb0c6541..a7bba75f1 100644 --- a/mesalib/src/mesa/program/prog_instruction.h +++ b/mesalib/src/mesa/program/prog_instruction.h @@ -165,9 +165,7 @@ typedef enum prog_opcode { OPCODE_DPH, /* X X 1.1 */ OPCODE_DST, /* X X X X */ OPCODE_ELSE, /* opt */ - OPCODE_EMIT_VERTEX,/* X */ OPCODE_END, /* X X X X opt */ - OPCODE_END_PRIMITIVE,/* X */ OPCODE_ENDIF, /* opt */ OPCODE_ENDLOOP, /* opt */ OPCODE_ENDSUB, /* opt */ diff --git a/mesalib/src/mesa/program/prog_print.c b/mesalib/src/mesa/program/prog_print.c index dbaa4d017..7e7e081f7 100644 --- a/mesalib/src/mesa/program/prog_print.c +++ b/mesalib/src/mesa/program/prog_print.c @@ -810,12 +810,6 @@ _mesa_fprint_instruction_opt(FILE *f, fprintf(f, "# %s\n", inst->Comment); } break; - case OPCODE_EMIT_VERTEX: - fprintf(f, "EMIT_VERTEX\n"); - break; - case OPCODE_END_PRIMITIVE: - fprintf(f, "END_PRIMITIVE\n"); - break; /* XXX may need other special-case instructions */ default: if (inst->Opcode < MAX_OPCODE) { diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index 6c287b3d4..b2711c342 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -102,6 +102,9 @@ gl_target_to_pipe(GLenum target) return PIPE_TEXTURE_2D_ARRAY; case GL_TEXTURE_BUFFER: return PIPE_BUFFER; + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + return PIPE_TEXTURE_CUBE_ARRAY; default: assert(0); return 0; @@ -272,6 +275,7 @@ get_texture_dims(GLenum target) case GL_TEXTURE_EXTERNAL_OES: return 2; case GL_TEXTURE_3D: + case GL_TEXTURE_CUBE_MAP_ARRAY: return 3; default: assert(0 && "invalid texture target in get_texture_dims()"); @@ -1123,6 +1127,7 @@ copy_image_data_to_texture(struct st_context *st, assert(stImage->pt->target == PIPE_TEXTURE_1D_ARRAY || u_minify(stImage->pt->height0, src_level) == stImage->base.Height); assert(stImage->pt->target == PIPE_TEXTURE_2D_ARRAY || + stImage->pt->target == PIPE_TEXTURE_CUBE_ARRAY || u_minify(stImage->pt->depth0, src_level) == stImage->base.Depth); st_texture_image_copy(st->pipe, diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index 887700568..7570d6894 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -378,7 +378,8 @@ void st_init_extensions(struct st_context *st) * support the GL_POINT_SPRITE_R_MODE_NV option. */ { o(MESA_texture_array), PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS }, - { o(OES_standard_derivatives), PIPE_CAP_SM3 } + { o(OES_standard_derivatives), PIPE_CAP_SM3 }, + { o(ARB_texture_cube_map_array), PIPE_CAP_CUBE_MAP_ARRAY } }; /* Required: render target and sampler support */ diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index a70a08bf3..c030a6b37 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2565,10 +2565,18 @@ glsl_to_tgsi_visitor::visit(ir_call *ir) void glsl_to_tgsi_visitor::visit(ir_texture *ir) { - st_src_reg result_src, coord, lod_info, projector, dx, dy, offset; - st_dst_reg result_dst, coord_dst; + st_src_reg result_src, coord, cube_sc, lod_info, projector, dx, dy, offset; + st_dst_reg result_dst, coord_dst, cube_sc_dst; glsl_to_tgsi_instruction *inst = NULL; unsigned opcode = TGSI_OPCODE_NOP; + const glsl_type *sampler_type = ir->sampler->type; + bool is_cube_array = false; + + /* if we are a cube array sampler */ + if ((sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE && + sampler_type->sampler_array)) { + is_cube_array = true; + } if (ir->coordinate) { ir->coordinate->accept(this); @@ -2591,20 +2599,20 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) /* Storage for our result. Ideally for an assignment we'd be using * the actual storage for the result here, instead. */ - result_src = get_temp(glsl_type::vec4_type); + result_src = get_temp(ir->type); result_dst = st_dst_reg(result_src); switch (ir->op) { case ir_tex: - opcode = TGSI_OPCODE_TEX; + opcode = (is_cube_array && ir->shadow_comparitor) ? TGSI_OPCODE_TEX2 : TGSI_OPCODE_TEX; break; case ir_txb: - opcode = TGSI_OPCODE_TXB; + opcode = is_cube_array ? TGSI_OPCODE_TXB2 : TGSI_OPCODE_TXB; ir->lod_info.bias->accept(this); lod_info = this->result; break; case ir_txl: - opcode = TGSI_OPCODE_TXL; + opcode = is_cube_array ? TGSI_OPCODE_TXL2 : TGSI_OPCODE_TXL; ir->lod_info.lod->accept(this); lod_info = this->result; break; @@ -2631,8 +2639,6 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) break; } - const glsl_type *sampler_type = ir->sampler->type; - if (ir->projector) { if (opcode == TGSI_OPCODE_TEX) { /* Slot the projector in as the last component of the coord. */ @@ -2692,17 +2698,25 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) */ ir->shadow_comparitor->accept(this); - /* XXX This will need to be updated for cubemap array samplers. */ - if ((sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_2D && - sampler_type->sampler_array) || - sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE) { - coord_dst.writemask = WRITEMASK_W; - } else { - coord_dst.writemask = WRITEMASK_Z; + if (is_cube_array) { + cube_sc = get_temp(glsl_type::float_type); + cube_sc_dst = st_dst_reg(cube_sc); + cube_sc_dst.writemask = WRITEMASK_X; + emit(ir, TGSI_OPCODE_MOV, cube_sc_dst, this->result); + cube_sc_dst.writemask = WRITEMASK_X; + } + else { + if ((sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_2D && + sampler_type->sampler_array) || + sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE) { + coord_dst.writemask = WRITEMASK_W; + } else { + coord_dst.writemask = WRITEMASK_Z; + } + + emit(ir, TGSI_OPCODE_MOV, coord_dst, this->result); + coord_dst.writemask = WRITEMASK_XYZW; } - - emit(ir, TGSI_OPCODE_MOV, coord_dst, this->result); - coord_dst.writemask = WRITEMASK_XYZW; } if (opcode == TGSI_OPCODE_TXL || opcode == TGSI_OPCODE_TXB || @@ -2719,7 +2733,11 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) inst = emit(ir, opcode, result_dst, lod_info); else if (opcode == TGSI_OPCODE_TXF) { inst = emit(ir, opcode, result_dst, coord); - } else + } else if (opcode == TGSI_OPCODE_TXL2 || opcode == TGSI_OPCODE_TXB2) { + inst = emit(ir, opcode, result_dst, coord, lod_info); + } else if (opcode == TGSI_OPCODE_TEX2) { + inst = emit(ir, opcode, result_dst, coord, cube_sc); + } else inst = emit(ir, opcode, result_dst, coord); if (ir->shadow_comparitor) @@ -2751,7 +2769,8 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) inst->tex_target = TEXTURE_3D_INDEX; break; case GLSL_SAMPLER_DIM_CUBE: - inst->tex_target = TEXTURE_CUBE_INDEX; + inst->tex_target = (sampler_type->sampler_array) + ? TEXTURE_CUBE_ARRAY_INDEX : TEXTURE_CUBE_INDEX; break; case GLSL_SAMPLER_DIM_RECT: inst->tex_target = TEXTURE_RECT_INDEX; @@ -4209,6 +4228,7 @@ compile_tgsi_instruction(struct st_translate *t, unsigned num_dst; unsigned num_src; + unsigned tex_target; num_dst = num_inst_dst_regs(inst->op); num_src = num_inst_src_regs(inst->op); @@ -4243,14 +4263,19 @@ compile_tgsi_instruction(struct st_translate *t, case TGSI_OPCODE_TXP: case TGSI_OPCODE_TXQ: case TGSI_OPCODE_TXF: + case TGSI_OPCODE_TEX2: + case TGSI_OPCODE_TXB2: + case TGSI_OPCODE_TXL2: src[num_src++] = t->samplers[inst->sampler]; for (i = 0; i < inst->tex_offset_num_offset; i++) { texoffsets[i] = translate_tex_offset(t, &inst->tex_offsets[i]); } + tex_target = st_translate_texture_target(inst->tex_target, inst->tex_shadow); + ureg_tex_insn(ureg, inst->op, - dst, num_dst, - st_translate_texture_target(inst->tex_target, inst->tex_shadow), + dst, num_dst, + tex_target, texoffsets, inst->tex_offset_num_offset, src, num_src); return; diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c index 0acab4340..81a870f86 100644 --- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -263,6 +263,7 @@ st_translate_texture_target( GLuint textarget, case TEXTURE_1D_ARRAY_INDEX: return TGSI_TEXTURE_SHADOW1D_ARRAY; case TEXTURE_2D_ARRAY_INDEX: return TGSI_TEXTURE_SHADOW2D_ARRAY; case TEXTURE_CUBE_INDEX: return TGSI_TEXTURE_SHADOWCUBE; + case TEXTURE_CUBE_ARRAY_INDEX: return TGSI_TEXTURE_SHADOWCUBE_ARRAY; default: break; } } @@ -272,6 +273,7 @@ st_translate_texture_target( GLuint textarget, case TEXTURE_2D_INDEX: return TGSI_TEXTURE_2D; case TEXTURE_3D_INDEX: return TGSI_TEXTURE_3D; case TEXTURE_CUBE_INDEX: return TGSI_TEXTURE_CUBE; + case TEXTURE_CUBE_ARRAY_INDEX: return TGSI_TEXTURE_CUBE_ARRAY; case TEXTURE_RECT_INDEX: return TGSI_TEXTURE_RECT; case TEXTURE_1D_ARRAY_INDEX: return TGSI_TEXTURE_1D_ARRAY; case TEXTURE_2D_ARRAY_INDEX: return TGSI_TEXTURE_2D_ARRAY; @@ -563,10 +565,6 @@ translate_opcode( unsigned op ) return TGSI_OPCODE_DST; case OPCODE_ELSE: return TGSI_OPCODE_ELSE; - case OPCODE_EMIT_VERTEX: - return TGSI_OPCODE_EMIT; - case OPCODE_END_PRIMITIVE: - return TGSI_OPCODE_ENDPRIM; case OPCODE_ENDIF: return TGSI_OPCODE_ENDIF; case OPCODE_ENDLOOP: diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c index d6dbf8d6c..5a4dcaab2 100644 --- a/mesalib/src/mesa/state_tracker/st_texture.c +++ b/mesalib/src/mesa/state_tracker/st_texture.c @@ -165,6 +165,13 @@ st_gl_texture_dims_to_pipe_dims(GLenum texture, *depthOut = 1; *layersOut = depthIn; break; + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + *widthOut = widthIn; + *heightOut = heightIn; + *depthOut = 1; + *layersOut = depthIn; + break; default: assert(0 && "Unexpected texture in st_gl_texture_dims_to_pipe_dims()"); /* fall-through */ @@ -277,7 +284,8 @@ st_texture_image_data(struct st_context *st, GLuint layers; if (dst->target == PIPE_TEXTURE_1D_ARRAY || - dst->target == PIPE_TEXTURE_2D_ARRAY) + dst->target == PIPE_TEXTURE_2D_ARRAY || + dst->target == PIPE_TEXTURE_CUBE_ARRAY) layers = dst->array_size; else layers = u_minify(dst->depth0, level); |