[Mesa-dev] [PATCH 1/2] mesa: set UniformBooleanTrue = 1.0f by default

2014-09-04 Thread Marek Olšák
From: Marek Olšák 

because NativeIntegers is 0 by default.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82882

Cc: 10.2 10.3 mesa-sta...@lists.freedesktop.org
---

Untested. This should fix swrast. See the bugzilla link above.
The second patch fixes the same issue for Gallium/r300g.

 src/mesa/main/context.c | 3 +++
 src/mesa/main/macros.h  | 7 +++
 2 files changed, 10 insertions(+)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index fbdbd68..8b5693e 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -653,6 +653,9 @@ _mesa_init_constants(struct gl_constants *consts, gl_api 
api)
/* GL_ARB_framebuffer_object */
consts->MaxSamples = 0;
 
+   /* GLSL default if NativeIntegers == FALSE */
+   consts->UniformBooleanTrue = FLT_AS_UINT(1.0f);
+
/* GL_ARB_sync */
consts->MaxServerWaitTimeout = 0x1fff7fffULL;
 
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 0ba658a..2d54ca5 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -184,6 +184,13 @@ static inline GLfloat UINT_AS_FLT(GLuint u)
return tmp.f;
 }
 
+static inline unsigned FLT_AS_UINT(float f)
+{
+   fi_type tmp;
+   tmp.f = f;
+   return tmp.u;
+}
+
 /**
  * Convert a floating point value to an unsigned fixed point value.
  *
-- 
1.9.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa: set UniformBooleanTrue = 1.0f by default

2014-09-04 Thread Brian Paul

On 09/04/2014 08:21 AM, Marek Olšák wrote:

From: Marek Olšák 

because NativeIntegers is 0 by default.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82882

Cc: 10.2 10.3 mesa-sta...@lists.freedesktop.org
---

Untested. This should fix swrast. See the bugzilla link above.
The second patch fixes the same issue for Gallium/r300g.

  src/mesa/main/context.c | 3 +++
  src/mesa/main/macros.h  | 7 +++
  2 files changed, 10 insertions(+)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index fbdbd68..8b5693e 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -653,6 +653,9 @@ _mesa_init_constants(struct gl_constants *consts, gl_api 
api)
 /* GL_ARB_framebuffer_object */
 consts->MaxSamples = 0;

+   /* GLSL default if NativeIntegers == FALSE */
+   consts->UniformBooleanTrue = FLT_AS_UINT(1.0f);
+
 /* GL_ARB_sync */
 consts->MaxServerWaitTimeout = 0x1fff7fffULL;

diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 0ba658a..2d54ca5 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -184,6 +184,13 @@ static inline GLfloat UINT_AS_FLT(GLuint u)
 return tmp.f;
  }

+static inline unsigned FLT_AS_UINT(float f)
+{
+   fi_type tmp;
+   tmp.f = f;
+   return tmp.u;
+}
+
  /**
   * Convert a floating point value to an unsigned fixed point value.
   *



For both: Reviewed-by: Brian Paul 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] mesa: set UniformBooleanTrue = 1.0f by default

2014-09-04 Thread Matt Turner
Thanks Marek,

Both are

Reviewed-by: Matt Turner 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev