aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c34
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp6
5 files changed, 32 insertions, 14 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
index 6d95d57c1..6534a4347 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -58,7 +58,7 @@ st_bufferobj_alloc(struct gl_context *ctx, GLuint name, GLenum target)
if (!st_obj)
return NULL;
- _mesa_initialize_buffer_object(&st_obj->Base, name, target);
+ _mesa_initialize_buffer_object(ctx, &st_obj->Base, name, target);
return &st_obj->Base;
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index ec40a2b70..911e321a5 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -688,6 +688,8 @@ st_MapRenderbuffer(struct gl_context *ctx,
usage |= PIPE_TRANSFER_READ;
if (mode & GL_MAP_WRITE_BIT)
usage |= PIPE_TRANSFER_WRITE;
+ if (mode & GL_MAP_INVALIDATE_RANGE_BIT)
+ usage |= PIPE_TRANSFER_DISCARD_RANGE;
/* Note: y=0=bottom of buffer while y2=0=top of buffer.
* 'invert' will be true for window-system buffers and false for
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index ad4f23c7e..5cd9a4c94 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -189,6 +189,8 @@ st_MapTextureImage(struct gl_context *ctx,
pipeMode |= PIPE_TRANSFER_READ;
if (mode & GL_MAP_WRITE_BIT)
pipeMode |= PIPE_TRANSFER_WRITE;
+ if (mode & GL_MAP_INVALIDATE_RANGE_BIT)
+ pipeMode |= PIPE_TRANSFER_DISCARD_RANGE;
map = st_texture_image_map(st, stImage, slice, pipeMode, x, y, w, h);
if (map) {
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 5f9ae9129..620910ddb 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -839,6 +839,15 @@ struct format_mapping
PIPE_FORMAT_S8_UINT_Z24_UNORM, \
0
+#define DEFAULT_SNORM8_RGBA_FORMATS \
+ PIPE_FORMAT_R8G8B8A8_SNORM, \
+ 0
+
+#define DEFAULT_UNORM16_RGBA_FORMATS \
+ PIPE_FORMAT_R16G16B16A16_UNORM, \
+ DEFAULT_RGBA_FORMATS
+
+
/**
* This table maps OpenGL texture format enums to Gallium pipe_format enums.
* Multiple GL enums might map to multiple pipe_formats.
@@ -1145,54 +1154,55 @@ static const struct format_mapping format_map[] = {
/* R, RG formats */
{
{ GL_RED, GL_R8, 0 },
- { PIPE_FORMAT_R8_UNORM, 0 }
+ { PIPE_FORMAT_R8_UNORM, PIPE_FORMAT_R8G8_UNORM, DEFAULT_RGBA_FORMATS }
},
{
{ GL_RG, GL_RG8, 0 },
- { PIPE_FORMAT_R8G8_UNORM, 0 }
+ { PIPE_FORMAT_R8G8_UNORM, DEFAULT_RGBA_FORMATS }
},
{
{ GL_R16, 0 },
- { PIPE_FORMAT_R16_UNORM, 0 }
+ { PIPE_FORMAT_R16_UNORM, PIPE_FORMAT_R16G16_UNORM,
+ DEFAULT_UNORM16_RGBA_FORMATS }
},
{
{ GL_RG16, 0 },
- { PIPE_FORMAT_R16G16_UNORM, 0 }
+ { PIPE_FORMAT_R16G16_UNORM, DEFAULT_UNORM16_RGBA_FORMATS }
},
/* compressed R, RG formats */
{
{ GL_COMPRESSED_RED, GL_COMPRESSED_RED_RGTC1, 0 },
- { PIPE_FORMAT_RGTC1_UNORM, PIPE_FORMAT_R8_UNORM, 0 }
+ { PIPE_FORMAT_RGTC1_UNORM, PIPE_FORMAT_R8_UNORM, DEFAULT_RGBA_FORMATS }
},
{
{ GL_COMPRESSED_SIGNED_RED_RGTC1, 0 },
- { PIPE_FORMAT_RGTC1_SNORM, 0 }
+ { PIPE_FORMAT_RGTC1_SNORM, DEFAULT_SNORM8_RGBA_FORMATS }
},
{
{ GL_COMPRESSED_RG, GL_COMPRESSED_RG_RGTC2, 0 },
- { PIPE_FORMAT_RGTC2_UNORM, PIPE_FORMAT_R8G8_UNORM, 0 }
+ { PIPE_FORMAT_RGTC2_UNORM, PIPE_FORMAT_R8G8_UNORM, DEFAULT_RGBA_FORMATS }
},
{
{ GL_COMPRESSED_SIGNED_RG_RGTC2, 0 },
- { PIPE_FORMAT_RGTC2_SNORM, 0 }
+ { PIPE_FORMAT_RGTC2_SNORM, DEFAULT_SNORM8_RGBA_FORMATS }
},
{
{ GL_COMPRESSED_LUMINANCE, GL_COMPRESSED_LUMINANCE_LATC1_EXT, 0 },
- { PIPE_FORMAT_LATC1_UNORM, PIPE_FORMAT_L8_UNORM, 0 }
+ { PIPE_FORMAT_LATC1_UNORM, PIPE_FORMAT_L8_UNORM, DEFAULT_RGBA_FORMATS }
},
{
{ GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT, 0 },
- { PIPE_FORMAT_LATC1_SNORM, 0 }
+ { PIPE_FORMAT_LATC1_SNORM, DEFAULT_SNORM8_RGBA_FORMATS }
},
{
{ GL_COMPRESSED_LUMINANCE_ALPHA, GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT,
GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI, 0 },
- { PIPE_FORMAT_LATC2_UNORM, PIPE_FORMAT_L8A8_UNORM, 0 }
+ { PIPE_FORMAT_LATC2_UNORM, PIPE_FORMAT_L8A8_UNORM, DEFAULT_RGBA_FORMATS }
},
{
{ GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT, 0 },
- { PIPE_FORMAT_LATC2_SNORM, 0 }
+ { PIPE_FORMAT_LATC2_SNORM, DEFAULT_SNORM8_RGBA_FORMATS }
},
/* ETC1 */
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 dc841ff97..92dffe258 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -357,7 +357,7 @@ public:
/** List of immediate_storage */
exec_list immediates;
- int num_immediates;
+ unsigned num_immediates;
/** List of function_entry */
exec_list function_signatures;
@@ -3645,6 +3645,7 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp,
v->indirect_addr_temps = original->indirect_addr_temps;
v->indirect_addr_consts = original->indirect_addr_consts;
memcpy(&v->immediates, &original->immediates, sizeof(v->immediates));
+ v->num_immediates = original->num_immediates;
/*
* Get initial pixel color from the texture.
@@ -3775,6 +3776,7 @@ get_bitmap_visitor(struct st_fragment_program *fp,
v->indirect_addr_temps = original->indirect_addr_temps;
v->indirect_addr_consts = original->indirect_addr_consts;
memcpy(&v->immediates, &original->immediates, sizeof(v->immediates));
+ v->num_immediates = original->num_immediates;
/* TEX tmp0, fragment.texcoord[0], texture[0], 2D; */
coord = st_src_reg(PROGRAM_INPUT, FRAG_ATTRIB_TEX0, glsl_type::vec2_type);
@@ -4679,8 +4681,10 @@ st_translate_program(
i = 0;
foreach_iter(exec_list_iterator, iter, program->immediates) {
immediate_storage *imm = (immediate_storage *)iter.get();
+ assert(i < program->num_immediates);
t->immediates[i++] = emit_immediate(t, imm->values, imm->type, imm->size);
}
+ assert(i == program->num_immediates);
/* texture samplers */
for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {