aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-02-15 08:16:33 +0100
committermarha <marha@users.sourceforge.net>2013-02-15 08:16:33 +0100
commit6f6a2340d40759b77ef43965efdd24f3e4e623fd (patch)
treeeb25fb9622df69a72ee33e655617a1127780cb90 /mesalib/src/mesa/state_tracker
parentb41f74438672dd682bc01ae818cb3da654f22c1e (diff)
downloadvcxsrv-6f6a2340d40759b77ef43965efdd24f3e4e623fd.tar.gz
vcxsrv-6f6a2340d40759b77ef43965efdd24f3e4e623fd.tar.bz2
vcxsrv-6f6a2340d40759b77ef43965efdd24f3e4e623fd.zip
libxcb mesa xserver xkeyboard-config git update 15 Feb 2013
xserver commit 90642948cc78834d95f7a3bddaac7ff77b68ed7e libxcb commit 0dd8f8d26a758bc385e79d9239bf6ef2e3d7bf13 xkeyboard-config commit 067b0e4fd8d4fe707d86b24ae83bcacb61624231 mesa commit 6dbe94c12cd1b3b912a7083055178e0dfd7372af
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c14
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c28
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c30
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c35
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.h3
5 files changed, 69 insertions, 41 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index 28327bc14..fc2d69013 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -234,11 +234,17 @@ update_single_texture(struct st_context *st,
}
/* Determine the format of the texture sampler view */
- view_format = stObj->pt->format;
+ if (texObj->Target == GL_TEXTURE_BUFFER) {
+ view_format =
+ st_mesa_format_to_pipe_format(stObj->base._BufferObjectFormat);
+ }
+ else {
+ view_format = stObj->pt->format;
- /* If sRGB decoding is off, use the linear format */
- if (samp->sRGBDecode == GL_SKIP_DECODE_EXT) {
- view_format = util_format_linear(view_format);
+ /* If sRGB decoding is off, use the linear format */
+ if (samp->sRGBDecode == GL_SKIP_DECODE_EXT) {
+ view_format = util_format_linear(view_format);
+ }
}
/* if sampler view has changed dereference it */
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index ba4f17a3d..e282bf98d 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -484,19 +484,29 @@ make_texture(struct st_context *st,
gl_format mformat;
struct pipe_resource *pt;
enum pipe_format pipeFormat;
- GLenum baseInternalFormat, intFormat;
-
- intFormat = internal_format(ctx, format, type);
- baseInternalFormat = _mesa_base_tex_format(ctx, intFormat);
+ GLenum baseInternalFormat;
/* Choose a pixel format for the temp texture which will hold the
* image to draw.
*/
- pipeFormat = st_choose_format(st, intFormat, format, type,
- PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW,
- FALSE);
- assert(pipeFormat != PIPE_FORMAT_NONE);
- mformat = st_pipe_format_to_mesa_format(pipeFormat);
+ pipeFormat = st_choose_matching_format(pipe->screen, PIPE_BIND_SAMPLER_VIEW,
+ format, type, unpack->SwapBytes);
+
+ if (pipeFormat != PIPE_FORMAT_NONE) {
+ mformat = st_pipe_format_to_mesa_format(pipeFormat);
+ baseInternalFormat = _mesa_get_format_base_format(mformat);
+ }
+ else {
+ /* Use the generic approach. */
+ GLenum intFormat = internal_format(ctx, format, type);
+
+ baseInternalFormat = _mesa_base_tex_format(ctx, intFormat);
+ pipeFormat = st_choose_format(st, intFormat, format, type,
+ PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW,
+ FALSE);
+ assert(pipeFormat != PIPE_FORMAT_NONE);
+ mformat = st_pipe_format_to_mesa_format(pipeFormat);
+ }
pixels = _mesa_map_pbo_source(ctx, unpack, pixels);
if (!pixels)
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index ac70e9292..f8ff024db 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -560,32 +560,6 @@ st_CompressedTexImage(struct gl_context *ctx, GLuint dims,
}
-static enum pipe_format
-choose_matching_format(struct pipe_screen *screen, unsigned bind,
- GLenum format, GLenum type, GLboolean swapBytes)
-{
- gl_format mesa_format;
-
- for (mesa_format = 1; mesa_format < MESA_FORMAT_COUNT; mesa_format++) {
- if (_mesa_get_format_color_encoding(mesa_format) == GL_SRGB) {
- continue;
- }
-
- if (_mesa_format_matches_format_and_type(mesa_format, format, type,
- swapBytes)) {
- enum pipe_format format = st_mesa_format_to_pipe_format(mesa_format);
-
- if (format &&
- screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0,
- bind)) {
- return format;
- }
- /* It's unlikely to find 2 matching Mesa formats. */
- break;
- }
- }
- return PIPE_FORMAT_NONE;
-}
/**
@@ -683,8 +657,8 @@ st_GetTexImage(struct gl_context * ctx,
/* Choose the destination format by finding the best match
* for the format+type combo. */
- dst_format = choose_matching_format(screen, bind, format, type,
- ctx->Pack.SwapBytes);
+ dst_format = st_choose_matching_format(screen, bind, format, type,
+ ctx->Pack.SwapBytes);
if (dst_format == PIPE_FORMAT_NONE) {
GLenum dst_glformat;
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 02969b995..5fd44e76d 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -1675,6 +1675,41 @@ st_choose_renderbuffer_format(struct st_context *st,
/**
+ * Given an OpenGL user-requested format and type, and swapBytes state,
+ * return the format which exactly matches those parameters, so that
+ * a memcpy-based transfer can be done.
+ *
+ * If no format is supported, return PIPE_FORMAT_NONE.
+ */
+enum pipe_format
+st_choose_matching_format(struct pipe_screen *screen, unsigned bind,
+ GLenum format, GLenum type, GLboolean swapBytes)
+{
+ gl_format mesa_format;
+
+ for (mesa_format = 1; mesa_format < MESA_FORMAT_COUNT; mesa_format++) {
+ if (_mesa_get_format_color_encoding(mesa_format) == GL_SRGB) {
+ continue;
+ }
+
+ if (_mesa_format_matches_format_and_type(mesa_format, format, type,
+ swapBytes)) {
+ enum pipe_format format = st_mesa_format_to_pipe_format(mesa_format);
+
+ if (format &&
+ screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0,
+ bind)) {
+ return format;
+ }
+ /* It's unlikely to find 2 matching Mesa formats. */
+ break;
+ }
+ }
+ return PIPE_FORMAT_NONE;
+}
+
+
+/**
* Called via ctx->Driver.ChooseTextureFormat().
*/
gl_format
diff --git a/mesalib/src/mesa/state_tracker/st_format.h b/mesalib/src/mesa/state_tracker/st_format.h
index aee624d24..3db409b74 100644
--- a/mesalib/src/mesa/state_tracker/st_format.h
+++ b/mesalib/src/mesa/state_tracker/st_format.h
@@ -57,6 +57,9 @@ extern enum pipe_format
st_choose_renderbuffer_format(struct st_context *st,
GLenum internalFormat, unsigned sample_count);
+extern enum pipe_format
+st_choose_matching_format(struct pipe_screen *screen, unsigned bind,
+ GLenum format, GLenum type, GLboolean swapBytes);
extern gl_format
st_ChooseTextureFormat(struct gl_context * ctx, GLenum target,