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.c26
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c36
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp6
3 files changed, 55 insertions, 13 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
index 25cc61aef..7fa4cbdc4 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -1,8 +1,8 @@
/**************************************************************************
- *
+ *
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
- *
+ *
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -10,11 +10,11 @@
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
@@ -22,7 +22,7 @@
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
+ *
**************************************************************************/
@@ -78,7 +78,7 @@ st_bufferobj_free(struct gl_context *ctx, struct gl_buffer_object *obj)
assert(obj->RefCount == 0);
assert(st_obj->transfer == NULL);
- if (st_obj->buffer)
+ if (st_obj->buffer)
pipe_resource_reference(&st_obj->buffer, NULL);
free(st_obj->Base.Label);
@@ -175,7 +175,7 @@ st_bufferobj_data(struct gl_context *ctx,
GLenum target,
GLsizeiptrARB size,
const GLvoid * data,
- GLenum usage,
+ GLenum usage,
struct gl_buffer_object *obj)
{
struct st_context *st = st_context(ctx);
@@ -200,8 +200,8 @@ st_bufferobj_data(struct gl_context *ctx,
st_obj->Base.Size = size;
st_obj->Base.Usage = usage;
-
- switch(target) {
+
+ switch (target) {
case GL_PIXEL_PACK_BUFFER_ARB:
case GL_PIXEL_UNPACK_BUFFER_ARB:
bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
@@ -302,7 +302,7 @@ st_bufferobj_map_range(struct gl_context *ctx,
else
flags |= PIPE_TRANSFER_DISCARD_RANGE;
}
-
+
if (access & GL_MAP_UNSYNCHRONIZED_BIT)
flags |= PIPE_TRANSFER_UNSYNCHRONIZED;
@@ -348,11 +348,11 @@ st_bufferobj_flush_mapped_range(struct gl_context *ctx,
assert(length >= 0);
assert(offset + length <= obj->Length);
assert(obj->Pointer);
-
+
if (!length)
return;
- pipe_buffer_flush_mapped_range(pipe, st_obj->transfer,
+ pipe_buffer_flush_mapped_range(pipe, st_obj->transfer,
obj->Offset + offset, length);
}
@@ -392,7 +392,7 @@ st_copy_buffer_subdata(struct gl_context *ctx,
struct st_buffer_object *dstObj = st_buffer_object(dst);
struct pipe_box box;
- if(!size)
+ if (!size)
return;
/* buffer should not already be mapped */
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 64bfd1faa..33c2ca661 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -35,6 +35,8 @@
#include "main/imports.h"
#include "main/context.h"
#include "main/glformats.h"
+#include "main/texgetimage.h"
+#include "main/teximage.h"
#include "main/texstore.h"
#include "main/image.h"
#include "main/macros.h"
@@ -1745,6 +1747,40 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target,
bindings |= PIPE_BIND_RENDER_TARGET;
}
+ /* GLES allows the driver to choose any format which matches
+ * the format+type combo, because GLES only supports unsized internal
+ * formats and expects the driver to choose whatever suits it.
+ */
+ if (_mesa_is_gles(ctx)) {
+ GLenum baseFormat = _mesa_base_tex_format(ctx, internalFormat);
+ GLenum basePackFormat = _mesa_base_pack_format(format);
+ GLenum iformat = internalFormat;
+
+ /* Treat GL_BGRA as GL_RGBA. */
+ if (iformat == GL_BGRA)
+ iformat = GL_RGBA;
+
+ /* Check if the internalformat is unsized and compatible
+ * with the "format".
+ */
+ if (iformat == baseFormat && iformat == basePackFormat) {
+ pFormat = st_choose_matching_format(st->pipe->screen, bindings,
+ format, type,
+ ctx->Unpack.SwapBytes);
+
+ if (pFormat != PIPE_FORMAT_NONE)
+ return st_pipe_format_to_mesa_format(pFormat);
+
+ /* try choosing format again, this time without render target bindings */
+ pFormat = st_choose_matching_format(st->pipe->screen,
+ PIPE_BIND_SAMPLER_VIEW,
+ format, type,
+ ctx->Unpack.SwapBytes);
+ if (pFormat != PIPE_FORMAT_NONE)
+ return st_pipe_format_to_mesa_format(pFormat);
+ }
+ }
+
pFormat = st_choose_format(st, internalFormat, format, type,
PIPE_TEXTURE_2D, 0, bindings, ctx->Mesa_DXTn);
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 d1706ca27..8d06ac6f7 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1978,6 +1978,9 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
case ir_binop_vector_extract:
case ir_triop_vector_insert:
case ir_binop_ldexp:
+ case ir_binop_carry:
+ case ir_binop_borrow:
+ case ir_binop_imul_high:
/* This operation is not supported, or should have already been handled.
*/
assert(!"Invalid ir opcode in glsl_to_tgsi_visitor::visit()");
@@ -2791,6 +2794,9 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
case ir_tg4:
assert(!"Unexpected ir_tg4 opcode");
break;
+ case ir_query_levels:
+ assert(!"Unexpected ir_query_levels opcode");
+ break;
}
if (ir->projector) {