diff options
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_texture.c | 30 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_fbo.c | 10 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_texture.c | 62 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_context.c | 82 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_extensions.c | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_format.c | 121 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_texture.c | 15 |
8 files changed, 241 insertions, 83 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c index 03d05932a..ed9a44429 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_texture.c +++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c @@ -192,9 +192,9 @@ get_texture_format_swizzle(const struct st_texture_object *stObj) return swizzle_swizzle(stObj->base._Swizzle, tex_swizzle); } - + /** - * Return TRUE if the texture's sampler view swizzle is equal to + * Return TRUE if the texture's sampler view swizzle is not equal to * the texture's swizzle. * * \param stObj the st texture object, @@ -214,9 +214,20 @@ check_sampler_swizzle(const struct st_texture_object *stObj, static unsigned last_level(struct st_texture_object *stObj) { - return MIN2(stObj->base._MaxLevel, stObj->pt->last_level); + unsigned ret = MIN2(stObj->base.MinLevel + stObj->base._MaxLevel, + stObj->pt->last_level); + if (stObj->base.Immutable) + ret = MIN2(ret, stObj->base.MinLevel + stObj->base.NumLevels - 1); + return ret; } +static unsigned last_layer(struct st_texture_object *stObj) +{ + if (stObj->base.Immutable) + return MIN2(stObj->base.MinLayer + stObj->base.NumLayers - 1, + stObj->pt->array_size - 1); + return stObj->pt->array_size - 1; +} static struct pipe_sampler_view * st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe, @@ -249,9 +260,13 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe, templ.u.buf.first_element = f; templ.u.buf.last_element = f + (n - 1); } else { - templ.u.tex.first_level = stObj->base.BaseLevel; + templ.u.tex.first_level = stObj->base.MinLevel + stObj->base.BaseLevel; templ.u.tex.last_level = last_level(stObj); assert(templ.u.tex.first_level <= templ.u.tex.last_level); + templ.u.tex.first_layer = stObj->base.MinLayer; + templ.u.tex.last_layer = last_layer(stObj); + assert(templ.u.tex.first_layer <= templ.u.tex.last_layer); + templ.target = gl_target_to_pipe(stObj->base.Target); } if (swizzle != SWIZZLE_NOOP) { @@ -287,8 +302,11 @@ st_get_texture_sampler_view_from_stobj(struct st_context *st, if (*sv) { if (check_sampler_swizzle(stObj, *sv) || (format != (*sv)->format) || - stObj->base.BaseLevel != (*sv)->u.tex.first_level || - last_level(stObj) != (*sv)->u.tex.last_level) { + gl_target_to_pipe(stObj->base.Target) != (*sv)->target || + stObj->base.MinLevel + stObj->base.BaseLevel != (*sv)->u.tex.first_level || + last_level(stObj) != (*sv)->u.tex.last_level || + stObj->base.MinLayer != (*sv)->u.tex.first_layer || + last_layer(stObj) != (*sv)->u.tex.last_layer) { pipe_sampler_view_reference(sv, NULL); } } diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c index 7cfd3dade..470ab278b 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c +++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c @@ -450,6 +450,16 @@ st_update_renderbuffer_surface(struct st_context *st, last_layer = strb->rtt_face + strb->rtt_slice; } + /* Adjust for texture views */ + if (strb->is_rtt) { + struct gl_texture_object *tex = strb->Base.TexImage->TexObject; + first_layer += tex->MinLayer; + if (!strb->rtt_layered) + last_layer += tex->MinLayer; + else + last_layer = MIN2(first_layer + tex->NumLayers - 1, last_layer); + } + if (!strb->surface || strb->surface->texture->nr_samples != strb->Base.NumSamples || strb->surface->format != format || diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index ad14bd939..dfa188a3f 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -829,12 +829,12 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims, blit.src.level = 0; blit.src.format = src_format; blit.dst.resource = dst; - blit.dst.level = stObj->pt != stImage->pt ? 0 : texImage->Level; + blit.dst.level = stObj->pt != stImage->pt ? 0 : texImage->TexObject->MinLevel + texImage->Level; blit.dst.format = dst_format; blit.src.box.x = blit.src.box.y = blit.src.box.z = 0; blit.dst.box.x = xoffset; blit.dst.box.y = yoffset; - blit.dst.box.z = zoffset + texImage->Face; + blit.dst.box.z = zoffset + texImage->Face + texImage->TexObject->MinLayer; blit.src.box.width = blit.dst.box.width = width; blit.src.box.height = blit.dst.box.height = height; blit.src.box.depth = blit.dst.box.depth = depth; @@ -916,7 +916,8 @@ st_GetTexImage(struct gl_context * ctx, GLuint height = texImage->Height; GLuint depth = texImage->Depth; struct st_texture_image *stImage = st_texture_image(texImage); - struct pipe_resource *src = st_texture_object(texImage->TexObject)->pt; + struct st_texture_object *stObj = st_texture_object(texImage->TexObject); + struct pipe_resource *src = stObj->pt; struct pipe_resource *dst = NULL; struct pipe_resource dst_templ; enum pipe_format dst_format, src_format; @@ -970,7 +971,10 @@ st_GetTexImage(struct gl_context * ctx, * - Luminance alpha must be returned as (L,0,0,A). * - Intensity must be returned as (I,0,0,1) */ - src_format = util_format_linear(src->format); + if (stObj->surface_based) + src_format = util_format_linear(stObj->surface_format); + else + src_format = util_format_linear(src->format); src_format = util_format_luminance_to_red(src_format); src_format = util_format_intensity_to_red(src_format); @@ -1069,14 +1073,14 @@ st_GetTexImage(struct gl_context * ctx, memset(&blit, 0, sizeof(blit)); blit.src.resource = src; - blit.src.level = texImage->Level; + blit.src.level = texImage->Level + texImage->TexObject->MinLevel; blit.src.format = src_format; blit.dst.resource = dst; blit.dst.level = 0; blit.dst.format = dst->format; blit.src.box.x = blit.dst.box.x = 0; blit.src.box.y = blit.dst.box.y = 0; - blit.src.box.z = texImage->Face; + blit.src.box.z = texImage->Face + texImage->TexObject->MinLayer; blit.dst.box.z = 0; blit.src.box.width = blit.dst.box.width = width; blit.src.box.height = blit.dst.box.height = height; @@ -1441,10 +1445,10 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims, blit.src.box.depth = 1; blit.dst.resource = stImage->pt; blit.dst.format = dst_format; - blit.dst.level = stObj->pt != stImage->pt ? 0 : texImage->Level; + blit.dst.level = stObj->pt != stImage->pt ? 0 : texImage->Level + texImage->TexObject->MinLevel; blit.dst.box.x = destX; blit.dst.box.y = destY; - blit.dst.box.z = stImage->base.Face + slice; + blit.dst.box.z = stImage->base.Face + slice + texImage->TexObject->MinLayer; blit.dst.box.width = width; blit.dst.box.height = height; blit.dst.box.depth = 1; @@ -1545,6 +1549,9 @@ st_finalize_texture(struct gl_context *ctx, enum pipe_format firstImageFormat; GLuint ptWidth, ptHeight, ptDepth, ptLayers, ptNumSamples; + if (tObj->Immutable) + return GL_TRUE; + if (_mesa_is_texture_complete(tObj, &tObj->Sampler)) { /* The texture is complete and we know exactly how many mipmap levels * are present/needed. This is conditional because we may be called @@ -1824,6 +1831,44 @@ st_TestProxyTexImage(struct gl_context *ctx, GLenum target, } } +static GLboolean +st_TextureView(struct gl_context *ctx, + struct gl_texture_object *texObj, + struct gl_texture_object *origTexObj) +{ + struct st_texture_object *orig = st_texture_object(origTexObj); + struct st_texture_object *tex = st_texture_object(texObj); + struct gl_texture_image *image = texObj->Image[0][0]; + + const int numFaces = _mesa_num_tex_faces(texObj->Target); + const int numLevels = texObj->NumLevels; + + int face; + int level; + + pipe_resource_reference(&tex->pt, orig->pt); + + /* Set image resource pointers */ + for (level = 0; level < numLevels; level++) { + for (face = 0; face < numFaces; face++) { + struct st_texture_image *stImage = + st_texture_image(texObj->Image[face][level]); + pipe_resource_reference(&stImage->pt, tex->pt); + } + } + + tex->surface_based = GL_TRUE; + tex->surface_format = + st_mesa_format_to_pipe_format(st_context(ctx), image->TexFormat); + + tex->width0 = image->Width; + tex->height0 = image->Height; + tex->depth0 = image->Depth; + tex->lastLevel = numLevels - 1; + + return GL_TRUE; +} + void st_init_texture_functions(struct dd_function_table *functions) @@ -1855,4 +1900,5 @@ st_init_texture_functions(struct dd_function_table *functions) functions->TestProxyTexImage = st_TestProxyTexImage; functions->AllocTextureStorage = st_AllocTextureStorage; + functions->TextureView = st_TextureView; } diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index 09b615465..768a66790 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -104,6 +104,42 @@ void st_invalidate_state(struct gl_context * ctx, GLuint new_state) _vbo_InvalidateState(ctx, new_state); } + +static void +st_destroy_context_priv(struct st_context *st) +{ + uint shader, i; + + st_destroy_atoms( st ); + st_destroy_draw( st ); + st_destroy_clear(st); + st_destroy_bitmap(st); + st_destroy_drawpix(st); + st_destroy_drawtex(st); + + for (shader = 0; shader < Elements(st->state.sampler_views); shader++) { + for (i = 0; i < Elements(st->state.sampler_views[0]); i++) { + pipe_sampler_view_release(st->pipe, + &st->state.sampler_views[shader][i]); + } + } + + if (st->default_texture) { + st->ctx->Driver.DeleteTexture(st->ctx, st->default_texture); + st->default_texture = NULL; + } + + u_upload_destroy(st->uploader); + if (st->indexbuf_uploader) { + u_upload_destroy(st->indexbuf_uploader); + } + if (st->constbuf_uploader) { + u_upload_destroy(st->constbuf_uploader); + } + free( st ); +} + + static struct st_context * st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, const struct st_config_options *options) @@ -238,6 +274,14 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, _mesa_compute_version(ctx); + if (ctx->Version == 0) { + /* This can happen when a core profile was requested, but the driver + * does not support some features of GL 3.1 or later. + */ + st_destroy_context_priv(st); + return NULL; + } + _mesa_initialize_dispatch_tables(ctx); _mesa_initialize_vbo_vtxfmt(ctx); @@ -259,6 +303,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, struct gl_context *ctx; struct gl_context *shareCtx = share ? share->ctx : NULL; struct dd_function_table funcs; + struct st_context *st; memset(&funcs, 0, sizeof(funcs)); st_init_driver_functions(&funcs); @@ -276,41 +321,12 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, if (debug_get_option_mesa_mvp_dp4()) ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = GL_TRUE; - return st_create_context_priv(ctx, pipe, options); -} - - -static void st_destroy_context_priv( struct st_context *st ) -{ - uint shader, i; - - st_destroy_atoms( st ); - st_destroy_draw( st ); - st_destroy_clear(st); - st_destroy_bitmap(st); - st_destroy_drawpix(st); - st_destroy_drawtex(st); - - for (shader = 0; shader < Elements(st->state.sampler_views); shader++) { - for (i = 0; i < Elements(st->state.sampler_views[0]); i++) { - pipe_sampler_view_release(st->pipe, - &st->state.sampler_views[shader][i]); - } + st = st_create_context_priv(ctx, pipe, options); + if (!st) { + _mesa_destroy_context(ctx); } - if (st->default_texture) { - st->ctx->Driver.DeleteTexture(st->ctx, st->default_texture); - st->default_texture = NULL; - } - - u_upload_destroy(st->uploader); - if (st->indexbuf_uploader) { - u_upload_destroy(st->indexbuf_uploader); - } - if (st->constbuf_uploader) { - u_upload_destroy(st->constbuf_uploader); - } - free( st ); + return st; } diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index 07bd12567..c7bc0ca50 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -463,6 +463,7 @@ void st_init_extensions(struct pipe_screen *screen, { o(ARB_draw_indirect), PIPE_CAP_DRAW_INDIRECT }, { o(ARB_derivative_control), PIPE_CAP_TGSI_FS_FINE_DERIVATIVE }, { o(ARB_conditional_render_inverted), PIPE_CAP_CONDITIONAL_RENDER_INVERTED }, + { o(ARB_texture_view), PIPE_CAP_SAMPLER_VIEW_TARGET }, }; /* Required: render target and sampler support */ diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c index b5e03b0f8..6c53567fc 100644 --- a/mesalib/src/mesa/state_tracker/st_format.c +++ b/mesalib/src/mesa/state_tracker/st_format.c @@ -88,9 +88,13 @@ st_mesa_format_to_pipe_format(struct st_context *st, mesa_format mesaFormat) case MESA_FORMAT_L4A4_UNORM: return PIPE_FORMAT_L4A4_UNORM; case MESA_FORMAT_L8A8_UNORM: - return PIPE_FORMAT_L8A8_UNORM; + return PIPE_FORMAT_LA88_UNORM; + case MESA_FORMAT_A8L8_UNORM: + return PIPE_FORMAT_AL88_UNORM; case MESA_FORMAT_L16A16_UNORM: - return PIPE_FORMAT_L16A16_UNORM; + return PIPE_FORMAT_LA1616_UNORM; + case MESA_FORMAT_A16L16_UNORM: + return PIPE_FORMAT_AL1616_UNORM; case MESA_FORMAT_A_UNORM8: return PIPE_FORMAT_A8_UNORM; case MESA_FORMAT_A_UNORM16: @@ -142,17 +146,21 @@ st_mesa_format_to_pipe_format(struct st_context *st, mesa_format mesaFormat) case MESA_FORMAT_SRGBA_DXT5: return PIPE_FORMAT_DXT5_SRGBA; case MESA_FORMAT_L8A8_SRGB: - return PIPE_FORMAT_L8A8_SRGB; + return PIPE_FORMAT_LA88_SRGB; + case MESA_FORMAT_A8L8_SRGB: + return PIPE_FORMAT_AL88_SRGB; case MESA_FORMAT_L_SRGB8: return PIPE_FORMAT_L8_SRGB; case MESA_FORMAT_BGR_SRGB8: return PIPE_FORMAT_R8G8B8_SRGB; case MESA_FORMAT_A8B8G8R8_SRGB: - return PIPE_FORMAT_A8B8G8R8_SRGB; - case MESA_FORMAT_B8G8R8A8_SRGB: - return PIPE_FORMAT_B8G8R8A8_SRGB; + return PIPE_FORMAT_ABGR8888_SRGB; case MESA_FORMAT_R8G8B8A8_SRGB: - return PIPE_FORMAT_R8G8B8A8_SRGB; + return PIPE_FORMAT_RGBA8888_SRGB; + case MESA_FORMAT_B8G8R8A8_SRGB: + return PIPE_FORMAT_BGRA8888_SRGB; + case MESA_FORMAT_A8R8G8B8_SRGB: + return PIPE_FORMAT_ARGB8888_SRGB; case MESA_FORMAT_RGBA_FLOAT32: return PIPE_FORMAT_R32G32B32A32_FLOAT; case MESA_FORMAT_RGBA_FLOAT16: @@ -191,9 +199,13 @@ st_mesa_format_to_pipe_format(struct st_context *st, mesa_format mesaFormat) case MESA_FORMAT_R_UNORM16: return PIPE_FORMAT_R16_UNORM; case MESA_FORMAT_R8G8_UNORM: - return PIPE_FORMAT_R8G8_UNORM; + return PIPE_FORMAT_RG88_UNORM; + case MESA_FORMAT_G8R8_UNORM: + return PIPE_FORMAT_GR88_UNORM; case MESA_FORMAT_R16G16_UNORM: - return PIPE_FORMAT_R16G16_UNORM; + return PIPE_FORMAT_RG1616_UNORM; + case MESA_FORMAT_G16R16_UNORM: + return PIPE_FORMAT_GR1616_UNORM; case MESA_FORMAT_RGBA_UNORM16: return PIPE_FORMAT_R16G16B16A16_UNORM; @@ -341,23 +353,31 @@ st_mesa_format_to_pipe_format(struct st_context *st, mesa_format mesaFormat) case MESA_FORMAT_R_SNORM8: return PIPE_FORMAT_R8_SNORM; case MESA_FORMAT_R8G8_SNORM: - return PIPE_FORMAT_R8G8_SNORM; + return PIPE_FORMAT_RG88_SNORM; + case MESA_FORMAT_G8R8_SNORM: + return PIPE_FORMAT_GR88_SNORM; case MESA_FORMAT_R8G8B8A8_SNORM: - return PIPE_FORMAT_R8G8B8A8_SNORM; + return PIPE_FORMAT_RGBA8888_SNORM; + case MESA_FORMAT_A8B8G8R8_SNORM: + return PIPE_FORMAT_ABGR8888_SNORM; case MESA_FORMAT_A_SNORM8: return PIPE_FORMAT_A8_SNORM; case MESA_FORMAT_L_SNORM8: return PIPE_FORMAT_L8_SNORM; case MESA_FORMAT_L8A8_SNORM: - return PIPE_FORMAT_L8A8_SNORM; + return PIPE_FORMAT_LA88_SNORM; + case MESA_FORMAT_A8L8_SNORM: + return PIPE_FORMAT_AL88_SNORM; case MESA_FORMAT_I_SNORM8: return PIPE_FORMAT_I8_SNORM; case MESA_FORMAT_R_SNORM16: return PIPE_FORMAT_R16_SNORM; case MESA_FORMAT_R16G16_SNORM: - return PIPE_FORMAT_R16G16_SNORM; + return PIPE_FORMAT_RG1616_SNORM; + case MESA_FORMAT_G16R16_SNORM: + return PIPE_FORMAT_GR1616_SNORM; case MESA_FORMAT_RGBA_SNORM16: return PIPE_FORMAT_R16G16B16A16_SNORM; @@ -384,9 +404,13 @@ st_mesa_format_to_pipe_format(struct st_context *st, mesa_format mesaFormat) case MESA_FORMAT_B5G5R5X1_UNORM: return PIPE_FORMAT_B5G5R5X1_UNORM; case MESA_FORMAT_R8G8B8X8_SNORM: - return PIPE_FORMAT_R8G8B8X8_SNORM; + return PIPE_FORMAT_RGBX8888_SNORM; + case MESA_FORMAT_X8B8G8R8_SNORM: + return PIPE_FORMAT_XBGR8888_SNORM; case MESA_FORMAT_R8G8B8X8_SRGB: - return PIPE_FORMAT_R8G8B8X8_SRGB; + return PIPE_FORMAT_RGBX8888_SRGB; + case MESA_FORMAT_X8B8G8R8_SRGB: + return PIPE_FORMAT_XBGR8888_SRGB; case MESA_FORMAT_RGBX_UINT8: return PIPE_FORMAT_R8G8B8X8_UINT; case MESA_FORMAT_RGBX_SINT8: @@ -411,7 +435,9 @@ st_mesa_format_to_pipe_format(struct st_context *st, mesa_format mesaFormat) return PIPE_FORMAT_R32G32B32X32_SINT; case MESA_FORMAT_B8G8R8X8_SRGB: - return PIPE_FORMAT_B8G8R8X8_SRGB; + return PIPE_FORMAT_BGRX8888_SRGB; + case MESA_FORMAT_X8R8G8B8_SRGB: + return PIPE_FORMAT_XRGB8888_SRGB; /* ETC2 formats are emulated as uncompressed ones. * The destination formats mustn't be changed, because they are also @@ -476,10 +502,14 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_R10G10B10A2_UNORM; case PIPE_FORMAT_L4A4_UNORM: return MESA_FORMAT_L4A4_UNORM; - case PIPE_FORMAT_L8A8_UNORM: + case PIPE_FORMAT_LA88_UNORM: return MESA_FORMAT_L8A8_UNORM; - case PIPE_FORMAT_L16A16_UNORM: + case PIPE_FORMAT_AL88_UNORM: + return MESA_FORMAT_A8L8_UNORM; + case PIPE_FORMAT_LA1616_UNORM: return MESA_FORMAT_L16A16_UNORM; + case PIPE_FORMAT_AL1616_UNORM: + return MESA_FORMAT_A16L16_UNORM; case PIPE_FORMAT_A8_UNORM: return MESA_FORMAT_A_UNORM8; case PIPE_FORMAT_A16_UNORM: @@ -536,16 +566,22 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_SRGBA_DXT3; case PIPE_FORMAT_DXT5_SRGBA: return MESA_FORMAT_SRGBA_DXT5; - case PIPE_FORMAT_L8A8_SRGB: + case PIPE_FORMAT_LA88_SRGB: return MESA_FORMAT_L8A8_SRGB; + case PIPE_FORMAT_AL88_SRGB: + return MESA_FORMAT_A8L8_SRGB; case PIPE_FORMAT_L8_SRGB: return MESA_FORMAT_L_SRGB8; case PIPE_FORMAT_R8G8B8_SRGB: return MESA_FORMAT_BGR_SRGB8; - case PIPE_FORMAT_A8B8G8R8_SRGB: + case PIPE_FORMAT_ABGR8888_SRGB: return MESA_FORMAT_A8B8G8R8_SRGB; - case PIPE_FORMAT_B8G8R8A8_SRGB: + case PIPE_FORMAT_RGBA8888_SRGB: + return MESA_FORMAT_R8G8B8A8_SRGB; + case PIPE_FORMAT_BGRA8888_SRGB: return MESA_FORMAT_B8G8R8A8_SRGB; + case PIPE_FORMAT_ARGB8888_SRGB: + return MESA_FORMAT_A8R8G8B8_SRGB; case PIPE_FORMAT_R32G32B32A32_FLOAT: return MESA_FORMAT_RGBA_FLOAT32; case PIPE_FORMAT_R16G16B16A16_FLOAT: @@ -583,10 +619,14 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_R_UNORM8; case PIPE_FORMAT_R16_UNORM: return MESA_FORMAT_R_UNORM16; - case PIPE_FORMAT_R8G8_UNORM: + case PIPE_FORMAT_RG88_UNORM: return MESA_FORMAT_R8G8_UNORM; - case PIPE_FORMAT_R16G16_UNORM: + case PIPE_FORMAT_GR88_UNORM: + return MESA_FORMAT_G8R8_UNORM; + case PIPE_FORMAT_RG1616_UNORM: return MESA_FORMAT_R16G16_UNORM; + case PIPE_FORMAT_GR1616_UNORM: + return MESA_FORMAT_G16R16_UNORM; case PIPE_FORMAT_A8_UINT: return MESA_FORMAT_A_UINT8; @@ -728,24 +768,32 @@ st_pipe_format_to_mesa_format(enum pipe_format format) /* signed normalized formats */ case PIPE_FORMAT_R8_SNORM: return MESA_FORMAT_R_SNORM8; - case PIPE_FORMAT_R8G8_SNORM: + case PIPE_FORMAT_RG88_SNORM: return MESA_FORMAT_R8G8_SNORM; - case PIPE_FORMAT_R8G8B8A8_SNORM: + case PIPE_FORMAT_GR88_SNORM: + return MESA_FORMAT_G8R8_SNORM; + case PIPE_FORMAT_RGBA8888_SNORM: return MESA_FORMAT_R8G8B8A8_SNORM; + case PIPE_FORMAT_ABGR8888_SNORM: + return MESA_FORMAT_A8B8G8R8_SNORM; case PIPE_FORMAT_A8_SNORM: return MESA_FORMAT_A_SNORM8; case PIPE_FORMAT_L8_SNORM: return MESA_FORMAT_L_SNORM8; - case PIPE_FORMAT_L8A8_SNORM: + case PIPE_FORMAT_LA88_SNORM: return MESA_FORMAT_L8A8_SNORM; + case PIPE_FORMAT_AL88_SNORM: + return MESA_FORMAT_A8L8_SNORM; case PIPE_FORMAT_I8_SNORM: return MESA_FORMAT_I_SNORM8; case PIPE_FORMAT_R16_SNORM: return MESA_FORMAT_R_SNORM16; - case PIPE_FORMAT_R16G16_SNORM: + case PIPE_FORMAT_RG1616_SNORM: return MESA_FORMAT_R16G16_SNORM; + case PIPE_FORMAT_GR1616_SNORM: + return MESA_FORMAT_G16R16_SNORM; case PIPE_FORMAT_R16G16B16A16_SNORM: return MESA_FORMAT_RGBA_SNORM16; @@ -772,10 +820,14 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_B4G4R4X4_UNORM; case PIPE_FORMAT_B5G5R5X1_UNORM: return MESA_FORMAT_B5G5R5X1_UNORM; - case PIPE_FORMAT_R8G8B8X8_SNORM: + case PIPE_FORMAT_RGBX8888_SNORM: return MESA_FORMAT_R8G8B8X8_SNORM; - case PIPE_FORMAT_R8G8B8X8_SRGB: + case PIPE_FORMAT_XBGR8888_SNORM: + return MESA_FORMAT_X8B8G8R8_SNORM; + case PIPE_FORMAT_RGBX8888_SRGB: return MESA_FORMAT_R8G8B8X8_SRGB; + case PIPE_FORMAT_XBGR8888_SRGB: + return MESA_FORMAT_X8B8G8R8_SRGB; case PIPE_FORMAT_R8G8B8X8_UINT: return MESA_FORMAT_RGBX_UINT8; case PIPE_FORMAT_R8G8B8X8_SINT: @@ -799,10 +851,10 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_R32G32B32X32_SINT: return MESA_FORMAT_RGBX_SINT32; - case PIPE_FORMAT_B8G8R8X8_SRGB: + case PIPE_FORMAT_BGRX8888_SRGB: return MESA_FORMAT_B8G8R8X8_SRGB; - case PIPE_FORMAT_R8G8B8A8_SRGB: - return MESA_FORMAT_R8G8B8A8_SRGB; + case PIPE_FORMAT_XRGB8888_SRGB: + return MESA_FORMAT_X8R8G8B8_SRGB; default: return MESA_FORMAT_NONE; @@ -879,6 +931,7 @@ struct format_mapping #define DEFAULT_SRGBA_FORMATS \ PIPE_FORMAT_B8G8R8A8_SRGB, \ + PIPE_FORMAT_R8G8B8A8_SRGB, \ PIPE_FORMAT_A8R8G8B8_SRGB, \ PIPE_FORMAT_A8B8G8R8_SRGB, \ 0 @@ -919,11 +972,11 @@ static const struct format_mapping format_map[] = { }, { { 4, GL_RGBA, GL_RGBA8, 0 }, - { PIPE_FORMAT_R8G8B8A8_UNORM, DEFAULT_RGBA_FORMATS } + { DEFAULT_RGBA_FORMATS } }, { { GL_BGRA, 0 }, - { PIPE_FORMAT_B8G8R8A8_UNORM, DEFAULT_RGBA_FORMATS } + { DEFAULT_RGBA_FORMATS } }, { { 3, GL_RGB, GL_RGB8, 0 }, 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 62e4101d1..b338a9836 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3172,6 +3172,7 @@ glsl_to_tgsi_visitor::glsl_to_tgsi_visitor() shader_program = NULL; shader = NULL; options = NULL; + have_sqrt = false; } glsl_to_tgsi_visitor::~glsl_to_tgsi_visitor() @@ -4167,6 +4168,8 @@ const unsigned _mesa_sysval_to_semantic[SYSTEM_VALUE_MAX] = { */ TGSI_SEMANTIC_VERTEXID, TGSI_SEMANTIC_INSTANCEID, + 0, + 0, /* Geometry shader */ diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c index af9b7675f..c84aa4566 100644 --- a/mesalib/src/mesa/state_tracker/st_texture.c +++ b/mesalib/src/mesa/state_tracker/st_texture.c @@ -260,6 +260,12 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage, else level = stImage->base.Level; + if (stObj->base.Immutable) { + level += stObj->base.MinLevel; + z += stObj->base.MinLayer; + d = MIN2(d, stObj->base.NumLayers); + } + z += stImage->base.Face; map = pipe_transfer_map_3d(st->pipe, stImage->pt, level, usage, @@ -289,8 +295,13 @@ st_texture_image_unmap(struct st_context *st, struct st_texture_image *stImage, unsigned slice) { struct pipe_context *pipe = st->pipe; - struct pipe_transfer **transfer = - &stImage->transfer[slice + stImage->base.Face].transfer; + struct st_texture_object *stObj = + st_texture_object(stImage->base.TexObject); + struct pipe_transfer **transfer; + + if (stObj->base.Immutable) + slice += stObj->base.MinLayer; + transfer = &stImage->transfer[slice + stImage->base.Face].transfer; DBG("%s\n", __FUNCTION__); |