aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/Makefile.am8
-rw-r--r--mesalib/src/gallium/Automake.inc69
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_blitter.c42
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c540
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_gen_mipmap.h23
-rw-r--r--mesalib/src/glsl/ast.h13
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp180
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.cpp21
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.h4
-rw-r--r--mesalib/src/glsl/ir.cpp9
-rw-r--r--mesalib/src/glsl/ir.h15
-rw-r--r--mesalib/src/glsl/ir_optimization.h6
-rw-r--r--mesalib/src/glsl/ir_validate.cpp3
-rw-r--r--mesalib/src/glsl/link_uniform_block_active_visitor.cpp8
-rw-r--r--mesalib/src/glsl/link_uniform_block_active_visitor.h3
-rw-r--r--mesalib/src/glsl/link_uniform_blocks.cpp14
-rw-r--r--mesalib/src/glsl/link_uniform_initializers.cpp117
-rw-r--r--mesalib/src/glsl/linker.cpp6
-rw-r--r--mesalib/src/glsl/loop_analysis.h3
-rw-r--r--mesalib/src/glsl/loop_unroll.cpp86
-rw-r--r--mesalib/src/glsl/lower_ubo_reference.cpp10
-rw-r--r--mesalib/src/glsl/opt_algebraic.cpp30
-rw-r--r--mesalib/src/glsl/opt_tree_grafting.cpp30
-rw-r--r--mesalib/src/glsl/opt_vectorize.cpp1
-rw-r--r--mesalib/src/glsl/test_optpass.cpp7
-rw-r--r--mesalib/src/loader/loader.c6
-rw-r--r--mesalib/src/mapi/Makefile.sources23
-rw-r--r--mesalib/src/mapi/glapi/Makefile.sources4
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_separate_shader_objects.xml122
-rw-r--r--mesalib/src/mapi/glapi/gen/Makefile.am44
-rw-r--r--mesalib/src/mapi/glapi/gen/SConscript2
-rw-r--r--mesalib/src/mapi/glapi/gen/es_EXT.xml2
-rwxr-xr-xmesalib/src/mapi/glapi/gen/gl_API.xml32
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_and_es_API.xml129
-rwxr-xr-xmesalib/src/mapi/glapi/gen/gl_procs.py43
-rwxr-xr-xmesalib/src/mapi/mapi_abi.py18
-rw-r--r--mesalib/src/mesa/drivers/dri/Makefile.am27
-rw-r--r--mesalib/src/mesa/drivers/dri/common/Makefile.am2
-rw-r--r--mesalib/src/mesa/drivers/dri/common/megadriver_stub.c4
-rw-r--r--mesalib/src/mesa/main/attrib.c20
-rw-r--r--mesalib/src/mesa/main/bufferobj.c6
-rw-r--r--mesalib/src/mesa/main/bufferobj.h7
-rw-r--r--mesalib/src/mesa/main/drawpix.c2
-rw-r--r--mesalib/src/mesa/main/errors.c2
-rw-r--r--mesalib/src/mesa/main/ff_fragment_shader.cpp3
-rw-r--r--mesalib/src/mesa/main/format_unpack.c80
-rw-r--r--mesalib/src/mesa/main/formats.c20
-rw-r--r--mesalib/src/mesa/main/imports.h6
-rw-r--r--mesalib/src/mesa/main/macros.h11
-rw-r--r--mesalib/src/mesa/main/mtypes.h5
-rw-r--r--mesalib/src/mesa/main/pack.c116
-rw-r--r--mesalib/src/mesa/main/shader_query.cpp36
-rw-r--r--mesalib/src/mesa/main/texcompress_etc.c78
-rw-r--r--mesalib/src/mesa/main/texformat.c22
-rw-r--r--mesalib/src/mesa/main/texobj.c7
-rw-r--r--mesalib/src/mesa/main/texparam.c3
-rw-r--r--mesalib/src/mesa/main/texstore.c34
-rw-r--r--mesalib/src/mesa/main/vdpau.c8
-rw-r--r--mesalib/src/mesa/main/version.c2
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp3
-rw-r--r--mesalib/src/mesa/program/prog_noise.c36
-rw-r--r--mesalib/src/mesa/program/program_parse.y5
-rw-r--r--mesalib/src/mesa/program/symbol_table.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_sampler.c22
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c55
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c28
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_eglimage.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c48
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h1
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c13
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c6
-rw-r--r--mesalib/src/mesa/state_tracker/st_gen_mipmap.c75
-rw-r--r--mesalib/src/mesa/state_tracker/st_gen_mipmap.h8
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp7
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.c115
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.h30
-rw-r--r--mesalib/src/mesa/state_tracker/st_vdpau.c11
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch.c1127
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch_tmp.h955
-rw-r--r--mesalib/src/mesa/tnl/t_context.c2
-rw-r--r--mesalib/src/mesa/tnl/t_draw.c34
-rw-r--r--mesalib/src/mesa/tnl/tnl.h9
83 files changed, 1839 insertions, 2935 deletions
diff --git a/mesalib/src/Makefile.am b/mesalib/src/Makefile.am
index 5b2549d9d..9d1580f90 100644
--- a/mesalib/src/Makefile.am
+++ b/mesalib/src/Makefile.am
@@ -33,12 +33,16 @@ if HAVE_EGL_PLATFORM_WAYLAND
SUBDIRS += egl/wayland
endif
+if HAVE_EGL_DRIVER_DRI2
+SUBDIRS += egl/drivers/dri2
+endif
+
if HAVE_GBM
SUBDIRS += gbm
endif
if HAVE_EGL
-SUBDIRS += egl
+SUBDIRS += egl/main
endif
if HAVE_GALLIUM
@@ -55,3 +59,5 @@ SUBDIRS += \
gallium/tests/unit
endif
endif
+
+EXTRA_DIST = getopt
diff --git a/mesalib/src/gallium/Automake.inc b/mesalib/src/gallium/Automake.inc
index 1acc99ef5..1f5d532e4 100644
--- a/mesalib/src/gallium/Automake.inc
+++ b/mesalib/src/gallium/Automake.inc
@@ -54,41 +54,72 @@ GALLIUM_VIDEO_CFLAGS = \
DRI_VERSION_SCRIPT ?= $(top_srcdir)/src/gallium/state_trackers/dri/dri.link
GALLIUM_DRI_LINKER_FLAGS = \
+ -shared \
+ -shrext .so \
-module \
-avoid-version \
- -Wl,--version-script=$(DRI_VERSION_SCRIPT) \
- -shared \
- -no-undefined
+ $(GC_SECTIONS) \
+ -Wl,--version-script=$(DRI_VERSION_SCRIPT)
GALLIUM_VDPAU_LINKER_FLAGS = \
+ -shared \
-module \
+ -no-undefined \
-version-number $(VDPAU_MAJOR):$(VDPAU_MINOR) \
-export-symbols-regex $(VDPAU_EXPORTS) \
- -shared \
- -no-undefined
+ $(GC_SECTIONS) \
+ $(LD_NO_UNDEFINED)
GALLIUM_XVMC_LINKER_FLAGS = \
+ -shared \
-module \
+ -no-undefined \
-version-number $(XVMC_MAJOR):$(XVMC_MINOR) \
- -shared \
-export-symbols-regex '^XvMC' \
- -no-undefined
+ $(GC_SECTIONS) \
+ $(LD_NO_UNDEFINED)
+
+GALLIUM_OMX_LINKER_FLAGS = \
+ -shared \
+ -module \
+ -no-undefined \
+ -export-symbols-regex $(EXPORTS) \
+ $(GC_SECTIONS) \
+ $(LD_NO_UNDEFINED)
+
+GALLIUM_COMMON_LIB_DEPS = \
+ -lm \
+ $(CLOCK_LIB) \
+ $(PTHREAD_LIBS) \
+ $(DLOPEN_LIBS)
+
+GALLIUM_DRI_LIB_DEPS = \
+ $(top_builddir)/src/mesa/libmesagallium.la \
+ $(top_builddir)/src/gallium/auxiliary/libgallium.la \
+ $(SELINUX_LIBS) \
+ $(LIBDRM_LIBS) \
+ $(EXPAT_LIBS) \
+ $(GALLIUM_COMMON_LIB_DEPS)
GALLIUM_VDPAU_LIB_DEPS = \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(top_builddir)/src/gallium/state_trackers/vdpau/libvdpautracker.la \
$(VDPAU_LIBS) \
$(LIBDRM_LIBS) \
- -lm \
- $(CLOCK_LIB) \
- $(PTHREAD_LIBS) \
- $(DLOPEN_LIBS)
+ $(GALLIUM_COMMON_LIB_DEPS)
GALLIUM_XVMC_LIB_DEPS = \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(top_builddir)/src/gallium/state_trackers/xvmc/libxvmctracker.la \
$(XVMC_LIBS) \
- $(LIBDRM_LIBS)
+ $(LIBDRM_LIBS) \
+ $(GALLIUM_COMMON_LIB_DEPS)
+
+GALLIUM_OMX_LIB_DEPS = \
+ $(top_builddir)/src/gallium/auxiliary/libgallium.la \
+ $(top_builddir)/src/gallium/state_trackers/omx/libomxtracker.la \
+ $(OMX_LIBS) \
+ $(GALLIUM_COMMON_LIB_DEPS)
GALLIUM_WINSYS_CFLAGS = \
-I$(top_srcdir)/include \
@@ -96,3 +127,17 @@ GALLIUM_WINSYS_CFLAGS = \
-I$(top_srcdir)/src/gallium/auxiliary \
$(DEFINES) \
$(VISIBILITY_CFLAGS)
+
+if HAVE_MESA_LLVM
+
+GALLIUM_DRI_LINKER_FLAGS += $(LLVM_LDFLAGS)
+GALLIUM_VDPAU_LINKER_FLAGS += $(LLVM_LDFLAGS)
+GALLIUM_XVMC_LINKER_FLAGS += $(LLVM_LDFLAGS)
+GALLIUM_OMX_LINKER_FLAGS += $(LLVM_LDFLAGS)
+
+GALLIUM_DRI_LIB_DEPS += $(LLVM_LIBS)
+GALLIUM_VDPAU_LIB_DEPS += $(LLVM_LIBS)
+GALLIUM_XVMC_LIB_DEPS += $(LLVM_LIBS)
+GALLIUM_OMX_LIB_DEPS += $(LLVM_LIBS)
+
+endif
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c
index 1e7f374ab..7b058fe22 100644
--- a/mesalib/src/gallium/auxiliary/util/u_blitter.c
+++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c
@@ -688,7 +688,7 @@ static void set_texcoords_in_vertices(const float coord[4],
static void blitter_set_texcoords(struct blitter_context_priv *ctx,
struct pipe_sampler_view *src,
unsigned src_width0, unsigned src_height0,
- unsigned layer, unsigned sample,
+ float layer, unsigned sample,
int x1, int y1, int x2, int y2)
{
unsigned i;
@@ -700,11 +700,11 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx,
if (src->texture->target == PIPE_TEXTURE_CUBE ||
src->texture->target == PIPE_TEXTURE_CUBE_ARRAY) {
set_texcoords_in_vertices(coord, &face_coord[0][0], 2);
- util_map_texcoords2d_onto_cubemap(layer % 6,
+ util_map_texcoords2d_onto_cubemap((unsigned)layer % 6,
/* pointer, stride in floats */
&face_coord[0][0], 2,
&ctx->vertices[0][1][0], 8,
- TRUE);
+ FALSE);
} else {
set_texcoords_in_vertices(coord, &ctx->vertices[0][1][0], 8);
}
@@ -734,7 +734,7 @@ static void blitter_set_texcoords(struct blitter_context_priv *ctx,
case PIPE_TEXTURE_CUBE_ARRAY:
for (i = 0; i < 4; i++)
- ctx->vertices[i][1][3] = (float) (layer / 6); /*w*/
+ ctx->vertices[i][1][3] = (float) ((unsigned)layer / 6); /*w*/
break;
case PIPE_TEXTURE_2D:
@@ -1528,9 +1528,31 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
UTIL_BLITTER_ATTRIB_TEXCOORD, &coord);
} else {
/* Draw the quad with the generic codepath. */
- int z;
- for (z = 0; z < dstbox->depth; z++) {
+ int dst_z;
+ for (dst_z = 0; dst_z < dstbox->depth; dst_z++) {
struct pipe_surface *old;
+ float dst2src_scale = srcbox->depth / (float)dstbox->depth;
+
+ /* Scale Z properly if the blit is scaled.
+ *
+ * When downscaling, we want the coordinates centered, so that
+ * mipmapping works for 3D textures. For example, when generating
+ * a 4x4x4 level, this wouldn't average the pixels:
+ *
+ * src Z: 0 1 2 3 4 5 6 7
+ * dst Z: 0 1 2 3
+ *
+ * Because the pixels are not centered below the pixels of the higher
+ * level. Therefore, we want this:
+ * src Z: 0 1 2 3 4 5 6 7
+ * dst Z: 0 1 2 3
+ *
+ * dst_offset defines the offset needed for centering the pixels and
+ * it works with any scaling (not just 2x).
+ */
+ float dst_offset = ((srcbox->depth - 1) -
+ (dstbox->depth - 1) * dst2src_scale) * 0.5;
+ float src_z = (dst_z + dst_offset) * dst2src_scale;
/* Set framebuffer state. */
if (blit_depth || blit_stencil) {
@@ -1548,7 +1570,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
for (i = 0; i <= max_sample; i++) {
pipe->set_sample_mask(pipe, 1 << i);
blitter_set_texcoords(ctx, src, src_width0, src_height0,
- srcbox->z + z,
+ srcbox->z + src_z,
i, srcbox->x, srcbox->y,
srcbox->x + srcbox->width,
srcbox->y + srcbox->height);
@@ -1560,7 +1582,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
/* Normal copy, MSAA upsampling, or MSAA resolve. */
pipe->set_sample_mask(pipe, ~0);
blitter_set_texcoords(ctx, src, src_width0, src_height0,
- srcbox->z + z, 0,
+ srcbox->z + src_z, 0,
srcbox->x, srcbox->y,
srcbox->x + srcbox->width,
srcbox->y + srcbox->height);
@@ -1572,10 +1594,10 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
/* Get the next surface or (if this is the last iteration)
* just unreference the last one. */
old = dst;
- if (z < dstbox->depth-1) {
+ if (dst_z < dstbox->depth-1) {
dst = ctx->base.get_next_surface_layer(ctx->base.pipe, dst);
}
- if (z) {
+ if (dst_z) {
pipe_surface_reference(&old, NULL);
}
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
index a2f42189f..aa8eaebb6 100644
--- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -3,6 +3,7 @@
* Copyright 2008 VMware, Inc.
* All Rights Reserved.
* Copyright 2008 VMware, Inc. All rights reserved.
+ * Copyright 2014 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
@@ -30,509 +31,98 @@
* @file
* Mipmap generation utility
*
- * @author Brian Paul
+ * @author Brian Paul, Marek Olšák
*/
-#include "pipe/p_context.h"
-#include "util/u_debug.h"
-#include "pipe/p_defines.h"
-#include "util/u_inlines.h"
-#include "pipe/p_shader_tokens.h"
-#include "pipe/p_state.h"
-
-#include "util/u_format.h"
-#include "util/u_memory.h"
-#include "util/u_draw_quad.h"
#include "util/u_gen_mipmap.h"
-#include "util/u_simple_shaders.h"
-#include "util/u_math.h"
-#include "util/u_texture.h"
-#include "util/u_half.h"
-#include "util/u_surface.h"
-
-#include "cso_cache/cso_context.h"
-
-
-struct gen_mipmap_state
-{
- struct pipe_context *pipe;
- struct cso_context *cso;
-
- struct pipe_blend_state blend_keep_color, blend_write_color;
- struct pipe_depth_stencil_alpha_state dsa_keep_depth, dsa_write_depth;
- struct pipe_rasterizer_state rasterizer;
- struct pipe_sampler_state sampler;
- struct pipe_vertex_element velem[2];
-
- void *vs;
-
- /** Not all are used, but simplifies code */
- void *fs_color[TGSI_TEXTURE_COUNT];
- void *fs_depth[TGSI_TEXTURE_COUNT];
-
- struct pipe_resource *vbuf; /**< quad vertices */
- unsigned vbuf_slot;
-
- float vertices[4][2][4]; /**< vertex/texcoords for quad */
-};
-
-
-/**
- * Create a mipmap generation context.
- * The idea is to create one of these and re-use it each time we need to
- * generate a mipmap.
- */
-struct gen_mipmap_state *
-util_create_gen_mipmap(struct pipe_context *pipe,
- struct cso_context *cso)
-{
- struct gen_mipmap_state *ctx;
- uint i;
-
- ctx = CALLOC_STRUCT(gen_mipmap_state);
- if (!ctx)
- return NULL;
-
- ctx->pipe = pipe;
- ctx->cso = cso;
-
- /* disabled blending/masking */
- memset(&ctx->blend_keep_color, 0, sizeof(ctx->blend_keep_color));
- memset(&ctx->blend_write_color, 0, sizeof(ctx->blend_write_color));
- ctx->blend_write_color.rt[0].colormask = PIPE_MASK_RGBA;
-
- /* no-op depth/stencil/alpha */
- memset(&ctx->dsa_keep_depth, 0, sizeof(ctx->dsa_keep_depth));
- memset(&ctx->dsa_write_depth, 0, sizeof(ctx->dsa_write_depth));
- ctx->dsa_write_depth.depth.enabled = 1;
- ctx->dsa_write_depth.depth.func = PIPE_FUNC_ALWAYS;
- ctx->dsa_write_depth.depth.writemask = 1;
-
- /* rasterizer */
- memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer));
- ctx->rasterizer.cull_face = PIPE_FACE_NONE;
- ctx->rasterizer.half_pixel_center = 1;
- ctx->rasterizer.bottom_edge_rule = 1;
- ctx->rasterizer.depth_clip = 1;
-
- /* sampler state */
- memset(&ctx->sampler, 0, sizeof(ctx->sampler));
- ctx->sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
- ctx->sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
- ctx->sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
- ctx->sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
- ctx->sampler.normalized_coords = 1;
-
- /* vertex elements state */
- memset(&ctx->velem[0], 0, sizeof(ctx->velem[0]) * 2);
- for (i = 0; i < 2; i++) {
- ctx->velem[i].src_offset = i * 4 * sizeof(float);
- ctx->velem[i].instance_divisor = 0;
- ctx->velem[i].vertex_buffer_index = cso_get_aux_vertex_buffer_slot(cso);
- ctx->velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
- }
-
- /* vertex data that doesn't change */
- for (i = 0; i < 4; i++) {
- ctx->vertices[i][0][2] = 0.0f; /* z */
- ctx->vertices[i][0][3] = 1.0f; /* w */
- ctx->vertices[i][1][3] = 1.0f; /* q */
- }
-
- /* Note: the actual vertex buffer is allocated as needed below */
-
- return ctx;
-}
-
-
-/**
- * Helper function to set the fragment shaders.
- */
-static INLINE void
-set_fragment_shader(struct gen_mipmap_state *ctx, uint type,
- boolean output_depth)
-{
- if (output_depth) {
- if (!ctx->fs_depth[type])
- ctx->fs_depth[type] =
- util_make_fragment_tex_shader_writedepth(ctx->pipe, type,
- TGSI_INTERPOLATE_LINEAR);
-
- cso_set_fragment_shader_handle(ctx->cso, ctx->fs_depth[type]);
- }
- else {
- if (!ctx->fs_color[type])
- ctx->fs_color[type] =
- util_make_fragment_tex_shader(ctx->pipe, type,
- TGSI_INTERPOLATE_LINEAR);
-
- cso_set_fragment_shader_handle(ctx->cso, ctx->fs_color[type]);
- }
-}
-
-
-/**
- * Helper function to set the vertex shader.
- */
-static INLINE void
-set_vertex_shader(struct gen_mipmap_state *ctx)
-{
- /* vertex shader - still required to provide the linkage between
- * fragment shader input semantics and vertex_element/buffers.
- */
- if (!ctx->vs)
- {
- const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
- TGSI_SEMANTIC_GENERIC };
- const uint semantic_indexes[] = { 0, 0 };
- ctx->vs = util_make_vertex_passthrough_shader(ctx->pipe, 2,
- semantic_names,
- semantic_indexes);
- }
-
- cso_set_vertex_shader_handle(ctx->cso, ctx->vs);
-}
-
-
-/**
- * Get next "slot" of vertex space in the vertex buffer.
- * We're allocating one large vertex buffer and using it piece by piece.
- */
-static unsigned
-get_next_slot(struct gen_mipmap_state *ctx)
-{
- const unsigned max_slots = 4096 / sizeof ctx->vertices;
-
- if (ctx->vbuf_slot >= max_slots) {
- pipe_resource_reference(&ctx->vbuf, NULL);
- ctx->vbuf_slot = 0;
- }
-
- if (!ctx->vbuf) {
- ctx->vbuf = pipe_buffer_create(ctx->pipe->screen,
- PIPE_BIND_VERTEX_BUFFER,
- PIPE_USAGE_STREAM,
- max_slots * sizeof ctx->vertices);
- }
-
- return ctx->vbuf_slot++ * sizeof ctx->vertices;
-}
-
-
-static unsigned
-set_vertex_data(struct gen_mipmap_state *ctx,
- enum pipe_texture_target tex_target,
- uint face, float r)
-{
- unsigned offset;
-
- /* vert[0].position */
- ctx->vertices[0][0][0] = -1.0f; /*x*/
- ctx->vertices[0][0][1] = -1.0f; /*y*/
-
- /* vert[1].position */
- ctx->vertices[1][0][0] = 1.0f;
- ctx->vertices[1][0][1] = -1.0f;
-
- /* vert[2].position */
- ctx->vertices[2][0][0] = 1.0f;
- ctx->vertices[2][0][1] = 1.0f;
-
- /* vert[3].position */
- ctx->vertices[3][0][0] = -1.0f;
- ctx->vertices[3][0][1] = 1.0f;
-
- /* Setup vertex texcoords. This is a little tricky for cube maps. */
- if (tex_target == PIPE_TEXTURE_CUBE ||
- tex_target == PIPE_TEXTURE_CUBE_ARRAY) {
- static const float st[4][2] = {
- {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f}
- };
-
- util_map_texcoords2d_onto_cubemap(face, &st[0][0], 2,
- &ctx->vertices[0][1][0], 8,
- FALSE);
-
- /* set the layer for cube arrays */
- ctx->vertices[0][1][3] = r;
- ctx->vertices[1][1][3] = r;
- ctx->vertices[2][1][3] = r;
- ctx->vertices[3][1][3] = r;
- }
- else if (tex_target == PIPE_TEXTURE_1D_ARRAY) {
- /* 1D texture array */
- ctx->vertices[0][1][0] = 0.0f; /*s*/
- ctx->vertices[0][1][1] = r; /*t*/
- ctx->vertices[0][1][2] = 0.0f; /*r*/
-
- ctx->vertices[1][1][0] = 1.0f;
- ctx->vertices[1][1][1] = r;
- ctx->vertices[1][1][2] = 0.0f;
-
- ctx->vertices[2][1][0] = 1.0f;
- ctx->vertices[2][1][1] = r;
- ctx->vertices[2][1][2] = 0.0f;
-
- ctx->vertices[3][1][0] = 0.0f;
- ctx->vertices[3][1][1] = r;
- ctx->vertices[3][1][2] = 0.0f;
- } else {
- /* 1D/2D/3D/2D array */
- ctx->vertices[0][1][0] = 0.0f; /*s*/
- ctx->vertices[0][1][1] = 0.0f; /*t*/
- ctx->vertices[0][1][2] = r; /*r*/
-
- ctx->vertices[1][1][0] = 1.0f;
- ctx->vertices[1][1][1] = 0.0f;
- ctx->vertices[1][1][2] = r;
-
- ctx->vertices[2][1][0] = 1.0f;
- ctx->vertices[2][1][1] = 1.0f;
- ctx->vertices[2][1][2] = r;
-
- ctx->vertices[3][1][0] = 0.0f;
- ctx->vertices[3][1][1] = 1.0f;
- ctx->vertices[3][1][2] = r;
- }
-
- offset = get_next_slot( ctx );
-
- pipe_buffer_write_nooverlap(ctx->pipe, ctx->vbuf,
- offset, sizeof(ctx->vertices), ctx->vertices);
-
- return offset;
-}
-
-
-
-/**
- * Destroy a mipmap generation context
- */
-void
-util_destroy_gen_mipmap(struct gen_mipmap_state *ctx)
-{
- struct pipe_context *pipe = ctx->pipe;
- unsigned i;
-
- for (i = 0; i < Elements(ctx->fs_color); i++)
- if (ctx->fs_color[i])
- pipe->delete_fs_state(pipe, ctx->fs_color[i]);
-
- for (i = 0; i < Elements(ctx->fs_depth); i++)
- if (ctx->fs_depth[i])
- pipe->delete_fs_state(pipe, ctx->fs_depth[i]);
-
- if (ctx->vs)
- pipe->delete_vs_state(pipe, ctx->vs);
-
- pipe_resource_reference(&ctx->vbuf, NULL);
-
- FREE(ctx);
-}
+#include "util/u_format.h"
+#include "util/u_inlines.h"
/**
* Generate mipmap images. It's assumed all needed texture memory is
* already allocated.
*
- * \param psv the sampler view to the texture to generate mipmap levels for
- * \param face which cube face to generate mipmaps for (0 for non-cube maps)
- * \param baseLevel the first mipmap level to use as a src
- * \param lastLevel the last mipmap level to generate
+ * \param pt the texture to generate mipmap levels for
+ * \param format format of texture
+ * \param first_layer the first layer to generate mipmap levels for
+ * (ignored for 3D textures)
+ * \param last_layer the last layer to generate mipmap levels for
+ * (ignored for 3D textures)
+ * \param base_level the first mipmap level to use as a src
+ * \param last_level the last mipmap level to generate
* \param filter the minification filter used to generate mipmap levels with
- * \param filter one of PIPE_TEX_FILTER_LINEAR, PIPE_TEX_FILTER_NEAREST
+ * one of PIPE_TEX_FILTER_LINEAR, PIPE_TEX_FILTER_NEAREST
*/
-void
-util_gen_mipmap(struct gen_mipmap_state *ctx,
- struct pipe_sampler_view *psv,
- uint face, uint baseLevel, uint lastLevel, uint filter)
+boolean
+util_gen_mipmap(struct pipe_context *pipe, struct pipe_resource *pt,
+ enum pipe_format format, uint base_level, uint last_level,
+ uint first_layer, uint last_layer, uint filter)
{
- struct pipe_context *pipe = ctx->pipe;
struct pipe_screen *screen = pipe->screen;
- struct pipe_framebuffer_state fb;
- struct pipe_resource *pt = psv->texture;
+ struct pipe_blit_info blit;
uint dstLevel;
- uint offset;
- uint type;
- boolean is_depth = util_format_is_depth_or_stencil(psv->format);
+ boolean is_zs = util_format_is_depth_or_stencil(format);
+ boolean has_depth =
+ util_format_has_depth(util_format_description(format));
+
+ /* nothing to do for stencil-only formats */
+ if (is_zs && !has_depth)
+ return TRUE;
+
+ /* nothing to do for integer formats */
+ if (!is_zs && util_format_is_pure_integer(format))
+ return TRUE;
+
+ if (!screen->is_format_supported(screen, format, pt->target,
+ pt->nr_samples,
+ PIPE_BIND_SAMPLER_VIEW |
+ (is_zs ? PIPE_BIND_DEPTH_STENCIL :
+ PIPE_BIND_RENDER_TARGET))) {
+ return FALSE;
+ }
/* The texture object should have room for the levels which we're
* about to generate.
*/
- assert(lastLevel <= pt->last_level);
+ assert(last_level <= pt->last_level);
/* If this fails, why are we here? */
- assert(lastLevel > baseLevel);
-
+ assert(last_level > base_level);
assert(filter == PIPE_TEX_FILTER_LINEAR ||
filter == PIPE_TEX_FILTER_NEAREST);
- type = util_pipe_tex_to_tgsi_tex(pt->target, 1);
-
- /* check if we can render in the texture's format */
- if (!screen->is_format_supported(screen, psv->format, pt->target,
- pt->nr_samples,
- is_depth ? PIPE_BIND_DEPTH_STENCIL :
- PIPE_BIND_RENDER_TARGET)) {
- /* The caller should check if the format is renderable. */
- assert(0);
- return;
- }
-
- /* save state (restored below) */
- cso_save_blend(ctx->cso);
- cso_save_depth_stencil_alpha(ctx->cso);
- cso_save_rasterizer(ctx->cso);
- cso_save_sample_mask(ctx->cso);
- cso_save_samplers(ctx->cso, PIPE_SHADER_FRAGMENT);
- cso_save_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT);
- cso_save_stream_outputs(ctx->cso);
- cso_save_framebuffer(ctx->cso);
- cso_save_fragment_shader(ctx->cso);
- cso_save_vertex_shader(ctx->cso);
- cso_save_geometry_shader(ctx->cso);
- cso_save_viewport(ctx->cso);
- cso_save_vertex_elements(ctx->cso);
- cso_save_aux_vertex_buffer_slot(ctx->cso);
- cso_save_render_condition(ctx->cso);
+ memset(&blit, 0, sizeof(blit));
+ blit.src.resource = blit.dst.resource = pt;
+ blit.src.format = blit.dst.format = format;
+ /* don't set the stencil mask, stencil shouldn't be changed */
+ blit.mask = is_zs ? PIPE_MASK_Z : PIPE_MASK_RGBA;
+ blit.filter = filter;
- /* bind our state */
- cso_set_blend(ctx->cso, is_depth ? &ctx->blend_keep_color :
- &ctx->blend_write_color);
- cso_set_depth_stencil_alpha(ctx->cso, is_depth ? &ctx->dsa_write_depth :
- &ctx->dsa_keep_depth);
- cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
- cso_set_sample_mask(ctx->cso, ~0);
- cso_set_vertex_elements(ctx->cso, 2, ctx->velem);
- cso_set_stream_outputs(ctx->cso, 0, NULL, NULL);
- cso_set_render_condition(ctx->cso, NULL, FALSE, 0);
+ for (dstLevel = base_level + 1; dstLevel <= last_level; dstLevel++) {
+ blit.src.level = dstLevel - 1;
+ blit.dst.level = dstLevel;
- set_fragment_shader(ctx, type, is_depth);
- set_vertex_shader(ctx);
- cso_set_geometry_shader_handle(ctx->cso, NULL);
+ blit.src.box.width = u_minify(pt->width0, blit.src.level);
+ blit.src.box.height = u_minify(pt->height0, blit.src.level);
- /* init framebuffer state */
- memset(&fb, 0, sizeof(fb));
+ blit.dst.box.width = u_minify(pt->width0, blit.dst.level);
+ blit.dst.box.height = u_minify(pt->height0, blit.dst.level);
- /* set min/mag to same filter for faster sw speed */
- ctx->sampler.mag_img_filter = filter;
- ctx->sampler.min_img_filter = filter;
-
- for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
- const uint srcLevel = dstLevel - 1;
- struct pipe_viewport_state vp;
- unsigned nr_layers, layer, i;
- float rcoord = 0.0f;
-
- if (pt->target == PIPE_TEXTURE_3D)
- nr_layers = u_minify(pt->depth0, dstLevel);
- else if (pt->target == PIPE_TEXTURE_2D_ARRAY ||
- pt->target == PIPE_TEXTURE_1D_ARRAY ||
- pt->target == PIPE_TEXTURE_CUBE_ARRAY)
- nr_layers = pt->array_size;
- else
- nr_layers = 1;
-
- for (i = 0; i < nr_layers; i++) {
- struct pipe_surface *surf, surf_templ;
- if (pt->target == PIPE_TEXTURE_3D) {
- /* in theory with geom shaders and driver with full layer support
- could do that in one go. */
- layer = i;
- /* XXX hmm really? */
- rcoord = (float)layer / (float)nr_layers + 1.0f / (float)(nr_layers * 2);
- } else if (pt->target == PIPE_TEXTURE_2D_ARRAY ||
- pt->target == PIPE_TEXTURE_1D_ARRAY) {
- layer = i;
- rcoord = (float)layer;
- } else if (pt->target == PIPE_TEXTURE_CUBE_ARRAY) {
- layer = i;
- face = layer % 6;
- rcoord = layer / 6;
- } else
- layer = face;
-
- u_surface_default_template(&surf_templ, pt);
- surf_templ.u.tex.level = dstLevel;
- surf_templ.u.tex.first_layer = layer;
- surf_templ.u.tex.last_layer = layer;
- surf = pipe->create_surface(pipe, pt, &surf_templ);
-
- /*
- * Setup framebuffer / dest surface
- */
- if (is_depth) {
- fb.nr_cbufs = 0;
- fb.zsbuf = surf;
- }
- else {
- fb.nr_cbufs = 1;
- fb.cbufs[0] = surf;
- }
- fb.width = u_minify(pt->width0, dstLevel);
- fb.height = u_minify(pt->height0, dstLevel);
- cso_set_framebuffer(ctx->cso, &fb);
-
- /* viewport */
- vp.scale[0] = 0.5f * fb.width;
- vp.scale[1] = 0.5f * fb.height;
- vp.scale[2] = 1.0f;
- vp.scale[3] = 1.0f;
- vp.translate[0] = 0.5f * fb.width;
- vp.translate[1] = 0.5f * fb.height;
- vp.translate[2] = 0.0f;
- vp.translate[3] = 0.0f;
- cso_set_viewport(ctx->cso, &vp);
-
- /*
- * Setup sampler state
- * Note: we should only have to set the min/max LOD clamps to ensure
- * we grab texels from the right mipmap level. But some hardware
- * has trouble with min clamping so we also set the lod_bias to
- * try to work around that.
- */
- ctx->sampler.min_lod = ctx->sampler.max_lod = (float) srcLevel;
- ctx->sampler.lod_bias = (float) srcLevel;
- cso_single_sampler(ctx->cso, PIPE_SHADER_FRAGMENT, 0, &ctx->sampler);
- cso_single_sampler_done(ctx->cso, PIPE_SHADER_FRAGMENT);
-
- cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &psv);
-
- /* quad coords in clip coords */
- offset = set_vertex_data(ctx,
- pt->target,
- face,
- rcoord);
-
- util_draw_vertex_buffer(ctx->pipe,
- ctx->cso,
- ctx->vbuf,
- cso_get_aux_vertex_buffer_slot(ctx->cso),
- offset,
- PIPE_PRIM_TRIANGLE_FAN,
- 4, /* verts */
- 2); /* attribs/vert */
-
- /* need to signal that the texture has changed _after_ rendering to it */
- pipe_surface_reference( &surf, NULL );
+ if (pt->target == PIPE_TEXTURE_3D) {
+ /* generate all layers/slices at once */
+ blit.src.box.z = blit.dst.box.z = 0;
+ blit.src.box.depth = util_max_layer(pt, blit.src.level)+1;
+ blit.dst.box.depth = util_max_layer(pt, blit.dst.level)+1;
+ }
+ else {
+ blit.src.box.z = blit.dst.box.z = first_layer;
+ blit.src.box.depth = blit.dst.box.depth =
+ (last_layer + 1 - first_layer);
}
- }
- /* restore state we changed */
- cso_restore_blend(ctx->cso);
- cso_restore_depth_stencil_alpha(ctx->cso);
- cso_restore_rasterizer(ctx->cso);
- cso_restore_sample_mask(ctx->cso);
- cso_restore_samplers(ctx->cso, PIPE_SHADER_FRAGMENT);
- cso_restore_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT);
- cso_restore_framebuffer(ctx->cso);
- cso_restore_fragment_shader(ctx->cso);
- cso_restore_vertex_shader(ctx->cso);
- cso_restore_geometry_shader(ctx->cso);
- cso_restore_viewport(ctx->cso);
- cso_restore_vertex_elements(ctx->cso);
- cso_restore_stream_outputs(ctx->cso);
- cso_restore_aux_vertex_buffer_slot(ctx->cso);
- cso_restore_render_condition(ctx->cso);
+ pipe->blit(pipe, &blit);
+ }
+ return TRUE;
}
diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.h b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.h
index ffeff425e..99d017888 100644
--- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.h
+++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.h
@@ -35,26 +35,13 @@
extern "C" {
#endif
-
-struct pipe_context;
-struct pipe_resource;
-struct cso_context;
-
-struct gen_mipmap_state;
-
-
-extern struct gen_mipmap_state *
-util_create_gen_mipmap(struct pipe_context *pipe, struct cso_context *cso);
-
-
-extern void
-util_destroy_gen_mipmap(struct gen_mipmap_state *ctx);
+struct pipe_context;
-extern void
-util_gen_mipmap(struct gen_mipmap_state *ctx,
- struct pipe_sampler_view *psv,
- uint layer, uint baseLevel, uint lastLevel, uint filter);
+extern boolean
+util_gen_mipmap(struct pipe_context *pipe, struct pipe_resource *pt,
+ enum pipe_format format, uint base_level, uint last_level,
+ uint first_layer, uint last_layer, uint filter);
#ifdef __cplusplus
diff --git a/mesalib/src/glsl/ast.h b/mesalib/src/glsl/ast.h
index eb047e0a2..a59ebcb9f 100644
--- a/mesalib/src/glsl/ast.h
+++ b/mesalib/src/glsl/ast.h
@@ -221,6 +221,13 @@ public:
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
+ virtual void hir_no_rvalue(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state);
+
+ ir_rvalue *do_hir(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state,
+ bool needs_rvalue);
+
virtual void print(void) const;
enum ast_operators oper;
@@ -291,6 +298,9 @@ public:
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
+ virtual void hir_no_rvalue(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state);
+
private:
/**
* Is this function call actually a constructor?
@@ -363,6 +373,9 @@ public:
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
+
+ virtual void hir_no_rvalue(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state);
};
/**
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index 8f6e90174..717dc68ea 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -56,6 +56,9 @@
#include "glsl_types.h"
#include "program/hash_table.h"
#include "ir.h"
+#include "ir_builder.h"
+
+using namespace ir_builder;
static void
detect_conflicting_assignments(struct _mesa_glsl_parse_state *state,
@@ -733,10 +736,12 @@ mark_whole_array_access(ir_rvalue *access)
}
}
-ir_rvalue *
+static bool
do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
const char *non_lvalue_description,
- ir_rvalue *lhs, ir_rvalue *rhs, bool is_initializer,
+ ir_rvalue *lhs, ir_rvalue *rhs,
+ ir_rvalue **out_rvalue, bool needs_rvalue,
+ bool is_initializer,
YYLTYPE lhs_loc)
{
void *ctx = state;
@@ -855,27 +860,33 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
* to handle things like:
*
* i = j += 1;
- *
- * So we always just store the computed value being assigned to a
- * temporary and return a deref of that temporary. If the rvalue
- * ends up not being used, the temp will get copy-propagated out.
*/
- ir_variable *var = new(ctx) ir_variable(rhs->type, "assignment_tmp",
- ir_var_temporary);
- ir_dereference_variable *deref_var = new(ctx) ir_dereference_variable(var);
- instructions->push_tail(var);
- instructions->push_tail(new(ctx) ir_assignment(deref_var, rhs));
- deref_var = new(ctx) ir_dereference_variable(var);
+ if (needs_rvalue) {
+ ir_variable *var = new(ctx) ir_variable(rhs->type, "assignment_tmp",
+ ir_var_temporary);
+ instructions->push_tail(var);
+ instructions->push_tail(assign(var, rhs));
+
+ if (!error_emitted) {
+ ir_dereference_variable *deref_var = new(ctx) ir_dereference_variable(var);
+ instructions->push_tail(new(ctx) ir_assignment(lhs, deref_var));
+ }
+ ir_rvalue *rvalue = new(ctx) ir_dereference_variable(var);
- if (!error_emitted)
- instructions->push_tail(new(ctx) ir_assignment(lhs, deref_var));
+ if (extract_channel) {
+ rvalue = new(ctx) ir_expression(ir_binop_vector_extract,
+ rvalue,
+ extract_channel->clone(ctx, NULL));
+ }
- if (extract_channel) {
- return new(ctx) ir_expression(ir_binop_vector_extract,
- new(ctx) ir_dereference_variable(var),
- extract_channel->clone(ctx, NULL));
+ *out_rvalue = rvalue;
+ } else {
+ if (!error_emitted)
+ instructions->push_tail(new(ctx) ir_assignment(lhs, rhs));
+ *out_rvalue = NULL;
}
- return new(ctx) ir_dereference_variable(var);
+
+ return error_emitted;
}
static ir_rvalue *
@@ -906,6 +917,20 @@ ast_node::hir(exec_list *instructions,
return NULL;
}
+void
+ast_function_expression::hir_no_rvalue(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ (void)hir(instructions, state);
+}
+
+void
+ast_aggregate_initializer::hir_no_rvalue(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ (void)hir(instructions, state);
+}
+
static ir_rvalue *
do_comparison(void *mem_ctx, int operation, ir_rvalue *op0, ir_rvalue *op1)
{
@@ -1075,6 +1100,21 @@ ir_rvalue *
ast_expression::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
+ return do_hir(instructions, state, true);
+}
+
+void
+ast_expression::hir_no_rvalue(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ do_hir(instructions, state, false);
+}
+
+ir_rvalue *
+ast_expression::do_hir(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state,
+ bool needs_rvalue)
+{
void *ctx = state;
static const int operations[AST_NUM_OPERATORS] = {
-1, /* ast_assign doesn't convert to ir_expression. */
@@ -1148,11 +1188,11 @@ ast_expression::hir(exec_list *instructions,
op[0] = this->subexpressions[0]->hir(instructions, state);
op[1] = this->subexpressions[1]->hir(instructions, state);
- result = do_assignment(instructions, state,
- this->subexpressions[0]->non_lvalue_description,
- op[0], op[1], false,
- this->subexpressions[0]->get_location());
- error_emitted = result->type->is_error();
+ error_emitted =
+ do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0], op[1], &result, needs_rvalue, false,
+ this->subexpressions[0]->get_location());
break;
}
@@ -1418,11 +1458,12 @@ ast_expression::hir(exec_list *instructions,
ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
- result = do_assignment(instructions, state,
- this->subexpressions[0]->non_lvalue_description,
- op[0]->clone(ctx, NULL), temp_rhs, false,
- this->subexpressions[0]->get_location());
- error_emitted = (op[0]->type->is_error());
+ error_emitted =
+ do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0]->clone(ctx, NULL), temp_rhs,
+ &result, needs_rvalue, false,
+ this->subexpressions[0]->get_location());
/* GLSL 1.10 does not allow array assignment. However, we don't have to
* explicitly test for this because none of the binary expression
@@ -1444,11 +1485,12 @@ ast_expression::hir(exec_list *instructions,
temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
- result = do_assignment(instructions, state,
- this->subexpressions[0]->non_lvalue_description,
- op[0]->clone(ctx, NULL), temp_rhs, false,
- this->subexpressions[0]->get_location());
- error_emitted = type->is_error();
+ error_emitted =
+ do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0]->clone(ctx, NULL), temp_rhs,
+ &result, needs_rvalue, false,
+ this->subexpressions[0]->get_location());
break;
}
@@ -1460,11 +1502,12 @@ ast_expression::hir(exec_list *instructions,
&loc);
ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper],
type, op[0], op[1]);
- result = do_assignment(instructions, state,
- this->subexpressions[0]->non_lvalue_description,
- op[0]->clone(ctx, NULL), temp_rhs, false,
- this->subexpressions[0]->get_location());
- error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
+ error_emitted =
+ do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0]->clone(ctx, NULL), temp_rhs,
+ &result, needs_rvalue, false,
+ this->subexpressions[0]->get_location());
break;
}
@@ -1477,11 +1520,12 @@ ast_expression::hir(exec_list *instructions,
state, &loc);
ir_rvalue *temp_rhs = new(ctx) ir_expression(operations[this->oper],
type, op[0], op[1]);
- result = do_assignment(instructions, state,
- this->subexpressions[0]->non_lvalue_description,
- op[0]->clone(ctx, NULL), temp_rhs, false,
- this->subexpressions[0]->get_location());
- error_emitted = op[0]->type->is_error() || op[1]->type->is_error();
+ error_emitted =
+ do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0]->clone(ctx, NULL), temp_rhs,
+ &result, needs_rvalue, false,
+ this->subexpressions[0]->get_location());
break;
}
@@ -1589,11 +1633,12 @@ ast_expression::hir(exec_list *instructions,
temp_rhs = new(ctx) ir_expression(operations[this->oper], type,
op[0], op[1]);
- result = do_assignment(instructions, state,
- this->subexpressions[0]->non_lvalue_description,
- op[0]->clone(ctx, NULL), temp_rhs, false,
- this->subexpressions[0]->get_location());
- error_emitted = op[0]->type->is_error();
+ error_emitted =
+ do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0]->clone(ctx, NULL), temp_rhs,
+ &result, needs_rvalue, false,
+ this->subexpressions[0]->get_location());
break;
}
@@ -1617,12 +1662,14 @@ ast_expression::hir(exec_list *instructions,
*/
result = get_lvalue_copy(instructions, op[0]->clone(ctx, NULL));
- (void)do_assignment(instructions, state,
- this->subexpressions[0]->non_lvalue_description,
- op[0]->clone(ctx, NULL), temp_rhs, false,
- this->subexpressions[0]->get_location());
+ ir_rvalue *junk_rvalue;
+ error_emitted =
+ do_assignment(instructions, state,
+ this->subexpressions[0]->non_lvalue_description,
+ op[0]->clone(ctx, NULL), temp_rhs,
+ &junk_rvalue, false, false,
+ this->subexpressions[0]->get_location());
- error_emitted = op[0]->type->is_error();
break;
}
@@ -1744,9 +1791,9 @@ ast_expression::hir(exec_list *instructions,
}
}
type = NULL; /* use result->type, not type. */
- assert(result != NULL);
+ assert(result != NULL || !needs_rvalue);
- if (result->type->is_error() && !error_emitted)
+ if (result && result->type->is_error() && !error_emitted)
_mesa_glsl_error(& loc, state, "type mismatch");
return result;
@@ -1767,7 +1814,7 @@ ast_expression_statement::hir(exec_list *instructions,
* anything in that case.
*/
if (expression != NULL)
- expression->hir(instructions, state);
+ expression->hir_no_rvalue(instructions, state);
/* Statements do not have r-values.
*/
@@ -2831,10 +2878,12 @@ process_initializer(ir_variable *var, ast_declaration *decl,
*/
const glsl_type *initializer_type;
if (!type->qualifier.flags.q.uniform) {
- result = do_assignment(initializer_instructions, state,
- NULL,
- lhs, rhs, true,
- type->get_location());
+ do_assignment(initializer_instructions, state,
+ NULL,
+ lhs, rhs,
+ &result, true,
+ true,
+ type->get_location());
initializer_type = result->type;
} else
initializer_type = rhs->type;
@@ -5267,12 +5316,19 @@ ast_interface_block::hir(exec_list *instructions,
earlier->reinit_interface_type(block_type);
delete var;
} else {
+ /* Propagate the "binding" keyword into this UBO's fields;
+ * the UBO declaration itself doesn't get an ir_variable unless it
+ * has an instance name. This is ugly.
+ */
+ var->data.explicit_binding = this->layout.flags.q.explicit_binding;
+ var->data.binding = this->layout.binding;
+
state->symbols->add_variable(var);
instructions->push_tail(var);
}
} else {
/* In order to have an array size, the block must also be declared with
- * an instane name.
+ * an instance name.
*/
assert(this->array_specifier == NULL);
diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp
index 61ae62150..03c2a972a 100644
--- a/mesalib/src/glsl/glsl_parser_extras.cpp
+++ b/mesalib/src/glsl/glsl_parser_extras.cpp
@@ -66,10 +66,6 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
this->translation_unit.make_empty();
this->symbols = new(mem_ctx) glsl_symbol_table;
- this->num_uniform_blocks = 0;
- this->uniform_block_array_size = 0;
- this->uniform_blocks = NULL;
-
this->info_log = ralloc_strdup(mem_ctx, "");
this->error = false;
this->loop_nesting_ast = NULL;
@@ -1448,7 +1444,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
/* Do some optimization at compile time to reduce shader IR size
* and reduce later work if the same shader is linked multiple times
*/
- while (do_common_optimization(shader->ir, false, false, 32, options))
+ while (do_common_optimization(shader->ir, false, false, options,
+ ctx->Const.NativeIntegers))
;
validate_ir_tree(shader->ir);
@@ -1464,12 +1461,6 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
shader->IsES = state->es_shader;
shader->uses_builtin_functions = state->uses_builtin_functions;
- if (shader->UniformBlocks)
- ralloc_free(shader->UniformBlocks);
- shader->NumUniformBlocks = state->num_uniform_blocks;
- shader->UniformBlocks = state->uniform_blocks;
- ralloc_steal(shader, shader->UniformBlocks);
-
if (!state->error)
set_shader_inout_layout(shader, state);
@@ -1501,8 +1492,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
bool
do_common_optimization(exec_list *ir, bool linked,
bool uniform_locations_assigned,
- unsigned max_unroll_iterations,
- const struct gl_shader_compiler_options *options)
+ const struct gl_shader_compiler_options *options,
+ bool native_integers)
{
GLboolean progress = GL_FALSE;
@@ -1538,7 +1529,7 @@ do_common_optimization(exec_list *ir, bool linked,
progress = do_constant_variable_unlinked(ir) || progress;
progress = do_constant_folding(ir) || progress;
progress = do_cse(ir) || progress;
- progress = do_algebraic(ir) || progress;
+ progress = do_algebraic(ir, native_integers) || progress;
progress = do_lower_jumps(ir) || progress;
progress = do_vec_index_to_swizzle(ir) || progress;
progress = lower_vector_insert(ir, false) || progress;
@@ -1551,7 +1542,7 @@ do_common_optimization(exec_list *ir, bool linked,
loop_state *ls = analyze_loop_variables(ir);
if (ls->loop_found) {
progress = set_loop_controls(ir, ls) || progress;
- progress = unroll_loops(ir, ls, max_unroll_iterations) || progress;
+ progress = unroll_loops(ir, ls, options) || progress;
}
delete ls;
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index 2e22c8c91..0fd778dc3 100644
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -179,10 +179,6 @@ struct _mesa_glsl_parse_state {
exec_list translation_unit;
glsl_symbol_table *symbols;
- unsigned num_uniform_blocks;
- unsigned uniform_block_array_size;
- struct gl_uniform_block *uniform_blocks;
-
unsigned num_supported_versions;
struct {
unsigned ver;
diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp
index 85fbfa9c4..f8f661d5e 100644
--- a/mesalib/src/glsl/ir.cpp
+++ b/mesalib/src/glsl/ir.cpp
@@ -1223,6 +1223,15 @@ ir_constant::is_basis() const
return ones == 1;
}
+bool
+ir_constant::is_uint16_constant() const
+{
+ if (!type->is_integer())
+ return false;
+
+ return value.u[0] < (1 << 16);
+}
+
ir_loop::ir_loop()
{
this->ir_type = ir_type_loop;
diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h
index ee276d2be..6c7c60a27 100644
--- a/mesalib/src/glsl/ir.h
+++ b/mesalib/src/glsl/ir.h
@@ -265,6 +265,13 @@ public:
*/
virtual bool is_basis() const;
+ /**
+ * Determine if an r-value is an unsigned integer constant which can be
+ * stored in 16 bits.
+ *
+ * \sa ir_constant::is_uint16_constant.
+ */
+ virtual bool is_uint16_constant() const { return false; }
/**
* Return a generic value of error_type.
@@ -2165,6 +2172,14 @@ public:
virtual bool is_basis() const;
/**
+ * Return true for constants that could be stored as 16-bit unsigned values.
+ *
+ * Note that this will return true even for signed integer ir_constants, as
+ * long as the value is non-negative and fits in 16-bits.
+ */
+ virtual bool is_uint16_constant() const;
+
+ /**
* Value of the constant.
*
* The field used to back the values supplied by the constant is determined
diff --git a/mesalib/src/glsl/ir_optimization.h b/mesalib/src/glsl/ir_optimization.h
index 5f4a2f405..40bb61392 100644
--- a/mesalib/src/glsl/ir_optimization.h
+++ b/mesalib/src/glsl/ir_optimization.h
@@ -66,10 +66,10 @@ enum lower_packing_builtins_op {
bool do_common_optimization(exec_list *ir, bool linked,
bool uniform_locations_assigned,
- unsigned max_unroll_iterations,
- const struct gl_shader_compiler_options *options);
+ const struct gl_shader_compiler_options *options,
+ bool native_integers);
-bool do_algebraic(exec_list *instructions);
+bool do_algebraic(exec_list *instructions, bool native_integers);
bool do_constant_folding(exec_list *instructions);
bool do_constant_variable(exec_list *instructions);
bool do_constant_variable_unlinked(exec_list *instructions);
diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp
index 527acea4c..71defc815 100644
--- a/mesalib/src/glsl/ir_validate.cpp
+++ b/mesalib/src/glsl/ir_validate.cpp
@@ -381,6 +381,9 @@ ir_validate::visit_leave(ir_expression *ir)
case ir_binop_min:
case ir_binop_max:
case ir_binop_pow:
+ assert(ir->operands[0]->type->base_type ==
+ ir->operands[1]->type->base_type);
+
if (ir->operands[0]->type->is_scalar())
assert(ir->operands[1]->type == ir->type);
else if (ir->operands[1]->type->is_scalar())
diff --git a/mesalib/src/glsl/link_uniform_block_active_visitor.cpp b/mesalib/src/glsl/link_uniform_block_active_visitor.cpp
index f2f46a211..d19ce20c7 100644
--- a/mesalib/src/glsl/link_uniform_block_active_visitor.cpp
+++ b/mesalib/src/glsl/link_uniform_block_active_visitor.cpp
@@ -46,6 +46,14 @@ process_block(void *mem_ctx, struct hash_table *ht, ir_variable *var)
b->type = block_type;
b->has_instance_name = var->is_interface_instance();
+ if (var->data.explicit_binding) {
+ b->has_binding = true;
+ b->binding = var->data.binding;
+ } else {
+ b->has_binding = false;
+ b->binding = 0;
+ }
+
_mesa_hash_table_insert(ht, h, var->get_interface_type()->name,
(void *) b);
return b;
diff --git a/mesalib/src/glsl/link_uniform_block_active_visitor.h b/mesalib/src/glsl/link_uniform_block_active_visitor.h
index fba628a8f..d76dbcaf1 100644
--- a/mesalib/src/glsl/link_uniform_block_active_visitor.h
+++ b/mesalib/src/glsl/link_uniform_block_active_visitor.h
@@ -36,7 +36,10 @@ struct link_uniform_block_active {
unsigned *array_elements;
unsigned num_array_elements;
+ unsigned binding;
+
bool has_instance_name;
+ bool has_binding;
};
class link_uniform_block_active_visitor : public ir_hierarchical_visitor {
diff --git a/mesalib/src/glsl/link_uniform_blocks.cpp b/mesalib/src/glsl/link_uniform_blocks.cpp
index 72d6c5323..1a0e64318 100644
--- a/mesalib/src/glsl/link_uniform_blocks.cpp
+++ b/mesalib/src/glsl/link_uniform_blocks.cpp
@@ -251,7 +251,17 @@ link_uniform_blocks(void *mem_ctx,
blocks[i].Name = ralloc_asprintf(blocks, "%s[%u]", name,
b->array_elements[j]);
blocks[i].Uniforms = &variables[parcel.index];
- blocks[i].Binding = 0;
+
+ /* The GL_ARB_shading_language_420pack spec says:
+ *
+ * "If the binding identifier is used with a uniform block
+ * instanced as an array then the first element of the array
+ * takes the specified block binding and each subsequent
+ * element takes the next consecutive uniform block binding
+ * point."
+ */
+ blocks[i].Binding = (b->has_binding) ? b->binding + j : 0;
+
blocks[i].UniformBufferSize = 0;
blocks[i]._Packing =
gl_uniform_block_packing(block_type->interface_packing);
@@ -269,7 +279,7 @@ link_uniform_blocks(void *mem_ctx,
} else {
blocks[i].Name = ralloc_strdup(blocks, block_type->name);
blocks[i].Uniforms = &variables[parcel.index];
- blocks[i].Binding = 0;
+ blocks[i].Binding = (b->has_binding) ? b->binding : 0;
blocks[i].UniformBufferSize = 0;
blocks[i]._Packing =
gl_uniform_block_packing(block_type->interface_packing);
diff --git a/mesalib/src/glsl/link_uniform_initializers.cpp b/mesalib/src/glsl/link_uniform_initializers.cpp
index 9d6977d57..e60bb64bc 100644
--- a/mesalib/src/glsl/link_uniform_initializers.cpp
+++ b/mesalib/src/glsl/link_uniform_initializers.cpp
@@ -46,6 +46,18 @@ get_storage(gl_uniform_storage *storage, unsigned num_storage,
return NULL;
}
+static unsigned
+get_uniform_block_index(const gl_shader_program *shProg,
+ const char *uniformBlockName)
+{
+ for (unsigned i = 0; i < shProg->NumUniformBlocks; i++) {
+ if (!strcmp(shProg->UniformBlocks[i].Name, uniformBlockName))
+ return i;
+ }
+
+ return GL_INVALID_INDEX;
+}
+
void
copy_constant_to_storage(union gl_constant_value *storage,
const ir_constant *val,
@@ -84,8 +96,7 @@ copy_constant_to_storage(union gl_constant_value *storage,
}
void
-set_uniform_binding(void *mem_ctx, gl_shader_program *prog,
- const char *name, const glsl_type *type, int binding)
+set_sampler_binding(gl_shader_program *prog, const char *name, int binding)
{
struct gl_uniform_storage *const storage =
get_storage(prog->UniformStorage, prog->NumUserUniformStorage, name);
@@ -95,42 +106,53 @@ set_uniform_binding(void *mem_ctx, gl_shader_program *prog,
return;
}
- if (storage->type->is_sampler()) {
- unsigned elements = MAX2(storage->array_elements, 1);
+ const unsigned elements = MAX2(storage->array_elements, 1);
- /* From section 4.4.4 of the GLSL 4.20 specification:
- * "If the binding identifier is used with an array, the first element
- * of the array takes the specified unit and each subsequent element
- * takes the next consecutive unit."
- */
- for (unsigned int i = 0; i < elements; i++) {
- storage->storage[i].i = binding + i;
- }
+ /* Section 4.4.4 (Opaque-Uniform Layout Qualifiers) of the GLSL 4.20 spec
+ * says:
+ *
+ * "If the binding identifier is used with an array, the first element
+ * of the array takes the specified unit and each subsequent element
+ * takes the next consecutive unit."
+ */
+ for (unsigned int i = 0; i < elements; i++) {
+ storage->storage[i].i = binding + i;
+ }
- for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
- gl_shader *shader = prog->_LinkedShaders[sh];
+ for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
+ gl_shader *shader = prog->_LinkedShaders[sh];
- if (shader && storage->sampler[sh].active) {
- for (unsigned i = 0; i < elements; i++) {
- unsigned index = storage->sampler[sh].index + i;
+ if (shader && storage->sampler[sh].active) {
+ for (unsigned i = 0; i < elements; i++) {
+ unsigned index = storage->sampler[sh].index + i;
- shader->SamplerUnits[index] = storage->storage[i].i;
- }
+ shader->SamplerUnits[index] = storage->storage[i].i;
}
}
- } else if (storage->block_index != -1) {
+ }
+
+ storage->initialized = true;
+}
+
+void
+set_block_binding(gl_shader_program *prog, const char *block_name, int binding)
+{
+ const unsigned block_index = get_uniform_block_index(prog, block_name);
+
+ if (block_index == GL_INVALID_INDEX) {
+ assert(block_index != GL_INVALID_INDEX);
+ return;
+ }
+
/* This is a field of a UBO. val is the binding index. */
for (int i = 0; i < MESA_SHADER_STAGES; i++) {
- int stage_index = prog->UniformBlockStageIndex[i][storage->block_index];
+ int stage_index = prog->UniformBlockStageIndex[i][block_index];
if (stage_index != -1) {
struct gl_shader *sh = prog->_LinkedShaders[i];
sh->UniformBlocks[stage_index].Binding = binding;
}
}
- }
-
- storage->initialized = true;
}
void
@@ -232,8 +254,51 @@ link_set_uniform_initializers(struct gl_shader_program *prog)
mem_ctx = ralloc_context(NULL);
if (var->data.explicit_binding) {
- linker::set_uniform_binding(mem_ctx, prog, var->name,
- var->type, var->data.binding);
+ const glsl_type *const type = var->type;
+
+ if (type->is_sampler()
+ || (type->is_array() && type->fields.array->is_sampler())) {
+ linker::set_sampler_binding(prog, var->name, var->data.binding);
+ } else if (var->is_in_uniform_block()) {
+ const glsl_type *const iface_type = var->get_interface_type();
+
+ /* If the variable is an array and it is an interface instance,
+ * we need to set the binding for each array element. Just
+ * checking that the variable is an array is not sufficient.
+ * The variable could be an array element of a uniform block
+ * that lacks an instance name. For example:
+ *
+ * uniform U {
+ * float f[4];
+ * };
+ *
+ * In this case "f" would pass is_in_uniform_block (above) and
+ * type->is_array(), but it will fail is_interface_instance().
+ */
+ if (var->is_interface_instance() && var->type->is_array()) {
+ for (unsigned i = 0; i < var->type->length; i++) {
+ const char *name =
+ ralloc_asprintf(mem_ctx, "%s[%u]", iface_type->name, i);
+
+ /* Section 4.4.3 (Uniform Block Layout Qualifiers) of the
+ * GLSL 4.20 spec says:
+ *
+ * "If the binding identifier is used with a uniform
+ * block instanced as an array then the first element
+ * of the array takes the specified block binding and
+ * each subsequent element takes the next consecutive
+ * uniform block binding point."
+ */
+ linker::set_block_binding(prog, name,
+ var->data.binding + i);
+ }
+ } else {
+ linker::set_block_binding(prog, iface_type->name,
+ var->data.binding);
+ }
+ } else {
+ assert(!"Explicit binding not on a sampler or UBO.");
+ }
} else if (var->constant_value) {
linker::set_uniform_initializer(mem_ctx, prog, var->name,
var->type, var->constant_value);
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index 3bf278965..c8dc0661d 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -2296,9 +2296,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
lower_clip_distance(prog->_LinkedShaders[i]);
}
- unsigned max_unroll = ctx->ShaderCompilerOptions[i].MaxUnrollIterations;
-
- while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, max_unroll, &ctx->ShaderCompilerOptions[i]))
+ while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false,
+ &ctx->ShaderCompilerOptions[i],
+ ctx->Const.NativeIntegers))
;
}
diff --git a/mesalib/src/glsl/loop_analysis.h b/mesalib/src/glsl/loop_analysis.h
index f841042f0..295dc797c 100644
--- a/mesalib/src/glsl/loop_analysis.h
+++ b/mesalib/src/glsl/loop_analysis.h
@@ -53,7 +53,8 @@ set_loop_controls(exec_list *instructions, loop_state *ls);
extern bool
-unroll_loops(exec_list *instructions, loop_state *ls, unsigned max_iterations);
+unroll_loops(exec_list *instructions, loop_state *ls,
+ const struct gl_shader_compiler_options *options);
ir_rvalue *
find_initial_value(ir_loop *loop, ir_variable *var);
diff --git a/mesalib/src/glsl/loop_unroll.cpp b/mesalib/src/glsl/loop_unroll.cpp
index 789655ebd..da532804a 100644
--- a/mesalib/src/glsl/loop_unroll.cpp
+++ b/mesalib/src/glsl/loop_unroll.cpp
@@ -25,15 +25,18 @@
#include "loop_analysis.h"
#include "ir_hierarchical_visitor.h"
+#include "main/mtypes.h"
+
namespace {
class loop_unroll_visitor : public ir_hierarchical_visitor {
public:
- loop_unroll_visitor(loop_state *state, unsigned max_iterations)
+ loop_unroll_visitor(loop_state *state,
+ const struct gl_shader_compiler_options *options)
{
this->state = state;
this->progress = false;
- this->max_iterations = max_iterations;
+ this->options = options;
}
virtual ir_visitor_status visit_leave(ir_loop *ir);
@@ -45,7 +48,7 @@ public:
loop_state *state;
bool progress;
- unsigned max_iterations;
+ const struct gl_shader_compiler_options *options;
};
} /* anonymous namespace */
@@ -60,12 +63,17 @@ is_break(ir_instruction *ir)
class loop_unroll_count : public ir_hierarchical_visitor {
public:
int nodes;
- bool fail;
+ bool unsupported_variable_indexing;
+ /* If there are nested loops, the node count will be inaccurate. */
+ bool nested_loop;
- loop_unroll_count(exec_list *list)
+ loop_unroll_count(exec_list *list, loop_variable_state *ls,
+ const struct gl_shader_compiler_options *options)
+ : ls(ls), options(options)
{
nodes = 0;
- fail = false;
+ nested_loop = false;
+ unsupported_variable_indexing = false;
run(list);
}
@@ -84,9 +92,57 @@ public:
virtual ir_visitor_status visit_enter(ir_loop *)
{
- fail = true;
+ nested_loop = true;
+ return visit_continue;
+ }
+
+ virtual ir_visitor_status visit_enter(ir_dereference_array *ir)
+ {
+ /* Check for arrays variably-indexed by a loop induction variable.
+ * Unrolling the loop may convert that access into constant-indexing.
+ *
+ * Many drivers don't support particular kinds of variable indexing,
+ * and have to resort to using lower_variable_index_to_cond_assign to
+ * handle it. This results in huge amounts of horrible code, so we'd
+ * like to avoid that if possible. Here, we just note that it will
+ * happen.
+ */
+ if ((ir->array->type->is_array() || ir->array->type->is_matrix()) &&
+ !ir->array_index->as_constant()) {
+ ir_variable *array = ir->array->variable_referenced();
+ loop_variable *lv = ls->get(ir->array_index->variable_referenced());
+ if (array && lv && lv->is_induction_var()) {
+ switch (array->data.mode) {
+ case ir_var_auto:
+ case ir_var_temporary:
+ case ir_var_const_in:
+ case ir_var_function_in:
+ case ir_var_function_out:
+ case ir_var_function_inout:
+ if (options->EmitNoIndirectTemp)
+ unsupported_variable_indexing = true;
+ break;
+ case ir_var_uniform:
+ if (options->EmitNoIndirectUniform)
+ unsupported_variable_indexing = true;
+ break;
+ case ir_var_shader_in:
+ if (options->EmitNoIndirectInput)
+ unsupported_variable_indexing = true;
+ break;
+ case ir_var_shader_out:
+ if (options->EmitNoIndirectOutput)
+ unsupported_variable_indexing = true;
+ break;
+ }
+ }
+ }
return visit_continue;
}
+
+private:
+ loop_variable_state *ls;
+ const struct gl_shader_compiler_options *options;
};
@@ -244,16 +300,21 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
iterations = ls->limiting_terminator->iterations;
+ const int max_iterations = options->MaxUnrollIterations;
+
/* Don't try to unroll loops that have zillions of iterations either.
*/
- if (iterations > (int) max_iterations)
+ if (iterations > max_iterations)
return visit_continue;
/* Don't try to unroll nested loops and loops with a huge body.
*/
- loop_unroll_count count(&ir->body_instructions);
+ loop_unroll_count count(&ir->body_instructions, ls, options);
+
+ bool loop_too_large =
+ count.nested_loop || count.nodes * iterations > max_iterations * 5;
- if (count.fail || count.nodes * iterations > (int)max_iterations * 5)
+ if (loop_too_large && !count.unsupported_variable_indexing)
return visit_continue;
/* Note: the limiting terminator contributes 1 to ls->num_loop_jumps.
@@ -338,9 +399,10 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
bool
-unroll_loops(exec_list *instructions, loop_state *ls, unsigned max_iterations)
+unroll_loops(exec_list *instructions, loop_state *ls,
+ const struct gl_shader_compiler_options *options)
{
- loop_unroll_visitor v(ls, max_iterations);
+ loop_unroll_visitor v(ls, options);
v.run(instructions);
diff --git a/mesalib/src/glsl/lower_ubo_reference.cpp b/mesalib/src/glsl/lower_ubo_reference.cpp
index c73b148b0..90e65bd0e 100644
--- a/mesalib/src/glsl/lower_ubo_reference.cpp
+++ b/mesalib/src/glsl/lower_ubo_reference.cpp
@@ -194,12 +194,16 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue)
array_stride = glsl_align(array_stride, 16);
}
- ir_constant *const_index = deref_array->array_index->as_constant();
+ ir_rvalue *array_index = deref_array->array_index;
+ if (array_index->type->base_type == GLSL_TYPE_INT)
+ array_index = i2u(array_index);
+
+ ir_constant *const_index = array_index->as_constant();
if (const_index) {
- const_offset += array_stride * const_index->value.i[0];
+ const_offset += array_stride * const_index->value.u[0];
} else {
offset = add(offset,
- mul(deref_array->array_index,
+ mul(array_index,
new(mem_ctx) ir_constant(array_stride)));
}
deref = deref_array->array->as_dereference();
diff --git a/mesalib/src/glsl/opt_algebraic.cpp b/mesalib/src/glsl/opt_algebraic.cpp
index 8494bd9ec..9d5539252 100644
--- a/mesalib/src/glsl/opt_algebraic.cpp
+++ b/mesalib/src/glsl/opt_algebraic.cpp
@@ -45,10 +45,11 @@ namespace {
class ir_algebraic_visitor : public ir_rvalue_visitor {
public:
- ir_algebraic_visitor()
+ ir_algebraic_visitor(bool native_integers)
{
this->progress = false;
this->mem_ctx = NULL;
+ this->native_integers = native_integers;
}
virtual ~ir_algebraic_visitor()
@@ -70,6 +71,7 @@ public:
void *mem_ctx;
+ bool native_integers;
bool progress;
};
@@ -445,6 +447,28 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
}
break;
+ case ir_binop_less:
+ case ir_binop_lequal:
+ case ir_binop_greater:
+ case ir_binop_gequal:
+ case ir_binop_equal:
+ case ir_binop_nequal:
+ for (int add_pos = 0; add_pos < 2; add_pos++) {
+ ir_expression *add = op_expr[add_pos];
+
+ if (!add || add->operation != ir_binop_add)
+ continue;
+
+ ir_constant *zero = op_const[1 - add_pos];
+ if (!is_vec_zero(zero))
+ continue;
+
+ return new(mem_ctx) ir_expression(ir->operation,
+ add->operands[0],
+ neg(add->operands[1]));
+ }
+ break;
+
case ir_binop_rshift:
case ir_binop_lshift:
/* 0 >> x == 0 */
@@ -623,9 +647,9 @@ ir_algebraic_visitor::handle_rvalue(ir_rvalue **rvalue)
}
bool
-do_algebraic(exec_list *instructions)
+do_algebraic(exec_list *instructions, bool native_integers)
{
- ir_algebraic_visitor v;
+ ir_algebraic_visitor v(native_integers);
visit_list_elements(&v, instructions);
diff --git a/mesalib/src/glsl/opt_tree_grafting.cpp b/mesalib/src/glsl/opt_tree_grafting.cpp
index f3bd580af..d47613c21 100644
--- a/mesalib/src/glsl/opt_tree_grafting.cpp
+++ b/mesalib/src/glsl/opt_tree_grafting.cpp
@@ -127,12 +127,12 @@ ir_tree_grafting_visitor::do_graft(ir_rvalue **rvalue)
return false;
if (debug) {
- printf("GRAFTING:\n");
- this->graft_assign->print();
- printf("\n");
- printf("TO:\n");
- (*rvalue)->print();
- printf("\n");
+ fprintf(stderr, "GRAFTING:\n");
+ this->graft_assign->fprint(stderr);
+ fprintf(stderr, "\n");
+ fprintf(stderr, "TO:\n");
+ (*rvalue)->fprint(stderr);
+ fprintf(stderr, "\n");
}
this->graft_assign->remove();
@@ -164,9 +164,9 @@ ir_tree_grafting_visitor::check_graft(ir_instruction *ir, ir_variable *var)
{
if (dereferences_variable(this->graft_assign->rhs, var)) {
if (debug) {
- printf("graft killed by: ");
- ir->print();
- printf("\n");
+ fprintf(stderr, "graft killed by: ");
+ ir->fprint(stderr);
+ fprintf(stderr, "\n");
}
return visit_stop;
}
@@ -316,9 +316,9 @@ try_tree_grafting(ir_assignment *start,
ir_tree_grafting_visitor v(start, lhs_var);
if (debug) {
- printf("trying to graft: ");
- lhs_var->print();
- printf("\n");
+ fprintf(stderr, "trying to graft: ");
+ lhs_var->fprint(stderr);
+ fprintf(stderr, "\n");
}
for (ir_instruction *ir = (ir_instruction *)start->next;
@@ -326,9 +326,9 @@ try_tree_grafting(ir_assignment *start,
ir = (ir_instruction *)ir->next) {
if (debug) {
- printf("- ");
- ir->print();
- printf("\n");
+ fprintf(stderr, "- ");
+ ir->fprint(stderr);
+ fprintf(stderr, "\n");
}
ir_visitor_status s = ir->accept(&v);
diff --git a/mesalib/src/glsl/opt_vectorize.cpp b/mesalib/src/glsl/opt_vectorize.cpp
index 3306397fd..f9a3b6183 100644
--- a/mesalib/src/glsl/opt_vectorize.cpp
+++ b/mesalib/src/glsl/opt_vectorize.cpp
@@ -260,6 +260,7 @@ ir_vectorize_visitor::visit_enter(ir_assignment *ir)
if (ir->condition ||
this->channels >= 4 ||
!single_channel_write_mask(ir->write_mask) ||
+ this->assignment[write_mask_to_swizzle(ir->write_mask)] != NULL ||
(lhs && !ir->lhs->equals(lhs)) ||
(rhs && !ir->rhs->equals(rhs, ir_type_swizzle))) {
try_vectorize();
diff --git a/mesalib/src/glsl/test_optpass.cpp b/mesalib/src/glsl/test_optpass.cpp
index f1b9579cd..db5cb2662 100644
--- a/mesalib/src/glsl/test_optpass.cpp
+++ b/mesalib/src/glsl/test_optpass.cpp
@@ -62,11 +62,10 @@ do_optimization(struct exec_list *ir, const char *optimization,
int int_3;
int int_4;
- if (sscanf(optimization, "do_common_optimization ( %d , %d ) ",
- &int_0, &int_1) == 2) {
- return do_common_optimization(ir, int_0 != 0, false, int_1, options);
+ if (sscanf(optimization, "do_common_optimization ( %d ) ", &int_0) == 1) {
+ return do_common_optimization(ir, int_0 != 0, false, options, true);
} else if (strcmp(optimization, "do_algebraic") == 0) {
- return do_algebraic(ir);
+ return do_algebraic(ir, true);
} else if (strcmp(optimization, "do_constant_folding") == 0) {
return do_constant_folding(ir);
} else if (strcmp(optimization, "do_constant_variable") == 0) {
diff --git a/mesalib/src/loader/loader.c b/mesalib/src/loader/loader.c
index e343f4a57..666d0158a 100644
--- a/mesalib/src/loader/loader.c
+++ b/mesalib/src/loader/loader.c
@@ -202,7 +202,7 @@ out:
return (*chip_id >= 0);
}
-#elif defined(ANDROID) && !defined(__NOT_HAVE_DRM_H)
+#elif !defined(__NOT_HAVE_DRM_H)
/* for i915 */
#include <i915_drm.h>
@@ -219,12 +219,12 @@ loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
version = drmGetVersion(fd);
if (!version) {
log_(_LOADER_WARNING, "MESA-LOADER: invalid drm fd\n");
- return FALSE;
+ return 0;
}
if (!version->name) {
log_(_LOADER_WARNING, "MESA-LOADER: unable to determine the driver name\n");
drmFreeVersion(version);
- return FALSE;
+ return 0;
}
if (strcmp(version->name, "i915") == 0) {
diff --git a/mesalib/src/mapi/Makefile.sources b/mesalib/src/mapi/Makefile.sources
index aff465a60..37ca4842c 100644
--- a/mesalib/src/mapi/Makefile.sources
+++ b/mesalib/src/mapi/Makefile.sources
@@ -15,22 +15,37 @@
# this mode, compile MAPI_BRIDGE_FILES with MAPI_MODE_BRIDGE defined.
MAPI_UTIL_FILES = \
+ $(TOP)/src/mapi/u_compiler.h \
$(TOP)/src/mapi/u_current.c \
- $(TOP)/src/mapi/u_execmem.c
+ $(TOP)/src/mapi/u_current.h \
+ $(TOP)/src/mapi/u_execmem.c \
+ $(TOP)/src/mapi/u_execmem.h \
+ $(TOP)/src/mapi/u_macros.h \
+ $(TOP)/src/mapi/u_thread.h
-MAPI_FILES = \
+MAPI_BRIDGE_FILES = \
$(TOP)/src/mapi/entry.c \
+ $(TOP)/src/mapi/entry.h \
+ $(TOP)/src/mapi/entry_x86-64_tls.h \
+ $(TOP)/src/mapi/entry_x86_tls.h \
+ $(TOP)/src/mapi/entry_x86_tsd.h \
+ $(TOP)/src/mapi/mapi_tmp.h
+
+MAPI_FILES = \
$(TOP)/src/mapi/mapi.c \
+ $(TOP)/src/mapi/mapi.h \
$(TOP)/src/mapi/stub.c \
+ $(TOP)/src/mapi/stub.h \
$(TOP)/src/mapi/table.c \
+ $(TOP)/src/mapi/table.h \
$(MAPI_UTIL_FILES)
MAPI_GLAPI_FILES = \
$(TOP)/src/mapi/entry.c \
$(TOP)/src/mapi/mapi_glapi.c \
$(TOP)/src/mapi/stub.c \
+ $(TOP)/src/mapi/stub.h \
$(TOP)/src/mapi/table.c \
+ $(TOP)/src/mapi/table.h \
$(MAPI_UTIL_FILES)
-MAPI_BRIDGE_FILES = \
- $(TOP)/src/mapi/entry.c
diff --git a/mesalib/src/mapi/glapi/Makefile.sources b/mesalib/src/mapi/glapi/Makefile.sources
index 100e6347e..04fef6c9e 100644
--- a/mesalib/src/mapi/glapi/Makefile.sources
+++ b/mesalib/src/mapi/glapi/Makefile.sources
@@ -6,7 +6,9 @@ GLAPI_SOURCES = \
glapi_gentable.c \
glapi_getproc.c \
glapi_nop.c \
- glapi.c
+ glapi.c \
+ glapi.h \
+ glapi_priv.h
X86_API = \
glapi_x86.S
diff --git a/mesalib/src/mapi/glapi/gen/ARB_separate_shader_objects.xml b/mesalib/src/mapi/glapi/gen/ARB_separate_shader_objects.xml
index 80234ea5e..d006917af 100644
--- a/mesalib/src/mapi/glapi/gen/ARB_separate_shader_objects.xml
+++ b/mesalib/src/mapi/glapi/gen/ARB_separate_shader_objects.xml
@@ -15,69 +15,69 @@
<enum name="ALL_SHADER_BITS" value="0xFFFFFFFF"/>
<enum name="PROGRAM_SEPARABLE" value="0x8258"/>
- <function name="UseProgramStages" offset="assign">
+ <function name="UseProgramStages" offset="assign" static_dispatch="false">
<param name="pipeline" type="GLuint" />
<param name="stages" type="GLbitfield" />
<param name="program" type="GLuint" />
</function>
- <function name="ActiveShaderProgram" offset="assign">
+ <function name="ActiveShaderProgram" offset="assign" static_dispatch="false">
<param name="pipeline" type="GLuint" />
<param name="program" type="GLuint" />
</function>
- <function name="CreateShaderProgramv" offset="assign">
+ <function name="CreateShaderProgramv" offset="assign" static_dispatch="false">
<param name="type" type="GLenum" />
<param name="count" type="GLsizei" />
<param name="strings" type="const GLchar * const *" />
<return type="GLuint"/>
</function>
- <function name="BindProgramPipeline" offset="assign">
+ <function name="BindProgramPipeline" offset="assign" static_dispatch="false">
<param name="pipeline" type="GLuint" />
</function>
- <function name="DeleteProgramPipelines" offset="assign">
+ <function name="DeleteProgramPipelines" offset="assign" static_dispatch="false">
<param name="n" type="GLsizei" />
<param name="pipelines" type="const GLuint *" />
</function>
- <function name="GenProgramPipelines" offset="assign">
+ <function name="GenProgramPipelines" offset="assign" static_dispatch="false">
<param name="n" type="GLsizei" />
<param name="pipelines" type="GLuint *" />
</function>
- <function name="IsProgramPipeline" offset="assign">
+ <function name="IsProgramPipeline" offset="assign" static_dispatch="false">
<param name="pipeline" type="GLuint" />
<return type="GLboolean"/>
</function>
<!-- Function already included on ARB_get_program_binary.xml. Keep a commented
version here for completeness -->
<!--
- <function name="ProgramParameteri" offset="assign" es2="3.0">
+ <function name="ProgramParameteri" offset="assign" es2="3.0" static_dispatch="false">
<param name="program" type="GLuint"/>
<param name="pname" type="GLenum"/>
<param name="value" type="GLint"/>
</function>
-->
- <function name="GetProgramPipelineiv" offset="assign">
+ <function name="GetProgramPipelineiv" offset="assign" static_dispatch="false">
<param name="pipeline" type="GLuint" />
<param name="pname" type="GLenum" />
<param name="params" type="GLint *" />
</function>
- <function name="ProgramUniform1i" offset="assign">
+ <function name="ProgramUniform1i" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLint" />
</function>
- <function name="ProgramUniform2i" offset="assign">
+ <function name="ProgramUniform2i" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLint" />
<param name="y" type="GLint" />
</function>
- <function name="ProgramUniform3i" offset="assign">
+ <function name="ProgramUniform3i" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLint" />
<param name="y" type="GLint" />
<param name="z" type="GLint" />
</function>
- <function name="ProgramUniform4i" offset="assign">
+ <function name="ProgramUniform4i" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLint" />
@@ -85,25 +85,25 @@
<param name="z" type="GLint" />
<param name="w" type="GLint" />
</function>
- <function name="ProgramUniform1ui" offset="assign">
+ <function name="ProgramUniform1ui" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLuint" />
</function>
- <function name="ProgramUniform2ui" offset="assign">
+ <function name="ProgramUniform2ui" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLuint" />
<param name="y" type="GLuint" />
</function>
- <function name="ProgramUniform3ui" offset="assign">
+ <function name="ProgramUniform3ui" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLuint" />
<param name="y" type="GLuint" />
<param name="z" type="GLuint" />
</function>
- <function name="ProgramUniform4ui" offset="assign">
+ <function name="ProgramUniform4ui" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLuint" />
@@ -111,25 +111,25 @@
<param name="z" type="GLuint" />
<param name="w" type="GLuint" />
</function>
- <function name="ProgramUniform1f" offset="assign">
+ <function name="ProgramUniform1f" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLfloat" />
</function>
- <function name="ProgramUniform2f" offset="assign">
+ <function name="ProgramUniform2f" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLfloat" />
<param name="y" type="GLfloat" />
</function>
- <function name="ProgramUniform3f" offset="assign">
+ <function name="ProgramUniform3f" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLfloat" />
<param name="y" type="GLfloat" />
<param name="z" type="GLfloat" />
</function>
- <function name="ProgramUniform4f" offset="assign">
+ <function name="ProgramUniform4f" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLfloat" />
@@ -137,145 +137,145 @@
<param name="z" type="GLfloat" />
<param name="w" type="GLfloat" />
</function>
- <function name="ProgramUniform1iv" offset="assign">
+ <function name="ProgramUniform1iv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLint *" />
</function>
- <function name="ProgramUniform2iv" offset="assign">
+ <function name="ProgramUniform2iv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLint *" />
</function>
- <function name="ProgramUniform3iv" offset="assign">
+ <function name="ProgramUniform3iv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLint *" />
</function>
- <function name="ProgramUniform4iv" offset="assign">
+ <function name="ProgramUniform4iv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLint *" />
</function>
- <function name="ProgramUniform1uiv" offset="assign">
+ <function name="ProgramUniform1uiv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLuint *" />
</function>
- <function name="ProgramUniform2uiv" offset="assign">
+ <function name="ProgramUniform2uiv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLuint *" />
</function>
- <function name="ProgramUniform3uiv" offset="assign">
+ <function name="ProgramUniform3uiv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLuint *" />
</function>
- <function name="ProgramUniform4uiv" offset="assign">
+ <function name="ProgramUniform4uiv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLuint *" />
</function>
- <function name="ProgramUniform1fv" offset="assign">
+ <function name="ProgramUniform1fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniform2fv" offset="assign">
+ <function name="ProgramUniform2fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniform3fv" offset="assign">
+ <function name="ProgramUniform3fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniform4fv" offset="assign">
+ <function name="ProgramUniform4fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix2fv" offset="assign">
+ <function name="ProgramUniformMatrix2fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix3fv" offset="assign">
+ <function name="ProgramUniformMatrix3fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix4fv" offset="assign">
+ <function name="ProgramUniformMatrix4fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix2x3fv" offset="assign">
+ <function name="ProgramUniformMatrix2x3fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix3x2fv" offset="assign">
+ <function name="ProgramUniformMatrix3x2fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix2x4fv" offset="assign">
+ <function name="ProgramUniformMatrix2x4fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix4x2fv" offset="assign">
+ <function name="ProgramUniformMatrix4x2fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix3x4fv" offset="assign">
+ <function name="ProgramUniformMatrix3x4fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ProgramUniformMatrix4x3fv" offset="assign">
+ <function name="ProgramUniformMatrix4x3fv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLfloat *" />
</function>
- <function name="ValidateProgramPipeline" offset="assign">
+ <function name="ValidateProgramPipeline" offset="assign" static_dispatch="false">
<param name="pipeline" type="GLuint" />
</function>
- <function name="GetProgramPipelineInfoLog" offset="assign">
+ <function name="GetProgramPipelineInfoLog" offset="assign" static_dispatch="false">
<param name="pipeline" type="GLuint" />
<param name="bufSize" type="GLsizei" />
<param name="length" type="GLsizei *" />
@@ -283,25 +283,25 @@
</function>
<!-- depends on GL_ARB_gpu_shader_fp64
- <function name="ProgramUniform1d" offset="assign">
+ <function name="ProgramUniform1d" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLdouble" />
</function>
- <function name="ProgramUniform2d" offset="assign">
+ <function name="ProgramUniform2d" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLdouble" />
<param name="y" type="GLdouble" />
</function>
- <function name="ProgramUniform3d" offset="assign">
+ <function name="ProgramUniform3d" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLdouble" />
<param name="y" type="GLdouble" />
<param name="z" type="GLdouble" />
</function>
- <function name="ProgramUniform4d" offset="assign">
+ <function name="ProgramUniform4d" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="x" type="GLdouble" />
@@ -309,88 +309,88 @@
<param name="z" type="GLdouble" />
<param name="w" type="GLdouble" />
</function>
- <function name="ProgramUniformMatrix2x3dv" offset="assign">
+ <function name="ProgramUniformMatrix2x3dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix3x2dv" offset="assign">
+ <function name="ProgramUniformMatrix3x2dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix2x4dv" offset="assign">
+ <function name="ProgramUniformMatrix2x4dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix4x2dv" offset="assign">
+ <function name="ProgramUniformMatrix4x2dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix3x4dv" offset="assign">
+ <function name="ProgramUniformMatrix3x4dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix4x3dv" offset="assign">
+ <function name="ProgramUniformMatrix4x3dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix2dv" offset="assign">
+ <function name="ProgramUniformMatrix2dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix3dv" offset="assign">
+ <function name="ProgramUniformMatrix3dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniformMatrix4dv" offset="assign">
+ <function name="ProgramUniformMatrix4dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="transpose" type="GLboolean" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniform1dv" offset="assign">
+ <function name="ProgramUniform1dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniform2dv" offset="assign">
+ <function name="ProgramUniform2dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniform3dv" offset="assign">
+ <function name="ProgramUniform3dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
<param name="value" type="const GLdouble *" />
</function>
- <function name="ProgramUniform4dv" offset="assign">
+ <function name="ProgramUniform4dv" offset="assign" static_dispatch="false">
<param name="program" type="GLuint" />
<param name="location" type="GLint" />
<param name="count" type="GLsizei" />
diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am
index 7b3c118f0..6b932e73f 100644
--- a/mesalib/src/mapi/glapi/gen/Makefile.am
+++ b/mesalib/src/mapi/glapi/gen/Makefile.am
@@ -59,7 +59,26 @@ EXTRA_DIST= \
$(BUILT_SOURCES) \
$(MESA_GLAPI_DIR)/glapi_x86.S \
$(MESA_GLAPI_DIR)/glapi_x86-64.S \
- $(MESA_GLAPI_DIR)/glapi_sparc.S
+ $(MESA_GLAPI_DIR)/glapi_sparc.S \
+ $(COMMON_GLX) \
+ extension_helper.py \
+ gl_apitemp.py \
+ gl_enums.py \
+ gl_genexec.py \
+ gl_gentable.py \
+ gl_offsets.py \
+ gl_procs.py \
+ gl_SPARC_asm.py \
+ gl_table.py \
+ gl_x86-64_asm.py \
+ gl_x86_asm.py \
+ glX_proto_recv.py \
+ glX_proto_send.py \
+ glX_proto_size.py \
+ glX_server_table.py \
+ mesadef.py \
+ remap_helper.py \
+ gl_API.dtd
######################################################################
@@ -88,8 +107,11 @@ XORG_OUTPUTS = \
API_XML = \
gl_API.xml \
+ es_EXT.xml \
+ gl_and_es_API.xml \
ARB_base_instance.xml \
ARB_blend_func_extended.xml \
+ ARB_clear_buffer_object.xml \
ARB_color_buffer_float.xml \
ARB_compute_shader.xml \
ARB_copy_buffer.xml \
@@ -105,6 +127,8 @@ API_XML = \
ARB_ES3_compatibility.xml \
ARB_framebuffer_object.xml \
ARB_geometry_shader4.xml \
+ ARB_get_program_binary.xml \
+ ARB_gpu_shader5.xml \
ARB_instanced_arrays.xml \
ARB_internalformat_query.xml \
ARB_invalidate_subdata.xml \
@@ -129,6 +153,7 @@ API_XML = \
ARB_texture_storage_multisample.xml \
ARB_texture_storage.xml \
ARB_texture_view.xml \
+ ARB_uniform_buffer_object.xml \
ARB_vertex_array_object.xml \
ARB_vertex_attrib_binding.xml \
ARB_viewport_array.xml \
@@ -137,7 +162,6 @@ API_XML = \
ARB_vertex_type_2_10_10_10_rev.xml \
APPLE_object_purgeable.xml \
APPLE_vertex_array_object.xml \
- ARB_uniform_buffer_object.xml \
EXT_draw_buffers2.xml \
EXT_framebuffer_object.xml \
EXT_gpu_shader4.xml \
@@ -147,28 +171,22 @@ API_XML = \
EXT_texture_array.xml \
EXT_texture_integer.xml \
EXT_transform_feedback.xml \
+ KHR_debug.xml \
NV_conditional_render.xml \
NV_primitive_restart.xml \
NV_texture_barrier.xml \
NV_vdpau_interop.xml \
OES_EGL_image.xml \
+ OES_fixed_point.xml \
+ OES_single_precision.xml \
GL3x.xml \
GL4x.xml
-
-
COMMON = $(API_XML) \
gl_XML.py \
glX_XML.py \
license.py \
- typeexpr.py \
- gl_and_es_API.xml \
- es_EXT.xml \
- ARB_ES2_compatibility.xml \
- ARB_ES3_compatibility.xml \
- ARB_get_program_binary.xml \
- OES_fixed_point.xml \
- OES_single_precision.xml
+ typeexpr.py
COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py
@@ -208,7 +226,7 @@ $(MESA_GLAPI_DIR)/glapi_mapi_tmp.h: $(MESA_MAPI_DIR)/mapi_abi.py $(COMMON)
--printer glapi --mode lib $(srcdir)/gl_and_es_API.xml > $@
$(MESA_GLAPI_DIR)/glprocs.h: gl_procs.py $(COMMON)
- $(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@
+ $(PYTHON_GEN) $< -c -f $(srcdir)/gl_and_es_API.xml > $@
$(MESA_GLAPI_DIR)/glapitemp.h: gl_apitemp.py $(COMMON)
$(PYTHON_GEN) $< -f $(srcdir)/gl_and_es_API.xml > $@
diff --git a/mesalib/src/mapi/glapi/gen/SConscript b/mesalib/src/mapi/glapi/gen/SConscript
index e4abe906a..b9cdbbf36 100644
--- a/mesalib/src/mapi/glapi/gen/SConscript
+++ b/mesalib/src/mapi/glapi/gen/SConscript
@@ -38,7 +38,7 @@ env.CodeGenerate(
target = '../../../mapi/glapi/glprocs.h',
script = 'gl_procs.py',
source = sources,
- command = python_cmd + ' $SCRIPT -f $SOURCE > $TARGET'
+ command = python_cmd + ' $SCRIPT -c -f $SOURCE > $TARGET'
)
env.CodeGenerate(
diff --git a/mesalib/src/mapi/glapi/gen/es_EXT.xml b/mesalib/src/mapi/glapi/gen/es_EXT.xml
index f412333df..e2dc39021 100644
--- a/mesalib/src/mapi/glapi/gen/es_EXT.xml
+++ b/mesalib/src/mapi/glapi/gen/es_EXT.xml
@@ -343,7 +343,7 @@
<enum name="POINT_SIZE_ARRAY_BUFFER_BINDING_OES" value="0x8B9F"/>
<function name="PointSizePointerOES" offset="assign"
- static_dispatch="false" es1="1.0" desktop="false">
+ static_dispatch="true" es1="1.0" desktop="false">
<param name="type" type="GLenum"/>
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml
index 6c4fb9506..7cb10b3ae 100755
--- a/mesalib/src/mapi/glapi/gen/gl_API.xml
+++ b/mesalib/src/mapi/glapi/gen/gl_API.xml
@@ -5403,13 +5403,11 @@
<param name="index" type="GLuint"/>
<param name="name" type="const GLchar *"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="CompileShader" es2="2.0" offset="assign">
<param name="shader" type="GLuint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="CreateProgram" offset="assign" es2="2.0">
@@ -5461,7 +5459,6 @@
<param name="type" type="GLenum *" output="true"/>
<param name="name" type="GLchar *" output="true"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="GetActiveUniform" es2="2.0" offset="assign">
@@ -5473,7 +5470,6 @@
<param name="type" type="GLenum *" output="true"/>
<param name="name" type="GLchar *" output="true"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="GetAttachedShaders" offset="assign" es2="2.0">
@@ -5489,7 +5485,6 @@
<param name="name" type="const GLchar *"/>
<return type="GLint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="GetProgramiv" offset="assign" es2="2.0">
@@ -5528,7 +5523,6 @@
<param name="length" type="GLsizei *" output="true"/>
<param name="source" type="GLchar *" output="true"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="GetUniformLocation"
@@ -5537,7 +5531,6 @@
<param name="name" type="const GLchar *"/>
<return type="GLint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="GetUniformfv" es2="2.0" offset="assign">
@@ -5545,7 +5538,6 @@
<param name="location" type="GLint"/>
<param name="params" type="GLfloat *" output="true"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="GetUniformiv" es2="2.0" offset="assign">
@@ -5553,7 +5545,6 @@
<param name="location" type="GLint"/>
<param name="params" type="GLint *" output="true"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="GetVertexAttribdv" offset="assign">
@@ -5604,7 +5595,6 @@
<function name="LinkProgram" es2="2.0" offset="assign">
<param name="program" type="GLuint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="ShaderSource" es2="2.0" offset="assign">
@@ -5613,27 +5603,23 @@
<param name="string" type="const GLchar * const *"/>
<param name="length" type="const GLint *"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="UseProgram" es2="2.0" offset="assign">
<param name="program" type="GLuint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform1f" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLfloat"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform2f" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLfloat"/>
<param name="v1" type="GLfloat"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform3f" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
@@ -5641,7 +5627,6 @@
<param name="v1" type="GLfloat"/>
<param name="v2" type="GLfloat"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform4f" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
@@ -5650,21 +5635,18 @@
<param name="v2" type="GLfloat"/>
<param name="v3" type="GLfloat"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform1i" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform2i" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLint"/>
<param name="v1" type="GLint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform3i" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
@@ -5672,7 +5654,6 @@
<param name="v1" type="GLint"/>
<param name="v2" type="GLint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform4i" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
@@ -5681,7 +5662,6 @@
<param name="v2" type="GLint"/>
<param name="v3" type="GLint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform1fv" es2="2.0" offset="assign">
@@ -5689,28 +5669,24 @@
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLfloat *" count="count"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform2fv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLfloat *" count="count" count_scale="2"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform3fv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLfloat *" count="count" count_scale="3"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform4fv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLfloat *" count="count" count_scale="4"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform1iv" es2="2.0" offset="assign">
@@ -5718,28 +5694,24 @@
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLint *" count="count"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform2iv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLint *" count="count" count_scale="2"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform3iv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLint *" count="count" count_scale="3"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="Uniform4iv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei" counter="true"/>
<param name="value" type="const GLint *" count="count" count_scale="4"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="UniformMatrix2fv" es2="2.0" offset="assign">
@@ -5748,7 +5720,6 @@
<param name="transpose" type="GLboolean"/>
<param name="value" type="const GLfloat *" count="count" count_scale="4"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="UniformMatrix3fv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
@@ -5756,7 +5727,6 @@
<param name="transpose" type="GLboolean"/>
<param name="value" type="const GLfloat *" count="count" count_scale="9"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="UniformMatrix4fv" es2="2.0" offset="assign">
<param name="location" type="GLint"/>
@@ -5764,13 +5734,11 @@
<param name="transpose" type="GLboolean"/>
<param name="value" type="const GLfloat *" count="count" count_scale="16"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="ValidateProgram" es2="2.0" offset="assign">
<param name="program" type="GLuint"/>
<glx ignore="true"/>
- <glx ignore="true"/>
</function>
<function name="VertexAttrib1d" offset="assign">
diff --git a/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml b/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml
index 18b0eb4ec..d158a6b31 100644
--- a/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml
+++ b/mesalib/src/mapi/glapi/gen/gl_and_es_API.xml
@@ -18,53 +18,45 @@
<type name="fixed" size="4" />
<type name="clampx" size="4" />
- <function name="AlphaFuncx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="AlphaFuncx" es1="1.0" desktop="false" offset="assign">
<param name="func" type="GLenum"/>
<param name="ref" type="GLclampx"/>
</function>
- <function name="ClearColorx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="ClearColorx" es1="1.0" desktop="false" offset="assign">
<param name="red" type="GLclampx"/>
<param name="green" type="GLclampx"/>
<param name="blue" type="GLclampx"/>
<param name="alpha" type="GLclampx"/>
</function>
- <function name="ClearDepthx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="ClearDepthx" es1="1.0" desktop="false" offset="assign">
<param name="depth" type="GLclampx"/>
</function>
- <function name="Color4x" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Color4x" es1="1.0" desktop="false" offset="assign">
<param name="red" type="GLfixed"/>
<param name="green" type="GLfixed"/>
<param name="blue" type="GLfixed"/>
<param name="alpha" type="GLfixed"/>
</function>
- <function name="DepthRangex" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="DepthRangex" es1="1.0" desktop="false" offset="assign">
<param name="zNear" type="GLclampx"/>
<param name="zFar" type="GLclampx"/>
</function>
- <function name="Fogx" static_dispatch="false" es1="1.0"
- desktop="false" offset="assign">
+ <function name="Fogx" es1="1.0" desktop="false" offset="assign">
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
- <function name="Fogxv" static_dispatch="false" es1="1.0"
- desktop="false" offset="assign">
+ <function name="Fogxv" es1="1.0" desktop="false" offset="assign">
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
- <function name="Frustumx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Frustumx" es1="1.0" desktop="false" offset="assign">
<param name="left" type="GLfixed"/>
<param name="right" type="GLfixed"/>
<param name="bottom" type="GLfixed"/>
@@ -73,63 +65,53 @@
<param name="zFar" type="GLfixed"/>
</function>
- <function name="LightModelx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="LightModelx" es1="1.0" desktop="false" offset="assign">
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
- <function name="LightModelxv"
- static_dispatch="false" es1="1.0" desktop="false" offset="assign">
+ <function name="LightModelxv" es1="1.0" desktop="false" offset="assign">
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
- <function name="Lightx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Lightx" es1="1.0" desktop="false" offset="assign">
<param name="light" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
- <function name="Lightxv" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Lightxv" es1="1.0" desktop="false" offset="assign">
<param name="light" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
- <function name="LineWidthx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="LineWidthx" es1="1.0" desktop="false" offset="assign">
<param name="width" type="GLfixed"/>
</function>
- <function name="LoadMatrixx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="LoadMatrixx" es1="1.0" desktop="false" offset="assign">
<param name="m" type="const GLfixed *" count="16"/>
</function>
- <function name="Materialx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Materialx" es1="1.0" desktop="false" offset="assign">
<param name="face" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
- <function name="Materialxv" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Materialxv" es1="1.0" desktop="false" offset="assign">
<param name="face" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
- <function name="MultMatrixx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="MultMatrixx" es1="1.0" desktop="false" offset="assign">
<param name="m" type="const GLfixed *" count="16"/>
</function>
- <function name="MultiTexCoord4x"
- static_dispatch="false" es1="1.0" desktop="false" offset="assign">
+ <function name="MultiTexCoord4x" es1="1.0" desktop="false" offset="assign">
<param name="target" type="GLenum"/>
<param name="s" type="GLfixed"/>
<param name="t" type="GLfixed"/>
@@ -137,15 +119,13 @@
<param name="q" type="GLfixed"/>
</function>
- <function name="Normal3x" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Normal3x" es1="1.0" desktop="false" offset="assign">
<param name="nx" type="GLfixed"/>
<param name="ny" type="GLfixed"/>
<param name="nz" type="GLfixed"/>
</function>
- <function name="Orthox" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Orthox" es1="1.0" desktop="false" offset="assign">
<param name="left" type="GLfixed"/>
<param name="right" type="GLfixed"/>
<param name="bottom" type="GLfixed"/>
@@ -154,69 +134,59 @@
<param name="zFar" type="GLfixed"/>
</function>
- <function name="PointSizex" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="PointSizex" es1="1.0" desktop="false" offset="assign">
<param name="size" type="GLfixed"/>
</function>
- <function name="PolygonOffsetx"
- static_dispatch="false" es1="1.0" desktop="false" offset="assign">
+ <function name="PolygonOffsetx" es1="1.0" desktop="false" offset="assign">
<param name="factor" type="GLfixed"/>
<param name="units" type="GLfixed"/>
</function>
- <function name="Rotatex" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Rotatex" es1="1.0" desktop="false" offset="assign">
<param name="angle" type="GLfixed"/>
<param name="x" type="GLfixed"/>
<param name="y" type="GLfixed"/>
<param name="z" type="GLfixed"/>
</function>
- <function name="SampleCoveragex"
- static_dispatch="false" es1="1.0" desktop="false" offset="assign">
+ <function name="SampleCoveragex" es1="1.0" desktop="false" offset="assign">
<param name="value" type="GLclampx"/>
<param name="invert" type="GLboolean"/>
</function>
- <function name="Scalex" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Scalex" es1="1.0" desktop="false" offset="assign">
<param name="x" type="GLfixed"/>
<param name="y" type="GLfixed"/>
<param name="z" type="GLfixed"/>
</function>
- <function name="TexEnvx" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="TexEnvx" es1="1.0" desktop="false" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
- <function name="TexEnvxv" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="TexEnvxv" es1="1.0" desktop="false" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
- <function name="TexParameterx"
- static_dispatch="false" es1="1.0" desktop="false" offset="assign">
+ <function name="TexParameterx" es1="1.0" desktop="false" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
- <function name="Translatex" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Translatex" es1="1.0" desktop="false" offset="assign">
<param name="x" type="GLfixed"/>
<param name="y" type="GLfixed"/>
<param name="z" type="GLfixed"/>
</function>
<!-- from GL_OES_single_precision -->
- <function name="Frustumf" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Frustumf" es1="1.0" desktop="false" offset="assign">
<param name="left" type="GLfloat"/>
<param name="right" type="GLfloat"/>
<param name="bottom" type="GLfloat"/>
@@ -225,8 +195,7 @@
<param name="zFar" type="GLfloat"/>
</function>
- <function name="Orthof" static_dispatch="false"
- es1="1.0" desktop="false" offset="assign">
+ <function name="Orthof" es1="1.0" desktop="false" offset="assign">
<param name="left" type="GLfloat"/>
<param name="right" type="GLfloat"/>
<param name="bottom" type="GLfloat"/>
@@ -238,80 +207,68 @@
<category name="es1.1">
<!-- from GL_OES_fixed_point -->
- <function name="ClipPlanex" static_dispatch="false"
- es1="1.1" desktop="false" offset="assign">
+ <function name="ClipPlanex" es1="1.1" desktop="false" offset="assign">
<param name="plane" type="GLenum"/>
<param name="equation" type="const GLfixed *" count="4"/>
</function>
- <function name="GetClipPlanex"
- static_dispatch="false" es1="1.1" offset="assign">
+ <function name="GetClipPlanex" es1="1.1" offset="assign">
<param name="plane" type="GLenum"/>
<param name="equation" type="GLfixed *" output="true" count="4"/>
</function>
- <function name="GetFixedv" static_dispatch="false"
- es1="1.1" desktop="false" offset="assign">
+ <function name="GetFixedv" es1="1.1" desktop="false" offset="assign">
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
- <function name="GetLightxv" static_dispatch="false"
- es1="1.1" desktop="false" offset="assign">
+ <function name="GetLightxv" es1="1.1" desktop="false" offset="assign">
<param name="light" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
- <function name="GetMaterialxv"
- static_dispatch="false" es1="1.1" desktop="false" offset="assign">
+ <function name="GetMaterialxv" es1="1.1" desktop="false" offset="assign">
<param name="face" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
- <function name="GetTexEnvxv" static_dispatch="false"
- es1="1.1" desktop="false" offset="assign">
+ <function name="GetTexEnvxv" es1="1.1" desktop="false" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
- <function name="GetTexParameterxv"
- static_dispatch="false" es1="1.1" desktop="false" offset="assign">
+ <function name="GetTexParameterxv" es1="1.1" desktop="false" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
- <function name="PointParameterx"
- static_dispatch="false" es1="1.1" desktop="false" offset="assign">
+ <function name="PointParameterx" es1="1.1" desktop="false" offset="assign">
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
- <function name="PointParameterxv"
- static_dispatch="false" es1="1.1" desktop="false" offset="assign">
+ <function name="PointParameterxv" es1="1.1" desktop="false" offset="assign">
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *"/>
</function>
- <function name="TexParameterxv"
- static_dispatch="false" es1="1.1" desktop="false" offset="assign">
+ <function name="TexParameterxv" es1="1.1" desktop="false" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
<!-- from GL_OES_single_precision -->
- <function name="ClipPlanef" static_dispatch="false"
- es1="1.1" desktop="false" offset="assign">
+ <function name="ClipPlanef" es1="1.1" desktop="false" offset="assign">
<param name="plane" type="GLenum"/>
<param name="equation" type="const GLfloat *" count="4"/>
</function>
- <function name="GetClipPlanef"
- static_dispatch="false" es1="1.1" offset="assign">
+ <function name="GetClipPlanef" es1="1.1" offset="assign">
<param name="plane" type="GLenum"/>
<param name="equation" type="GLfloat *" output="true" count="4"/>
</function>
diff --git a/mesalib/src/mapi/glapi/gen/gl_procs.py b/mesalib/src/mapi/glapi/gen/gl_procs.py
index f139c58ea..b1fffc4ca 100755
--- a/mesalib/src/mapi/glapi/gen/gl_procs.py
+++ b/mesalib/src/mapi/glapi/gen/gl_procs.py
@@ -30,11 +30,10 @@ import gl_XML, glX_XML
import sys, getopt
class PrintGlProcs(gl_XML.gl_print_base):
- def __init__(self, long_strings, es=False):
+ def __init__(self, es=False):
gl_XML.gl_print_base.__init__(self)
self.es = es
- self.long_strings = long_strings
self.name = "gl_procs.py (from Mesa)"
self.license = license.bsd_license_template % ( \
"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
@@ -74,22 +73,11 @@ typedef struct {
return
def printFunctionString(self, name):
- if self.long_strings:
- print ' "gl%s\\0"' % (name)
- else:
- print " 'g','l',",
- for c in name:
- print "'%s'," % (c),
-
- print "'\\0',"
-
+ print ' "gl%s\\0"' % (name)
def printBody(self, api):
print ''
- if self.long_strings:
- print 'static const char gl_string_table[] ='
- else:
- print 'static const char gl_string_table[] = {'
+ print 'static const char gl_string_table[] ='
base_offset = 0
table = []
@@ -119,11 +107,7 @@ typedef struct {
base_offset += len(n) + 3
- if self.long_strings:
- print ' ;'
- else:
- print '};'
-
+ print ' ;'
print ''
print ''
print "#ifdef USE_MGL_NAMESPACE"
@@ -178,38 +162,25 @@ typedef struct {
def show_usage():
- print "Usage: %s [-f input_file_name] [-m mode] [-c]" % sys.argv[0]
+ print "Usage: %s [-f input_file_name] [-c]" % sys.argv[0]
print "-c Enable compatibility with OpenGL ES."
- print "-m mode mode can be one of:"
- print " long - Create code for compilers that can handle very"
- print " long string constants. (default)"
- print " short - Create code for compilers that can only handle"
- print " ANSI C89 string constants."
sys.exit(1)
if __name__ == '__main__':
file_name = "gl_API.xml"
try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:c")
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:c")
except Exception,e:
show_usage()
- long_string = 1
es = False
for (arg,val) in args:
if arg == "-f":
file_name = val
- elif arg == "-m":
- if val == "short":
- long_string = 0
- elif val == "long":
- long_string = 1
- else:
- show_usage()
elif arg == "-c":
es = True
api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
- printer = PrintGlProcs(long_string, es)
+ printer = PrintGlProcs(es)
printer.Print(api)
diff --git a/mesalib/src/mapi/mapi_abi.py b/mesalib/src/mapi/mapi_abi.py
index f5ff8d843..d783ed32f 100755
--- a/mesalib/src/mapi/mapi_abi.py
+++ b/mesalib/src/mapi/mapi_abi.py
@@ -744,8 +744,9 @@ class ES1APIPrinter(GLAPIPrinter):
def _override_for_api(self, ent):
if ent.xml_data is None:
raise Exception('ES2 API printer requires XML input')
- ent.hidden = ent.name not in \
- ent.xml_data.entry_points_for_api_version('es1')
+ ent.hidden = (ent.name not in \
+ ent.xml_data.entry_points_for_api_version('es1')) \
+ or ent.hidden
ent.handcode = False
def _get_c_header(self):
@@ -767,8 +768,17 @@ class ES2APIPrinter(GLAPIPrinter):
def _override_for_api(self, ent):
if ent.xml_data is None:
raise Exception('ES2 API printer requires XML input')
- ent.hidden = ent.name not in \
- ent.xml_data.entry_points_for_api_version('es2')
+ ent.hidden = (ent.name not in \
+ ent.xml_data.entry_points_for_api_version('es2')) \
+ or ent.hidden
+
+ # This is hella ugly. The same-named function in desktop OpenGL is
+ # hidden, but it needs to be exposed by libGLESv2 for OpenGL ES 3.0.
+ # There's no way to express in the XML that a function should be be
+ # hidden in one API but exposed in another.
+ if ent.name == 'GetInternalformativ':
+ ent.hidden = False
+
ent.handcode = False
def _get_c_header(self):
diff --git a/mesalib/src/mesa/drivers/dri/Makefile.am b/mesalib/src/mesa/drivers/dri/Makefile.am
index 17ac76be1..e8076120d 100644
--- a/mesalib/src/mesa/drivers/dri/Makefile.am
+++ b/mesalib/src/mesa/drivers/dri/Makefile.am
@@ -9,37 +9,37 @@ SUBDIRS+=common
if HAVE_I915_DRI
SUBDIRS += i915
MEGADRIVERS_DEPS += i915/libi915_dri.la
-MEGADRIVERS += i915_dri.@LIB_EXT@
+MEGADRIVERS += i915_dri.so
endif
if HAVE_I965_DRI
SUBDIRS += i965
MEGADRIVERS_DEPS += i965/libi965_dri.la
-MEGADRIVERS += i965_dri.@LIB_EXT@
+MEGADRIVERS += i965_dri.so
endif
if HAVE_NOUVEAU_DRI
SUBDIRS += nouveau
MEGADRIVERS_DEPS += nouveau/libnouveau_dri.la
-MEGADRIVERS += nouveau_vieux_dri.@LIB_EXT@
+MEGADRIVERS += nouveau_vieux_dri.so
endif
if HAVE_R200_DRI
SUBDIRS += r200
MEGADRIVERS_DEPS += r200/libr200_dri.la
-MEGADRIVERS += r200_dri.@LIB_EXT@
+MEGADRIVERS += r200_dri.so
endif
if HAVE_RADEON_DRI
SUBDIRS += radeon
MEGADRIVERS_DEPS += radeon/libradeon_dri.la
-MEGADRIVERS += radeon_dri.@LIB_EXT@
+MEGADRIVERS += radeon_dri.so
endif
if HAVE_SWRAST_DRI
SUBDIRS += swrast
MEGADRIVERS_DEPS += swrast/libswrast_dri.la
-MEGADRIVERS += swrast_dri.@LIB_EXT@
+MEGADRIVERS += swrast_dri.so
endif
pkgconfigdir = $(libdir)/pkgconfig
@@ -51,8 +51,9 @@ driinclude_HEADERS = $(top_srcdir)/include/GL/internal/dri_interface.h
nodist_EXTRA_mesa_dri_drivers_la_SOURCES = dummy.cpp
mesa_dri_drivers_la_SOURCES =
mesa_dri_drivers_la_LDFLAGS = \
- -module -avoid-version -shared \
+ -module -avoid-version -shared -shrext .so \
-Wl,-Bsymbolic \
+ $(GC_SECTIONS) \
$()
mesa_dri_drivers_la_LIBADD = \
../../libmesa.la \
@@ -69,22 +70,22 @@ if HAVE_COMPAT_SYMLINKS
# Add a link to allow setting LD_LIBRARY_PATH/LIBGL_DRIVERS_PATH to /lib of the build tree.
all-local: mesa_dri_drivers.la
$(AM_V_at)$(MKDIR_P) $(top_builddir)/$(LIB_DIR);
- $(AM_V_GEN)ln -f .libs/mesa_dri_drivers.@LIB_EXT@ \
- $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.@LIB_EXT@;
+ $(AM_V_GEN)ln -f .libs/mesa_dri_drivers.so \
+ $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so;
$(AM_V_GEN)for i in $(MEGADRIVERS); do \
- ln -f $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.@LIB_EXT@ \
+ ln -f $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so \
$(top_builddir)/$(LIB_DIR)/$$i; \
done;
endif
# hardlink each megadriver instance, but don't actually have
-# mesa_dri_drivers.@LIB_EXT@ in the set of final installed files.
+# mesa_dri_drivers.so in the set of final installed files.
install-data-hook:
for i in $(MEGADRIVERS); do \
- ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.@LIB_EXT@ \
+ ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so \
$(DESTDIR)$(dridir)/$$i; \
done;
- $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.@LIB_EXT@
+ $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so
$(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.la
endif
diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.am b/mesalib/src/mesa/drivers/dri/common/Makefile.am
index e500bdb30..c98ccf7b8 100644
--- a/mesalib/src/mesa/drivers/dri/common/Makefile.am
+++ b/mesalib/src/mesa/drivers/dri/common/Makefile.am
@@ -48,7 +48,7 @@ sysconf_DATA = drirc
if DRICOMMON_NEED_LIBDRM
AM_CFLAGS += $(LIBDRM_CFLAGS)
-libdricommon_la_LDFLAGS = $(LIBDRM_LIBS)
+libdricommon_la_LIBADD = $(LIBDRM_LIBS)
else
AM_CFLAGS += -D__NOT_HAVE_DRM_H
endif
diff --git a/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c b/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c
index 5664af4da..4c3cc6776 100644
--- a/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c
+++ b/mesalib/src/mesa/drivers/dri/common/megadriver_stub.c
@@ -31,7 +31,7 @@
* Dl_info, and RTLD_DEFAULT are only defined when _GNU_SOURCE is
* defined.)
*/
-#ifdef _GNU_SOURCE
+#ifdef RTLD_DEFAULT
#define MEGADRIVER_STUB_MAX_EXTENSIONS 10
#define LIB_PATH_SUFFIX "_dri.so"
@@ -148,7 +148,7 @@ megadriver_stub_init(void)
}
}
-#endif /* _GNU_SOURCE */
+#endif /* RTLD_DEFAULT */
static const
__DRIconfig **stub_error_init_screen(__DRIscreen *psp)
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 5a626f2f4..c656845df 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -217,7 +217,7 @@ push_attrib(struct gl_context *ctx, struct gl_attrib_node **head,
{
void *attribute;
- attribute = MALLOC(attr_size);
+ attribute = malloc(attr_size);
if (attribute == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib");
return false;
@@ -227,7 +227,7 @@ push_attrib(struct gl_context *ctx, struct gl_attrib_node **head,
memcpy(attribute, attr_data, attr_size);
}
else {
- FREE(attribute);
+ free(attribute);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib");
return false;
}
@@ -277,7 +277,7 @@ _mesa_PushAttrib(GLbitfield mask)
attr->DrawBuffer[i] = ctx->DrawBuffer->ColorDrawBuffer[i];
}
else {
- FREE(attr);
+ free(attr);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib");
goto end;
}
@@ -374,7 +374,7 @@ _mesa_PushAttrib(GLbitfield mask)
attr->FragmentProgram = ctx->FragmentProgram.Enabled;
if (!save_attrib_data(&head, GL_ENABLE_BIT, attr)) {
- FREE(attr);
+ free(attr);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib");
goto end;
}
@@ -440,7 +440,7 @@ _mesa_PushAttrib(GLbitfield mask)
attr->ReadBuffer = ctx->ReadBuffer->ColorReadBuffer;
}
else {
- FREE(attr);
+ free(attr);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib");
goto end;
}
@@ -491,7 +491,7 @@ _mesa_PushAttrib(GLbitfield mask)
}
if (!save_attrib_data(&head, GL_TEXTURE_BIT, texstate)) {
- FREE(texstate);
+ free(texstate);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_TEXTURE_BIT)");
goto end;
}
@@ -1626,7 +1626,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
}
else {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib" );
- FREE(attr);
+ free(attr);
goto end;
}
@@ -1642,7 +1642,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
}
else {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib" );
- FREE(attr);
+ free(attr);
goto end;
}
}
@@ -1656,7 +1656,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
}
if (!init_array_attrib_data(ctx, attr)) {
- FREE(attr);
+ free(attr);
goto end;
}
@@ -1666,7 +1666,7 @@ _mesa_PushClientAttrib(GLbitfield mask)
else {
free_array_attrib_data(ctx, attr);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib");
- FREE(attr);
+ free(attr);
/* goto to keep safe from possible later changes */
goto end;
}
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index c4417c922..aed6d4366 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -665,7 +665,7 @@ _mesa_buffer_get_subdata( struct gl_context *ctx, GLintptrARB offset,
* \sa glClearBufferSubData, glClearBufferData and
* dd_function_table::ClearBufferSubData.
*/
-static void
+void
_mesa_buffer_clear_subdata(struct gl_context *ctx,
GLintptr offset, GLsizeiptr size,
const GLvoid *clearValue,
@@ -1458,7 +1458,7 @@ _mesa_ClearBufferData(GLenum target, GLenum internalformat, GLenum format,
if (data == NULL) {
/* clear to zeros, per the spec */
ctx->Driver.ClearBufferSubData(ctx, 0, bufObj->Size,
- NULL, 0, bufObj);
+ NULL, clearValueSize, bufObj);
return;
}
@@ -1510,7 +1510,7 @@ _mesa_ClearBufferSubData(GLenum target, GLenum internalformat,
/* clear to zeros, per the spec */
if (size > 0) {
ctx->Driver.ClearBufferSubData(ctx, offset, size,
- NULL, 0, bufObj);
+ NULL, clearValueSize, bufObj);
}
return;
}
diff --git a/mesalib/src/mesa/main/bufferobj.h b/mesalib/src/mesa/main/bufferobj.h
index 9814552eb..c08c4fdf2 100644
--- a/mesalib/src/mesa/main/bufferobj.h
+++ b/mesalib/src/mesa/main/bufferobj.h
@@ -115,6 +115,13 @@ extern void
_mesa_buffer_unmap_all_mappings(struct gl_context *ctx,
struct gl_buffer_object *bufObj);
+extern void
+_mesa_buffer_clear_subdata(struct gl_context *ctx,
+ GLintptr offset, GLsizeiptr size,
+ const GLvoid *clearValue,
+ GLsizeiptr clearValueSize,
+ struct gl_buffer_object *bufObj);
+
/*
* API functions
*/
diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c
index 63e5870e6..1865a66b9 100644
--- a/mesalib/src/mesa/main/drawpix.c
+++ b/mesalib/src/mesa/main/drawpix.c
@@ -109,7 +109,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
/* these buffers must exist */
if (!_mesa_dest_buffer_exists(ctx, format)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glDrawPixels(missing deest buffer)");
+ "glDrawPixels(missing dest buffer)");
goto end;
}
break;
diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c
index 9151718ea..d80fda0db 100644
--- a/mesalib/src/mesa/main/errors.c
+++ b/mesalib/src/mesa/main/errors.c
@@ -980,7 +980,7 @@ _mesa_free_errors_data(struct gl_context *ctx)
for (i = 0; i <= ctx->Debug->GroupStackDepth; i++) {
free_errors_data(ctx, i);
}
- FREE(ctx->Debug);
+ free(ctx->Debug);
/* set to NULL just in case it is used before context is completely gone. */
ctx->Debug = NULL;
}
diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp
index 1d2ad604b..66c18fa16 100644
--- a/mesalib/src/mesa/main/ff_fragment_shader.cpp
+++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp
@@ -1344,7 +1344,8 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
const struct gl_shader_compiler_options *options =
&ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT];
- while (do_common_optimization(p.shader->ir, false, false, 32, options))
+ while (do_common_optimization(p.shader->ir, false, false, options,
+ ctx->Const.NativeIntegers))
;
reparent_ir(p.shader->ir, p.shader->ir);
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c
index 2ef2e31d6..cf96609ea 100644
--- a/mesalib/src/mesa/main/format_unpack.c
+++ b/mesalib/src/mesa/main/format_unpack.c
@@ -645,7 +645,7 @@ unpack_R10G10B10A2_UINT(const void *src, GLfloat dst[][4], GLuint n)
static void
-unpack_Z24_S8(const void *src, GLfloat dst[][4], GLuint n)
+unpack_S8_UINT_Z24_UNORM(const void *src, GLfloat dst[][4], GLuint n)
{
/* only return Z, not stencil data */
const GLuint *s = ((const GLuint *) src);
@@ -662,7 +662,7 @@ unpack_Z24_S8(const void *src, GLfloat dst[][4], GLuint n)
}
static void
-unpack_S8_Z24(const void *src, GLfloat dst[][4], GLuint n)
+unpack_Z24_UNORM_S8_UINT(const void *src, GLfloat dst[][4], GLuint n)
{
/* only return Z, not stencil data */
const GLuint *s = ((const GLuint *) src);
@@ -679,7 +679,7 @@ unpack_S8_Z24(const void *src, GLfloat dst[][4], GLuint n)
}
static void
-unpack_Z16(const void *src, GLfloat dst[][4], GLuint n)
+unpack_Z_UNORM16(const void *src, GLfloat dst[][4], GLuint n)
{
const GLushort *s = ((const GLushort *) src);
GLuint i;
@@ -692,19 +692,19 @@ unpack_Z16(const void *src, GLfloat dst[][4], GLuint n)
}
static void
-unpack_X8_Z24(const void *src, GLfloat dst[][4], GLuint n)
+unpack_Z24_UNORM_X8_UINT(const void *src, GLfloat dst[][4], GLuint n)
{
- unpack_S8_Z24(src, dst, n);
+ unpack_Z24_UNORM_S8_UINT(src, dst, n);
}
static void
-unpack_Z24_X8(const void *src, GLfloat dst[][4], GLuint n)
+unpack_X8_UINT_Z24_UNORM(const void *src, GLfloat dst[][4], GLuint n)
{
- unpack_Z24_S8(src, dst, n);
+ unpack_S8_UINT_Z24_UNORM(src, dst, n);
}
static void
-unpack_Z32(const void *src, GLfloat dst[][4], GLuint n)
+unpack_Z_UNORM32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLuint *s = ((const GLuint *) src);
GLuint i;
@@ -717,7 +717,7 @@ unpack_Z32(const void *src, GLfloat dst[][4], GLuint n)
}
static void
-unpack_Z32_FLOAT_X24S8(const void *src, GLfloat dst[][4], GLuint n)
+unpack_Z32_FLOAT_S8X24_UINT(const void *src, GLfloat dst[][4], GLuint n)
{
const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src;
GLuint i;
@@ -730,7 +730,7 @@ unpack_Z32_FLOAT_X24S8(const void *src, GLfloat dst[][4], GLuint n)
}
static void
-unpack_Z32_FLOAT(const void *src, GLfloat dst[][4], GLuint n)
+unpack_Z_FLOAT32(const void *src, GLfloat dst[][4], GLuint n)
{
const GLfloat *s = ((const GLfloat *) src);
GLuint i;
@@ -2391,12 +2391,12 @@ get_unpack_rgba_function(mesa_format format)
table[MESA_FORMAT_B10G10R10A2_UNORM] = unpack_B10G10R10A2_UNORM;
table[MESA_FORMAT_B10G10R10A2_UINT] = unpack_B10G10R10A2_UINT;
table[MESA_FORMAT_R10G10B10A2_UINT] = unpack_R10G10B10A2_UINT;
- table[MESA_FORMAT_S8_UINT_Z24_UNORM] = unpack_Z24_S8;
- table[MESA_FORMAT_Z24_UNORM_S8_UINT] = unpack_S8_Z24;
- table[MESA_FORMAT_Z_UNORM16] = unpack_Z16;
- table[MESA_FORMAT_Z24_UNORM_X8_UINT] = unpack_X8_Z24;
- table[MESA_FORMAT_X8_UINT_Z24_UNORM] = unpack_Z24_X8;
- table[MESA_FORMAT_Z_UNORM32] = unpack_Z32;
+ table[MESA_FORMAT_S8_UINT_Z24_UNORM] = unpack_S8_UINT_Z24_UNORM;
+ table[MESA_FORMAT_Z24_UNORM_S8_UINT] = unpack_Z24_UNORM_S8_UINT;
+ table[MESA_FORMAT_Z_UNORM16] = unpack_Z_UNORM16;
+ table[MESA_FORMAT_Z24_UNORM_X8_UINT] = unpack_Z24_UNORM_X8_UINT;
+ table[MESA_FORMAT_X8_UINT_Z24_UNORM] = unpack_X8_UINT_Z24_UNORM;
+ table[MESA_FORMAT_Z_UNORM32] = unpack_Z_UNORM32;
table[MESA_FORMAT_S_UINT8] = unpack_S8;
table[MESA_FORMAT_BGR_SRGB8] = unpack_BGR_SRGB8;
table[MESA_FORMAT_A8B8G8R8_SRGB] = unpack_A8B8G8R8_SRGB;
@@ -2533,8 +2533,8 @@ get_unpack_rgba_function(mesa_format format)
table[MESA_FORMAT_R9G9B9E5_FLOAT] = unpack_R9G9B9E5_FLOAT;
table[MESA_FORMAT_R11G11B10_FLOAT] = unpack_R11G11B10_FLOAT;
- table[MESA_FORMAT_Z_FLOAT32] = unpack_Z32_FLOAT;
- table[MESA_FORMAT_Z32_FLOAT_S8X24_UINT] = unpack_Z32_FLOAT_X24S8;
+ table[MESA_FORMAT_Z_FLOAT32] = unpack_Z_FLOAT32;
+ table[MESA_FORMAT_Z32_FLOAT_S8X24_UINT] = unpack_Z32_FLOAT_S8X24_UINT;
table[MESA_FORMAT_B4G4R4X4_UNORM] = unpack_XRGB4444_UNORM;
table[MESA_FORMAT_B5G5R5X1_UNORM] = unpack_XRGB1555_UNORM;
@@ -3935,7 +3935,7 @@ _mesa_unpack_rgba_block(mesa_format format,
typedef void (*unpack_float_z_func)(GLuint n, const void *src, GLfloat *dst);
static void
-unpack_float_z_Z24_X8(GLuint n, const void *src, GLfloat *dst)
+unpack_float_z_X8_UINT_Z24_UNORM(GLuint n, const void *src, GLfloat *dst)
{
/* only return Z, not stencil data */
const GLuint *s = ((const GLuint *) src);
@@ -3949,7 +3949,7 @@ unpack_float_z_Z24_X8(GLuint n, const void *src, GLfloat *dst)
}
static void
-unpack_float_z_X8_Z24(GLuint n, const void *src, GLfloat *dst)
+unpack_float_z_Z24_UNORM_X8_UINT(GLuint n, const void *src, GLfloat *dst)
{
/* only return Z, not stencil data */
const GLuint *s = ((const GLuint *) src);
@@ -3983,7 +3983,7 @@ unpack_float_Z_UNORM32(GLuint n, const void *src, GLfloat *dst)
}
static void
-unpack_float_z_Z32F(GLuint n, const void *src, GLfloat *dst)
+unpack_float_Z_FLOAT32(GLuint n, const void *src, GLfloat *dst)
{
memcpy(dst, src, n * sizeof(float));
}
@@ -4013,11 +4013,11 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n,
switch (format) {
case MESA_FORMAT_S8_UINT_Z24_UNORM:
case MESA_FORMAT_X8_UINT_Z24_UNORM:
- unpack = unpack_float_z_Z24_X8;
+ unpack = unpack_float_z_X8_UINT_Z24_UNORM;
break;
case MESA_FORMAT_Z24_UNORM_S8_UINT:
case MESA_FORMAT_Z24_UNORM_X8_UINT:
- unpack = unpack_float_z_X8_Z24;
+ unpack = unpack_float_z_Z24_UNORM_X8_UINT;
break;
case MESA_FORMAT_Z_UNORM16:
unpack = unpack_float_Z_UNORM16;
@@ -4026,7 +4026,7 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n,
unpack = unpack_float_Z_UNORM32;
break;
case MESA_FORMAT_Z_FLOAT32:
- unpack = unpack_float_z_Z32F;
+ unpack = unpack_float_Z_FLOAT32;
break;
case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
unpack = unpack_float_z_Z32X24S8;
@@ -4045,7 +4045,7 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n,
typedef void (*unpack_uint_z_func)(const void *src, GLuint *dst, GLuint n);
static void
-unpack_uint_z_Z24_X8(const void *src, GLuint *dst, GLuint n)
+unpack_uint_z_X8_UINT_Z24_UNORM(const void *src, GLuint *dst, GLuint n)
{
/* only return Z, not stencil data */
const GLuint *s = ((const GLuint *) src);
@@ -4056,7 +4056,7 @@ unpack_uint_z_Z24_X8(const void *src, GLuint *dst, GLuint n)
}
static void
-unpack_uint_z_X8_Z24(const void *src, GLuint *dst, GLuint n)
+unpack_uint_z_Z24_UNORM_X8_UINT(const void *src, GLuint *dst, GLuint n)
{
/* only return Z, not stencil data */
const GLuint *s = ((const GLuint *) src);
@@ -4118,11 +4118,11 @@ _mesa_unpack_uint_z_row(mesa_format format, GLuint n,
switch (format) {
case MESA_FORMAT_S8_UINT_Z24_UNORM:
case MESA_FORMAT_X8_UINT_Z24_UNORM:
- unpack = unpack_uint_z_Z24_X8;
+ unpack = unpack_uint_z_X8_UINT_Z24_UNORM;
break;
case MESA_FORMAT_Z24_UNORM_S8_UINT:
case MESA_FORMAT_Z24_UNORM_X8_UINT:
- unpack = unpack_uint_z_X8_Z24;
+ unpack = unpack_uint_z_Z24_UNORM_X8_UINT;
break;
case MESA_FORMAT_Z_UNORM16:
unpack = unpack_uint_Z_UNORM16;
@@ -4147,13 +4147,13 @@ _mesa_unpack_uint_z_row(mesa_format format, GLuint n,
static void
-unpack_ubyte_s_S8(const void *src, GLubyte *dst, GLuint n)
+unpack_ubyte_s_S_UINT8(const void *src, GLubyte *dst, GLuint n)
{
memcpy(dst, src, n);
}
static void
-unpack_ubyte_s_Z24_S8(const void *src, GLubyte *dst, GLuint n)
+unpack_ubyte_s_S8_UINT_Z24_UNORM(const void *src, GLubyte *dst, GLuint n)
{
GLuint i;
const GLuint *src32 = src;
@@ -4163,7 +4163,7 @@ unpack_ubyte_s_Z24_S8(const void *src, GLubyte *dst, GLuint n)
}
static void
-unpack_ubyte_s_S8_Z24(const void *src, GLubyte *dst, GLuint n)
+unpack_ubyte_s_Z24_UNORM_S8_UINT(const void *src, GLubyte *dst, GLuint n)
{
GLuint i;
const GLuint *src32 = src;
@@ -4173,7 +4173,7 @@ unpack_ubyte_s_S8_Z24(const void *src, GLubyte *dst, GLuint n)
}
static void
-unpack_ubyte_s_Z32_FLOAT_X24S8(const void *src, GLubyte *dst, GLuint n)
+unpack_ubyte_s_Z32_FLOAT_S8X24_UINT(const void *src, GLubyte *dst, GLuint n)
{
GLuint i;
const struct z32f_x24s8 *s = (const struct z32f_x24s8 *) src;
@@ -4188,16 +4188,16 @@ _mesa_unpack_ubyte_stencil_row(mesa_format format, GLuint n,
{
switch (format) {
case MESA_FORMAT_S_UINT8:
- unpack_ubyte_s_S8(src, dst, n);
+ unpack_ubyte_s_S_UINT8(src, dst, n);
break;
case MESA_FORMAT_S8_UINT_Z24_UNORM:
- unpack_ubyte_s_Z24_S8(src, dst, n);
+ unpack_ubyte_s_S8_UINT_Z24_UNORM(src, dst, n);
break;
case MESA_FORMAT_Z24_UNORM_S8_UINT:
- unpack_ubyte_s_S8_Z24(src, dst, n);
+ unpack_ubyte_s_Z24_UNORM_S8_UINT(src, dst, n);
break;
case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
- unpack_ubyte_s_Z32_FLOAT_X24S8(src, dst, n);
+ unpack_ubyte_s_Z32_FLOAT_S8X24_UINT(src, dst, n);
break;
default:
_mesa_problem(NULL, "bad format %s in _mesa_unpack_ubyte_s_row",
@@ -4207,7 +4207,7 @@ _mesa_unpack_ubyte_stencil_row(mesa_format format, GLuint n,
}
static void
-unpack_uint_24_8_depth_stencil_S8_Z24(const GLuint *src, GLuint *dst, GLuint n)
+unpack_uint_24_8_depth_stencil_Z24_UNORM_S8_UINT(const GLuint *src, GLuint *dst, GLuint n)
{
GLuint i;
@@ -4233,7 +4233,7 @@ unpack_uint_24_8_depth_stencil_Z32_S8X24(const GLuint *src,
}
static void
-unpack_uint_24_8_depth_stencil_Z24_S8(const GLuint *src, GLuint *dst, GLuint n)
+unpack_uint_24_8_depth_stencil_S8_UINT_Z24_UNORM(const GLuint *src, GLuint *dst, GLuint n)
{
memcpy(dst, src, n * 4);
}
@@ -4248,10 +4248,10 @@ _mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n,
{
switch (format) {
case MESA_FORMAT_S8_UINT_Z24_UNORM:
- unpack_uint_24_8_depth_stencil_Z24_S8(src, dst, n);
+ unpack_uint_24_8_depth_stencil_S8_UINT_Z24_UNORM(src, dst, n);
break;
case MESA_FORMAT_Z24_UNORM_S8_UINT:
- unpack_uint_24_8_depth_stencil_S8_Z24(src, dst, n);
+ unpack_uint_24_8_depth_stencil_Z24_UNORM_S8_UINT(src, dst, n);
break;
case MESA_FORMAT_Z32_FLOAT_S8X24_UINT:
unpack_uint_24_8_depth_stencil_Z32_S8X24(src, dst, n);
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index 4fb1f116b..fb2501c69 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -3153,9 +3153,9 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
case MESA_FORMAT_L_UNORM16:
return format == GL_LUMINANCE && type == GL_UNSIGNED_SHORT && !swapBytes;
case MESA_FORMAT_I_UNORM8:
- return format == GL_INTENSITY && type == GL_UNSIGNED_BYTE;
+ return format == GL_RED && type == GL_UNSIGNED_BYTE;
case MESA_FORMAT_I_UNORM16:
- return format == GL_INTENSITY && type == GL_UNSIGNED_SHORT && !swapBytes;
+ return format == GL_RED && type == GL_UNSIGNED_SHORT && !swapBytes;
case MESA_FORMAT_YCBCR:
return format == GL_YCBCR_MESA &&
@@ -3247,9 +3247,9 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
return format == GL_LUMINANCE_ALPHA && type == GL_HALF_FLOAT && !swapBytes;
case MESA_FORMAT_I_FLOAT32:
- return format == GL_INTENSITY && type == GL_FLOAT && !swapBytes;
+ return format == GL_RED && type == GL_FLOAT && !swapBytes;
case MESA_FORMAT_I_FLOAT16:
- return format == GL_INTENSITY && type == GL_HALF_FLOAT && !swapBytes;
+ return format == GL_RED && type == GL_HALF_FLOAT && !swapBytes;
case MESA_FORMAT_R_FLOAT32:
return format == GL_RED && type == GL_FLOAT && !swapBytes;
@@ -3277,13 +3277,17 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
return format == GL_ALPHA_INTEGER && type == GL_INT && !swapBytes;
case MESA_FORMAT_I_UINT8:
+ return format == GL_RED_INTEGER && type == GL_UNSIGNED_BYTE;
case MESA_FORMAT_I_UINT16:
+ return format == GL_RED_INTEGER && type == GL_UNSIGNED_SHORT && !swapBytes;
case MESA_FORMAT_I_UINT32:
+ return format == GL_RED_INTEGER && type == GL_UNSIGNED_INT && !swapBytes;
case MESA_FORMAT_I_SINT8:
+ return format == GL_RED_INTEGER && type == GL_BYTE;
case MESA_FORMAT_I_SINT16:
+ return format == GL_RED_INTEGER && type == GL_SHORT && !swapBytes;
case MESA_FORMAT_I_SINT32:
- /* GL_INTENSITY_INTEGER_EXT doesn't exist. */
- return GL_FALSE;
+ return format == GL_RED_INTEGER && type == GL_INT && !swapBytes;
case MESA_FORMAT_L_UINT8:
return format == GL_LUMINANCE_INTEGER_EXT && type == GL_UNSIGNED_BYTE;
@@ -3450,7 +3454,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
return format == GL_LUMINANCE_ALPHA && type == GL_BYTE &&
littleEndian && !swapBytes;
case MESA_FORMAT_I_SNORM8:
- return format == GL_INTENSITY && type == GL_BYTE;
+ return format == GL_RED && type == GL_BYTE;
case MESA_FORMAT_A_SNORM16:
return format == GL_ALPHA && type == GL_SHORT && !swapBytes;
case MESA_FORMAT_L_SNORM16:
@@ -3459,7 +3463,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
return format == GL_LUMINANCE_ALPHA && type == GL_SHORT &&
littleEndian && !swapBytes;
case MESA_FORMAT_I_SNORM16:
- return format == GL_INTENSITY && type == GL_SHORT && littleEndian &&
+ return format == GL_RED && type == GL_SHORT && littleEndian &&
!swapBytes;
case MESA_FORMAT_B10G10R10A2_UINT:
diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h
index 29772be6e..db19eda3d 100644
--- a/mesalib/src/mesa/main/imports.h
+++ b/mesalib/src/mesa/main/imports.h
@@ -49,16 +49,10 @@ extern "C" {
/** Memory macros */
/*@{*/
-/** Allocate \p BYTES bytes */
-#define MALLOC(BYTES) malloc(BYTES)
-/** Allocate and zero \p BYTES bytes */
-#define CALLOC(BYTES) calloc(1, BYTES)
/** Allocate a structure of type \p T */
#define MALLOC_STRUCT(T) (struct T *) malloc(sizeof(struct T))
/** Allocate and zero a structure of type \p T */
#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
-/** Free memory */
-#define FREE(PTR) free(PTR)
/*@}*/
diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h
index dafeaa372..5228c3a8f 100644
--- a/mesalib/src/mesa/main/macros.h
+++ b/mesalib/src/mesa/main/macros.h
@@ -685,6 +685,17 @@ minify(unsigned value, unsigned levels)
}
/**
+ * Return true if the given value is a power of two.
+ *
+ * Note that this considers 0 a power of two.
+ */
+static inline bool
+is_power_of_two(unsigned value)
+{
+ return (value & (value - 1)) == 0;
+}
+
+/**
* Align a value up to an alignment value
*
* If \c value is not already aligned to the requested alignment value, it
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 33cb88881..4d014d1ee 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2421,8 +2421,7 @@ struct gl_shader
/**
* This shader's uniform block information.
*
- * The offsets of the variables are assigned only for shaders in a program's
- * _LinkedShaders[].
+ * These fields are only set post-linking.
*/
struct gl_uniform_block *UniformBlocks;
unsigned NumUniformBlocks;
@@ -3472,6 +3471,8 @@ struct gl_constants
/** GL_ARB_gpu_shader5 */
GLfloat MinFragmentInterpolationOffset;
GLfloat MaxFragmentInterpolationOffset;
+
+ GLboolean FakeSWMSAA;
};
diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c
index d976e5aae..1df656832 100644
--- a/mesalib/src/mesa/main/pack.c
+++ b/mesalib/src/mesa/main/pack.c
@@ -1489,72 +1489,72 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
switch (dstFormat) {
case GL_RED:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
+ dst[i] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
break;
case GL_GREEN:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
+ dst[i] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
break;
case GL_BLUE:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
+ dst[i] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]);
break;
case GL_ALPHA:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
+ dst[i] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]);
break;
case GL_LUMINANCE:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_BYTE(luminance[i]);
+ dst[i] = FLOAT_TO_BYTE_TEX(luminance[i]);
break;
case GL_LUMINANCE_ALPHA:
for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_BYTE(luminance[i]);
- dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
+ dst[i*2+0] = FLOAT_TO_BYTE_TEX(luminance[i]);
+ dst[i*2+1] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]);
}
break;
case GL_RG:
for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
+ dst[i*2+0] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
+ dst[i*2+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
}
break;
case GL_RGB:
for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
+ dst[i*3+0] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
+ dst[i*3+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
+ dst[i*3+2] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]);
}
break;
case GL_RGBA:
for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
- dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
+ dst[i*4+0] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
+ dst[i*4+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
+ dst[i*4+2] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]);
+ dst[i*4+3] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]);
}
break;
case GL_BGR:
for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
- dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
+ dst[i*3+0] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]);
+ dst[i*3+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
+ dst[i*3+2] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
}
break;
case GL_BGRA:
for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
- dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
+ dst[i*4+0] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]);
+ dst[i*4+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
+ dst[i*4+2] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
+ dst[i*4+3] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]);
}
break;
case GL_ABGR_EXT:
for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][ACOMP]);
- dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][BCOMP]);
- dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
+ dst[i*4+0] = FLOAT_TO_BYTE_TEX(rgba[i][ACOMP]);
+ dst[i*4+1] = FLOAT_TO_BYTE_TEX(rgba[i][BCOMP]);
+ dst[i*4+2] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
+ dst[i*4+3] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
}
break;
case GL_RED_INTEGER_EXT:
@@ -1631,8 +1631,8 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
case GL_DUDV_ATI:
case GL_DU8DV8_ATI:
for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
+ dst[i*2+0] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
+ dst[i*2+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
}
break;
default:
@@ -1803,72 +1803,72 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
switch (dstFormat) {
case GL_RED:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
+ dst[i] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
break;
case GL_GREEN:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
+ dst[i] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
break;
case GL_BLUE:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
+ dst[i] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]);
break;
case GL_ALPHA:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
+ dst[i] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]);
break;
case GL_LUMINANCE:
for (i=0;i<n;i++)
- dst[i] = FLOAT_TO_SHORT(luminance[i]);
+ dst[i] = FLOAT_TO_SHORT_TEX(luminance[i]);
break;
case GL_LUMINANCE_ALPHA:
for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_SHORT(luminance[i]);
- dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
+ dst[i*2+0] = FLOAT_TO_SHORT_TEX(luminance[i]);
+ dst[i*2+1] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]);
}
break;
case GL_RG:
for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
+ dst[i*2+0] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
+ dst[i*2+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
}
break;
case GL_RGB:
for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
+ dst[i*3+0] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
+ dst[i*3+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
+ dst[i*3+2] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]);
}
break;
case GL_RGBA:
for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
- dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
+ dst[i*4+0] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
+ dst[i*4+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
+ dst[i*4+2] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]);
+ dst[i*4+3] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]);
}
break;
case GL_BGR:
for (i=0;i<n;i++) {
- dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
- dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
+ dst[i*3+0] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]);
+ dst[i*3+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
+ dst[i*3+2] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
}
break;
case GL_BGRA:
for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
- dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
+ dst[i*4+0] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]);
+ dst[i*4+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
+ dst[i*4+2] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
+ dst[i*4+3] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]);
}
break;
case GL_ABGR_EXT:
for (i=0;i<n;i++) {
- dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][ACOMP]);
- dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][BCOMP]);
- dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
- dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
+ dst[i*4+0] = FLOAT_TO_SHORT_TEX(rgba[i][ACOMP]);
+ dst[i*4+1] = FLOAT_TO_SHORT_TEX(rgba[i][BCOMP]);
+ dst[i*4+2] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
+ dst[i*4+3] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
}
break;
case GL_RED_INTEGER_EXT:
@@ -1945,8 +1945,8 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
case GL_DUDV_ATI:
case GL_DU8DV8_ATI:
for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]);
+ dst[i*2+0] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
+ dst[i*2+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
}
break;
default:
diff --git a/mesalib/src/mesa/main/shader_query.cpp b/mesalib/src/mesa/main/shader_query.cpp
index e1afe5315..f66c11733 100644
--- a/mesalib/src/mesa/main/shader_query.cpp
+++ b/mesalib/src/mesa/main/shader_query.cpp
@@ -76,6 +76,30 @@ _mesa_BindAttribLocation(GLhandleARB program, GLuint index,
*/
}
+static bool
+is_active_attrib(const ir_variable *var)
+{
+ if (!var)
+ return false;
+
+ switch (var->data.mode) {
+ case ir_var_shader_in:
+ return var->data.location != -1;
+
+ case ir_var_system_value:
+ /* From GL 4.3 core spec, section 11.1.1 (Vertex Attributes):
+ * "For GetActiveAttrib, all active vertex shader input variables
+ * are enumerated, including the special built-in inputs gl_VertexID
+ * and gl_InstanceID."
+ */
+ return !strcmp(var->name, "gl_VertexID") ||
+ !strcmp(var->name, "gl_InstanceID");
+
+ default:
+ return false;
+ }
+}
+
void GLAPIENTRY
_mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
GLsizei maxLength, GLsizei * length, GLint * size,
@@ -105,10 +129,8 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
foreach_list(node, ir) {
const ir_variable *const var = ((ir_instruction *) node)->as_variable();
- if (var == NULL
- || var->data.mode != ir_var_shader_in
- || var->data.location == -1)
- continue;
+ if (!is_active_attrib(var))
+ continue;
if (current_index == desired_index) {
_mesa_copy_string(name, maxLength, length, var->name);
@@ -196,10 +218,8 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg)
foreach_list(node, ir) {
const ir_variable *const var = ((ir_instruction *) node)->as_variable();
- if (var == NULL
- || var->data.mode != ir_var_shader_in
- || var->data.location == -1)
- continue;
+ if (!is_active_attrib(var))
+ continue;
i++;
}
diff --git a/mesalib/src/mesa/main/texcompress_etc.c b/mesalib/src/mesa/main/texcompress_etc.c
index cbda68940..ae973b001 100644
--- a/mesalib/src/mesa/main/texcompress_etc.c
+++ b/mesalib/src/mesa/main/texcompress_etc.c
@@ -678,14 +678,25 @@ etc2_unpack_rgb8(uint8_t *dst_row,
for (y = 0; y < height; y += bh) {
const uint8_t *src = src_row;
+ /*
+ * Destination texture may not be a multiple of four texels in
+ * height. Compute a safe height to avoid writing outside the texture.
+ */
+ const unsigned h = MIN2(bh, height - y);
for (x = 0; x < width; x+= bw) {
+ /*
+ * Destination texture may not be a multiple of four texels in
+ * width. Compute a safe width to avoid writing outside the texture.
+ */
+ const unsigned w = MIN2(bw, width - x);
+
etc2_rgb8_parse_block(&block, src,
false /* punchthrough_alpha */);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
false /* punchthrough_alpha */);
dst[3] = 255;
@@ -715,14 +726,17 @@ etc2_unpack_srgb8(uint8_t *dst_row,
for (y = 0; y < height; y += bh) {
const uint8_t *src = src_row;
+ const unsigned h = MIN2(bh, height - y);
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
etc2_rgb8_parse_block(&block, src,
false /* punchthrough_alpha */);
- for (j = 0; j < bh; j++) {
+
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
false /* punchthrough_alpha */);
/* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
@@ -759,13 +773,15 @@ etc2_unpack_rgba8(uint8_t *dst_row,
for (y = 0; y < height; y += bh) {
const uint8_t *src = src_row;
+ const unsigned h = MIN2(bh, height - y);
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
etc2_rgba8_parse_block(&block, src);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_rgba8_fetch_texel(&block, i, j, dst);
dst += comps;
}
@@ -795,14 +811,16 @@ etc2_unpack_srgb8_alpha8(uint8_t *dst_row,
uint8_t tmp;
for (y = 0; y < height; y += bh) {
+ const unsigned h = MIN2(bh, height - y);
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
etc2_rgba8_parse_block(&block, src);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_rgba8_fetch_texel(&block, i, j, dst);
/* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
@@ -837,14 +855,16 @@ etc2_unpack_r11(uint8_t *dst_row,
unsigned x, y, i, j;
for (y = 0; y < height; y += bh) {
+ const unsigned h = MIN2(bh, height - y);
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
etc2_r11_parse_block(&block, src);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps * comp_size;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
}
@@ -872,16 +892,18 @@ etc2_unpack_rg11(uint8_t *dst_row,
unsigned x, y, i, j;
for (y = 0; y < height; y += bh) {
+ const unsigned h = MIN2(bh, height - y);
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
/* red component */
etc2_r11_parse_block(&block, src);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
}
@@ -889,10 +911,10 @@ etc2_unpack_rg11(uint8_t *dst_row,
/* green component */
etc2_r11_parse_block(&block, src + 8);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_r11_fetch_texel(&block, i, j, dst + comp_size);
dst += comps * comp_size;
}
@@ -920,15 +942,17 @@ etc2_unpack_signed_r11(uint8_t *dst_row,
unsigned x, y, i, j;
for (y = 0; y < height; y += bh) {
+ const unsigned h = MIN2(bh, height - y);
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
etc2_r11_parse_block(&block, src);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_signed_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
}
@@ -956,16 +980,18 @@ etc2_unpack_signed_rg11(uint8_t *dst_row,
unsigned x, y, i, j;
for (y = 0; y < height; y += bh) {
+ const unsigned h = MIN2(bh, height - y);
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
/* red component */
etc2_r11_parse_block(&block, src);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_signed_r11_fetch_texel(&block, i, j, dst);
dst += comps * comp_size;
}
@@ -973,10 +999,10 @@ etc2_unpack_signed_rg11(uint8_t *dst_row,
/* green component */
etc2_r11_parse_block(&block, src + 8);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride +
x * comps * comp_size;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_signed_r11_fetch_texel(&block, i, j, dst + comp_size);
dst += comps * comp_size;
}
@@ -1001,14 +1027,16 @@ etc2_unpack_rgb8_punchthrough_alpha1(uint8_t *dst_row,
unsigned x, y, i, j;
for (y = 0; y < height; y += bh) {
+ const unsigned h = MIN2(bh, height - y);
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
etc2_rgb8_parse_block(&block, src,
true /* punchthrough_alpha */);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
true /* punchthrough_alpha */);
dst += comps;
@@ -1036,14 +1064,16 @@ etc2_unpack_srgb8_punchthrough_alpha1(uint8_t *dst_row,
uint8_t tmp;
for (y = 0; y < height; y += bh) {
+ const unsigned h = MIN2(bh, height - y);
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
+ const unsigned w = MIN2(bw, width - x);
etc2_rgb8_parse_block(&block, src,
true /* punchthrough_alpha */);
- for (j = 0; j < bh; j++) {
+ for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
- for (i = 0; i < bw; i++) {
+ for (i = 0; i < w; i++) {
etc2_rgb8_fetch_texel(&block, i, j, dst,
true /* punchthrough_alpha */);
/* Convert to MESA_FORMAT_B8G8R8A8_SRGB */
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index 004e7ebac..d43480482 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -76,11 +76,10 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
} else if (type == GL_UNSIGNED_INT_2_10_10_10_REV) {
RETURN_IF_SUPPORTED(MESA_FORMAT_B10G10R10A2_UNORM);
}
- RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_UNORM);
- RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM);
- break;
+ /* fallthrough */
case GL_RGBA8:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_UNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_UNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM);
break;
@@ -97,6 +96,7 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
/* deep RGBA formats */
case GL_RGB10_A2:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R10G10B10A2_UNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_B10G10R10A2_UNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM);
break;
@@ -116,6 +116,10 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
}
/* fallthrough */
case GL_RGB8:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UNORM8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8X8_UNORM);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_UNORM);
+
RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_UNORM8);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8X8_UNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM);
@@ -451,10 +455,14 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
break;
case GL_RGB_SNORM:
case GL_RGB8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8X8_SNORM);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_X8B8G8R8_SNORM);
- /* FALLTHROUGH */
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM);
+ break;
case GL_RGBA_SNORM:
case GL_RGBA8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM);
RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM);
break;
@@ -522,11 +530,17 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
case GL_SRGB_EXT:
case GL_SRGB8_EXT:
+ /* there is no MESA_FORMAT_RGB_SRGB8 */
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8X8_SRGB);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SRGB);
+
RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_SRGB8);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
break;
case GL_SRGB_ALPHA_EXT:
case GL_SRGB8_ALPHA8_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SRGB);
+
RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SRGB);
RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB);
break;
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 8bdbb08c8..918dd59ed 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -559,6 +559,13 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
/* 'q' in the GL spec */
maxLevels - 1);
+ if (t->Immutable) {
+ /* Adjust max level for views: the data store may have more levels than
+ * the view exposes.
+ */
+ t->_MaxLevel = MIN2(t->_MaxLevel, t->NumLevels - 1);
+ }
+
/* Compute _MaxLambda = q - p in the spec used during mipmapping */
t->_MaxLambda = (GLfloat) (t->_MaxLevel - baseLevel);
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index bfb2e1b9f..40790ff0e 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -352,7 +352,8 @@ set_tex_parameteri(struct gl_context *ctx,
if (texObj->MaxLevel == params[0])
return GL_FALSE;
- if (params[0] < 0 || texObj->Target == GL_TEXTURE_RECTANGLE_ARB) {
+ if (params[0] < 0 ||
+ (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] > 0)) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glTexParameter(param=%d)", params[0]);
return GL_FALSE;
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index b68ba603e..d9096abf3 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -3260,19 +3260,10 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS)
GLboolean k;
ASSERT(dstFormat == MESA_FORMAT_A8B8G8R8_SRGB ||
- dstFormat == MESA_FORMAT_R8G8B8X8_SRGB);
+ dstFormat == MESA_FORMAT_R8G8B8X8_SRGB ||
+ dstFormat == MESA_FORMAT_R8G8B8A8_SRGB);
- /* reuse normal rgba texstore code */
- if (dstFormat == MESA_FORMAT_A8B8G8R8_SRGB) {
- newDstFormat = MESA_FORMAT_A8B8G8R8_UNORM;
- }
- else if (dstFormat == MESA_FORMAT_R8G8B8X8_SRGB) {
- newDstFormat = MESA_FORMAT_R8G8B8X8_UNORM;
- }
- else {
- ASSERT(0);
- return GL_TRUE;
- }
+ newDstFormat = _mesa_get_srgb_format_linear(dstFormat);
k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat,
newDstFormat,
@@ -3290,20 +3281,10 @@ _mesa_texstore_sargb8(TEXSTORE_PARAMS)
mesa_format newDstFormat;
GLboolean k;
- switch (dstFormat) {
- case MESA_FORMAT_B8G8R8A8_SRGB:
- newDstFormat = MESA_FORMAT_B8G8R8A8_UNORM;
- break;
- case MESA_FORMAT_R8G8B8A8_SRGB:
- newDstFormat = MESA_FORMAT_R8G8B8A8_UNORM;
- break;
- case MESA_FORMAT_B8G8R8X8_SRGB:
- newDstFormat = MESA_FORMAT_B8G8R8X8_UNORM;
- break;
- default:
- ASSERT(0);
- return GL_FALSE;
- }
+ assert(dstFormat == MESA_FORMAT_B8G8R8A8_SRGB ||
+ dstFormat == MESA_FORMAT_B8G8R8X8_SRGB);
+
+ newDstFormat = _mesa_get_srgb_format_linear(dstFormat);
k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat,
newDstFormat,
@@ -3852,6 +3833,7 @@ _mesa_get_texstore_func(mesa_format format)
table[MESA_FORMAT_B5G5R5X1_UNORM] = store_ubyte_texture;
table[MESA_FORMAT_R8G8B8X8_SNORM] = _mesa_texstore_signed_rgbx8888;
table[MESA_FORMAT_R8G8B8X8_SRGB] = _mesa_texstore_srgba8;
+ table[MESA_FORMAT_R8G8B8A8_SRGB] = _mesa_texstore_srgba8;
table[MESA_FORMAT_RGBX_UINT8] = _mesa_texstore_rgba_uint8;
table[MESA_FORMAT_RGBX_SINT8] = _mesa_texstore_rgba_int8;
table[MESA_FORMAT_B10G10R10X2_UNORM] = _mesa_texstore_argb2101010;
diff --git a/mesalib/src/mesa/main/vdpau.c b/mesalib/src/mesa/main/vdpau.c
index c2cf20664..d97459393 100644
--- a/mesalib/src/mesa/main/vdpau.c
+++ b/mesalib/src/mesa/main/vdpau.c
@@ -88,7 +88,7 @@ unregister_surface(struct set_entry *entry)
}
_mesa_set_remove(ctx->vdpSurfaces, entry);
- FREE(surf);
+ free(surf);
}
void GLAPIENTRY
@@ -145,7 +145,7 @@ register_surface(struct gl_context *ctx, GLboolean isOutput,
if (tex->Immutable) {
_mesa_unlock_texture(ctx, tex);
- FREE(surf);
+ free(surf);
_mesa_error(ctx, GL_INVALID_OPERATION,
"VDPAURegisterSurfaceNV(texture is immutable)");
return (GLintptr)NULL;
@@ -155,7 +155,7 @@ register_surface(struct gl_context *ctx, GLboolean isOutput,
tex->Target = target;
else if (tex->Target != target) {
_mesa_unlock_texture(ctx, tex);
- FREE(surf);
+ free(surf);
_mesa_error(ctx, GL_INVALID_OPERATION,
"VDPAURegisterSurfaceNV(target mismatch)");
return (GLintptr)NULL;
@@ -254,7 +254,7 @@ _mesa_VDPAUUnregisterSurfaceNV(GLintptr surface)
}
_mesa_set_remove(ctx->vdpSurfaces, entry);
- FREE(surf);
+ free(surf);
}
void GLAPIENTRY
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 63cba26da..b3ae3f5e8 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -228,7 +228,7 @@ compute_version(struct gl_context *ctx)
ctx->Extensions.EXT_texture_sRGB);
const GLboolean ver_3_0 = (ver_2_1 &&
ctx->Const.GLSLVersion >= 130 &&
- ctx->Const.MaxSamples >= 4 &&
+ (ctx->Const.MaxSamples >= 4 || ctx->Const.FakeSWMSAA) &&
(ctx->API == API_OPENGL_CORE ||
ctx->Extensions.ARB_color_buffer_float) &&
ctx->Extensions.ARB_depth_buffer_float &&
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index 0923357b1..59cf1232a 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -3007,8 +3007,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
progress = do_common_optimization(ir, true, true,
- options->MaxUnrollIterations,
- options)
+ options, ctx->Const.NativeIntegers)
|| progress;
progress = lower_quadop_vector(ir, true) || progress;
diff --git a/mesalib/src/mesa/program/prog_noise.c b/mesalib/src/mesa/program/prog_noise.c
index c258c5e2e..ac920c23f 100644
--- a/mesalib/src/mesa/program/prog_noise.c
+++ b/mesalib/src/mesa/program/prog_noise.c
@@ -257,12 +257,12 @@ _mesa_noise2(GLfloat x, GLfloat y)
float y0 = y - Y0;
float x1, y1, x2, y2;
- int ii, jj;
+ unsigned int ii, jj;
float t0, t1, t2;
/* For the 2D case, the simplex shape is an equilateral triangle. */
/* Determine which simplex we are in. */
- int i1, j1; /* Offsets for second (middle) corner of simplex in (i,j) coords */
+ unsigned int i1, j1; /* Offsets for second (middle) corner of simplex in (i,j) coords */
if (x0 > y0) {
i1 = 1;
j1 = 0;
@@ -282,8 +282,8 @@ _mesa_noise2(GLfloat x, GLfloat y)
y2 = y0 - 1.0f + 2.0f * G2;
/* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */
- ii = i % 256;
- jj = j % 256;
+ ii = i & 0xff;
+ jj = j & 0xff;
/* Calculate the contribution from the three corners */
t0 = 0.5f - x0 * x0 - y0 * y0;
@@ -344,13 +344,13 @@ _mesa_noise3(GLfloat x, GLfloat y, GLfloat z)
float z0 = z - Z0;
float x1, y1, z1, x2, y2, z2, x3, y3, z3;
- int ii, jj, kk;
+ unsigned int ii, jj, kk;
float t0, t1, t2, t3;
/* For the 3D case, the simplex shape is a slightly irregular tetrahedron. */
/* Determine which simplex we are in. */
- int i1, j1, k1; /* Offsets for second corner of simplex in (i,j,k) coords */
- int i2, j2, k2; /* Offsets for third corner of simplex in (i,j,k) coords */
+ unsigned int i1, j1, k1; /* Offsets for second corner of simplex in (i,j,k) coords */
+ unsigned int i2, j2, k2; /* Offsets for third corner of simplex in (i,j,k) coords */
/* This code would benefit from a backport from the GLSL version! */
if (x0 >= y0) {
@@ -423,9 +423,9 @@ _mesa_noise3(GLfloat x, GLfloat y, GLfloat z)
z3 = z0 - 1.0f + 3.0f * G3;
/* Wrap the integer indices at 256 to avoid indexing perm[] out of bounds */
- ii = i % 256;
- jj = j % 256;
- kk = k % 256;
+ ii = i & 0xff;
+ jj = j & 0xff;
+ kk = k & 0xff;
/* Calculate the contribution from the four corners */
t0 = 0.6f - x0 * x0 - y0 * y0 - z0 * z0;
@@ -522,12 +522,12 @@ _mesa_noise4(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
int c6 = (z0 > w0) ? 1 : 0;
int c = c1 + c2 + c3 + c4 + c5 + c6;
- int i1, j1, k1, l1; /* The integer offsets for the second simplex corner */
- int i2, j2, k2, l2; /* The integer offsets for the third simplex corner */
- int i3, j3, k3, l3; /* The integer offsets for the fourth simplex corner */
+ unsigned int i1, j1, k1, l1; /* The integer offsets for the second simplex corner */
+ unsigned int i2, j2, k2, l2; /* The integer offsets for the third simplex corner */
+ unsigned int i3, j3, k3, l3; /* The integer offsets for the fourth simplex corner */
float x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, w3, x4, y4, z4, w4;
- int ii, jj, kk, ll;
+ unsigned int ii, jj, kk, ll;
float t0, t1, t2, t3, t4;
/*
@@ -573,10 +573,10 @@ _mesa_noise4(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
w4 = w0 - 1.0f + 4.0f * G4;
/* Wrap the integer indices at 256, to avoid indexing perm[] out of bounds */
- ii = i % 256;
- jj = j % 256;
- kk = k % 256;
- ll = l % 256;
+ ii = i & 0xff;
+ jj = j & 0xff;
+ kk = k & 0xff;
+ ll = l & 0xff;
/* Calculate the contribution from the five corners */
t0 = 0.6f - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0;
diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y
index 6dde69d53..1664740b4 100644
--- a/mesalib/src/mesa/program/program_parse.y
+++ b/mesalib/src/mesa/program/program_parse.y
@@ -2749,6 +2749,11 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st
*/
state->prog->Instructions =
_mesa_alloc_instructions(state->prog->NumInstructions + 1);
+
+ if (state->prog->Instructions == NULL) {
+ goto error;
+ }
+
inst = state->inst_head;
for (i = 0; i < state->prog->NumInstructions; i++) {
struct asm_instruction *const temp = inst->next;
diff --git a/mesalib/src/mesa/program/symbol_table.c b/mesalib/src/mesa/program/symbol_table.c
index 2f41322f6..9462978ee 100644
--- a/mesalib/src/mesa/program/symbol_table.c
+++ b/mesalib/src/mesa/program/symbol_table.c
@@ -115,7 +115,7 @@ struct _mesa_symbol_table {
static void
check_symbol_table(struct _mesa_symbol_table *table)
{
-#if 1
+#if !defined(NDEBUG)
struct scope_level *scope;
for (scope = table->current_scope; scope != NULL; scope = scope->next) {
@@ -134,7 +134,9 @@ check_symbol_table(struct _mesa_symbol_table *table)
}
}
}
-#endif
+#else
+ (void) table;
+#endif /* !defined(NDEBUG) */
}
void
diff --git a/mesalib/src/mesa/state_tracker/st_atom_sampler.c b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
index ec2bab20b..3929251f8 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_sampler.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
@@ -182,15 +182,27 @@ convert_sampler(struct st_context *st,
msamp->BorderColor.ui[3]) {
const struct st_texture_object *stobj = st_texture_object_const(texobj);
const GLboolean is_integer = texobj->_IsIntegerFormat;
+ const struct pipe_sampler_view *sv = NULL;
union pipe_color_union border_color;
+ GLuint i;
+
+ /* Just search for the first used view. We can do this because the
+ swizzle is per-texture, not per context. */
+ /* XXX: clean that up to not use the sampler view at all */
+ for (i = 0; i < stobj->num_sampler_views; ++i) {
+ if (stobj->sampler_views[i]) {
+ sv = stobj->sampler_views[i];
+ break;
+ }
+ }
- if (st->apply_texture_swizzle_to_border_color && stobj->sampler_view) {
+ if (st->apply_texture_swizzle_to_border_color && sv) {
const unsigned char swz[4] =
{
- stobj->sampler_view->swizzle_r,
- stobj->sampler_view->swizzle_g,
- stobj->sampler_view->swizzle_b,
- stobj->sampler_view->swizzle_a,
+ sv->swizzle_r,
+ sv->swizzle_g,
+ sv->swizzle_b,
+ sv->swizzle_a,
};
st_translate_color(&msamp->BorderColor,
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index c9bffce4f..afc6d9dab 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -200,9 +200,9 @@ get_texture_format_swizzle(const struct st_texture_object *stObj)
* \param stObj the st texture object,
*/
static boolean
-check_sampler_swizzle(const struct st_texture_object *stObj)
+check_sampler_swizzle(const struct st_texture_object *stObj,
+ struct pipe_sampler_view *sv)
{
- const struct pipe_sampler_view *sv = stObj->sampler_view;
unsigned swizzle = get_texture_format_swizzle(stObj);
return ((sv->swizzle_r != GET_SWZ(swizzle, 0)) ||
@@ -258,40 +258,47 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe,
static struct pipe_sampler_view *
-st_get_texture_sampler_view_from_stobj(struct st_texture_object *stObj,
- struct pipe_context *pipe,
+st_get_texture_sampler_view_from_stobj(struct st_context *st,
+ struct st_texture_object *stObj,
const struct gl_sampler_object *samp,
enum pipe_format format)
{
+ struct pipe_sampler_view **sv;
+
if (!stObj || !stObj->pt) {
return NULL;
}
- if (!stObj->sampler_view) {
- stObj->sampler_view =
- st_create_texture_sampler_view_from_stobj(pipe, stObj, samp, format);
+ sv = st_texture_get_sampler_view(st, stObj);
+
+ /* if sampler view has changed dereference it */
+ if (*sv) {
+ if (check_sampler_swizzle(stObj, *sv) ||
+ (format != (*sv)->format) ||
+ stObj->base.BaseLevel != (*sv)->u.tex.first_level) {
+ pipe_sampler_view_reference(sv, NULL);
+ }
+ }
+
+ if (!*sv) {
+ *sv = st_create_texture_sampler_view_from_stobj(st->pipe, stObj, samp, format);
- } else if (stObj->sampler_view->context != pipe) {
+ } else if ((*sv)->context != st->pipe) {
/* Recreate view in correct context, use existing view as template */
- /* XXX: This isn't optimal, we should try to use more than one view.
- Otherwise we create/destroy the view all the time
- */
- struct pipe_sampler_view *sv =
- pipe->create_sampler_view(pipe, stObj->pt, stObj->sampler_view);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
- stObj->sampler_view = sv;
+ struct pipe_sampler_view *new_sv =
+ st->pipe->create_sampler_view(st->pipe, stObj->pt, *sv);
+ pipe_sampler_view_reference(sv, NULL);
+ *sv = new_sv;
}
- return stObj->sampler_view;
+ return *sv;
}
-
static GLboolean
update_single_texture(struct st_context *st,
struct pipe_sampler_view **sampler_view,
GLuint texUnit)
{
- struct pipe_context *pipe = st->pipe;
struct gl_context *ctx = st->ctx;
const struct gl_sampler_object *samp;
struct gl_texture_object *texObj;
@@ -330,17 +337,7 @@ update_single_texture(struct st_context *st,
}
}
- /* if sampler view has changed dereference it */
- if (stObj->sampler_view) {
- if (check_sampler_swizzle(stObj) ||
- (view_format != stObj->sampler_view->format) ||
- stObj->base.BaseLevel != stObj->sampler_view->u.tex.first_level) {
- pipe_sampler_view_release(pipe, &stObj->sampler_view);
- }
- }
-
- *sampler_view = st_get_texture_sampler_view_from_stobj(stObj, pipe,
- samp,
+ *sampler_view = st_get_texture_sampler_view_from_stobj(st, stObj, samp,
view_format);
return GL_TRUE;
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
index 49c4b903e..02624617b 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -447,6 +447,33 @@ st_copy_buffer_subdata(struct gl_context *ctx,
srcObj->buffer, 0, &box);
}
+/**
+ * Called via glClearBufferSubData().
+ */
+static void
+st_clear_buffer_subdata(struct gl_context *ctx,
+ GLintptr offset, GLsizeiptr size,
+ const GLvoid *clearValue,
+ GLsizeiptr clearValueSize,
+ struct gl_buffer_object *bufObj)
+{
+ struct pipe_context *pipe = st_context(ctx)->pipe;
+ struct st_buffer_object *buf = st_buffer_object(bufObj);
+ static const char zeros[16] = {0};
+
+ if (!pipe->clear_buffer) {
+ _mesa_buffer_clear_subdata(ctx, offset, size,
+ clearValue, clearValueSize, bufObj);
+ return;
+ }
+
+ if (!clearValue)
+ clearValue = zeros;
+
+ pipe->clear_buffer(pipe, buf->buffer, offset, size,
+ clearValue, clearValueSize);
+}
+
/* TODO: if buffer wasn't created with appropriate usage flags, need
* to recreate it now and copy contents -- or possibly create a
@@ -476,6 +503,7 @@ st_init_bufferobject_functions(struct dd_function_table *functions)
functions->FlushMappedBufferRange = st_bufferobj_flush_mapped_range;
functions->UnmapBuffer = st_bufferobj_unmap;
functions->CopyBufferSubData = st_copy_buffer_subdata;
+ functions->ClearBufferSubData = st_clear_buffer_subdata;
/* For GL_APPLE_vertex_array_object */
functions->NewArrayObject = _mesa_new_vao;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c
index 561967d6c..34eb80959 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c
@@ -124,7 +124,7 @@ st_bind_surface(struct gl_context *ctx, GLenum target,
/* FIXME create a non-default sampler view from the pipe_surface? */
pipe_resource_reference(&stObj->pt, ps->texture);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ st_texture_release_all_sampler_views(stObj);
pipe_resource_reference(&stImage->pt, stObj->pt);
stObj->width0 = ps->width;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index f0bf3745b..97bba8b7d 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -151,13 +151,11 @@ static void
st_DeleteTextureObject(struct gl_context *ctx,
struct gl_texture_object *texObj)
{
- struct st_context *st = st_context(ctx);
struct st_texture_object *stObj = st_texture_object(texObj);
- if (stObj->pt)
- pipe_resource_reference(&stObj->pt, NULL);
- if (stObj->sampler_view) {
- pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
- }
+
+ pipe_resource_reference(&stObj->pt, NULL);
+ st_texture_release_all_sampler_views(stObj);
+ st_texture_free_sampler_views(stObj);
_mesa_delete_texture_object(ctx, texObj);
}
@@ -177,6 +175,10 @@ st_FreeTextureImageBuffer(struct gl_context *ctx,
_mesa_align_free(stImage->TexData);
stImage->TexData = NULL;
+
+ free(stImage->transfer);
+ stImage->transfer = NULL;
+ stImage->num_transfers = 0;
}
@@ -192,6 +194,7 @@ st_MapTextureImage(struct gl_context *ctx,
struct st_texture_image *stImage = st_texture_image(texImage);
unsigned pipeMode;
GLubyte *map;
+ struct pipe_transfer *transfer;
pipeMode = 0x0;
if (mode & GL_MAP_READ_BIT)
@@ -201,10 +204,11 @@ st_MapTextureImage(struct gl_context *ctx,
if (mode & GL_MAP_INVALIDATE_RANGE_BIT)
pipeMode |= PIPE_TRANSFER_DISCARD_RANGE;
- map = st_texture_image_map(st, stImage, pipeMode, x, y, slice, w, h, 1);
+ map = st_texture_image_map(st, stImage, pipeMode, x, y, slice, w, h, 1,
+ &transfer);
if (map) {
*mapOut = map;
- *rowStrideOut = stImage->transfer->stride;
+ *rowStrideOut = transfer->stride;
}
else {
*mapOut = NULL;
@@ -221,7 +225,7 @@ st_UnmapTextureImage(struct gl_context *ctx,
{
struct st_context *st = st_context(ctx);
struct st_texture_image *stImage = st_texture_image(texImage);
- st_texture_image_unmap(st, stImage);
+ st_texture_image_unmap(st, stImage, slice);
}
@@ -454,7 +458,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx,
/* The parent texture object does not have space for this image */
pipe_resource_reference(&stObj->pt, NULL);
- pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
+ st_texture_release_all_sampler_views(stObj);
if (!guess_and_alloc_texture(st, stObj, stImage)) {
/* Probably out of memory.
@@ -1146,6 +1150,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
unsigned dst_width = width;
unsigned dst_height = height;
unsigned dst_depth = 1;
+ struct pipe_transfer *transfer;
if (ST_DEBUG & DEBUG_FALLBACK)
debug_printf("%s: fallback processing\n", __FUNCTION__);
@@ -1171,7 +1176,8 @@ fallback_copy_texsubimage(struct gl_context *ctx,
texDest = st_texture_image_map(st, stImage, transfer_usage,
destX, destY, slice,
- dst_width, dst_height, dst_depth);
+ dst_width, dst_height, dst_depth,
+ &transfer);
if (baseFormat == GL_DEPTH_COMPONENT ||
baseFormat == GL_DEPTH_STENCIL) {
@@ -1201,13 +1207,11 @@ fallback_copy_texsubimage(struct gl_context *ctx,
}
if (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY) {
- pipe_put_tile_z(stImage->transfer,
- texDest + row*stImage->transfer->layer_stride,
+ pipe_put_tile_z(transfer, texDest + row*transfer->layer_stride,
0, 0, width, 1, data);
}
else {
- pipe_put_tile_z(stImage->transfer, texDest, 0, row, width, 1,
- data);
+ pipe_put_tile_z(transfer, texDest, 0, row, width, 1, data);
}
}
}
@@ -1233,10 +1237,10 @@ fallback_copy_texsubimage(struct gl_context *ctx,
}
if (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY) {
- dstRowStride = stImage->transfer->layer_stride;
+ dstRowStride = transfer->layer_stride;
}
else {
- dstRowStride = stImage->transfer->stride;
+ dstRowStride = transfer->stride;
}
/* get float/RGBA image from framebuffer */
@@ -1269,7 +1273,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
free(tempSrc);
}
- st_texture_image_unmap(st, stImage);
+ st_texture_image_unmap(st, stImage, slice);
pipe->transfer_unmap(pipe, src_trans);
}
@@ -1487,13 +1491,13 @@ st_finalize_texture(struct gl_context *ctx,
if (!st_obj) {
pipe_resource_reference(&stObj->pt, NULL);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ st_texture_release_all_sampler_views(stObj);
return GL_TRUE;
}
if (st_obj->buffer != stObj->pt) {
pipe_resource_reference(&stObj->pt, st_obj->buffer);
- pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
+ st_texture_release_all_sampler_views(stObj);
stObj->width0 = stObj->pt->width0 / _mesa_get_format_bytes(tObj->_BufferObjectFormat);
stObj->height0 = 1;
stObj->depth0 = 1;
@@ -1514,7 +1518,7 @@ st_finalize_texture(struct gl_context *ctx,
firstImage->pt != stObj->pt &&
(!stObj->pt || firstImage->pt->last_level >= stObj->pt->last_level)) {
pipe_resource_reference(&stObj->pt, firstImage->pt);
- pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
+ st_texture_release_all_sampler_views(stObj);
}
/* If this texture comes from a window system, there is nothing else to do. */
@@ -1561,7 +1565,7 @@ st_finalize_texture(struct gl_context *ctx,
* gallium texture now. We'll make a new one below.
*/
pipe_resource_reference(&stObj->pt, NULL);
- pipe_sampler_view_release(st->pipe, &stObj->sampler_view);
+ st_texture_release_all_sampler_views(stObj);
st->dirty.st |= ST_NEW_FRAMEBUFFER;
}
}
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 807a86fdf..c7f3ec6be 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -152,7 +152,6 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
st_init_bitmap(st);
st_init_clear(st);
st_init_draw( st );
- st_init_generate_mipmap(st);
/* Choose texture target for glDrawPixels, glBitmap, renderbuffers */
if (pipe->screen->get_param(pipe->screen, PIPE_CAP_NPOT_TEXTURES))
@@ -254,7 +253,6 @@ static void st_destroy_context_priv( struct st_context *st )
st_destroy_atoms( st );
st_destroy_draw( st );
- st_destroy_generate_mipmap(st);
st_destroy_clear(st);
st_destroy_bitmap(st);
st_destroy_drawpix(st);
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index 0e00dd4fa..361a24b1d 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -188,7 +188,6 @@ struct st_context
void *passthrough_fs; /**< simple pass-through frag shader */
enum pipe_texture_target internal_target;
- struct gen_mipmap_state *gen_mipmap;
struct cso_context *cso_context;
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 18ddd4e47..059989342 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -275,6 +275,9 @@ void st_init_limits(struct st_context *st)
c->MaxProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXEL_OFFSET);
c->MaxProgramTextureGatherComponents = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS);
+ c->MinProgramTextureGatherOffset = screen->get_param(screen, PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET);
+ c->MaxProgramTextureGatherOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET);
+
c->UniformBooleanTrue = ~0;
c->MaxTransformFeedbackBuffers =
@@ -421,7 +424,8 @@ void st_init_extensions(struct st_context *st)
{ o(OES_standard_derivatives), PIPE_CAP_SM3 },
{ o(ARB_texture_cube_map_array), PIPE_CAP_CUBE_MAP_ARRAY },
- { o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE }
+ { o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE },
+ { o(ARB_texture_query_lod), PIPE_CAP_TEXTURE_QUERY_LOD }
};
/* Required: render target and sampler support */
@@ -728,6 +732,13 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE;
}
+ if (ctx->Const.MaxSamples == 0 && screen->get_param(screen, PIPE_CAP_FAKE_SW_MSAA)) {
+ ctx->Const.FakeSWMSAA = GL_TRUE;
+ ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE;
+ ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE;
+ ctx->Extensions.ARB_texture_multisample = GL_TRUE;
+ }
+
if (ctx->Const.MaxDualSourceDrawBuffers > 0 &&
!st->options.disable_blend_func_extended)
ctx->Extensions.ARB_blend_func_extended = GL_TRUE;
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index cd6b46681..38d4ccfea 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -1750,6 +1750,12 @@ st_choose_matching_format(struct pipe_screen *screen, unsigned bind,
if (_mesa_get_format_color_encoding(mesa_format) == GL_SRGB) {
continue;
}
+ if (_mesa_get_format_bits(mesa_format, GL_TEXTURE_INTENSITY_SIZE) > 0) {
+ /* If `format` is GL_RED/GL_RED_INTEGER, then we might match some
+ * intensity formats, which we don't want.
+ */
+ continue;
+ }
if (_mesa_format_matches_format_and_type(mesa_format, format, type,
swapBytes)) {
diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
index b615575b5..18cf504a7 100644
--- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
@@ -44,64 +44,6 @@
/**
- * one-time init for generate mipmap
- * XXX Note: there may be other times we need no-op/simple state like this.
- * In that case, some code refactoring would be good.
- */
-void
-st_init_generate_mipmap(struct st_context *st)
-{
- st->gen_mipmap = util_create_gen_mipmap(st->pipe, st->cso_context);
-}
-
-
-void
-st_destroy_generate_mipmap(struct st_context *st)
-{
- util_destroy_gen_mipmap(st->gen_mipmap);
- st->gen_mipmap = NULL;
-}
-
-
-/**
- * Generate mipmap levels using hardware rendering.
- * \return TRUE if successful, FALSE if not possible
- */
-static boolean
-st_render_mipmap(struct st_context *st,
- GLenum target,
- struct st_texture_object *stObj,
- uint baseLevel, uint lastLevel)
-{
- struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
- struct pipe_sampler_view *psv;
- const uint face = _mesa_tex_target_to_face(target);
-
-#if 0
- assert(target != GL_TEXTURE_3D); /* implemented but untested */
-#endif
-
- /* check if we can render in the texture's format */
- /* XXX should probably kill this and always use util_gen_mipmap
- since this implements a sw fallback as well */
- if (!screen->is_format_supported(screen, stObj->pt->format,
- stObj->pt->target,
- 0, PIPE_BIND_RENDER_TARGET)) {
- return FALSE;
- }
-
- psv = st_create_texture_sampler_view(pipe, stObj->pt);
-
- util_gen_mipmap(st->gen_mipmap, psv, face, baseLevel, lastLevel,
- PIPE_TEX_FILTER_LINEAR);
-
- pipe_sampler_view_reference(&psv, NULL);
-
- return TRUE;
-}
-
-/**
* Compute the expected number of mipmap levels in the texture given
* the width/height/depth of the base image and the GL_TEXTURE_BASE_LEVEL/
* GL_TEXTURE_MAX_LEVEL settings. This will tell us how many mipmap
@@ -136,7 +78,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
struct st_texture_object *stObj = st_texture_object(texObj);
struct pipe_resource *pt = st_get_texobj_resource(texObj);
const uint baseLevel = texObj->BaseLevel;
- uint lastLevel;
+ uint lastLevel, first_layer, last_layer;
uint dstLevel;
if (!pt)
@@ -182,7 +124,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
/* release the old tex (will likely be freed too) */
pipe_resource_reference(&oldTex, NULL);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ st_texture_release_all_sampler_views(stObj);
}
else {
/* Make sure that the base texture image data is present in the
@@ -195,12 +137,19 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target,
assert(pt->last_level >= lastLevel);
+ if (pt->target == PIPE_TEXTURE_CUBE) {
+ first_layer = last_layer = _mesa_tex_target_to_face(target);
+ }
+ else {
+ first_layer = 0;
+ last_layer = util_max_layer(pt, baseLevel);
+ }
+
/* Try to generate the mipmap by rendering/texturing. If that fails,
* use the software fallback.
*/
- if (!st_render_mipmap(st, target, stObj, baseLevel, lastLevel)) {
- /* since the util code actually also has a fallback, should
- probably make it never fail and kill this */
+ if (!util_gen_mipmap(st->pipe, pt, pt->format, baseLevel, lastLevel,
+ first_layer, last_layer, PIPE_TEX_FILTER_LINEAR)) {
_mesa_generate_mipmap(ctx, target, texObj);
}
diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.h b/mesalib/src/mesa/state_tracker/st_gen_mipmap.h
index 64eb39723..4cc208951 100644
--- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.h
+++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.h
@@ -34,14 +34,6 @@
struct gl_context;
struct gl_texture_object;
-struct st_context;
-
-extern void
-st_init_generate_mipmap(struct st_context *st);
-
-
-extern void
-st_destroy_generate_mipmap(struct st_context *st);
extern void
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 f019a55c2..edd0aa765 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2793,7 +2793,7 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
}
break;
case ir_lod:
- assert(!"Unexpected ir_lod opcode");
+ opcode = TGSI_OPCODE_LODQ;
break;
case ir_query_levels:
assert(!"Unexpected ir_query_levels opcode");
@@ -4513,6 +4513,7 @@ compile_tgsi_instruction(struct st_translate *t,
case TGSI_OPCODE_TXB2:
case TGSI_OPCODE_TXL2:
case TGSI_OPCODE_TG4:
+ case TGSI_OPCODE_LODQ:
src[num_src++] = t->samplers[inst->sampler];
for (i = 0; i < inst->tex_offset_num_offset; i++) {
texoffsets[i] = translate_tex_offset(t, &inst->tex_offsets[i], i);
@@ -5356,8 +5357,8 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
- progress = do_common_optimization(ir, true, true,
- options->MaxUnrollIterations, options)
+ progress = do_common_optimization(ir, true, true, options,
+ ctx->Const.NativeIntegers)
|| progress;
progress = lower_if_to_cond_assign(ir, options->MaxIfDepth) || progress;
diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c
index a3b345356..f664ef5f1 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_texture.c
@@ -40,6 +40,7 @@
#include "util/u_format.h"
#include "util/u_rect.h"
#include "util/u_math.h"
+#include "util/u_memory.h"
#define DBG if(0) printf
@@ -240,11 +241,13 @@ GLubyte *
st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
enum pipe_transfer_usage usage,
GLuint x, GLuint y, GLuint z,
- GLuint w, GLuint h, GLuint d)
+ GLuint w, GLuint h, GLuint d,
+ struct pipe_transfer **transfer)
{
struct st_texture_object *stObj =
st_texture_object(stImage->base.TexObject);
GLuint level;
+ void *map;
DBG("%s \n", __FUNCTION__);
@@ -256,22 +259,41 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
else
level = stImage->base.Level;
- return pipe_transfer_map_3d(st->pipe, stImage->pt, level, usage,
- x, y, z + stImage->base.Face,
- w, h, d, &stImage->transfer);
+ z += stImage->base.Face;
+
+ map = pipe_transfer_map_3d(st->pipe, stImage->pt, level, usage,
+ x, y, z, w, h, d, transfer);
+ if (map) {
+ /* Enlarge the transfer array if it's not large enough. */
+ if (z >= stImage->num_transfers) {
+ unsigned new_size = z + 1;
+
+ stImage->transfer = realloc(stImage->transfer,
+ new_size * sizeof(void*));
+ memset(&stImage->transfer[stImage->num_transfers], 0,
+ (new_size - stImage->num_transfers) * sizeof(void*));
+ stImage->num_transfers = new_size;
+ }
+
+ assert(!stImage->transfer[z]);
+ stImage->transfer[z] = *transfer;
+ }
+ return map;
}
void
st_texture_image_unmap(struct st_context *st,
- struct st_texture_image *stImage)
+ struct st_texture_image *stImage, unsigned slice)
{
struct pipe_context *pipe = st->pipe;
+ struct pipe_transfer **transfer =
+ &stImage->transfer[slice + stImage->base.Face];
DBG("%s\n", __FUNCTION__);
- pipe_transfer_unmap(pipe, stImage->transfer);
- stImage->transfer = NULL;
+ pipe_transfer_unmap(pipe, *transfer);
+ *transfer = NULL;
}
@@ -412,10 +434,85 @@ st_create_color_map_texture(struct gl_context *ctx)
return pt;
}
+/**
+ * Try to find a matching sampler view for the given context.
+ * If none is found an empty slot is initialized with a
+ * template and returned instead.
+ */
+struct pipe_sampler_view **
+st_texture_get_sampler_view(struct st_context *st,
+ struct st_texture_object *stObj)
+{
+ struct pipe_sampler_view **used = NULL, **free = NULL;
+ GLuint i;
+
+ for (i = 0; i < stObj->num_sampler_views; ++i) {
+ struct pipe_sampler_view **sv = &stObj->sampler_views[i];
+ /* Is the array entry used ? */
+ if (*sv) {
+ /* Yes, check if it's the right one */
+ if ((*sv)->context == st->pipe)
+ return sv;
+
+ /* Wasn't the right one, but remember it as template */
+ used = sv;
+ } else {
+ /* Found a free slot, remember that */
+ free = sv;
+ }
+ }
+
+ /* Couldn't find a slot for our context, create a new one */
+
+ if (!free) {
+ /* Haven't even found a free one, resize the array */
+ GLuint old_size = stObj->num_sampler_views * sizeof(void *);
+ GLuint new_size = old_size + sizeof(void *);
+ stObj->sampler_views = REALLOC(stObj->sampler_views, old_size, new_size);
+ free = &stObj->sampler_views[stObj->num_sampler_views++];
+ *free = NULL;
+ }
+
+ /* Add just any sampler view to be used as a template */
+ if (used)
+ pipe_sampler_view_reference(free, *used);
+
+ return free;
+}
+
void
st_texture_release_sampler_view(struct st_context *st,
struct st_texture_object *stObj)
{
- if (stObj->sampler_view && stObj->sampler_view->context == st->pipe)
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ GLuint i;
+
+ for (i = 0; i < stObj->num_sampler_views; ++i) {
+ struct pipe_sampler_view **sv = &stObj->sampler_views[i];
+
+ if (*sv && (*sv)->context == st->pipe) {
+ pipe_sampler_view_reference(sv, NULL);
+ break;
+ }
+ }
+}
+
+void
+st_texture_release_all_sampler_views(struct st_texture_object *stObj)
+{
+ GLuint i;
+
+ for (i = 0; i < stObj->num_sampler_views; ++i)
+ pipe_sampler_view_reference(&stObj->sampler_views[i], NULL);
+}
+
+
+void
+st_texture_free_sampler_views(struct st_texture_object *stObj)
+{
+ /* NOTE:
+ * We use FREE() here to match REALLOC() above. Both come from
+ * u_memory.h, not imports.h. If we mis-match MALLOC/FREE from
+ * those two headers we can trash the heap.
+ */
+ FREE(stObj->sampler_views);
}
diff --git a/mesalib/src/mesa/state_tracker/st_texture.h b/mesalib/src/mesa/state_tracker/st_texture.h
index b4a27a00a..affb56812 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.h
+++ b/mesalib/src/mesa/state_tracker/st_texture.h
@@ -56,7 +56,11 @@ struct st_texture_image
*/
struct pipe_resource *pt;
- struct pipe_transfer *transfer;
+ /* List of transfers, allocated on demand.
+ * transfer[layer] is a mapping for that layer.
+ */
+ struct pipe_transfer **transfer;
+ unsigned num_transfers;
};
@@ -82,10 +86,13 @@ struct st_texture_object
*/
struct pipe_resource *pt;
- /* Default sampler view attached to this texture object. Created lazily
- * on first binding.
+ /* Number of views in sampler_views array */
+ GLuint num_sampler_views;
+
+ /* Array of sampler views (one per context) attached to this texture
+ * object. Created lazily on first binding in context.
*/
- struct pipe_sampler_view *sampler_view;
+ struct pipe_sampler_view **sampler_views;
/* True if this texture comes from the window system. Such a texture
* cannot be reallocated and the format can only be changed with a sampler
@@ -192,11 +199,12 @@ extern GLubyte *
st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
enum pipe_transfer_usage usage,
GLuint x, GLuint y, GLuint z,
- GLuint w, GLuint h, GLuint d);
+ GLuint w, GLuint h, GLuint d,
+ struct pipe_transfer **transfer);
extern void
st_texture_image_unmap(struct st_context *st,
- struct st_texture_image *stImage);
+ struct st_texture_image *stImage, unsigned slice);
/* Return pointers to each 2d slice within an image. Indexed by depth
@@ -227,8 +235,18 @@ st_texture_image_copy(struct pipe_context *pipe,
extern struct pipe_resource *
st_create_color_map_texture(struct gl_context *ctx);
+extern struct pipe_sampler_view **
+st_texture_get_sampler_view(struct st_context *st,
+ struct st_texture_object *stObj);
+
extern void
st_texture_release_sampler_view(struct st_context *st,
struct st_texture_object *stObj);
+extern void
+st_texture_release_all_sampler_views(struct st_texture_object *stObj);
+
+void
+st_texture_free_sampler_views(struct st_texture_object *stObj);
+
#endif
diff --git a/mesalib/src/mesa/state_tracker/st_vdpau.c b/mesalib/src/mesa/state_tracker/st_vdpau.c
index c5b4780ce..8c10cdaf3 100644
--- a/mesalib/src/mesa/state_tracker/st_vdpau.c
+++ b/mesalib/src/mesa/state_tracker/st_vdpau.c
@@ -63,7 +63,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
struct st_texture_image *stImage = st_texture_image(texImage);
struct pipe_resource *res;
- struct pipe_sampler_view *sv, templ;
+ struct pipe_sampler_view templ, **sampler_view;
mesa_format texFormat;
getProcAddr = ctx->vdpGetProcAddress;
@@ -83,6 +83,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
}
} else {
+ struct pipe_sampler_view *sv;
VdpVideoSurfaceGallium *f;
struct pipe_video_buffer *buffer;
@@ -138,7 +139,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
texFormat);
pipe_resource_reference(&stObj->pt, res);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ st_texture_release_all_sampler_views(stObj);
pipe_resource_reference(&stImage->pt, res);
u_sampler_view_default_template(&templ, res, res->format);
@@ -148,7 +149,9 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access,
templ.swizzle_g = GET_SWZ(stObj->base._Swizzle, 1);
templ.swizzle_b = GET_SWZ(stObj->base._Swizzle, 2);
templ.swizzle_a = GET_SWZ(stObj->base._Swizzle, 3);
- stObj->sampler_view = st->pipe->create_sampler_view(st->pipe, res, &templ);
+
+ sampler_view = st_texture_get_sampler_view(st, stObj);
+ *sampler_view = st->pipe->create_sampler_view(st->pipe, res, &templ);
stObj->width0 = res->width0;
stObj->height0 = res->height0;
@@ -169,7 +172,7 @@ st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access,
struct st_texture_image *stImage = st_texture_image(texImage);
pipe_resource_reference(&stObj->pt, NULL);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ st_texture_release_all_sampler_views(stObj);
pipe_resource_reference(&stImage->pt, NULL);
_mesa_dirty_texobj(ctx, texObj);
diff --git a/mesalib/src/mesa/swrast/s_texfetch.c b/mesalib/src/mesa/swrast/s_texfetch.c
index cd0982705..90a514c16 100644
--- a/mesalib/src/mesa/swrast/s_texfetch.c
+++ b/mesalib/src/mesa/swrast/s_texfetch.c
@@ -129,9 +129,24 @@ static void fetch_null_texelf( const struct swrast_texture_image *texImage,
}
+#define FETCH_FUNCS(NAME) \
+ { \
+ MESA_FORMAT_ ## NAME, \
+ fetch_texel_1d_ ## NAME, \
+ fetch_texel_2d_ ## NAME, \
+ fetch_texel_3d_ ## NAME, \
+ }
+
+#define FETCH_NULL(NAME) \
+ { \
+ MESA_FORMAT_ ## NAME, \
+ NULL, \
+ NULL, \
+ NULL \
+ }
+
/**
* Table to map MESA_FORMAT_ to texel fetch/store funcs.
- * XXX this is somewhat temporary.
*/
static struct {
mesa_format Name;
@@ -149,978 +164,198 @@ texfetch_funcs[] =
},
/* Packed unorm formats */
- {
- MESA_FORMAT_A8B8G8R8_UNORM,
- fetch_texel_1d_f_rgba8888,
- fetch_texel_2d_f_rgba8888,
- fetch_texel_3d_f_rgba8888
- },
- {
- MESA_FORMAT_X8B8G8R8_UNORM,
- fetch_texel_1d_f_rgbx8888,
- fetch_texel_2d_f_rgbx8888,
- fetch_texel_3d_f_rgbx8888
- },
- {
- MESA_FORMAT_R8G8B8A8_UNORM,
- fetch_texel_1d_f_rgba8888_rev,
- fetch_texel_2d_f_rgba8888_rev,
- fetch_texel_3d_f_rgba8888_rev
- },
- {
- MESA_FORMAT_R8G8B8X8_UNORM,
- fetch_texel_1d_f_rgbx8888_rev,
- fetch_texel_2d_f_rgbx8888_rev,
- fetch_texel_3d_f_rgbx8888_rev
- },
- {
- MESA_FORMAT_B8G8R8A8_UNORM,
- fetch_texel_1d_f_argb8888,
- fetch_texel_2d_f_argb8888,
- fetch_texel_3d_f_argb8888
- },
- {
- MESA_FORMAT_B8G8R8X8_UNORM,
- fetch_texel_1d_f_xrgb8888,
- fetch_texel_2d_f_xrgb8888,
- fetch_texel_3d_f_xrgb8888
- },
- {
- MESA_FORMAT_A8R8G8B8_UNORM,
- fetch_texel_1d_f_argb8888_rev,
- fetch_texel_2d_f_argb8888_rev,
- fetch_texel_3d_f_argb8888_rev
- },
- {
- MESA_FORMAT_X8R8G8B8_UNORM,
- fetch_texel_1d_f_xrgb8888_rev,
- fetch_texel_2d_f_xrgb8888_rev,
- fetch_texel_3d_f_xrgb8888_rev
- },
- {
- MESA_FORMAT_L16A16_UNORM,
- fetch_texel_1d_f_al1616,
- fetch_texel_2d_f_al1616,
- fetch_texel_3d_f_al1616
- },
- {
- MESA_FORMAT_A16L16_UNORM,
- fetch_texel_1d_f_al1616_rev,
- fetch_texel_2d_f_al1616_rev,
- fetch_texel_3d_f_al1616_rev
- },
- {
- MESA_FORMAT_B5G6R5_UNORM,
- fetch_texel_1d_f_rgb565,
- fetch_texel_2d_f_rgb565,
- fetch_texel_3d_f_rgb565
- },
- {
- MESA_FORMAT_R5G6B5_UNORM,
- fetch_texel_1d_f_rgb565_rev,
- fetch_texel_2d_f_rgb565_rev,
- fetch_texel_3d_f_rgb565_rev
- },
- {
- MESA_FORMAT_B4G4R4A4_UNORM,
- fetch_texel_1d_f_argb4444,
- fetch_texel_2d_f_argb4444,
- fetch_texel_3d_f_argb4444
- },
- {
- MESA_FORMAT_B4G4R4X4_UNORM,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_A4R4G4B4_UNORM,
- fetch_texel_1d_f_argb4444_rev,
- fetch_texel_2d_f_argb4444_rev,
- fetch_texel_3d_f_argb4444_rev
- },
- {
- MESA_FORMAT_A1B5G5R5_UNORM,
- fetch_texel_1d_f_rgba5551,
- fetch_texel_2d_f_rgba5551,
- fetch_texel_3d_f_rgba5551
- },
- {
- MESA_FORMAT_B5G5R5A1_UNORM,
- fetch_texel_1d_f_argb1555,
- fetch_texel_2d_f_argb1555,
- fetch_texel_3d_f_argb1555
- },
- {
- MESA_FORMAT_B5G5R5X1_UNORM,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_A1R5G5B5_UNORM,
- fetch_texel_1d_f_argb1555_rev,
- fetch_texel_2d_f_argb1555_rev,
- fetch_texel_3d_f_argb1555_rev
- },
- {
- MESA_FORMAT_L8A8_UNORM,
- fetch_texel_1d_f_al88,
- fetch_texel_2d_f_al88,
- fetch_texel_3d_f_al88
- },
- {
- MESA_FORMAT_A8L8_UNORM,
- fetch_texel_1d_f_al88_rev,
- fetch_texel_2d_f_al88_rev,
- fetch_texel_3d_f_al88_rev
- },
- {
- MESA_FORMAT_R8G8_UNORM,
- fetch_texel_1d_f_gr88,
- fetch_texel_2d_f_gr88,
- fetch_texel_3d_f_gr88
- },
- {
- MESA_FORMAT_G8R8_UNORM,
- fetch_texel_1d_f_rg88,
- fetch_texel_2d_f_rg88,
- fetch_texel_3d_f_rg88
- },
- {
- MESA_FORMAT_L4A4_UNORM,
- fetch_texel_1d_f_al44,
- fetch_texel_2d_f_al44,
- fetch_texel_3d_f_al44
- },
- {
- MESA_FORMAT_B2G3R3_UNORM,
- fetch_texel_1d_f_rgb332,
- fetch_texel_2d_f_rgb332,
- fetch_texel_3d_f_rgb332
- },
- {
- MESA_FORMAT_R16G16_UNORM,
- fetch_texel_1d_f_rg1616,
- fetch_texel_2d_f_rg1616,
- fetch_texel_3d_f_rg1616
- },
- {
- MESA_FORMAT_G16R16_UNORM,
- fetch_texel_1d_f_rg1616_rev,
- fetch_texel_2d_f_rg1616_rev,
- fetch_texel_3d_f_rg1616_rev
- },
- {
- MESA_FORMAT_B10G10R10A2_UNORM,
- fetch_texel_1d_f_argb2101010,
- fetch_texel_2d_f_argb2101010,
- fetch_texel_3d_f_argb2101010
- },
- {
- MESA_FORMAT_B10G10R10X2_UNORM,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R10G10B10A2_UNORM,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_S8_UINT_Z24_UNORM,
- fetch_texel_1d_f_z24_s8,
- fetch_texel_2d_f_z24_s8,
- fetch_texel_3d_f_z24_s8
- },
+ FETCH_FUNCS(A8B8G8R8_UNORM),
+ FETCH_FUNCS(X8B8G8R8_UNORM),
+ FETCH_FUNCS(R8G8B8A8_UNORM),
+ FETCH_FUNCS(R8G8B8X8_UNORM),
+ FETCH_FUNCS(B8G8R8A8_UNORM),
+ FETCH_FUNCS(B8G8R8X8_UNORM),
+ FETCH_FUNCS(A8R8G8B8_UNORM),
+ FETCH_FUNCS(X8R8G8B8_UNORM),
+ FETCH_FUNCS(L16A16_UNORM),
+ FETCH_FUNCS(A16L16_UNORM),
+ FETCH_FUNCS(B5G6R5_UNORM),
+ FETCH_FUNCS(R5G6B5_UNORM),
+ FETCH_FUNCS(B4G4R4A4_UNORM),
+ FETCH_NULL(B4G4R4X4_UNORM),
+ FETCH_FUNCS(A4R4G4B4_UNORM),
+ FETCH_FUNCS(A1B5G5R5_UNORM),
+ FETCH_FUNCS(B5G5R5A1_UNORM),
+ FETCH_NULL(B5G5R5X1_UNORM),
+ FETCH_FUNCS(A1R5G5B5_UNORM),
+ FETCH_FUNCS(L8A8_UNORM),
+ FETCH_FUNCS(A8L8_UNORM),
+ FETCH_FUNCS(R8G8_UNORM),
+ FETCH_FUNCS(G8R8_UNORM),
+ FETCH_FUNCS(L4A4_UNORM),
+ FETCH_FUNCS(B2G3R3_UNORM),
+ FETCH_FUNCS(R16G16_UNORM),
+ FETCH_FUNCS(G16R16_UNORM),
+ FETCH_FUNCS(B10G10R10A2_UNORM),
+ FETCH_NULL(B10G10R10X2_UNORM),
+ FETCH_FUNCS(R10G10B10A2_UNORM),
+ FETCH_FUNCS(S8_UINT_Z24_UNORM),
{
MESA_FORMAT_X8_UINT_Z24_UNORM,
- fetch_texel_1d_f_z24_s8,
- fetch_texel_2d_f_z24_s8,
- fetch_texel_3d_f_z24_s8
- },
- {
- MESA_FORMAT_Z24_UNORM_S8_UINT,
- fetch_texel_1d_f_s8_z24,
- fetch_texel_2d_f_s8_z24,
- fetch_texel_3d_f_s8_z24
+ fetch_texel_1d_S8_UINT_Z24_UNORM,
+ fetch_texel_2d_S8_UINT_Z24_UNORM,
+ fetch_texel_3d_S8_UINT_Z24_UNORM
},
+ FETCH_FUNCS(Z24_UNORM_S8_UINT),
{
MESA_FORMAT_Z24_UNORM_X8_UINT,
- fetch_texel_1d_f_s8_z24,
- fetch_texel_2d_f_s8_z24,
- fetch_texel_3d_f_s8_z24
- },
- {
- MESA_FORMAT_YCBCR,
- fetch_texel_1d_f_ycbcr,
- fetch_texel_2d_f_ycbcr,
- fetch_texel_3d_f_ycbcr
- },
- {
- MESA_FORMAT_YCBCR_REV,
- fetch_texel_1d_f_ycbcr_rev,
- fetch_texel_2d_f_ycbcr_rev,
- fetch_texel_3d_f_ycbcr_rev
- },
- {
- MESA_FORMAT_DUDV8,
- fetch_texel_1d_dudv8,
- fetch_texel_2d_dudv8,
- fetch_texel_3d_dudv8
+ fetch_texel_1d_Z24_UNORM_S8_UINT,
+ fetch_texel_2d_Z24_UNORM_S8_UINT,
+ fetch_texel_3d_Z24_UNORM_S8_UINT
},
+ FETCH_FUNCS(YCBCR),
+ FETCH_FUNCS(YCBCR_REV),
+ FETCH_FUNCS(DUDV8),
/* Array unorm formats */
- {
- MESA_FORMAT_A_UNORM8,
- fetch_texel_1d_f_a8,
- fetch_texel_2d_f_a8,
- fetch_texel_3d_f_a8
- },
- {
- MESA_FORMAT_A_UNORM16,
- fetch_texel_1d_f_a16,
- fetch_texel_2d_f_a16,
- fetch_texel_3d_f_a16
- },
- {
- MESA_FORMAT_L_UNORM8,
- fetch_texel_1d_f_l8,
- fetch_texel_2d_f_l8,
- fetch_texel_3d_f_l8
- },
- {
- MESA_FORMAT_L_UNORM16,
- fetch_texel_1d_f_l16,
- fetch_texel_2d_f_l16,
- fetch_texel_3d_f_l16
- },
- {
- MESA_FORMAT_I_UNORM8,
- fetch_texel_1d_f_i8,
- fetch_texel_2d_f_i8,
- fetch_texel_3d_f_i8
- },
- {
- MESA_FORMAT_I_UNORM16,
- fetch_texel_1d_f_i16,
- fetch_texel_2d_f_i16,
- fetch_texel_3d_f_i16
- },
- {
- MESA_FORMAT_R_UNORM8,
- fetch_texel_1d_f_r8,
- fetch_texel_2d_f_r8,
- fetch_texel_3d_f_r8
- },
- {
- MESA_FORMAT_R_UNORM16,
- fetch_texel_1d_f_r16,
- fetch_texel_2d_f_r16,
- fetch_texel_3d_f_r16
- },
- {
- MESA_FORMAT_BGR_UNORM8,
- fetch_texel_1d_f_rgb888,
- fetch_texel_2d_f_rgb888,
- fetch_texel_3d_f_rgb888
- },
- {
- MESA_FORMAT_RGB_UNORM8,
- fetch_texel_1d_f_bgr888,
- fetch_texel_2d_f_bgr888,
- fetch_texel_3d_f_bgr888
- },
- {
- MESA_FORMAT_RGBA_UNORM16,
- fetch_texel_1d_rgba_16,
- fetch_texel_2d_rgba_16,
- fetch_texel_3d_rgba_16
- },
- {
- MESA_FORMAT_RGBX_UNORM16,
- fetch_texel_1d_xbgr16161616_unorm,
- fetch_texel_2d_xbgr16161616_unorm,
- fetch_texel_3d_xbgr16161616_unorm
- },
- {
- MESA_FORMAT_Z_UNORM16,
- fetch_texel_1d_f_z16,
- fetch_texel_2d_f_z16,
- fetch_texel_3d_f_z16
- },
- {
- MESA_FORMAT_Z_UNORM32,
- fetch_texel_1d_f_z32,
- fetch_texel_2d_f_z32,
- fetch_texel_3d_f_z32
- },
- {
- MESA_FORMAT_S_UINT8,
- NULL,
- NULL,
- NULL
- },
+ FETCH_FUNCS(A_UNORM8),
+ FETCH_FUNCS(A_UNORM16),
+ FETCH_FUNCS(L_UNORM8),
+ FETCH_FUNCS(L_UNORM16),
+ FETCH_FUNCS(I_UNORM8),
+ FETCH_FUNCS(I_UNORM16),
+ FETCH_FUNCS(R_UNORM8),
+ FETCH_FUNCS(R_UNORM16),
+ FETCH_FUNCS(BGR_UNORM8),
+ FETCH_FUNCS(RGB_UNORM8),
+ FETCH_FUNCS(RGBA_UNORM16),
+ FETCH_FUNCS(RGBX_UNORM16),
+ FETCH_FUNCS(Z_UNORM16),
+ FETCH_FUNCS(Z_UNORM32),
+ FETCH_NULL(S_UINT8),
/* Packed signed/normalized formats */
- {
- MESA_FORMAT_A8B8G8R8_SNORM,
- fetch_texel_1d_signed_rgba8888,
- fetch_texel_2d_signed_rgba8888,
- fetch_texel_3d_signed_rgba8888
- },
- {
- MESA_FORMAT_X8B8G8R8_SNORM,
- fetch_texel_1d_signed_rgbx8888,
- fetch_texel_2d_signed_rgbx8888,
- fetch_texel_3d_signed_rgbx8888
- },
- {
- MESA_FORMAT_R8G8B8A8_SNORM,
- fetch_texel_1d_signed_rgba8888_rev,
- fetch_texel_2d_signed_rgba8888_rev,
- fetch_texel_3d_signed_rgba8888_rev
- },
- {
- MESA_FORMAT_R8G8B8X8_SNORM,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R16G16_SNORM,
- fetch_texel_1d_signed_rg1616,
- fetch_texel_2d_signed_rg1616,
- fetch_texel_3d_signed_rg1616
- },
- {
- MESA_FORMAT_G16R16_SNORM,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R8G8_SNORM,
- fetch_texel_1d_signed_rg88_rev,
- fetch_texel_2d_signed_rg88_rev,
- fetch_texel_3d_signed_rg88_rev
- },
- {
- MESA_FORMAT_G8R8_SNORM,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_L8A8_SNORM,
- fetch_texel_1d_signed_al88,
- fetch_texel_2d_signed_al88,
- fetch_texel_3d_signed_al88
- },
+ FETCH_FUNCS(A8B8G8R8_SNORM),
+ FETCH_FUNCS(X8B8G8R8_SNORM),
+ FETCH_FUNCS(R8G8B8A8_SNORM),
+ FETCH_NULL(R8G8B8X8_SNORM),
+ FETCH_FUNCS(R16G16_SNORM),
+ FETCH_NULL(G16R16_SNORM),
+ FETCH_FUNCS(R8G8_SNORM),
+ FETCH_NULL(G8R8_SNORM),
+ FETCH_FUNCS(L8A8_SNORM),
/* Array signed/normalized formats */
- {
- MESA_FORMAT_A_SNORM8,
- fetch_texel_1d_signed_a8,
- fetch_texel_2d_signed_a8,
- fetch_texel_3d_signed_a8
- },
- {
- MESA_FORMAT_A_SNORM16,
- fetch_texel_1d_signed_a16,
- fetch_texel_2d_signed_a16,
- fetch_texel_3d_signed_a16
- },
- {
- MESA_FORMAT_L_SNORM8,
- fetch_texel_1d_signed_l8,
- fetch_texel_2d_signed_l8,
- fetch_texel_3d_signed_l8
- },
- {
- MESA_FORMAT_L_SNORM16,
- fetch_texel_1d_signed_l16,
- fetch_texel_2d_signed_l16,
- fetch_texel_3d_signed_l16
- },
- {
- MESA_FORMAT_I_SNORM8,
- fetch_texel_1d_signed_i8,
- fetch_texel_2d_signed_i8,
- fetch_texel_3d_signed_i8
- },
- {
- MESA_FORMAT_I_SNORM16,
- fetch_texel_1d_signed_i16,
- fetch_texel_2d_signed_i16,
- fetch_texel_3d_signed_i16
- },
- {
- MESA_FORMAT_R_SNORM8,
- fetch_texel_1d_signed_r8,
- fetch_texel_2d_signed_r8,
- fetch_texel_3d_signed_r8
- },
- {
- MESA_FORMAT_R_SNORM16,
- fetch_texel_1d_signed_r16,
- fetch_texel_2d_signed_r16,
- fetch_texel_3d_signed_r16
- },
- {
- MESA_FORMAT_LA_SNORM16,
- fetch_texel_1d_signed_al1616,
- fetch_texel_2d_signed_al1616,
- fetch_texel_3d_signed_al1616
- },
- {
- MESA_FORMAT_RGB_SNORM16,
- fetch_texel_1d_signed_rgb_16,
- fetch_texel_2d_signed_rgb_16,
- fetch_texel_3d_signed_rgb_16
- },
- {
- MESA_FORMAT_RGBA_SNORM16,
- fetch_texel_1d_signed_rgba_16,
- fetch_texel_2d_signed_rgba_16,
- fetch_texel_3d_signed_rgba_16
- },
- {
- MESA_FORMAT_RGBX_SNORM16,
- NULL,
- NULL,
- NULL
- },
+ FETCH_FUNCS(A_SNORM8),
+ FETCH_FUNCS(A_SNORM16),
+ FETCH_FUNCS(L_SNORM8),
+ FETCH_FUNCS(L_SNORM16),
+ FETCH_FUNCS(I_SNORM8),
+ FETCH_FUNCS(I_SNORM16),
+ FETCH_FUNCS(R_SNORM8),
+ FETCH_FUNCS(R_SNORM16),
+ FETCH_FUNCS(LA_SNORM16),
+ FETCH_FUNCS(RGB_SNORM16),
+ FETCH_FUNCS(RGBA_SNORM16),
+ FETCH_NULL(RGBX_SNORM16),
/* Packed sRGB formats */
- {
- MESA_FORMAT_A8B8G8R8_SRGB,
- fetch_texel_1d_srgba8,
- fetch_texel_2d_srgba8,
- fetch_texel_3d_srgba8
- },
- {
- MESA_FORMAT_B8G8R8A8_SRGB,
- fetch_texel_1d_sargb8,
- fetch_texel_2d_sargb8,
- fetch_texel_3d_sargb8
- },
- {
- MESA_FORMAT_B8G8R8X8_SRGB,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R8G8B8A8_SRGB,
- fetch_texel_1d_sabgr8,
- fetch_texel_2d_sabgr8,
- fetch_texel_3d_sabgr8
- },
- {
- MESA_FORMAT_R8G8B8X8_SRGB,
- fetch_texel_1d_sxbgr8,
- fetch_texel_2d_sxbgr8,
- fetch_texel_3d_sxbgr8
- },
- {
- MESA_FORMAT_L8A8_SRGB,
- fetch_texel_1d_sla8,
- fetch_texel_2d_sla8,
- fetch_texel_3d_sla8
- },
+ FETCH_FUNCS(A8B8G8R8_SRGB),
+ FETCH_FUNCS(B8G8R8A8_SRGB),
+ FETCH_NULL(B8G8R8X8_SRGB),
+ FETCH_FUNCS(R8G8B8A8_SRGB),
+ FETCH_FUNCS(R8G8B8X8_SRGB),
+ FETCH_FUNCS(L8A8_SRGB),
/* Array sRGB formats */
- {
- MESA_FORMAT_L_SRGB8,
- fetch_texel_1d_sl8,
- fetch_texel_2d_sl8,
- fetch_texel_3d_sl8
- },
- {
- MESA_FORMAT_BGR_SRGB8,
- fetch_texel_1d_srgb8,
- fetch_texel_2d_srgb8,
- fetch_texel_3d_srgb8
- },
+ FETCH_FUNCS(L_SRGB8),
+ FETCH_FUNCS(BGR_SRGB8),
/* Packed float formats */
- {
- MESA_FORMAT_R9G9B9E5_FLOAT,
- fetch_texel_1d_rgb9_e5,
- fetch_texel_2d_rgb9_e5,
- fetch_texel_3d_rgb9_e5
- },
- {
- MESA_FORMAT_R11G11B10_FLOAT,
- fetch_texel_1d_r11_g11_b10f,
- fetch_texel_2d_r11_g11_b10f,
- fetch_texel_3d_r11_g11_b10f
- },
- {
- MESA_FORMAT_Z32_FLOAT_S8X24_UINT,
- fetch_texel_1d_z32f_x24s8,
- fetch_texel_2d_z32f_x24s8,
- fetch_texel_3d_z32f_x24s8
- },
+ FETCH_FUNCS(R9G9B9E5_FLOAT),
+ FETCH_FUNCS(R11G11B10_FLOAT),
+ FETCH_FUNCS(Z32_FLOAT_S8X24_UINT),
/* Array float formats */
- {
- MESA_FORMAT_A_FLOAT16,
- fetch_texel_1d_f_alpha_f16,
- fetch_texel_2d_f_alpha_f16,
- fetch_texel_3d_f_alpha_f16
- },
- {
- MESA_FORMAT_A_FLOAT32,
- fetch_texel_1d_f_alpha_f32,
- fetch_texel_2d_f_alpha_f32,
- fetch_texel_3d_f_alpha_f32
- },
- {
- MESA_FORMAT_L_FLOAT16,
- fetch_texel_1d_f_luminance_f16,
- fetch_texel_2d_f_luminance_f16,
- fetch_texel_3d_f_luminance_f16
- },
- {
- MESA_FORMAT_L_FLOAT32,
- fetch_texel_1d_f_luminance_f32,
- fetch_texel_2d_f_luminance_f32,
- fetch_texel_3d_f_luminance_f32
- },
- {
- MESA_FORMAT_LA_FLOAT16,
- fetch_texel_1d_f_luminance_alpha_f16,
- fetch_texel_2d_f_luminance_alpha_f16,
- fetch_texel_3d_f_luminance_alpha_f16
- },
- {
- MESA_FORMAT_LA_FLOAT32,
- fetch_texel_1d_f_luminance_alpha_f32,
- fetch_texel_2d_f_luminance_alpha_f32,
- fetch_texel_3d_f_luminance_alpha_f32
- },
- {
- MESA_FORMAT_I_FLOAT16,
- fetch_texel_1d_f_intensity_f16,
- fetch_texel_2d_f_intensity_f16,
- fetch_texel_3d_f_intensity_f16
- },
- {
- MESA_FORMAT_I_FLOAT32,
- fetch_texel_1d_f_intensity_f32,
- fetch_texel_2d_f_intensity_f32,
- fetch_texel_3d_f_intensity_f32
- },
- {
- MESA_FORMAT_R_FLOAT16,
- fetch_texel_1d_f_r_f16,
- fetch_texel_2d_f_r_f16,
- fetch_texel_3d_f_r_f16
- },
- {
- MESA_FORMAT_R_FLOAT32,
- fetch_texel_1d_f_r_f32,
- fetch_texel_2d_f_r_f32,
- fetch_texel_3d_f_r_f32
- },
- {
- MESA_FORMAT_RG_FLOAT16,
- fetch_texel_1d_f_rg_f16,
- fetch_texel_2d_f_rg_f16,
- fetch_texel_3d_f_rg_f16
- },
- {
- MESA_FORMAT_RG_FLOAT32,
- fetch_texel_1d_f_rg_f32,
- fetch_texel_2d_f_rg_f32,
- fetch_texel_3d_f_rg_f32
- },
- {
- MESA_FORMAT_RGB_FLOAT16,
- fetch_texel_1d_f_rgb_f16,
- fetch_texel_2d_f_rgb_f16,
- fetch_texel_3d_f_rgb_f16
- },
- {
- MESA_FORMAT_RGB_FLOAT32,
- fetch_texel_1d_f_rgb_f32,
- fetch_texel_2d_f_rgb_f32,
- fetch_texel_3d_f_rgb_f32
- },
- {
- MESA_FORMAT_RGBA_FLOAT16,
- fetch_texel_1d_f_rgba_f16,
- fetch_texel_2d_f_rgba_f16,
- fetch_texel_3d_f_rgba_f16
- },
- {
- MESA_FORMAT_RGBA_FLOAT32,
- fetch_texel_1d_f_rgba_f32,
- fetch_texel_2d_f_rgba_f32,
- fetch_texel_3d_f_rgba_f32
- },
- {
- MESA_FORMAT_RGBX_FLOAT16,
- fetch_texel_1d_xbgr16161616_float,
- fetch_texel_2d_xbgr16161616_float,
- fetch_texel_3d_xbgr16161616_float
- },
- {
- MESA_FORMAT_RGBX_FLOAT32,
- fetch_texel_1d_xbgr32323232_float,
- fetch_texel_2d_xbgr32323232_float,
- fetch_texel_3d_xbgr32323232_float
- },
+ FETCH_FUNCS(A_FLOAT16),
+ FETCH_FUNCS(A_FLOAT32),
+ FETCH_FUNCS(L_FLOAT16),
+ FETCH_FUNCS(L_FLOAT32),
+ FETCH_FUNCS(LA_FLOAT16),
+ FETCH_FUNCS(LA_FLOAT32),
+ FETCH_FUNCS(I_FLOAT16),
+ FETCH_FUNCS(I_FLOAT32),
+ FETCH_FUNCS(R_FLOAT16),
+ FETCH_FUNCS(R_FLOAT32),
+ FETCH_FUNCS(RG_FLOAT16),
+ FETCH_FUNCS(RG_FLOAT32),
+ FETCH_FUNCS(RGB_FLOAT16),
+ FETCH_FUNCS(RGB_FLOAT32),
+ FETCH_FUNCS(RGBA_FLOAT16),
+ FETCH_FUNCS(RGBA_FLOAT32),
+ FETCH_FUNCS(RGBX_FLOAT16),
+ FETCH_FUNCS(RGBX_FLOAT32),
{
MESA_FORMAT_Z_FLOAT32,
- fetch_texel_1d_f_r_f32, /* Reuse the R32F functions. */
- fetch_texel_2d_f_r_f32,
- fetch_texel_3d_f_r_f32
+ fetch_texel_1d_R_FLOAT32, /* Reuse the R32F functions. */
+ fetch_texel_2d_R_FLOAT32,
+ fetch_texel_3d_R_FLOAT32
},
/* Packed signed/unsigned non-normalized integer formats */
- {
- MESA_FORMAT_B10G10R10A2_UINT,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R10G10B10A2_UINT,
- NULL,
- NULL,
- NULL
- },
+ FETCH_NULL(B10G10R10A2_UINT),
+ FETCH_NULL(R10G10B10A2_UINT),
/* Array signed/unsigned non-normalized integer formats */
- {
- MESA_FORMAT_A_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_A_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_A_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_A_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_A_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_A_SINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_I_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_I_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_I_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_I_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_I_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_I_SINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_L_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_L_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_L_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_L_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_L_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_L_SINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_LA_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_LA_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_LA_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_LA_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_LA_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_LA_SINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_R_SINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RG_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RG_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RG_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RG_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RG_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RG_SINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGB_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGB_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGB_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGB_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGB_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGB_SINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGBA_UINT8,
- fetch_texel_1d_rgba_uint8,
- fetch_texel_2d_rgba_uint8,
- fetch_texel_3d_rgba_uint8
- },
- {
- MESA_FORMAT_RGBA_UINT16,
- fetch_texel_1d_rgba_uint16,
- fetch_texel_2d_rgba_uint16,
- fetch_texel_3d_rgba_uint16
- },
- {
- MESA_FORMAT_RGBA_UINT32,
- fetch_texel_1d_rgba_uint32,
- fetch_texel_2d_rgba_uint32,
- fetch_texel_3d_rgba_uint32
- },
- {
- MESA_FORMAT_RGBA_SINT8,
- fetch_texel_1d_rgba_int8,
- fetch_texel_2d_rgba_int8,
- fetch_texel_3d_rgba_int8
- },
- {
- MESA_FORMAT_RGBA_SINT16,
- fetch_texel_1d_rgba_int16,
- fetch_texel_2d_rgba_int16,
- fetch_texel_3d_rgba_int16
- },
- {
- MESA_FORMAT_RGBA_SINT32,
- fetch_texel_1d_rgba_int32,
- fetch_texel_2d_rgba_int32,
- fetch_texel_3d_rgba_int32
- },
- {
- MESA_FORMAT_RGBX_UINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGBX_UINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGBX_UINT32,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGBX_SINT8,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGBX_SINT16,
- NULL,
- NULL,
- NULL
- },
- {
- MESA_FORMAT_RGBX_SINT32,
- NULL,
- NULL,
- NULL
- },
+ FETCH_NULL(A_UINT8),
+ FETCH_NULL(A_UINT16),
+ FETCH_NULL(A_UINT32),
+ FETCH_NULL(A_SINT8),
+ FETCH_NULL(A_SINT16),
+ FETCH_NULL(A_SINT32),
+ FETCH_NULL(I_UINT8),
+ FETCH_NULL(I_UINT16),
+ FETCH_NULL(I_UINT32),
+ FETCH_NULL(I_SINT8),
+ FETCH_NULL(I_SINT16),
+ FETCH_NULL(I_SINT32),
+ FETCH_NULL(L_UINT8),
+ FETCH_NULL(L_UINT16),
+ FETCH_NULL(L_UINT32),
+ FETCH_NULL(L_SINT8),
+ FETCH_NULL(L_SINT16),
+ FETCH_NULL(L_SINT32),
+ FETCH_NULL(LA_UINT8),
+ FETCH_NULL(LA_UINT16),
+ FETCH_NULL(LA_UINT32),
+ FETCH_NULL(LA_SINT8),
+ FETCH_NULL(LA_SINT16),
+ FETCH_NULL(LA_SINT32),
+ FETCH_NULL(R_UINT8),
+ FETCH_NULL(R_UINT16),
+ FETCH_NULL(R_UINT32),
+ FETCH_NULL(R_SINT8),
+ FETCH_NULL(R_SINT16),
+ FETCH_NULL(R_SINT32),
+ FETCH_NULL(RG_UINT8),
+ FETCH_NULL(RG_UINT16),
+ FETCH_NULL(RG_UINT32),
+ FETCH_NULL(RG_SINT8),
+ FETCH_NULL(RG_SINT16),
+ FETCH_NULL(RG_SINT32),
+ FETCH_NULL(RGB_UINT8),
+ FETCH_NULL(RGB_UINT16),
+ FETCH_NULL(RGB_UINT32),
+ FETCH_NULL(RGB_SINT8),
+ FETCH_NULL(RGB_SINT16),
+ FETCH_NULL(RGB_SINT32),
+ FETCH_FUNCS(RGBA_UINT8),
+ FETCH_FUNCS(RGBA_UINT16),
+ FETCH_FUNCS(RGBA_UINT32),
+ FETCH_FUNCS(RGBA_SINT8),
+ FETCH_FUNCS(RGBA_SINT16),
+ FETCH_FUNCS(RGBA_SINT32),
+ FETCH_NULL(RGBX_UINT8),
+ FETCH_NULL(RGBX_UINT16),
+ FETCH_NULL(RGBX_UINT32),
+ FETCH_NULL(RGBX_SINT8),
+ FETCH_NULL(RGBX_SINT16),
+ FETCH_NULL(RGBX_SINT32),
/* DXT compressed formats */
{
diff --git a/mesalib/src/mesa/swrast/s_texfetch_tmp.h b/mesalib/src/mesa/swrast/s_texfetch_tmp.h
index f749b491f..d48e39bfd 100644
--- a/mesalib/src/mesa/swrast/s_texfetch_tmp.h
+++ b/mesalib/src/mesa/swrast/s_texfetch_tmp.h
@@ -27,14 +27,14 @@
/**
* \file texfetch_tmp.h
* Texel fetch functions template.
- *
+ *
* This template file is used by texfetch.c to generate texel fetch functions
- * for 1-D, 2-D and 3-D texture images.
+ * for 1-D, 2-D and 3-D texture images.
*
* It should be expanded by defining \p DIM as the number texture dimensions
* (1, 2 or 3). According to the value of \p DIM a series of macros is defined
* for the texel lookup in the gl_texture_image::Data.
- *
+ *
* \author Gareth Hughes
* \author Brian Paul
*/
@@ -69,41 +69,27 @@
#endif
-/* MESA_FORMAT_Z_UNORM32 ***********************************************************/
-
-/* Fetch depth texel from 1D, 2D or 3D 32-bit depth texture,
- * returning 1 GLfloat.
- * Note: no GLchan version of this function.
- */
-static void FETCH(f_z32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(Z_UNORM32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[0] = src[0] * (1.0F / 0xffffffff);
}
-/* MESA_FORMAT_Z_UNORM16 ***********************************************************/
-
-/* Fetch depth texel from 1D, 2D or 3D 16-bit depth texture,
- * returning 1 GLfloat.
- * Note: no GLchan version of this function.
- */
-static void FETCH(f_z16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(Z_UNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[0] = src[0] * (1.0F / 65535.0F);
}
-
-/* MESA_FORMAT_RGBA_F32 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLfloats.
- */
-static void FETCH(f_rgba_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(RGBA_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4);
texel[RCOMP] = src[0];
@@ -113,15 +99,9 @@ static void FETCH(f_rgba_f32)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_F16 ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rgba_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(RGBA_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4);
texel[RCOMP] = _mesa_half_to_float(src[0]);
@@ -131,14 +111,9 @@ static void FETCH(f_rgba_f16)( const struct swrast_texture_image *texImage,
}
-
-/* MESA_FORMAT_RGB_F32 *******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rgb_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(RGB_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3);
texel[RCOMP] = src[0];
@@ -148,15 +123,9 @@ static void FETCH(f_rgb_f32)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGB_F16 *******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rgb_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(RGB_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3);
texel[RCOMP] = _mesa_half_to_float(src[0]);
@@ -166,15 +135,9 @@ static void FETCH(f_rgb_f16)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_ALPHA_F32 *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_alpha_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -184,15 +147,9 @@ static void FETCH(f_alpha_f32)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_ALPHA_F32 *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_alpha_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -202,15 +159,9 @@ static void FETCH(f_alpha_f16)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_LUMINANCE_F32 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -220,15 +171,9 @@ static void FETCH(f_luminance_f32)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_LUMINANCE_F16 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -238,15 +183,9 @@ static void FETCH(f_luminance_f16)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_LUMINANCE_ALPHA_F32 *******************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_alpha_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(LA_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
texel[RCOMP] =
@@ -256,15 +195,9 @@ static void FETCH(f_luminance_alpha_f32)( const struct swrast_texture_image *tex
}
-
-
-/* MESA_FORMAT_LUMINANCE_ALPHA_F16 *******************************************/
-
-/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_luminance_alpha_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(LA_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
texel[RCOMP] =
@@ -274,15 +207,9 @@ static void FETCH(f_luminance_alpha_f16)( const struct swrast_texture_image *tex
}
-
-
-/* MESA_FORMAT_INTENSITY_F32 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_intensity_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(I_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -292,15 +219,9 @@ static void FETCH(f_intensity_f32)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_INTENSITY_F16 *************************************************/
-
-/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_intensity_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(I_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -310,15 +231,9 @@ static void FETCH(f_intensity_f16)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_R_FLOAT32 *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D R_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_r_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1);
texel[RCOMP] = src[0];
@@ -328,15 +243,9 @@ static void FETCH(f_r_f32)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_R_FLOAT16 *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D R_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_r_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1);
texel[RCOMP] = _mesa_half_to_float(src[0]);
@@ -346,15 +255,9 @@ static void FETCH(f_r_f16)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RG_FLOAT32 ****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RG_FLOAT32 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rg_f32)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(RG_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
texel[RCOMP] = src[0];
@@ -364,15 +267,9 @@ static void FETCH(f_rg_f32)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RG_FLOAT16 ****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D RG_FLOAT16 texture,
- * returning 4 GLfloats.
- */
-static void FETCH(f_rg_f16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(RG_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2);
texel[RCOMP] = _mesa_half_to_float(src[0]);
@@ -382,17 +279,9 @@ static void FETCH(f_rg_f16)( const struct swrast_texture_image *texImage,
}
-
-
-/*
- * Begin Hardware formats
- */
-
-/* MESA_FORMAT_A8B8G8R8_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */
-static void FETCH(f_rgba8888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A8B8G8R8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 24) );
@@ -402,15 +291,9 @@ static void FETCH(f_rgba8888)( const struct swrast_texture_image *texImage,
}
-
-
-
-
-/* MESA_FORMAT_RGBA888_REV ***************************************************/
-
-/* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */
-static void FETCH(f_rgba8888_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R8G8B8A8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
@@ -420,13 +303,9 @@ static void FETCH(f_rgba8888_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_B8G8R8A8_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */
-static void FETCH(f_argb8888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B8G8R8A8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
@@ -436,13 +315,9 @@ static void FETCH(f_argb8888)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A8R8G8B8_UNORM **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */
-static void FETCH(f_argb8888_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A8R8G8B8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
@@ -452,13 +327,9 @@ static void FETCH(f_argb8888_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_X8B8G8R8_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgbx8888 texture, return 4 GLfloats */
-static void FETCH(f_rgbx8888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(X8B8G8R8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 24) );
@@ -468,13 +339,9 @@ static void FETCH(f_rgbx8888)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBX888_REV ***************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgbx8888_rev texture, return 4 GLchans */
-static void FETCH(f_rgbx8888_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R8G8B8X8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff );
@@ -484,13 +351,9 @@ static void FETCH(f_rgbx8888_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_B8G8R8X8_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D xrgb8888 texture, return 4 GLchans */
-static void FETCH(f_xrgb8888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B8G8R8X8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
@@ -500,13 +363,9 @@ static void FETCH(f_xrgb8888)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_X8R8G8B8_UNORM **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D xrgb8888_rev texture, return 4 GLfloats */
-static void FETCH(f_xrgb8888_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(X8R8G8B8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff );
@@ -516,13 +375,9 @@ static void FETCH(f_xrgb8888_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_BGR_UNORM8 ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */
-static void FETCH(f_rgb888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(BGR_UNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
texel[RCOMP] = UBYTE_TO_FLOAT( src[2] );
@@ -532,13 +387,9 @@ static void FETCH(f_rgb888)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGB_UNORM8 ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */
-static void FETCH(f_bgr888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(RGB_UNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
texel[RCOMP] = UBYTE_TO_FLOAT( src[0] );
@@ -548,16 +399,9 @@ static void FETCH(f_bgr888)( const struct swrast_texture_image *texImage,
}
-
-
-/* use color expansion like (g << 2) | (g >> 4) (does somewhat random rounding)
- instead of slow (g << 2) * 255 / 252 (always rounds down) */
-
-/* MESA_FORMAT_B5G6R5_UNORM ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */
-static void FETCH(f_rgb565)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B5G6R5_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
const GLushort s = *src;
@@ -568,13 +412,9 @@ static void FETCH(f_rgb565)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_R5G6B5_UNORM ****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */
-static void FETCH(f_rgb565_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R5G6B5_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */
@@ -585,13 +425,9 @@ static void FETCH(f_rgb565_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_B4G4R4A4_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */
-static void FETCH(f_argb4444)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B4G4R4A4_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
const GLushort s = *src;
@@ -602,13 +438,9 @@ static void FETCH(f_argb4444)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A4R4G4B4_UNORM **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */
-static void FETCH(f_argb4444_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A4R4G4B4_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F);
@@ -618,12 +450,9 @@ static void FETCH(f_argb4444_rev)( const struct swrast_texture_image *texImage,
}
-
-/* MESA_FORMAT_A1B5G5R5_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
-static void FETCH(f_rgba5551)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A1B5G5R5_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
const GLushort s = *src;
@@ -634,12 +463,9 @@ static void FETCH(f_rgba5551)( const struct swrast_texture_image *texImage,
}
-
-/* MESA_FORMAT_B5G5R5A1_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
-static void FETCH(f_argb1555)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B5G5R5A1_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
const GLushort s = *src;
@@ -650,13 +476,9 @@ static void FETCH(f_argb1555)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A1R5G5B5_UNORM **************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */
-static void FETCH(f_argb1555_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A1R5G5B5_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */
@@ -667,13 +489,9 @@ static void FETCH(f_argb1555_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_B10G10R10A2_UNORM ***************************************************/
-
-/* Fetch texel from 1D, 2D or 3D argb2101010 texture, return 4 GLchans */
-static void FETCH(f_argb2101010)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B10G10R10A2_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
const GLuint s = *src;
@@ -684,13 +502,22 @@ static void FETCH(f_argb2101010)( const struct swrast_texture_image *texImage,
}
+static void
+FETCH(R10G10B10A2_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
+{
+ const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+ const GLuint s = *src;
+ texel[RCOMP] = ((s >> 0) & 0x3ff) * (1.0F / 1023.0F);
+ texel[GCOMP] = ((s >> 10) & 0x3ff) * (1.0F / 1023.0F);
+ texel[BCOMP] = ((s >> 20) & 0x3ff) * (1.0F / 1023.0F);
+ texel[ACOMP] = ((s >> 30) & 0x03) * (1.0F / 3.0F);
+}
-/* MESA_FORMAT_R8G8_UNORM **********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */
-static void FETCH(f_gr88)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R8G8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( s & 0xff );
@@ -700,13 +527,9 @@ static void FETCH(f_gr88)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_G8R8_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg88_rev texture, return 4 GLchans */
-static void FETCH(f_rg88)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(G8R8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT( s >> 8 );
@@ -716,13 +539,9 @@ static void FETCH(f_rg88)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L4A4_UNORM **********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al44 texture, return 4 GLchans */
-static void FETCH(f_al44)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L4A4_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -732,29 +551,21 @@ static void FETCH(f_al44)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L8A8_UNORM **********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */
-static void FETCH(f_al88)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L8A8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
+ texel[RCOMP] =
+ texel[GCOMP] =
texel[BCOMP] = UBYTE_TO_FLOAT( s & 0xff );
texel[ACOMP] = UBYTE_TO_FLOAT( s >> 8 );
}
-
-
-/* MESA_FORMAT_R_UNORM8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */
-static void FETCH(f_r8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+static void
+FETCH(R_UNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
texel[RCOMP] = UBYTE_TO_FLOAT(s);
@@ -764,13 +575,9 @@ static void FETCH(f_r8)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_R_UNORM16 ***********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D r16 texture, return 4 GLchans */
-static void FETCH(f_r16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+static void
+FETCH(R_UNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] = USHORT_TO_FLOAT(s);
@@ -780,29 +587,21 @@ static void FETCH(f_r16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A8L8_UNORM ******************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */
-static void FETCH(f_al88_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A8L8_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
+ texel[RCOMP] =
+ texel[GCOMP] =
texel[BCOMP] = UBYTE_TO_FLOAT( s >> 8 );
texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff );
}
-
-
-/* MESA_FORMAT_R16G16_UNORM ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg1616 texture, return 4 GLchans */
-static void FETCH(f_rg1616)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R16G16_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = USHORT_TO_FLOAT( s & 0xffff );
@@ -812,13 +611,9 @@ static void FETCH(f_rg1616)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_G16R16_UNORM ****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rg1616_rev texture, return 4 GLchans */
-static void FETCH(f_rg1616_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(G16R16_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = USHORT_TO_FLOAT( s >> 16 );
@@ -828,13 +623,9 @@ static void FETCH(f_rg1616_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L16A16_UNORM ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al1616 texture, return 4 GLchans */
-static void FETCH(f_al1616)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L16A16_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -844,13 +635,9 @@ static void FETCH(f_al1616)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A16L16_UNORM ****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D al1616_rev texture, return 4 GLchans */
-static void FETCH(f_al1616_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A16L16_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -860,13 +647,9 @@ static void FETCH(f_al1616_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_B2G3R3_UNORM ********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */
-static void FETCH(f_rgb332)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B2G3R3_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
const GLubyte s = *src;
@@ -877,13 +660,9 @@ static void FETCH(f_rgb332)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A_UNORM8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
-static void FETCH(f_a8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A_UNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -893,13 +672,9 @@ static void FETCH(f_a8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A_UNORM16 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
-static void FETCH(f_a16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A_UNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -909,13 +684,9 @@ static void FETCH(f_a16)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L_UNORM8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */
-static void FETCH(f_l8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L_UNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -925,13 +696,9 @@ static void FETCH(f_l8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L_UNORM16 ***********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D l16 texture, return 4 GLchans */
-static void FETCH(f_l16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L_UNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -941,13 +708,9 @@ static void FETCH(f_l16)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_I_UNORM8 ************************************************************/
-
-/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */
-static void FETCH(f_i8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(I_UNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -957,13 +720,9 @@ static void FETCH(f_i8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_I_UNORM16 ***********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D i16 texture, return 4 GLchans */
-static void FETCH(f_i16)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(I_UNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -973,12 +732,9 @@ static void FETCH(f_i16)( const struct swrast_texture_image *texImage,
}
-
-
-/* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */
-/* Note: component order is same as for MESA_FORMAT_BGR_UNORM8 */
-static void FETCH(srgb8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(BGR_SRGB8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
texel[RCOMP] = nonlinear_to_linear(src[2]);
@@ -988,10 +744,9 @@ static void FETCH(srgb8)(const struct swrast_texture_image *texImage,
}
-
-/* Fetch texel from 1D, 2D or 3D srgba8 texture, return 4 GLfloats */
-static void FETCH(srgba8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A8B8G8R8_SRGB)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = nonlinear_to_linear( (s >> 24) );
@@ -1001,10 +756,9 @@ static void FETCH(srgba8)(const struct swrast_texture_image *texImage,
}
-
-/* Fetch texel from 1D, 2D or 3D sargb8 texture, return 4 GLfloats */
-static void FETCH(sargb8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(B8G8R8A8_SRGB)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = nonlinear_to_linear( (s >> 16) & 0xff );
@@ -1014,10 +768,9 @@ static void FETCH(sargb8)(const struct swrast_texture_image *texImage,
}
-
-/* Fetch texel from 1D, 2D or 3D sabgr8 texture, return 4 GLfloats */
-static void FETCH(sabgr8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R8G8B8A8_SRGB)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = nonlinear_to_linear( (s ) & 0xff );
@@ -1027,9 +780,9 @@ static void FETCH(sabgr8)(const struct swrast_texture_image *texImage,
}
-/* Fetch texel from 1D, 2D or 3D sabgr8 texture, return 4 GLfloats */
-static void FETCH(sxbgr8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R8G8B8X8_SRGB)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = nonlinear_to_linear( (s ) & 0xff );
@@ -1039,22 +792,21 @@ static void FETCH(sxbgr8)(const struct swrast_texture_image *texImage,
}
-/* Fetch texel from 1D, 2D or 3D sl8 texture, return 4 GLfloats */
-static void FETCH(sl8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L_SRGB8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
- texel[RCOMP] =
- texel[GCOMP] =
+ texel[RCOMP] =
+ texel[GCOMP] =
texel[BCOMP] = nonlinear_to_linear(src[0]);
texel[ACOMP] = 1.0F;
}
-
-/* Fetch texel from 1D, 2D or 3D sla8 texture, return 4 GLfloats */
-static void FETCH(sla8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L8A8_SRGB)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2);
texel[RCOMP] =
@@ -1064,13 +816,9 @@ static void FETCH(sla8)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_SINT8 **************************************************/
-
static void
-FETCH(rgba_int8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+FETCH(RGBA_SINT8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 4);
texel[RCOMP] = (GLfloat) src[0];
@@ -1080,13 +828,9 @@ FETCH(rgba_int8)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_SINT16 **************************************************/
-
static void
-FETCH(rgba_int16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+FETCH(RGBA_SINT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort *src = TEXEL_ADDR(GLshort, texImage, i, j, k, 4);
texel[RCOMP] = (GLfloat) src[0];
@@ -1096,13 +840,9 @@ FETCH(rgba_int16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_SINT32 **************************************************/
-
static void
-FETCH(rgba_int32)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+FETCH(RGBA_SINT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLint *src = TEXEL_ADDR(GLint, texImage, i, j, k, 4);
texel[RCOMP] = (GLfloat) src[0];
@@ -1112,13 +852,9 @@ FETCH(rgba_int32)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_UINT8 **************************************************/
-
static void
-FETCH(rgba_uint8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+FETCH(RGBA_UINT8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4);
texel[RCOMP] = (GLfloat) src[0];
@@ -1128,13 +864,9 @@ FETCH(rgba_uint8)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_UINT16 **************************************************/
-
static void
-FETCH(rgba_uint16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+FETCH(RGBA_UINT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 4);
texel[RCOMP] = (GLfloat) src[0];
@@ -1144,13 +876,9 @@ FETCH(rgba_uint16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_UINT32 **************************************************/
-
static void
-FETCH(rgba_uint32)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+FETCH(RGBA_UINT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 4);
texel[RCOMP] = (GLfloat) src[0];
@@ -1160,14 +888,13 @@ FETCH(rgba_uint32)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_DUDV8 ********************************************************/
-
-/* this format by definition produces 0,0,0,1 as rgba values,
- however we'll return the dudv values as rg and fix up elsewhere */
-static void FETCH(dudv8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+/**
+ * This format by definition produces 0,0,0,1 as rgba values,
+ * however we'll return the dudv values as rg and fix up elsewhere.
+ */
+static void
+FETCH(DUDV8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 2);
texel[RCOMP] = BYTE_TO_FLOAT(src[0]);
@@ -1177,10 +904,9 @@ static void FETCH(dudv8)(const struct swrast_texture_image *texImage,
}
-/* MESA_FORMAT_R_SNORM8 ***********************************************/
-
-static void FETCH(signed_r8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R_SNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX( s );
@@ -1190,12 +916,9 @@ static void FETCH(signed_r8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A_SNORM8 ***********************************************/
-
-static void FETCH(signed_a8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A_SNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
texel[RCOMP] = 0.0F;
@@ -1205,12 +928,9 @@ static void FETCH(signed_a8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L_SNORM8 ***********************************************/
-
-static void FETCH(signed_l8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L_SNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -1220,12 +940,9 @@ static void FETCH(signed_l8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_I_SNORM8 ***********************************************/
-
-static void FETCH(signed_i8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(I_SNORM8)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLbyte s = *TEXEL_ADDR(GLbyte, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -1235,12 +952,9 @@ static void FETCH(signed_i8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_R8G8_SNORM ***********************************************/
-
-static void FETCH(signed_rg88_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R8G8_SNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s & 0xff) );
@@ -1250,12 +964,9 @@ static void FETCH(signed_rg88_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L8A8_SNORM ***********************************************/
-
-static void FETCH(signed_al88)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(L8A8_SNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -1265,12 +976,9 @@ static void FETCH(signed_al88)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_X8B8G8R8_SNORM ***********************************************/
-
-static void FETCH(signed_rgbx8888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(X8B8G8R8_SNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) );
@@ -1280,12 +988,9 @@ static void FETCH(signed_rgbx8888)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A8B8G8R8_SNORM ***********************************************/
-
-static void FETCH(signed_rgba8888)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(A8B8G8R8_SNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s >> 24) );
@@ -1295,9 +1000,9 @@ static void FETCH(signed_rgba8888)( const struct swrast_texture_image *texImage,
}
-
-static void FETCH(signed_rgba8888_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R8G8B8A8_SNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX( (GLbyte) (s ) );
@@ -1307,14 +1012,9 @@ static void FETCH(signed_rgba8888_rev)( const struct swrast_texture_image *texIm
}
-
-
-
-/* MESA_FORMAT_R_SNORM16 ***********************************************/
-
static void
-FETCH(signed_r16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(R_SNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
texel[RCOMP] = SHORT_TO_FLOAT_TEX( s );
@@ -1324,13 +1024,9 @@ FETCH(signed_r16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_A_SNORM16 ***********************************************/
-
static void
-FETCH(signed_a16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(A_SNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
texel[RCOMP] = 0.0F;
@@ -1340,13 +1036,9 @@ FETCH(signed_a16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_L_SNORM16 ***********************************************/
-
static void
-FETCH(signed_l16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(L_SNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -1356,13 +1048,9 @@ FETCH(signed_l16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_I_SNORM16 ***********************************************/
-
static void
-FETCH(signed_i16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(I_SNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort s = *TEXEL_ADDR(GLshort, texImage, i, j, k, 1);
texel[RCOMP] =
@@ -1372,12 +1060,8 @@ FETCH(signed_i16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_G16R16_SNORM ***********************************************/
-
static void
-FETCH(signed_rg1616)(const struct swrast_texture_image *texImage,
+FETCH(R16G16_SNORM)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 2);
@@ -1388,13 +1072,9 @@ FETCH(signed_rg1616)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_LA_SNORM16 ***********************************************/
-
static void
-FETCH(signed_al1616)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(LA_SNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 2);
texel[RCOMP] =
@@ -1404,13 +1084,10 @@ FETCH(signed_al1616)(const struct swrast_texture_image *texImage,
}
+static void
-
-/* MESA_FORMAT_RGB_SNORM16 ***********************************************/
-
-static void
-FETCH(signed_rgb_16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(RGB_SNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 3);
texel[RCOMP] = SHORT_TO_FLOAT_TEX( s[0] );
@@ -1420,13 +1097,9 @@ FETCH(signed_rgb_16)(const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGBA_SNORM16 ***********************************************/
-
static void
-FETCH(signed_rgba_16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(RGBA_SNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLshort *s = TEXEL_ADDR(GLshort, texImage, i, j, k, 4);
texel[RCOMP] = SHORT_TO_FLOAT_TEX( s[0] );
@@ -1436,14 +1109,9 @@ FETCH(signed_rgba_16)(const struct swrast_texture_image *texImage,
}
-
-
-
-/* MESA_FORMAT_RGBA_UNORM16 ***********************************************/
-
static void
-FETCH(rgba_16)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(RGBA_UNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *s = TEXEL_ADDR(GLushort, texImage, i, j, k, 4);
texel[RCOMP] = USHORT_TO_FLOAT( s[0] );
@@ -1453,12 +1121,9 @@ FETCH(rgba_16)(const struct swrast_texture_image *texImage,
}
-
-/* MESA_FORMAT_XBGR.... **********************************************/
-
static void
-FETCH(xbgr16161616_unorm)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(RGBX_UNORM16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *s = TEXEL_ADDR(GLushort, texImage, i, j, k, 4);
texel[RCOMP] = USHORT_TO_FLOAT(s[0]);
@@ -1467,9 +1132,10 @@ FETCH(xbgr16161616_unorm)(const struct swrast_texture_image *texImage,
texel[ACOMP] = 1.0f;
}
+
static void
-FETCH(xbgr16161616_float)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(RGBX_FLOAT16)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLhalfARB *s = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4);
texel[RCOMP] = _mesa_half_to_float(s[0]);
@@ -1478,9 +1144,10 @@ FETCH(xbgr16161616_float)(const struct swrast_texture_image *texImage,
texel[ACOMP] = 1.0f;
}
+
static void
-FETCH(xbgr32323232_float)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+FETCH(RGBX_FLOAT32)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *s = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4);
texel[RCOMP] = s[0];
@@ -1489,17 +1156,13 @@ FETCH(xbgr32323232_float)(const struct swrast_texture_image *texImage,
texel[ACOMP] = 1.0f;
}
-/* XXX other XBGR formats need to be implemented here */
-
-
-/* MESA_FORMAT_YCBCR *********************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLfloats.
- * We convert YCbCr to RGB here.
+/**
+ * Fetch texel from 1D, 2D or 3D ycbcr texture, returning RGBA.
*/
-static void FETCH(f_ycbcr)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(YCBCR)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
const GLushort *src1 = src0 + 1; /* odd */
@@ -1521,15 +1184,12 @@ static void FETCH(f_ycbcr)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_YCBCR_REV *****************************************************/
-
-/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats.
- * We convert YCbCr to RGB here.
+/**
+ * Fetch texel from 1D, 2D or 3D ycbcr texture, returning RGBA.
*/
-static void FETCH(f_ycbcr_rev)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(YCBCR_REV)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
const GLushort *src1 = src0 + 1; /* odd */
@@ -1551,12 +1211,9 @@ static void FETCH(f_ycbcr_rev)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_TEXFORMAT_Z24_S8 ***************************************************/
-
-static void FETCH(f_z24_s8)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(S8_UINT_Z24_UNORM)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
/* only return Z, not stencil data */
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1569,12 +1226,9 @@ static void FETCH(f_z24_s8)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_TEXFORMAT_S8_Z24 ***************************************************/
-
-static void FETCH(f_s8_z24)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(Z24_UNORM_S8_UINT)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
/* only return Z, not stencil data */
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
@@ -1587,12 +1241,9 @@ static void FETCH(f_s8_z24)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_RGB9_E5 ******************************************************/
-
-static void FETCH(rgb9_e5)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R9G9B9E5_FLOAT)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
rgb9e5_to_float3(*src, texel);
@@ -1600,12 +1251,9 @@ static void FETCH(rgb9_e5)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_R11G11B10_FLOAT *********************************************/
-
-static void FETCH(r11_g11_b10f)( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+static void
+FETCH(R11G11B10_FLOAT)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
r11g11b10f_to_float3(*src, texel);
@@ -1613,12 +1261,9 @@ static void FETCH(r11_g11_b10f)( const struct swrast_texture_image *texImage,
}
-
-
-/* MESA_FORMAT_Z32_FLOAT_S8X24_UINT ***********************************************/
-
-static void FETCH(z32f_x24s8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+static void
+FETCH(Z32_FLOAT_S8X24_UINT)(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
texel[RCOMP] = src[0];
diff --git a/mesalib/src/mesa/tnl/t_context.c b/mesalib/src/mesa/tnl/t_context.c
index 134f699be..eb5bae41d 100644
--- a/mesalib/src/mesa/tnl/t_context.c
+++ b/mesalib/src/mesa/tnl/t_context.c
@@ -93,7 +93,7 @@ _tnl_CreateContext( struct gl_context *ctx )
}
/* plug in the VBO drawing function */
- vbo_set_draw_func(ctx, _tnl_vbo_draw_prims);
+ vbo_set_draw_func(ctx, _tnl_draw_prims);
_math_init_transformation();
_math_init_translate();
diff --git a/mesalib/src/mesa/tnl/t_draw.c b/mesalib/src/mesa/tnl/t_draw.c
index 2755ae62d..be3f059bb 100644
--- a/mesalib/src/mesa/tnl/t_draw.c
+++ b/mesalib/src/mesa/tnl/t_draw.c
@@ -411,7 +411,11 @@ static void unmap_vbos( struct gl_context *ctx,
}
-void _tnl_vbo_draw_prims(struct gl_context *ctx,
+/* This is the main entrypoint into the slimmed-down software tnl
+ * module. In a regular swtnl driver, this can be plugged straight
+ * into the vbo->Driver.DrawPrims() callback.
+ */
+void _tnl_draw_prims(struct gl_context *ctx,
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,
@@ -421,32 +425,16 @@ void _tnl_vbo_draw_prims(struct gl_context *ctx,
struct gl_transform_feedback_object *tfb_vertcount,
struct gl_buffer_object *indirect)
{
- const struct gl_client_array **arrays = ctx->Array._DrawArrays;
-
- if (!index_bounds_valid)
- vbo_get_minmax_indices(ctx, prim, ib, &min_index, &max_index, nr_prims);
-
- _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index);
-}
-
-/* This is the main entrypoint into the slimmed-down software tnl
- * module. In a regular swtnl driver, this can be plugged straight
- * into the vbo->Driver.DrawPrims() callback.
- */
-void _tnl_draw_prims( struct gl_context *ctx,
- const struct gl_client_array *arrays[],
- const struct _mesa_prim *prim,
- GLuint nr_prims,
- const struct _mesa_index_buffer *ib,
- GLuint min_index,
- GLuint max_index)
-{
TNLcontext *tnl = TNL_CONTEXT(ctx);
+ const struct gl_client_array **arrays = ctx->Array._DrawArrays;
const GLuint TEST_SPLIT = 0;
const GLint max = TEST_SPLIT ? 8 : tnl->vb.Size - MAX_CLIPPED_VERTICES;
GLint max_basevertex = prim->basevertex;
GLuint i;
+ if (!index_bounds_valid)
+ vbo_get_minmax_indices(ctx, prim, ib, &min_index, &max_index, nr_prims);
+
/* Mesa core state should have been validated already */
assert(ctx->NewState == 0x0);
@@ -471,7 +459,7 @@ void _tnl_draw_prims( struct gl_context *ctx,
*/
vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib,
min_index, max_index,
- _tnl_vbo_draw_prims );
+ _tnl_draw_prims );
return;
}
else if ((GLint)max_index + max_basevertex > max) {
@@ -489,7 +477,7 @@ void _tnl_draw_prims( struct gl_context *ctx,
*/
vbo_split_prims( ctx, arrays, prim, nr_prims, ib,
0, max_index + prim->basevertex,
- _tnl_vbo_draw_prims,
+ _tnl_draw_prims,
&limits );
}
else {
diff --git a/mesalib/src/mesa/tnl/tnl.h b/mesalib/src/mesa/tnl/tnl.h
index 59a0ac380..8c59ff9e5 100644
--- a/mesalib/src/mesa/tnl/tnl.h
+++ b/mesalib/src/mesa/tnl/tnl.h
@@ -77,15 +77,6 @@ struct _mesa_index_buffer;
void
_tnl_draw_prims( struct gl_context *ctx,
- const struct gl_client_array *arrays[],
- const struct _mesa_prim *prim,
- GLuint nr_prims,
- const struct _mesa_index_buffer *ib,
- GLuint min_index,
- GLuint max_index);
-
-void
-_tnl_vbo_draw_prims( struct gl_context *ctx,
const struct _mesa_prim *prim,
GLuint nr_prims,
const struct _mesa_index_buffer *ib,