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_atom_pixeltransfer.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_fbo.c5
-rw-r--r--mesalib/src/mesa/state_tracker/st_draw.c10
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c11
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp8
-rw-r--r--mesalib/src/mesa/state_tracker/st_program.c10
7 files changed, 35 insertions, 17 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
index 12b5bc5ba..afca60976 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -166,7 +166,7 @@ get_pixel_transfer_program(struct gl_context *ctx, const struct state_key *key)
inst[ic].TexSrcUnit = 0;
inst[ic].TexSrcTarget = TEXTURE_2D_INDEX;
ic++;
- fp->Base.InputsRead = (1 << FRAG_ATTRIB_TEX0);
+ fp->Base.InputsRead = BITFIELD64_BIT(FRAG_ATTRIB_TEX0);
fp->Base.OutputsWritten = BITFIELD64_BIT(FRAG_RESULT_COLOR);
fp->Base.SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */
diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
index 1e8ec0556..2a60ed4df 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c
@@ -124,6 +124,11 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
pipe_surface_reference( &strb->surface, NULL );
pipe_resource_reference( &strb->texture, NULL );
+ if (width == 0 || height == 0) {
+ /* if size is zero, nothing to allocate */
+ return GL_TRUE;
+ }
+
/* Setup new texture template.
*/
memset(&template, 0, sizeof(template));
diff --git a/mesalib/src/mesa/state_tracker/st_draw.c b/mesalib/src/mesa/state_tracker/st_draw.c
index 05a71d35c..fd1c8ee48 100644
--- a/mesalib/src/mesa/state_tracker/st_draw.c
+++ b/mesalib/src/mesa/state_tracker/st_draw.c
@@ -325,7 +325,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp,
if (abs(array->Ptr - firstPtr) > firstStride)
return GL_FALSE; /* arrays start too far apart */
- if ((!bufObj || !_mesa_is_bufferobj(bufObj)) != userSpaceBuffer)
+ if ((!_mesa_is_bufferobj(bufObj)) != userSpaceBuffer)
return GL_FALSE; /* mix of VBO and user-space arrays */
}
}
@@ -390,7 +390,7 @@ setup_interleaved_attribs(struct gl_context *ctx,
}
/* are the arrays in user space? */
- usingVBO = bufobj && _mesa_is_bufferobj(bufobj);
+ usingVBO = _mesa_is_bufferobj(bufobj);
for (attr = 0; attr < vpv->num_inputs; attr++) {
const GLuint mesaAttr = vp->index_to_input[attr];
@@ -497,7 +497,7 @@ setup_non_interleaved_attribs(struct gl_context *ctx,
assert(element_size == array->Size * _mesa_sizeof_type(array->Type));
- if (bufobj && _mesa_is_bufferobj(bufobj)) {
+ if (_mesa_is_bufferobj(bufobj)) {
/* Attribute data is in a VBO.
* Recall that for VBOs, the gl_client_array->Ptr field is
* really an offset from the start of the VBO, not a pointer.
@@ -599,7 +599,7 @@ setup_index_buffer(struct gl_context *ctx,
}
/* get/create the index buffer object */
- if (bufobj && _mesa_is_bufferobj(bufobj)) {
+ if (_mesa_is_bufferobj(bufobj)) {
/* elements/indexes are in a real VBO */
struct st_buffer_object *stobj = st_buffer_object(bufobj);
pipe_resource_reference(&ibuffer->buffer, stobj->buffer);
@@ -775,7 +775,7 @@ handle_fallback_primitive_restart(struct pipe_context *pipe,
info.primitive_restart = FALSE;
info.instance_count = 1;
- if (ib->obj && _mesa_is_bufferobj(ib->obj)) {
+ if (_mesa_is_bufferobj(ib->obj)) {
ptr = pipe_buffer_map_range(pipe, ibuffer->buffer,
start * ibuffer->index_size, /* start */
count * ibuffer->index_size, /* length */
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 25a6cdc75..c741d13f4 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -664,4 +664,10 @@ void st_init_extensions(struct st_context *st)
PIPE_BIND_SAMPLER_VIEW)) {
ctx->Extensions.ARB_depth_buffer_float = GL_TRUE;
}
+
+ if (screen->is_format_supported(screen, PIPE_FORMAT_B10G10R10A2_UINT,
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW))
+ ctx->Extensions.ARB_texture_rgb10_a2ui = GL_TRUE;
+
}
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index b11245beb..bc414f442 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -457,7 +457,8 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat)
return PIPE_FORMAT_R9G9B9E5_FLOAT;
case MESA_FORMAT_R11_G11_B10_FLOAT:
return PIPE_FORMAT_R11G11B10_FLOAT;
-
+ case MESA_FORMAT_ARGB2101010_UINT:
+ return PIPE_FORMAT_B10G10R10A2_UINT;
default:
assert(0);
return PIPE_FORMAT_NONE;
@@ -782,6 +783,8 @@ st_pipe_format_to_mesa_format(enum pipe_format format)
case PIPE_FORMAT_R11G11B10_FLOAT:
return MESA_FORMAT_R11_G11_B10_FLOAT;
+ case PIPE_FORMAT_B10G10R10A2_UINT:
+ return MESA_FORMAT_ARGB2101010_UINT;
default:
assert(0);
return MESA_FORMAT_NONE;
@@ -1471,7 +1474,11 @@ static const struct format_mapping format_map[] = {
{
{ GL_R11F_G11F_B10F, 0 },
{ PIPE_FORMAT_R11G11B10_FLOAT, 0 }
- }
+ },
+ {
+ { GL_RGB10_A2UI, 0 },
+ { PIPE_FORMAT_B10G10R10A2_UINT, 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 74b8fa7c7..59b5ffd4c 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -3731,7 +3731,7 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp,
inst->sampler = 0;
inst->tex_target = TEXTURE_2D_INDEX;
- prog->InputsRead |= (1 << FRAG_ATTRIB_TEX0);
+ prog->InputsRead |= FRAG_BIT_TEX0;
prog->SamplersUsed |= (1 << 0); /* mark sampler 0 as used */
v->samplers_used |= (1 << 0);
@@ -3802,7 +3802,7 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp,
src_regs[i].index = src0.index;
}
else if (src_regs[i].file == PROGRAM_INPUT)
- prog->InputsRead |= (1 << src_regs[i].index);
+ prog->InputsRead |= BITFIELD64_BIT(src_regs[i].index);
}
v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], src_regs[2]);
@@ -3855,7 +3855,7 @@ get_bitmap_visitor(struct st_fragment_program *fp,
inst->sampler = samplerIndex;
inst->tex_target = TEXTURE_2D_INDEX;
- prog->InputsRead |= (1 << FRAG_ATTRIB_TEX0);
+ prog->InputsRead |= FRAG_BIT_TEX0;
prog->SamplersUsed |= (1 << samplerIndex); /* mark sampler as used */
v->samplers_used |= (1 << samplerIndex);
@@ -3877,7 +3877,7 @@ get_bitmap_visitor(struct st_fragment_program *fp,
for (int i=0; i<3; i++) {
src_regs[i] = inst->src[i];
if (src_regs[i].file == PROGRAM_INPUT)
- prog->InputsRead |= (1 << src_regs[i].index);
+ prog->InputsRead |= BITFIELD64_BIT(src_regs[i].index);
}
v->emit(NULL, inst->op, inst->dst, src_regs[0], src_regs[1], src_regs[2]);
diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c
index e03157940..768da5114 100644
--- a/mesalib/src/mesa/state_tracker/st_program.c
+++ b/mesalib/src/mesa/state_tracker/st_program.c
@@ -194,7 +194,7 @@ st_prepare_vertex_program(struct gl_context *ctx,
* and TGSI generic input indexes, plus input attrib semantic info.
*/
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
- if (stvp->Base.Base.InputsRead & (1 << attr)) {
+ if ((stvp->Base.Base.InputsRead & BITFIELD64_BIT(attr)) != 0) {
stvp->input_to_index[attr] = stvp->num_inputs;
stvp->index_to_input[stvp->num_inputs] = attr;
stvp->num_inputs++;
@@ -490,7 +490,7 @@ st_translate_fragment_program(struct st_context *st,
GLuint inputMapping[FRAG_ATTRIB_MAX];
GLuint interpMode[PIPE_MAX_SHADER_INPUTS]; /* XXX size? */
GLuint attr;
- const GLbitfield inputsRead = stfp->Base.Base.InputsRead;
+ const GLbitfield64 inputsRead = stfp->Base.Base.InputsRead;
struct ureg_program *ureg;
GLboolean write_all = GL_FALSE;
@@ -510,7 +510,7 @@ st_translate_fragment_program(struct st_context *st,
* Convert Mesa program inputs to TGSI input register semantics.
*/
for (attr = 0; attr < FRAG_ATTRIB_MAX; attr++) {
- if (inputsRead & (1 << attr)) {
+ if ((inputsRead & BITFIELD64_BIT(attr)) != 0) {
const GLuint slot = fs_num_inputs++;
inputMapping[attr] = slot;
@@ -749,7 +749,7 @@ st_translate_geometry_program(struct st_context *st,
GLuint outputMapping[GEOM_RESULT_MAX];
struct pipe_context *pipe = st->pipe;
GLuint attr;
- const GLbitfield inputsRead = stgp->Base.Base.InputsRead;
+ const GLbitfield64 inputsRead = stgp->Base.Base.InputsRead;
GLuint vslot = 0;
GLuint num_generic = 0;
@@ -790,7 +790,7 @@ st_translate_geometry_program(struct st_context *st,
* Convert Mesa program inputs to TGSI input register semantics.
*/
for (attr = 0; attr < GEOM_ATTRIB_MAX; attr++) {
- if (inputsRead & (1 << attr)) {
+ if ((inputsRead & BITFIELD64_BIT(attr)) != 0) {
const GLuint slot = gs_num_inputs;
gs_num_inputs++;