aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-10-31 08:40:01 +0100
committermarha <marha@users.sourceforge.net>2013-10-31 08:40:01 +0100
commite4ef724e06621be9325fc41ed886fd404467fdc0 (patch)
treebe445314647f682fbb4a1e8b94aeb6ee79cede5f /mesalib/src/gallium
parent270d3a1aa4137dc15d7b7e5a0958cc8c0bef9a1a (diff)
downloadvcxsrv-e4ef724e06621be9325fc41ed886fd404467fdc0.tar.gz
vcxsrv-e4ef724e06621be9325fc41ed886fd404467fdc0.tar.bz2
vcxsrv-e4ef724e06621be9325fc41ed886fd404467fdc0.zip
fontconfig glproto libX11 mesa xserver xkeyboard-config git update 31 oct 2013
xserver commit 902ff0b3497d202b86bf9a411e17db7b694d6eaa xkeyboard-config commit 70bbf18d6cddb7271db1b2e042765ace3c4ac485 libX11 commit 6cb02b166361200da35ba14f52cd9aaa493eb0ea glproto commit aacc7a51b6161c765b04524e0d2ab31e5e586834 fontconfig commit 525a135ccf53e4bf3363c3143d9cfdf15fba55ab mesa commit b16b3c8703f198ca0f025b730d582600df79c19c
Diffstat (limited to 'mesalib/src/gallium')
-rw-r--r--mesalib/src/gallium/auxiliary/Makefile.sources1
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.c41
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.h11
3 files changed, 53 insertions, 0 deletions
diff --git a/mesalib/src/gallium/auxiliary/Makefile.sources b/mesalib/src/gallium/auxiliary/Makefile.sources
index acbcef7e2..c89cbddd0 100644
--- a/mesalib/src/gallium/auxiliary/Makefile.sources
+++ b/mesalib/src/gallium/auxiliary/Makefile.sources
@@ -43,6 +43,7 @@ C_SOURCES := \
hud/hud_cpu.c \
hud/hud_fps.c \
hud/hud_driver_query.c \
+ indices/u_primconvert.c \
os/os_misc.c \
os/os_process.c \
os/os_time.c \
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.c b/mesalib/src/gallium/auxiliary/util/u_format.c
index a8aa5719d..9ef3bb53f 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.c
+++ b/mesalib/src/gallium/auxiliary/util/u_format.c
@@ -208,6 +208,47 @@ util_format_is_supported(enum pipe_format format, unsigned bind)
}
+/**
+ * Calculates the MRD for the depth format. MRD is used in depth bias
+ * for UNORM and unbound depth buffers. When the depth buffer is floating
+ * point, the depth bias calculation does not use the MRD. However, the
+ * default MRD will be 1.0 / ((1 << 24) - 1).
+ */
+double
+util_get_depth_format_mrd(enum pipe_format format)
+{
+ struct util_format_description *format_desc;
+ /*
+ * Depth buffer formats without a depth component OR scenarios
+ * without a bound depth buffer default to D24.
+ */
+ double mrd = 1.0 / ((1 << 24) - 1);
+ unsigned depth_channel;
+
+ format_desc = (struct util_format_description *)
+ util_format_description(format);
+
+ assert(format_desc);
+
+ /*
+ * Some depth formats do not store the depth component in the first
+ * channel, detect the format and adjust the depth channel. Get the
+ * swizzled depth component channel.
+ */
+ depth_channel = format_desc->swizzle[0];
+
+ if (format_desc->channel[depth_channel].type == UTIL_FORMAT_TYPE_UNSIGNED &&
+ format_desc->channel[depth_channel].normalized) {
+ int depth_bits;
+
+ depth_bits = format_desc->channel[depth_channel].size;
+ mrd = 1.0 / ((1ULL << depth_bits) - 1);
+ }
+
+ return mrd;
+}
+
+
void
util_format_read_4f(enum pipe_format format,
float *dst, unsigned dst_stride,
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.h b/mesalib/src/gallium/auxiliary/util/u_format.h
index 84f16d503..dc777c35c 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.h
+++ b/mesalib/src/gallium/auxiliary/util/u_format.h
@@ -544,6 +544,17 @@ util_format_is_depth_and_stencil(enum pipe_format format)
util_format_has_stencil(desc);
}
+
+/**
+ * Calculates the MRD for the depth format. MRD is used in depth bias
+ * for UNORM and unbound depth buffers. When the depth buffer is floating
+ * point, the depth bias calculation does not use the MRD. However, the
+ * default MRD will be 1.0 / ((1 << 24) - 1).
+ */
+double
+util_get_depth_format_mrd(enum pipe_format format);
+
+
/**
* Return whether this is an RGBA, Z, S, or combined ZS format.
* Useful for initializing pipe_blit_info::mask.