<value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
<value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
<value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
+ <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
</desc>
<desc name="pname">
<value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/>
<value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
<value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/>
+ <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
</desc>
<desc name="cap" category="GLES2.0">
<value name="GL_MATRIX_PALETTE_OES" category="OES_matrix_palette"/>
<value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
<value name="GL_TEXTURE_GEN_STR_OES" category="OES_texture_cube_map"/>
+ <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
</desc>
<desc name="cap" category="GLES2.0">
<value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
<value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
<value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
+ <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
</desc>
<desc name="pname">
<value name="GL_MATRIX_INDEX_ARRAY_OES" category="OES_matrix_palette"/>
<value name="GL_WEIGHT_ARRAY_OES" category="OES_matrix_palette"/>
<value name="GL_POINT_SIZE_ARRAY_OES" category="OES_point_size_array"/>
+ <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
</desc>
<desc name="cap" category="GLES2.0">
<value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
<value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
<value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
+ <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
</desc>
</template>
<desc name="target">
<value name="GL_TEXTURE_2D"/>
+ <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
</desc>
</template>
<category name="EXT_blend_minmax"/>
<category name="EXT_multi_draw_arrays"/>
<category name="OES_EGL_image"/>
+ <category name="OES_EGL_image_external"/>
<category name="OES_matrix_palette"/>
<category name="EXT_blend_minmax"/>
<category name="EXT_multi_draw_arrays"/>
<category name="OES_EGL_image"/>
+ <category name="OES_EGL_image_external"/>
<category name="NV_draw_buffers"/>
<function name="DrawBuffersNV" template="DrawBuffers"/>
}
else if (obj->Target == GL_TEXTURE_BUFFER)
continue;
+ else if (obj->Target == GL_TEXTURE_EXTERNAL_OES)
+ continue;
target = obj->Target;
{ 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" }
+ { GL_TEXTURE_2D_ARRAY_EXT, "GL_TEXTURE_2D_ARRAY" },
+ { GL_TEXTURE_EXTERNAL_OES, "GL_TEXTURE_EXTERNAL_OES" }
};
GLuint i;
for (i = 0; i < Elements(tex_targets); i++) {
ctx->Color.sRGBEnabled = state;
break;
+ /* GL_OES_EGL_image_external */
+ case GL_TEXTURE_EXTERNAL_OES:
+ CHECK_EXTENSION(OES_EGL_image_external, cap);
+ if (!enable_texture(ctx, state, TEXTURE_EXTERNAL_BIT)) {
+ return;
+ }
+ break;
+
default:
goto invalid_enum_error;
}
CHECK_EXTENSION(EXT_framebuffer_sRGB);
return ctx->Color.sRGBEnabled;
+ /* GL_OES_EGL_image_external */
+ case GL_TEXTURE_EXTERNAL_OES:
+ CHECK_EXTENSION(OES_EGL_image_external);
+ return is_texture_enabled(ctx, TEXTURE_EXTERNAL_BIT);
+
default:
goto invalid_enum_error;
}
sampler_type = p->shader->symbols->get_type("samplerCube");
coords = 3;
break;
+ case TEXTURE_EXTERNAL_INDEX:
+ assert(!p->state->unit[unit].shadow);
+ sampler_type = p->shader->symbols->get_type("samplerExternalOES");
+ coords = 2;
+ break;
}
p->src_texture[unit] = new(p->mem_ctx) ir_variable(glsl_type::vec4_type,
p.shader_program->InternalSeparateShader = GL_TRUE;
state->language_version = 130;
+ if (ctx->Extensions.OES_EGL_image_external)
+ state->OES_EGL_image_external_enable = true;
_mesa_glsl_initialize_types(state);
_mesa_glsl_initialize_variables(p.instructions, state);
EXTRA_EXT(ARB_copy_buffer);
EXTRA_EXT(EXT_framebuffer_sRGB);
EXTRA_EXT(ARB_texture_buffer_object);
+EXTRA_EXT(OES_EGL_image_external);
static const int
extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = {
{ GL_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA },
#endif /* FEATURE_ES2 */
+ /* GL_OES_EGL_image_external */
+ { GL_TEXTURE_BINDING_EXTERNAL_OES, LOC_CUSTOM,
+ TYPE_INT, TEXTURE_EXTERNAL_INDEX, extra_OES_EGL_image_external },
+ { GL_TEXTURE_EXTERNAL_OES, LOC_CUSTOM,
+ TYPE_BOOLEAN, 0, extra_OES_EGL_image_external },
+
#if FEATURE_GL
/* Remaining enums are only in OpenGL */
{ 0, 0, TYPE_API_MASK, API_OPENGL_BIT, NO_EXTRA },
case GL_TEXTURE_2D_ARRAY_EXT:
case GL_TEXTURE_CUBE_MAP_ARB:
case GL_TEXTURE_RECTANGLE_NV:
+ case GL_TEXTURE_EXTERNAL_OES:
v->value_bool = _mesa_IsEnabled(d->pname);
break;
case GL_TEXTURE_BINDING_2D_ARRAY_EXT:
case GL_TEXTURE_BINDING_CUBE_MAP_ARB:
case GL_TEXTURE_BINDING_RECTANGLE_NV:
+ case GL_TEXTURE_BINDING_EXTERNAL_OES:
unit = ctx->Texture.CurrentUnit;
v->value_int =
ctx->Texture.Unit[unit].CurrentTex[d->offset]->Name;
}
break;
case GL_TEXTURE_RECTANGLE_NV:
+ case GL_TEXTURE_EXTERNAL_OES:
/* no mipmaps, do nothing */
break;
default:
TEXTURE_BUFFER_INDEX,
TEXTURE_2D_ARRAY_INDEX,
TEXTURE_1D_ARRAY_INDEX,
+ TEXTURE_EXTERNAL_INDEX,
TEXTURE_CUBE_INDEX,
TEXTURE_3D_INDEX,
TEXTURE_RECT_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)
+#define TEXTURE_EXTERNAL_BIT (1 << TEXTURE_EXTERNAL_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)
struct gl_buffer_object *BufferObject;
GLenum BufferObjectFormat;
+ /** GL_OES_EGL_image_external */
+ GLint RequiredTextureImageUnits;
+
/**
* \name For device driver.
* Note: instead of attaching driver data to this pointer, it's preferable
case GL_SAMPLER_1D_ARRAY_SHADOW_EXT:
case GL_SAMPLER_2D_ARRAY_SHADOW_EXT:
case GL_SAMPLER_CUBE_SHADOW_EXT:
+ case GL_SAMPLER_EXTERNAL_OES:
return 1;
case GL_FLOAT_VEC2:
case GL_INT_VEC2:
"TEXTURE_BUFFER",
"TEXTURE_2D_ARRAY",
"TEXTURE_1D_ARRAY",
+ "TEXTURE_EXTERNAL",
"TEXTURE_CUBE",
"TEXTURE_3D",
"TEXTURE_RECT",
GL_TEXTURE_BUFFER,
GL_TEXTURE_2D_ARRAY_EXT,
GL_TEXTURE_1D_ARRAY_EXT,
+ GL_TEXTURE_EXTERNAL_OES,
GL_TEXTURE_CUBE_MAP,
GL_TEXTURE_3D,
GL_TEXTURE_RECTANGLE_NV,
ASSERT(tObj);
ASSERT(texImage);
- ASSERT(target != GL_TEXTURE_RECTANGLE_NV || level == 0);
+ if (target == GL_TEXTURE_RECTANGLE_NV || target == GL_TEXTURE_EXTERNAL_OES)
+ assert(level == 0);
tObj->Image[face][level] = texImage;
GLboolean
_mesa_is_proxy_texture(GLenum target)
{
- /* NUM_TEXTURE_TARGETS should match number of terms below,
- * except there's no proxy for GL_TEXTURE_BUFFER.
+ /*
+ * 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 == 8);
+ assert(NUM_TEXTURE_TARGETS == 7 + 2);
return (target == GL_PROXY_TEXTURE_1D ||
target == GL_PROXY_TEXTURE_2D ||
case GL_TEXTURE_BUFFER:
return ctx->Extensions.ARB_texture_buffer_object
? texUnit->CurrentTex[TEXTURE_BUFFER_INDEX] : NULL;
+ case GL_TEXTURE_EXTERNAL_OES:
+ return ctx->Extensions.OES_EGL_image_external
+ ? texUnit->CurrentTex[TEXTURE_EXTERNAL_INDEX] : NULL;
default:
_mesa_problem(NULL, "bad target in _mesa_select_tex_object()");
return NULL;
ctx->Extensions.EXT_texture_array)
? ctx->Const.MaxTextureLevels : 0;
case GL_TEXTURE_BUFFER:
+ case GL_TEXTURE_EXTERNAL_OES:
/* fall-through */
default:
return 0; /* bad target */
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
case GL_TEXTURE_1D_ARRAY:
case GL_PROXY_TEXTURE_1D_ARRAY:
+ case GL_TEXTURE_EXTERNAL_OES:
return 2;
case GL_TEXTURE_3D:
case GL_PROXY_TEXTURE_3D:
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (!ctx->Extensions.OES_EGL_image) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glEGLImageTargetTexture2DOES(unsupported)");
- return;
- }
-
- if (target != GL_TEXTURE_2D) {
+ if ((target == GL_TEXTURE_2D &&
+ !ctx->Extensions.OES_EGL_image) ||
+ (target == GL_TEXTURE_EXTERNAL_OES &&
+ !ctx->Extensions.OES_EGL_image_external)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glEGLImageTargetTexture2D(target=%d)", target);
return;
target == GL_TEXTURE_RECTANGLE_NV ||
target == GL_TEXTURE_1D_ARRAY_EXT ||
target == GL_TEXTURE_2D_ARRAY_EXT ||
+ target == GL_TEXTURE_EXTERNAL_OES ||
target == GL_TEXTURE_BUFFER);
memset(obj, 0, sizeof(*obj));
obj->BaseLevel = 0;
obj->MaxLevel = 1000;
+ /* must be one; no support for (YUV) planes in separate buffers */
+ obj->RequiredTextureImageUnits = 1;
+
/* sampler state */
- if (target == GL_TEXTURE_RECTANGLE_NV) {
+ if (target == GL_TEXTURE_RECTANGLE_NV ||
+ target == GL_TEXTURE_EXTERNAL_OES) {
obj->Sampler.WrapS = GL_CLAMP_TO_EDGE;
obj->Sampler.WrapT = GL_CLAMP_TO_EDGE;
obj->Sampler.WrapR = GL_CLAMP_TO_EDGE;
{
assert(obj->Target == 0);
- if (target == GL_TEXTURE_RECTANGLE_NV) {
+ if (target == GL_TEXTURE_RECTANGLE_NV ||
+ target == GL_TEXTURE_EXTERNAL_OES) {
/* have to init wrap and filter state here - kind of klunky */
obj->Sampler.WrapS = GL_CLAMP_TO_EDGE;
obj->Sampler.WrapT = GL_CLAMP_TO_EDGE;
dest->_Complete = src->_Complete;
COPY_4V(dest->Swizzle, src->Swizzle);
dest->_Swizzle = src->_Swizzle;
+
+ dest->RequiredTextureImageUnits = src->RequiredTextureImageUnits;
}
case GL_TEXTURE_1D_ARRAY_EXT:
case GL_TEXTURE_2D_ARRAY_EXT:
case GL_TEXTURE_BUFFER:
+ case GL_TEXTURE_EXTERNAL_OES:
return GL_TRUE;
case 0x99:
_mesa_problem(NULL, "invalid reference to a deleted texture object");
t->Image[0][baseLevel]->HeightLog2);
maxLevels = ctx->Const.MaxCubeTextureLevels;
}
- else if (t->Target == GL_TEXTURE_RECTANGLE_NV) {
+ else if (t->Target == GL_TEXTURE_RECTANGLE_NV ||
+ t->Target == GL_TEXTURE_EXTERNAL_OES) {
maxLog2 = 0; /* not applicable */
maxLevels = 1; /* no mipmapping */
}
return TEXTURE_2D_ARRAY_INDEX;
case GL_TEXTURE_BUFFER_ARB:
return TEXTURE_BUFFER_INDEX;
+ case GL_TEXTURE_EXTERNAL_OES:
+ return TEXTURE_EXTERNAL_INDEX;
default:
return -1;
}
(wrap == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp))
return GL_TRUE;
}
+ else if (target == GL_TEXTURE_EXTERNAL_OES) {
+ if (wrap == GL_CLAMP_TO_EDGE)
+ return GL_TRUE;
+ }
else {
switch (wrap) {
case GL_CLAMP:
return texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX];
}
break;
+ case GL_TEXTURE_EXTERNAL_OES:
+ if (ctx->Extensions.OES_EGL_image_external) {
+ return texUnit->CurrentTex[TEXTURE_EXTERNAL_INDEX];
+ }
+ break;
default:
;
}
case GL_LINEAR_MIPMAP_NEAREST:
case GL_NEAREST_MIPMAP_LINEAR:
case GL_LINEAR_MIPMAP_LINEAR:
- if (texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
+ if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
+ texObj->Target != GL_TEXTURE_EXTERNAL_OES) {
incomplete(ctx, texObj);
texObj->Sampler.MinFilter = params[0];
return GL_TRUE;
return GL_TRUE;
case GL_GENERATE_MIPMAP_SGIS:
+ if (params[0] && texObj->Target == GL_TEXTURE_EXTERNAL_OES)
+ goto invalid_param;
if (texObj->GenerateMipmap != params[0]) {
/* no flush() */
texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
*params = (GLint) obj->Immutable;
break;
+ case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
+ if (!ctx->Extensions.OES_EGL_image_external)
+ goto invalid_pname;
+ *params = obj->RequiredTextureImageUnits;
+ break;
+
default:
goto invalid_pname;
}
GL_TEXTURE_RECTANGLE_NV,
GL_TEXTURE_1D_ARRAY_EXT,
GL_TEXTURE_2D_ARRAY_EXT,
- GL_TEXTURE_BUFFER
+ GL_TEXTURE_BUFFER,
+ GL_TEXTURE_EXTERNAL_OES
};
GLint tgt;
case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
+ case GL_SAMPLER_EXTERNAL_OES:
return GL_TRUE;
default:
return GL_FALSE;
case GLSL_SAMPLER_DIM_BUF:
assert(!"FINISHME: Implement ARB_texture_buffer_object");
break;
+ case GLSL_SAMPLER_DIM_EXTERNAL:
+ inst->tex_target = TEXTURE_EXTERNAL_INDEX;
+ break;
default:
assert(!"Should not get here.");
}