summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2013-04-13 15:04:55 +0200
committerChristoph Bumiller <[email protected]>2013-04-18 20:35:40 +0200
commit246ff8f887e10a2828fb43104a06ba6f2505b74d (patch)
tree21c13937490308e246fb3b5c5211979492bfb4ad
parent2d5d054752fc7885d1dd4fedfd90888e66bd8d34 (diff)
nv50: set BORDER_COLOR_SRGB in sampler objects
-rw-r--r--src/gallium/drivers/nv50/nv50_state.c30
-rw-r--r--src/gallium/drivers/nv50/nv50_texture.xml.h24
2 files changed, 35 insertions, 19 deletions
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index 819b0a2e2bf..cbde4b12d1e 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -24,6 +24,7 @@
#include "util/u_helpers.h"
#include "util/u_inlines.h"
#include "util/u_transfer.h"
+#include "util/u_format_srgb.h"
#include "tgsi/tgsi_parse.h"
@@ -456,7 +457,7 @@ void *
nv50_sampler_state_create(struct pipe_context *pipe,
const struct pipe_sampler_state *cso)
{
- struct nv50_tsc_entry *so = CALLOC_STRUCT(nv50_tsc_entry);
+ struct nv50_tsc_entry *so = MALLOC_STRUCT(nv50_tsc_entry);
float f[2];
so->id = -1;
@@ -466,20 +467,13 @@ nv50_sampler_state_create(struct pipe_context *pipe,
(nv50_tsc_wrap_mode(cso->wrap_t) << 3) |
(nv50_tsc_wrap_mode(cso->wrap_r) << 6));
- if (nouveau_screen(pipe->screen)->class_3d >= NVE4_3D_CLASS) {
- if (cso->seamless_cube_map)
- so->tsc[1] |= NVE4_TSC_1_CUBE_SEAMLESS;
- if (!cso->normalized_coords)
- so->tsc[1] |= NVE4_TSC_1_FORCE_NONNORMALIZED_COORDS;
- }
-
switch (cso->mag_img_filter) {
case PIPE_TEX_FILTER_LINEAR:
- so->tsc[1] |= NV50_TSC_1_MAGF_LINEAR;
+ so->tsc[1] = NV50_TSC_1_MAGF_LINEAR;
break;
case PIPE_TEX_FILTER_NEAREST:
default:
- so->tsc[1] |= NV50_TSC_1_MAGF_NEAREST;
+ so->tsc[1] = NV50_TSC_1_MAGF_NEAREST;
break;
}
@@ -506,6 +500,13 @@ nv50_sampler_state_create(struct pipe_context *pipe,
break;
}
+ if (nouveau_screen(pipe->screen)->class_3d >= NVE4_3D_CLASS) {
+ if (cso->seamless_cube_map)
+ so->tsc[1] |= NVE4_TSC_1_CUBE_SEAMLESS;
+ if (!cso->normalized_coords)
+ so->tsc[1] |= NVE4_TSC_1_FORCE_NONNORMALIZED_COORDS;
+ }
+
if (cso->max_anisotropy >= 16)
so->tsc[0] |= (7 << 20);
else
@@ -532,9 +533,16 @@ nv50_sampler_state_create(struct pipe_context *pipe,
f[0] = CLAMP(cso->min_lod, 0.0f, 15.0f);
f[1] = CLAMP(cso->max_lod, 0.0f, 15.0f);
- so->tsc[2] |=
+ so->tsc[2] =
(((int)(f[1] * 256.0f) & 0xfff) << 12) | ((int)(f[0] * 256.0f) & 0xfff);
+ so->tsc[2] |=
+ util_format_linear_float_to_srgb_8unorm(cso->border_color.f[0]) << 24;
+ so->tsc[3] =
+ util_format_linear_float_to_srgb_8unorm(cso->border_color.f[1]) << 12;
+ so->tsc[3] |=
+ util_format_linear_float_to_srgb_8unorm(cso->border_color.f[2]) << 20;
+
so->tsc[4] = fui(cso->border_color.f[0]);
so->tsc[5] = fui(cso->border_color.f[1]);
so->tsc[6] = fui(cso->border_color.f[2]);
diff --git a/src/gallium/drivers/nv50/nv50_texture.xml.h b/src/gallium/drivers/nv50/nv50_texture.xml.h
index 63daf9ea89f..31eab9b5d87 100644
--- a/src/gallium/drivers/nv50/nv50_texture.xml.h
+++ b/src/gallium/drivers/nv50/nv50_texture.xml.h
@@ -1,5 +1,5 @@
-#ifndef RNNDB_NV50_TEXTURE_XML
-#define RNNDB_NV50_TEXTURE_XML
+#ifndef NV50_TEXTURE_XML
+#define NV50_TEXTURE_XML
/* Autogenerated file, DO NOT EDIT manually!
@@ -8,12 +8,12 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
git clone git://0x04.net/rules-ng-ng
The rules-ng-ng source files this header was generated from are:
-- rnndb/nv50_texture.xml ( 8180 bytes, from 2012-07-31 11:07:50)
-- ./rnndb/copyright.xml ( 6452 bytes, from 2011-07-10 21:35:25)
-- ./rnndb/nvchipsets.xml ( 3736 bytes, from 2012-07-31 11:01:16)
-- ./rnndb/nv50_defs.xml ( 5468 bytes, from 2011-07-10 21:35:25)
+- rnndb/nv50_texture.xml ( 8648 bytes, from 2013-04-13 12:49:11)
+- rnndb/copyright.xml ( 6452 bytes, from 2011-08-11 18:25:12)
+- rnndb/nvchipsets.xml ( 3954 bytes, from 2013-03-26 01:26:43)
+- rnndb/nv50_defs.xml ( 16652 bytes, from 2013-04-04 10:57:15)
-Copyright (C) 2006-2012 by the following authors:
+Copyright (C) 2006-2013 by the following authors:
- Artur Huillet <[email protected]> (ahuillet)
- Ben Skeggs (darktama, darktama_)
- B. R. <[email protected]> (koala_br)
@@ -277,6 +277,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define NV50_TSC_2_MIN_LOD__SHIFT 0
#define NV50_TSC_2_MAX_LOD__MASK 0x00fff000
#define NV50_TSC_2_MAX_LOD__SHIFT 12
+#define NV50_TSC_2_BORDER_COLOR_SRGB_RED__MASK 0xff000000
+#define NV50_TSC_2_BORDER_COLOR_SRGB_RED__SHIFT 24
+
+#define NV50_TSC_3 0x0000000c
+#define NV50_TSC_3_BORDER_COLOR_SRGB_GREEN__MASK 0x000ff000
+#define NV50_TSC_3_BORDER_COLOR_SRGB_GREEN__SHIFT 12
+#define NV50_TSC_3_BORDER_COLOR_SRGB_BLUE__MASK 0x0ff00000
+#define NV50_TSC_3_BORDER_COLOR_SRGB_BLUE__SHIFT 20
#define NV50_TSC_4 0x00000010
#define NV50_TSC_4_BORDER_COLOR_RED__MASK 0xffffffff
@@ -295,4 +303,4 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define NV50_TSC_7_BORDER_COLOR_ALPHA__SHIFT 0
-#endif /* RNNDB_NV50_TEXTURE_XML */
+#endif /* NV50_TEXTURE_XML */