aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-11-04 08:57:20 +0100
committermarha <marha@users.sourceforge.net>2011-11-04 08:57:20 +0100
commit02f377d5e2dd18537d0807ad63675a0970b5a37d (patch)
tree1814c826db4d95a30ad71431d9c84b8d2611ec18 /mesalib/src/mesa/state_tracker
parent6f4feafd4d22beaabfb0202e66b0dea9047ee084 (diff)
downloadvcxsrv-02f377d5e2dd18537d0807ad63675a0970b5a37d.tar.gz
vcxsrv-02f377d5e2dd18537d0807ad63675a0970b5a37d.tar.bz2
vcxsrv-02f377d5e2dd18537d0807ad63675a0970b5a37d.zip
xserver pixman mesa git update 4 nov 2011
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c64
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp3
-rw-r--r--mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c1
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c16
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.c1
6 files changed, 88 insertions, 1 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index f82346bc6..c58a9df56 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -75,6 +75,7 @@ gl_target_to_pipe(GLenum target)
case GL_TEXTURE_1D:
return PIPE_TEXTURE_1D;
case GL_TEXTURE_2D:
+ case GL_TEXTURE_EXTERNAL_OES:
return PIPE_TEXTURE_2D;
case GL_TEXTURE_RECTANGLE_NV:
return PIPE_TEXTURE_RECT;
@@ -310,6 +311,7 @@ get_texture_dims(GLenum target)
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
case GL_TEXTURE_RECTANGLE_NV:
case GL_TEXTURE_2D_ARRAY_EXT:
+ case GL_TEXTURE_EXTERNAL_OES:
return 2;
case GL_TEXTURE_3D:
return 3;
@@ -1842,6 +1844,66 @@ st_get_default_texture(struct st_context *st)
}
+/**
+ * Called via ctx->Driver.AllocTextureStorage() to allocate texture memory
+ * for a whole mipmap stack.
+ */
+static GLboolean
+st_AllocTextureStorage(struct gl_context *ctx,
+ struct gl_texture_object *texObj,
+ GLsizei levels, GLsizei width,
+ GLsizei height, GLsizei depth)
+{
+ const GLuint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+ struct st_context *st = st_context(ctx);
+ struct st_texture_object *stObj = st_texture_object(texObj);
+ GLuint ptWidth, ptHeight, ptDepth, ptLayers, bindings;
+ enum pipe_format fmt;
+ GLint level;
+
+ assert(levels > 0);
+
+ /* Save the level=0 dimensions */
+ stObj->width0 = width;
+ stObj->height0 = height;
+ stObj->depth0 = depth;
+ stObj->lastLevel = levels - 1;
+
+ fmt = st_mesa_format_to_pipe_format(texObj->Image[0][0]->TexFormat);
+
+ bindings = default_bindings(st, fmt);
+
+ st_gl_texture_dims_to_pipe_dims(texObj->Target,
+ width, height, depth,
+ &ptWidth, &ptHeight, &ptDepth, &ptLayers);
+
+ stObj->pt = st_texture_create(st,
+ gl_target_to_pipe(texObj->Target),
+ fmt,
+ levels,
+ ptWidth,
+ ptHeight,
+ ptDepth,
+ ptLayers,
+ bindings);
+ if (!stObj->pt)
+ return GL_FALSE;
+
+ /* Set image resource pointers */
+ for (level = 0; level < levels; level++) {
+ GLuint face;
+ for (face = 0; face < numFaces; face++) {
+ struct st_texture_image *stImage =
+ st_texture_image(texObj->Image[face][level]);
+ pipe_resource_reference(&stImage->pt, stObj->pt);
+ }
+ }
+
+ return GL_TRUE;
+}
+
+
+
void
st_init_texture_functions(struct dd_function_table *functions)
{
@@ -1879,4 +1941,6 @@ st_init_texture_functions(struct dd_function_table *functions)
/* XXX Temporary until we can query pipe's texture sizes */
functions->TestProxyTexImage = _mesa_test_proxy_teximage;
+
+ functions->AllocTextureStorage = st_AllocTextureStorage;
}
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 6b9ff6b72..af8cc0476 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -264,6 +264,7 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
+ ctx->Extensions.ARB_texture_storage = GL_TRUE;
ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
ctx->Extensions.ARB_vertex_program = GL_TRUE;
ctx->Extensions.ARB_window_pos = GL_TRUE;
@@ -290,6 +291,7 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.MESA_pack_invert = GL_TRUE;
ctx->Extensions.NV_blend_square = GL_TRUE;
+ ctx->Extensions.NV_fog_distance = GL_TRUE;
ctx->Extensions.NV_texgen_reflection = GL_TRUE;
ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
ctx->Extensions.NV_texture_rectangle = GL_TRUE;
@@ -301,6 +303,8 @@ void st_init_extensions(struct st_context *st)
#if FEATURE_OES_EGL_image
ctx->Extensions.OES_EGL_image = GL_TRUE;
+ if (ctx->API != API_OPENGL)
+ ctx->Extensions.OES_EGL_image_external = GL_TRUE;
#endif
#if FEATURE_OES_draw_texture
ctx->Extensions.OES_draw_texture = GL_TRUE;
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 67a1b513b..6b841f1e9 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2725,6 +2725,9 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
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.");
}
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 b4111b00d..27ebb1ad7 100644
--- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -290,6 +290,7 @@ translate_texture_target( GLuint textarget,
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;
+ case TEXTURE_EXTERNAL_INDEX: return TGSI_TEXTURE_2D;
default:
debug_assert( 0 );
return TGSI_TEXTURE_1D;
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index c419c4066..146e77f9d 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -416,6 +416,20 @@ st_get_vp_variant(struct st_context *st,
return vpv;
}
+static int st_translate_interp(enum glsl_interp_qualifier glsl_qual)
+{
+ switch (glsl_qual) {
+ case INTERP_QUALIFIER_NONE:
+ case INTERP_QUALIFIER_SMOOTH:
+ return TGSI_INTERPOLATE_PERSPECTIVE;
+ case INTERP_QUALIFIER_FLAT:
+ return TGSI_INTERPOLATE_CONSTANT;
+ case INTERP_QUALIFIER_NOPERSPECTIVE:
+ return TGSI_INTERPOLATE_LINEAR;
+ }
+ assert(0);
+ return TGSI_INTERPOLATE_PERSPECTIVE;
+}
/**
* Translate a Mesa fragment shader into a TGSI shader using extra info in
@@ -558,7 +572,7 @@ st_translate_fragment_program(struct st_context *st,
if (attr == FRAG_ATTRIB_PNTC)
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
else
- interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
+ interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr]);
break;
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c
index ca8106b52..3323bbbbe 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_texture.c
@@ -133,6 +133,7 @@ st_gl_texture_dims_to_pipe_dims(GLenum texture,
break;
case GL_TEXTURE_2D:
case GL_TEXTURE_RECTANGLE:
+ case GL_TEXTURE_EXTERNAL_OES:
assert(depthIn == 1);
*widthOut = widthIn;
*heightOut = heightIn;