Mesa (master): util/u_atomic: Remove MSVC 2008 support.

2016-02-12 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 5bc8d34526bcacc6d30d7925dab4e7c2ded3b360
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5bc8d34526bcacc6d30d7925dab4e7c2ded3b360

Author: Jose Fonseca 
Date:   Fri Feb 12 10:28:30 2016 +

util/u_atomic: Remove MSVC 2008 support.

Spotted by Emil Velikov.

Trivial.

---

 src/util/u_atomic.h | 59 -
 1 file changed, 59 deletions(-)

diff --git a/src/util/u_atomic.h b/src/util/u_atomic.h
index e38395a..8675903 100644
--- a/src/util/u_atomic.h
+++ b/src/util/u_atomic.h
@@ -88,65 +88,6 @@
 #include 
 #include 
 
-#if _MSC_VER < 1600
-
-/* Implement _InterlockedCompareExchange8 in terms of 
_InterlockedCompareExchange16 */
-static __inline char
-_InterlockedCompareExchange8(char volatile *destination8, char exchange8, char 
comparand8)
-{
-   INT_PTR destinationAddr = (INT_PTR)destination8;
-   short volatile *destination16 = (short volatile *)(destinationAddr & ~1);
-   const short shift8 = (destinationAddr & 1) * 8;
-   const short mask8 = 0xff << shift8;
-   short initial16 = *destination16;
-   char initial8 = initial16 >> shift8;
-   while (initial8 == comparand8) {
-  /* initial *destination8 matches, so try exchange it while keeping the
-   * neighboring byte untouched */
-  short exchange16 = (initial16 & ~mask8) | ((short)exchange8 << shift8);
-  short comparand16 = initial16;
-  short initial16 = _InterlockedCompareExchange16(destination16, 
exchange16, comparand16);
-  if (initial16 == comparand16) {
- /* succeeded */
- return comparand8;
-  }
-  /* something changed, retry with the new initial value */
-  initial8 = initial16 >> shift8;
-   }
-   return initial8;
-}
-
-/* Implement _InterlockedExchangeAdd16 in terms of 
_InterlockedCompareExchange16 */
-static __inline short
-_InterlockedExchangeAdd16(short volatile *addend, short value)
-{
-   short initial = *addend;
-   short comparand;
-   do {
-  short exchange = initial + value;
-  comparand = initial;
-  /* if *addend==comparand then *addend=exchange, return original *addend 
*/
-  initial = _InterlockedCompareExchange16(addend, exchange, comparand);
-   } while(initial != comparand);
-   return comparand;
-}
-
-/* Implement _InterlockedExchangeAdd8 in terms of _InterlockedCompareExchange8 
*/
-static __inline char
-_InterlockedExchangeAdd8(char volatile *addend, char value)
-{
-   char initial = *addend;
-   char comparand;
-   do {
-  char exchange = initial + value;
-  comparand = initial;
-  initial = _InterlockedCompareExchange8(addend, exchange, comparand);
-   } while(initial != comparand);
-   return comparand;
-}
-
-#endif /* _MSC_VER < 1600 */
-
 /* MSVC supports decltype keyword, but it's only supported on C++ and doesn't
  * quite work here; and if a C++-only solution is worthwhile, then it would be
  * better to use templates / function overloading, instead of decltype magic.

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: Remove support for MSVC2008.

2016-02-12 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: c69ef377c8b30ee8d4088cfc586fe4100a5f0e62
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c69ef377c8b30ee8d4088cfc586fe4100a5f0e62

Author: Jose Fonseca 
Date:   Fri Feb 12 10:29:22 2016 +

mesa: Remove support for MSVC2008.

Spotted by Emil Velikov.

Trivial.

---

 src/mesa/main/imports.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index ad7af5c..d96d666 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -83,9 +83,6 @@ typedef union { GLfloat f; GLint i; GLuint u; } fi_type;
 
 
 #if defined(_MSC_VER)
-#if _MSC_VER < 1800  /* Not req'd on VS2013 and above */
-#define strtoll(p, e, b) _strtoi64(p, e, b)
-#endif /* _MSC_VER < 1800 */
 #define strcasecmp(s1, s2) _stricmp(s1, s2)
 #endif
 /*@}*/

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: Use _aligned_malloc/free for MinGW too.

2016-02-12 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 950da38164095217fb6a06acae750eee5d336ba7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=950da38164095217fb6a06acae750eee5d336ba7

Author: Jose Fonseca 
Date:   Fri Feb 12 12:21:39 2016 +

mesa: Use _aligned_malloc/free for MinGW too.

We already use these for gallium in
src/gallium/auxiliary/os/os_memory_stdc.h and it's always better to
minimize divergences between MinGW and MSVC.

Reviewed-by: Brian Paul 

---

 src/mesa/main/imports.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 230ebbc..14cd588 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -89,7 +89,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
if (err)
   return NULL;
return mem;
-#elif defined(_WIN32) && defined(_MSC_VER)
+#elif defined(_WIN32)
return _aligned_malloc(bytes, alignment);
 #else
uintptr_t ptr, buf;
@@ -131,7 +131,7 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment)
}
 
return mem;
-#elif defined(_WIN32) && defined(_MSC_VER)
+#elif defined(_WIN32)
void *mem;
 
mem = _aligned_malloc(bytes, alignment);
@@ -178,7 +178,7 @@ _mesa_align_free(void *ptr)
 {
 #if defined(HAVE_POSIX_MEMALIGN)
free(ptr);
-#elif defined(_WIN32) && defined(_MSC_VER)
+#elif defined(_WIN32)
_aligned_free(ptr);
 #else
if (ptr) {
@@ -196,7 +196,7 @@ void *
 _mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
 unsigned long alignment)
 {
-#if defined(_WIN32) && defined(_MSC_VER)
+#if defined(_WIN32)
(void) oldSize;
return _aligned_realloc(oldBuffer, newSize, alignment);
 #else

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Make brw_clear_cache NULL out stale program pointers.

2016-02-12 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: c8b0020f2f3447780da9cf669217811bfd25d082
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c8b0020f2f3447780da9cf669217811bfd25d082

Author: Kenneth Graunke 
Date:   Thu Feb 11 19:22:32 2016 -0800

i965: Make brw_clear_cache NULL out stale program pointers.

The L3 partitioning code tries to look at all programs - both render
programs (VS/TCS/TES/GS/FS) and compute (CS).

After calling brw_clear_cache, all prog_data pointers are invalid and
point to freed data.  The intention was that flagging the dirty bits for
all programs would cause the next draw call to re-run the atoms for each
program stage, uploading new programs and installing new, valid pointers.

However, this doesn't quite work in our new multi-pipeline world.  When
drawing or dispatching a compute workload, we only consider the programs
for the appropriate pipeline: drawing sets up VS/TCS/TES/GS/FS, but not
CS, and vice versa.  This leaves pointers dangling a bit longer than
intended.

The L3 configuration code tries to inspect the prog_data for all shader
stages, so that we avoid having to reconfigure it when swapping back and
forth between render and compute workloads.  So we can't have dangling
pointers.

The fix is simple: have brw_clear_cache NULL out stale prog_data
pointers, making it safe to inspect.  The next L3 configuration pass
will see either the render shaders or compute shader as missing for
one go around, but will pick them up when both pipelines have run.

In other words, we'll simply reconfigure L3 twice, which is safe,
if a tiny bit wasteful - but then again, we just threw every compiled
shader we had on the floor and started recompiling the from scratch,
which is massively more wasteful, so it's not much of a concern.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93790
Signed-off-by: Kenneth Graunke 
Reviewed-by: Francisco Jerez 
Reviewed-by: Jordan Justen 

---

 src/mesa/drivers/dri/i965/brw_state_cache.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c 
b/src/mesa/drivers/dri/i965/brw_state_cache.c
index ce178aa..c6aa134 100644
--- a/src/mesa/drivers/dri/i965/brw_state_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
@@ -393,6 +393,21 @@ brw_clear_cache(struct brw_context *brw, struct brw_cache 
*cache)
brw->state.pipelines[BRW_RENDER_PIPELINE].brw = ~0ull;
brw->state.pipelines[BRW_COMPUTE_PIPELINE].mesa = ~0;
brw->state.pipelines[BRW_COMPUTE_PIPELINE].brw = ~0ull;
+
+   /* Also, NULL out any stale program pointers. */
+   brw->vs.prog_data = NULL;
+   brw->vs.base.prog_data = NULL;
+   brw->tcs.prog_data = NULL;
+   brw->tcs.base.prog_data = NULL;
+   brw->tes.prog_data = NULL;
+   brw->tes.base.prog_data = NULL;
+   brw->gs.prog_data = NULL;
+   brw->gs.base.prog_data = NULL;
+   brw->wm.prog_data = NULL;
+   brw->wm.base.prog_data = NULL;
+   brw->cs.prog_data = NULL;
+   brw->cs.base.prog_data = NULL;
+
intel_batchbuffer_flush(brw);
 }
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Rename optimizer debug 00 filename

2016-02-12 Thread Ben Widawsky
Module: Mesa
Branch: master
Commit: 5743fd957145040a4734b5542ee5187cfad4cf1d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5743fd957145040a4734b5542ee5187cfad4cf1d

Author: Ben Widawsky 
Date:   Thu Feb 11 10:55:48 2016 -0800

i965: Rename optimizer debug 00 filename

This allows ls, and scripts to get the file names in the correct order of
optimization.

Signed-off-by: Ben Widawsky 
Reviewed-by: Matt Turner 

---

 src/mesa/drivers/dri/i965/brw_fs.cpp   | 2 +-
 src/mesa/drivers/dri/i965/brw_vec4.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index b44eefe..80939b3 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -5084,7 +5084,7 @@ fs_visitor::optimize()
 
if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER)) {
   char filename[64];
-  snprintf(filename, 64, "%s%d-%s-00-start",
+  snprintf(filename, 64, "%s%d-%s-00-00-start",
stage_abbrev, dispatch_width, nir->info.name);
 
   backend_shader::dump_instructions(filename);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 0d8c104..807ff60 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1869,7 +1869,7 @@ vec4_visitor::run()
 
if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER)) {
   char filename[64];
-  snprintf(filename, 64, "%s-%s-00-start",
+  snprintf(filename, 64, "%s-%s-00-00-start",
stage_abbrev, nir->info.name);
 
   backend_shader::dump_instructions(filename);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): glsl: replace _strtoui64() with strtoull() for MSVC

2016-02-12 Thread Timothy Arceri
Module: Mesa
Branch: master
Commit: 4e59362d1b8846371f12252c49b87f6f7080967b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e59362d1b8846371f12252c49b87f6f7080967b

Author: Timothy Arceri 
Date:   Fri Feb 12 10:08:13 2016 +1100

glsl: replace _strtoui64() with strtoull() for MSVC

Now that MSVC 2013 is required we can remove this.

Reviewed-by: Jose Fonseca 

---

 src/compiler/glsl/glsl_lexer.ll | 4 
 1 file changed, 4 deletions(-)

diff --git a/src/compiler/glsl/glsl_lexer.ll b/src/compiler/glsl/glsl_lexer.ll
index e59f93e..9704fc7 100644
--- a/src/compiler/glsl/glsl_lexer.ll
+++ b/src/compiler/glsl/glsl_lexer.ll
@@ -113,11 +113,7 @@ literal_integer(char *text, int len, struct 
_mesa_glsl_parse_state *state,
if (base == 16)
   digits += 2;
 
-#ifdef _MSC_VER
-   unsigned __int64 value = _strtoui64(digits, NULL, base);
-#else
unsigned long long value = strtoull(digits, NULL, base);
-#endif
 
lval->n = (int)value;
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/nine: Align stack for entry points

2016-02-12 Thread Axel Davy
Module: Mesa
Branch: master
Commit: 77d6c11f8fa87ba1070028cb036807dc8a115633
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=77d6c11f8fa87ba1070028cb036807dc8a115633

Author: Axel Davy 
Date:   Sun Feb  7 12:29:45 2016 +0100

st/nine: Align stack for entry points

For 32 bits, incoming stack is 4-byte aligned.
We need to realign the stack to 16-byte at some point,
or there are issues later (crash with SSE, llvm, etc).

This patch chooses to align the stack at API entry points.

Signed-off-by: Axel Davy 

---

 src/gallium/state_trackers/nine/Makefile.sources   |   1 +
 src/gallium/state_trackers/nine/adapter9.c |  18 +-
 src/gallium/state_trackers/nine/adapter9.h |  18 +-
 .../state_trackers/nine/authenticatedchannel9.c|  10 +-
 .../state_trackers/nine/authenticatedchannel9.h|  10 +-
 src/gallium/state_trackers/nine/basetexture9.c |  14 +-
 src/gallium/state_trackers/nine/basetexture9.h |  14 +-
 src/gallium/state_trackers/nine/buffer9.c  |   4 +-
 src/gallium/state_trackers/nine/buffer9.h  |   4 +-
 src/gallium/state_trackers/nine/cryptosession9.c   |  18 +-
 src/gallium/state_trackers/nine/cryptosession9.h   |  18 +-
 src/gallium/state_trackers/nine/cubetexture9.c |  10 +-
 src/gallium/state_trackers/nine/cubetexture9.h |  10 +-
 src/gallium/state_trackers/nine/device9.c  | 232 +--
 src/gallium/state_trackers/nine/device9.h  | 232 +--
 src/gallium/state_trackers/nine/device9ex.c|  34 +-
 src/gallium/state_trackers/nine/device9ex.h|  36 +-
 src/gallium/state_trackers/nine/device9video.c |   6 +-
 src/gallium/state_trackers/nine/device9video.h |   6 +-
 src/gallium/state_trackers/nine/indexbuffer9.c |   6 +-
 src/gallium/state_trackers/nine/indexbuffer9.h |   6 +-
 src/gallium/state_trackers/nine/iunknown.c |   8 +-
 src/gallium/state_trackers/nine/iunknown.h |   9 +-
 src/gallium/state_trackers/nine/nine_flags.h   |  14 +
 src/gallium/state_trackers/nine/nine_lock.c| 444 ++---
 .../state_trackers/nine/nineexoverlayextension.c   |   2 +-
 .../state_trackers/nine/nineexoverlayextension.h   |   2 +-
 src/gallium/state_trackers/nine/pixelshader9.c |   2 +-
 src/gallium/state_trackers/nine/pixelshader9.h |   2 +-
 src/gallium/state_trackers/nine/query9.c   |   8 +-
 src/gallium/state_trackers/nine/query9.h   |   8 +-
 src/gallium/state_trackers/nine/resource9.c|  14 +-
 src/gallium/state_trackers/nine/resource9.h|  14 +-
 src/gallium/state_trackers/nine/stateblock9.c  |   4 +-
 src/gallium/state_trackers/nine/stateblock9.h  |   4 +-
 src/gallium/state_trackers/nine/surface9.c |  12 +-
 src/gallium/state_trackers/nine/surface9.h |  12 +-
 src/gallium/state_trackers/nine/swapchain9.c   |  12 +-
 src/gallium/state_trackers/nine/swapchain9.h   |  12 +-
 src/gallium/state_trackers/nine/swapchain9ex.c |   6 +-
 src/gallium/state_trackers/nine/swapchain9ex.h |   6 +-
 src/gallium/state_trackers/nine/texture9.c |  10 +-
 src/gallium/state_trackers/nine/texture9.h |  10 +-
 src/gallium/state_trackers/nine/vertexbuffer9.c|   6 +-
 src/gallium/state_trackers/nine/vertexbuffer9.h|   6 +-
 .../state_trackers/nine/vertexdeclaration9.c   |   2 +-
 .../state_trackers/nine/vertexdeclaration9.h   |   2 +-
 src/gallium/state_trackers/nine/vertexshader9.c|   2 +-
 src/gallium/state_trackers/nine/vertexshader9.h|   2 +-
 src/gallium/state_trackers/nine/volume9.c  |  14 +-
 src/gallium/state_trackers/nine/volume9.h  |  14 +-
 src/gallium/state_trackers/nine/volumetexture9.c   |  10 +-
 src/gallium/state_trackers/nine/volumetexture9.h   |  10 +-
 53 files changed, 703 insertions(+), 687 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=77d6c11f8fa87ba1070028cb036807dc8a115633
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/nine: Implement Managed vertex/index buffers

2016-02-12 Thread Axel Davy
Module: Mesa
Branch: master
Commit: cc0114f30b587a10766ec212afb3ad356099ef23
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cc0114f30b587a10766ec212afb3ad356099ef23

Author: Axel Davy 
Date:   Sat Feb  6 13:39:58 2016 +0100

st/nine: Implement Managed vertex/index buffers

We were implementing those the same way than
the default pool, which is sub-optimal.

The buffer is supposed to return pointer to
a ram copy when user locks, and automatically
update the vram copy when needed.

v2: Rename NineBuffer9_Validate to NineBuffer9_Upload
Rename validate_buffers to update_managed_buffers
Initialize NineBuffer9 managed fields after the resource
is allocated. In case of allocation failure, when the dtor
is executed, This->base.pool is then rightfully set.

Signed-off-by: Axel Davy 

---

 src/gallium/state_trackers/nine/buffer9.c| 77 
 src/gallium/state_trackers/nine/buffer9.h| 28 ++
 src/gallium/state_trackers/nine/device9.c| 11 
 src/gallium/state_trackers/nine/device9.h|  2 +
 src/gallium/state_trackers/nine/nine_state.c | 12 +
 5 files changed, 121 insertions(+), 9 deletions(-)

diff --git a/src/gallium/state_trackers/nine/buffer9.c 
b/src/gallium/state_trackers/nine/buffer9.c
index 82aa000..e066fc5 100644
--- a/src/gallium/state_trackers/nine/buffer9.c
+++ b/src/gallium/state_trackers/nine/buffer9.c
@@ -93,7 +93,26 @@ NineBuffer9_ctor( struct NineBuffer9 *This,
 
 hr = NineResource9_ctor(>base, pParams, NULL, TRUE,
 Type, Pool, Usage);
-return hr;
+
+if (FAILED(hr))
+return hr;
+
+if (Pool == D3DPOOL_MANAGED) {
+This->managed.data = align_malloc(
+nine_format_get_level_alloc_size(This->base.info.format,
+ Size, 1, 0), 32);
+if (!This->managed.data)
+return E_OUTOFMEMORY;
+memset(This->managed.data, 0, Size);
+This->managed.dirty = TRUE;
+u_box_1d(0, Size, >managed.dirty_box);
+list_inithead(>managed.list);
+list_inithead(>managed.list2);
+list_add(>managed.list, >device->update_buffers);
+list_add(>managed.list2, >device->managed_buffers);
+}
+
+return D3D_OK;
 }
 
 void
@@ -106,6 +125,15 @@ NineBuffer9_dtor( struct NineBuffer9 *This )
 FREE(This->maps);
 }
 
+if (This->base.pool == D3DPOOL_MANAGED) {
+if (This->managed.data)
+align_free(This->managed.data);
+if (This->managed.list.prev != NULL && This->managed.list.next != NULL)
+list_del(>managed.list);
+if (This->managed.list2.prev != NULL && This->managed.list2.next != 
NULL)
+list_del(>managed.list2);
+}
+
 NineResource9_dtor(>base);
 }
 
@@ -138,6 +166,28 @@ NineBuffer9_Lock( struct NineBuffer9 *This,
 D3DLOCK_READONLY |
 D3DLOCK_NOOVERWRITE)), D3DERR_INVALIDCALL);
 
+if (SizeToLock == 0) {
+SizeToLock = This->size - OffsetToLock;
+user_warn(OffsetToLock != 0);
+}
+
+u_box_1d(OffsetToLock, SizeToLock, );
+
+if (This->base.pool == D3DPOOL_MANAGED) {
+if (!This->managed.dirty) {
+assert(LIST_IS_EMPTY(>managed.list));
+list_add(>managed.list, 
>base.base.device->update_buffers);
+This->managed.dirty = TRUE;
+This->managed.dirty_box = box;
+} else {
+u_box_union_2d(>managed.dirty_box, >managed.dirty_box, 
);
+}
+*ppbData = (char *)This->managed.data + OffsetToLock;
+DBG("returning pointer %p\n", *ppbData);
+This->nmaps++;
+return D3D_OK;
+}
+
 if (This->nmaps == This->maxmaps) {
 struct pipe_transfer **newmaps =
 REALLOC(This->maps, sizeof(struct pipe_transfer *)*This->maxmaps,
@@ -149,13 +199,6 @@ NineBuffer9_Lock( struct NineBuffer9 *This,
 This->maps = newmaps;
 }
 
-if (SizeToLock == 0) {
-SizeToLock = This->size - OffsetToLock;
-user_warn(OffsetToLock != 0);
-}
-
-u_box_1d(OffsetToLock, SizeToLock, );
-
 data = This->pipe->transfer_map(This->pipe, This->base.resource, 0,
 usage, , >maps[This->nmaps]);
 
@@ -184,6 +227,22 @@ NineBuffer9_Unlock( struct NineBuffer9 *This )
 DBG("This=%p\n", This);
 
 user_assert(This->nmaps > 0, D3DERR_INVALIDCALL);
-This->pipe->transfer_unmap(This->pipe, This->maps[--(This->nmaps)]);
+if (This->base.pool != D3DPOOL_MANAGED)
+This->pipe->transfer_unmap(This->pipe, This->maps[--(This->nmaps)]);
+else
+This->nmaps--;
 return D3D_OK;
 }
+
+void
+NineBuffer9_SetDirty( struct NineBuffer9 *This )
+{
+assert(This->base.pool == D3DPOOL_MANAGED);
+
+if (!This->managed.dirty) {
+assert(LIST_IS_EMPTY(>managed.list));
+list_add(>managed.list, >base.base.device->update_buffers);
+  

Mesa (master): st/nine: SCRATCH does support all formats

2016-02-12 Thread Axel Davy
Module: Mesa
Branch: master
Commit: 6cba347530433c61b218d2b897fb57f33835b37b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6cba347530433c61b218d2b897fb57f33835b37b

Author: Axel Davy 
Date:   Tue Jan 26 18:27:39 2016 +0100

st/nine: SCRATCH does support all formats

Add new argument to d3d9_to_pipe_format_checked to
be able to bypass format support checks. This argument
is set to TRUE when the requested Pool is SCRATCH.

Signed-off-by: Axel Davy 
Reviewed-by: Patrick Rudolph 

---

 src/gallium/state_trackers/nine/adapter9.c   | 21 +++--
 src/gallium/state_trackers/nine/cubetexture9.c   |  4 +++-
 src/gallium/state_trackers/nine/device9.c|  2 +-
 src/gallium/state_trackers/nine/nine_pipe.h  |  8 ++--
 src/gallium/state_trackers/nine/surface9.c   |  3 ++-
 src/gallium/state_trackers/nine/swapchain9.c |  8 
 src/gallium/state_trackers/nine/texture9.c   |  4 +++-
 src/gallium/state_trackers/nine/volume9.c|  3 ++-
 src/gallium/state_trackers/nine/volumetexture9.c |  4 +++-
 9 files changed, 35 insertions(+), 22 deletions(-)

diff --git a/src/gallium/state_trackers/nine/adapter9.c 
b/src/gallium/state_trackers/nine/adapter9.c
index 5e9c7f7..e677c7b 100644
--- a/src/gallium/state_trackers/nine/adapter9.c
+++ b/src/gallium/state_trackers/nine/adapter9.c
@@ -207,11 +207,11 @@ NineAdapter9_CheckDeviceType( struct NineAdapter9 *This,
 dfmt = d3d9_to_pipe_format_checked(screen, AdapterFormat, PIPE_TEXTURE_2D,
1,
PIPE_BIND_DISPLAY_TARGET |
-   PIPE_BIND_SHARED, FALSE);
+   PIPE_BIND_SHARED, FALSE, FALSE);
 bfmt = d3d9_to_pipe_format_checked(screen, BackBufferFormat, 
PIPE_TEXTURE_2D,
1,
PIPE_BIND_DISPLAY_TARGET |
-   PIPE_BIND_SHARED, FALSE);
+   PIPE_BIND_SHARED, FALSE, FALSE);
 if (dfmt == PIPE_FORMAT_NONE || bfmt == PIPE_FORMAT_NONE) {
 DBG("Unsupported Adapter/BackBufferFormat.\n");
 return D3DERR_NOTAVAILABLE;
@@ -270,7 +270,7 @@ NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
 return hr;
 pf = d3d9_to_pipe_format_checked(screen, AdapterFormat, PIPE_TEXTURE_2D, 0,
  PIPE_BIND_DISPLAY_TARGET |
- PIPE_BIND_SHARED, FALSE);
+ PIPE_BIND_SHARED, FALSE, FALSE);
 if (pf == PIPE_FORMAT_NONE) {
 DBG("AdapterFormat %s not available.\n",
 d3dformat_to_string(AdapterFormat));
@@ -332,7 +332,8 @@ NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
 
 
 srgb = (Usage & (D3DUSAGE_QUERY_SRGBREAD | D3DUSAGE_QUERY_SRGBWRITE)) != 0;
-pf = d3d9_to_pipe_format_checked(screen, CheckFormat, target, 0, bind, 
srgb);
+pf = d3d9_to_pipe_format_checked(screen, CheckFormat, target,
+ 0, bind, srgb, FALSE);
 if (pf == PIPE_FORMAT_NONE) {
 DBG("NOT AVAILABLE\n");
 return D3DERR_NOTAVAILABLE;
@@ -379,7 +380,7 @@ NineAdapter9_CheckDeviceMultiSampleType( struct 
NineAdapter9 *This,
PIPE_BIND_TRANSFER_WRITE | PIPE_BIND_RENDER_TARGET;
 
 pf = d3d9_to_pipe_format_checked(screen, SurfaceFormat, PIPE_TEXTURE_2D,
- MultiSampleType, bind, FALSE);
+ MultiSampleType, bind, FALSE, FALSE);
 
 if (pf == PIPE_FORMAT_NONE) {
 DBG("%s with %u samples not available.\n",
@@ -418,16 +419,16 @@ NineAdapter9_CheckDepthStencilMatch( struct NineAdapter9 
*This,
 
 dfmt = d3d9_to_pipe_format_checked(screen, AdapterFormat, PIPE_TEXTURE_2D, 
0,
PIPE_BIND_DISPLAY_TARGET |
-   PIPE_BIND_SHARED, FALSE);
+   PIPE_BIND_SHARED, FALSE, FALSE);
 bfmt = d3d9_to_pipe_format_checked(screen, RenderTargetFormat,
PIPE_TEXTURE_2D, 0,
-   PIPE_BIND_RENDER_TARGET, FALSE);
+   PIPE_BIND_RENDER_TARGET, FALSE, FALSE);
 if (RenderTargetFormat == D3DFMT_NULL)
 bfmt = dfmt;
 zsfmt = d3d9_to_pipe_format_checked(screen, DepthStencilFormat,
 PIPE_TEXTURE_2D, 0,
 
d3d9_get_pipe_depth_format_bindings(DepthStencilFormat),
-FALSE);
+FALSE, FALSE);
 if (dfmt == PIPE_FORMAT_NONE ||
 bfmt == PIPE_FORMAT_NONE ||
 zsfmt == PIPE_FORMAT_NONE) {
@@ -462,10 +463,10 @@ 

Mesa (master): st/nine: Clean pSharedHandle Texture ctors checks

2016-02-12 Thread Axel Davy
Module: Mesa
Branch: master
Commit: 6c4774bbe4f259cf7af329ce6493d9b50310689f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6c4774bbe4f259cf7af329ce6493d9b50310689f

Author: Axel Davy 
Date:   Tue Jan 26 18:00:30 2016 +0100

st/nine: Clean pSharedHandle Texture ctors checks

Clarify the behaviour and clean the checks

Signed-off-by: Axel Davy 
Reviewed-by: Patrick Rudolph 

---

 src/gallium/state_trackers/nine/cubetexture9.c   |  7 ---
 src/gallium/state_trackers/nine/texture9.c   | 25 
 src/gallium/state_trackers/nine/volumetexture9.c |  7 ---
 3 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/src/gallium/state_trackers/nine/cubetexture9.c 
b/src/gallium/state_trackers/nine/cubetexture9.c
index c6fa397..1749190 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -54,12 +54,13 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
 Format, Pool, pSharedHandle);
 
 user_assert(EdgeLength, D3DERR_INVALIDCALL);
-user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
-user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) ||
-(Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), 
D3DERR_INVALIDCALL);
 
+/* user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, 
D3DERR_INVALIDCALL); */
 user_assert(!pSharedHandle, D3DERR_INVALIDCALL); /* TODO */
 
+user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) ||
+(Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), 
D3DERR_INVALIDCALL);
+
 if (Usage & D3DUSAGE_AUTOGENMIPMAP)
 Levels = 0;
 
diff --git a/src/gallium/state_trackers/nine/texture9.c 
b/src/gallium/state_trackers/nine/texture9.c
index 7338215..3052937 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -61,18 +61,22 @@ NineTexture9_ctor( struct NineTexture9 *This,
 d3dformat_to_string(Format), nine_D3DPOOL_to_str(Pool), pSharedHandle);
 
 user_assert(Width && Height, D3DERR_INVALIDCALL);
+
+/* pSharedHandle: can be non-null for ex only.
+ * D3DPOOL_SYSTEMMEM: Levels must be 1
+ * D3DPOOL_DEFAULT: no restriction for Levels
+ * Other Pools are forbidden. */
 user_assert(!pSharedHandle || pParams->device->ex, D3DERR_INVALIDCALL);
-/* When is used shared handle, Pool must be
- * SYSTEMMEM with Levels 1 or DEFAULT with any Levels */
-user_assert(!pSharedHandle || Pool != D3DPOOL_SYSTEMMEM || Levels == 1,
-D3DERR_INVALIDCALL);
-user_assert(!pSharedHandle || Pool == D3DPOOL_SYSTEMMEM || Pool == 
D3DPOOL_DEFAULT,
-D3DERR_INVALIDCALL);
-user_assert((Usage != D3DUSAGE_AUTOGENMIPMAP || Levels <= 1), 
D3DERR_INVALIDCALL);
+user_assert(!pSharedHandle ||
+(Pool == D3DPOOL_SYSTEMMEM && Levels == 1) ||
+Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
+
 user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) ||
-(Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), 
D3DERR_INVALIDCALL);
+(Pool != D3DPOOL_SYSTEMMEM && Pool != D3DPOOL_SCRATCH && 
Levels <= 1),
+D3DERR_INVALIDCALL);
 
-/* TODO: implement buffer sharing (should work with cross process too)
+/* TODO: implement pSharedHandle for D3DPOOL_DEFAULT (cross process
+ * buffer sharing).
  *
  * Gem names may have fit but they're depreciated and won't work on 
render-nodes.
  * One solution is to use shm buffers. We would use a /dev/shm file, fill 
the first
@@ -85,9 +89,6 @@ NineTexture9_ctor( struct NineTexture9 *This,
  * invalid handle, that we would fail to import. Please note that we don't 
advertise
  * the flag indicating the support for that feature, but apps seem to not 
care.
  */
-user_assert(!pSharedHandle ||
-Pool == D3DPOOL_SYSTEMMEM ||
-Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
 
 if (pSharedHandle && Pool == D3DPOOL_DEFAULT) {
 if (!*pSharedHandle) {
diff --git a/src/gallium/state_trackers/nine/volumetexture9.c 
b/src/gallium/state_trackers/nine/volumetexture9.c
index cdfe7f2..cdec21f 100644
--- a/src/gallium/state_trackers/nine/volumetexture9.c
+++ b/src/gallium/state_trackers/nine/volumetexture9.c
@@ -49,14 +49,15 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This,
 Usage, Format, Pool, pSharedHandle);
 
 user_assert(Width && Height && Depth, D3DERR_INVALIDCALL);
-user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
+
+/* user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, 
D3DERR_INVALIDCALL); */
+user_assert(!pSharedHandle, D3DERR_INVALIDCALL); /* TODO */
+
 /* An IDirect3DVolume9 cannot be bound as a render target can it ? */
 user_assert(!(Usage & (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)),
 D3DERR_INVALIDCALL);
 

Mesa (master): st/nine: Drop path for ureg_NRM and ureg_CLAMP

2016-02-12 Thread Axel Davy
Module: Mesa
Branch: master
Commit: d7a5468da9796af193e65cd5823525b97dfed2df
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d7a5468da9796af193e65cd5823525b97dfed2df

Author: Axel Davy 
Date:   Sat Feb  6 20:03:51 2016 +0100

st/nine: Drop path for ureg_NRM and ureg_CLAMP

using MIN/MAX is fine instead of CLAMP.
NRM doesn't exist anymore.

Signed-off-by: Axel Davy 
Reviewed-by: Patrick Rudolph 

---

 src/gallium/state_trackers/nine/nine_ff.c | 28 
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_ff.c 
b/src/gallium/state_trackers/nine/nine_ff.c
index e79d0b4..d5daabd 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -24,8 +24,6 @@
 #include "util/u_hash_table.h"
 #include "util/u_upload_mgr.h"
 
-#define NINE_TGSI_LAZY_DEVS 1
-
 #define DBG_CHANNEL DBG_FF
 
 #define NINE_FF_NUM_VS_CONST 256
@@ -319,15 +317,11 @@ ureg_normalize3(struct ureg_program *ureg,
 struct ureg_dst dst, struct ureg_src src,
 struct ureg_dst tmp)
 {
-#ifdef NINE_TGSI_LAZY_DEVS
 struct ureg_dst tmp_x = ureg_writemask(tmp, TGSI_WRITEMASK_X);
 
 ureg_DP3(ureg, tmp_x, src, src);
 ureg_RSQ(ureg, tmp_x, _X(tmp));
 ureg_MUL(ureg, dst, src, _X(tmp));
-#else
-ureg_NRM(ureg, dst, src);
-#endif
 }
 
 static void *
@@ -549,15 +543,8 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
  */
 if (key->vertexpointsize) {
 struct ureg_src cPsz1 = ureg_DECL_constant(ureg, 26);
-#ifdef NINE_TGSI_LAZY_DEVS
-struct ureg_dst tmp_clamp = ureg_DECL_temporary(ureg);
-
-ureg_MAX(ureg, tmp_clamp, vs->aPsz, _(cPsz1));
-ureg_MIN(ureg, oPsz, ureg_src(tmp_clamp), _(cPsz1));
-ureg_release_temporary(ureg, tmp_clamp);
-#else
-ureg_CLAMP(ureg, oPsz, vs->aPsz, _(cPsz1), _(cPsz1));
-#endif
+ureg_MAX(ureg, tmp_x, _(vs->aPsz), _(cPsz1));
+ureg_MIN(ureg, oPsz, _X(tmp), _(cPsz1));
 } else if (key->pointscale) {
 struct ureg_src cPsz1 = ureg_DECL_constant(ureg, 26);
 struct ureg_src cPsz2 = ureg_DECL_constant(ureg, 27);
@@ -570,15 +557,8 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
 ureg_MAD(ureg, tmp_x, _Y(tmp), _X(tmp), _(cPsz1));
 ureg_RCP(ureg, tmp_x, ureg_src(tmp));
 ureg_MUL(ureg, tmp_x, ureg_src(tmp), _(cPsz1));
-#ifdef NINE_TGSI_LAZY_DEVS
-struct ureg_dst tmp_clamp = ureg_DECL_temporary(ureg);
-
-ureg_MAX(ureg, tmp_clamp, _X(tmp), _(cPsz1));
-ureg_MIN(ureg, oPsz, ureg_src(tmp_clamp), _(cPsz1));
-ureg_release_temporary(ureg, tmp_clamp);
-#else
-ureg_CLAMP(ureg, oPsz, _X(tmp), _(cPsz1), _(cPsz1));
-#endif
+ureg_MAX(ureg, tmp_x, _X(tmp), _(cPsz1));
+ureg_MIN(ureg, oPsz, _X(tmp), _(cPsz1));
 }
 
 for (i = 0; i < 8; ++i) {

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/nine: Remove usage of SQRT in ff code

2016-02-12 Thread Axel Davy
Module: Mesa
Branch: master
Commit: 6b43f5b1d4efca53f246296f98db00ff8f7544b6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b43f5b1d4efca53f246296f98db00ff8f7544b6

Author: Axel Davy 
Date:   Sat Feb  6 19:55:54 2016 +0100

st/nine: Remove usage of SQRT in ff code

SQRT is not supported everywhere, so replace
it by RSQ + MUL and handle case <= 0.

Signed-off-by: Axel Davy 

---

 src/gallium/state_trackers/nine/nine_ff.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/nine_ff.c 
b/src/gallium/state_trackers/nine/nine_ff.c
index a5466a7..e79d0b4 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -563,7 +563,9 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
 struct ureg_src cPsz2 = ureg_DECL_constant(ureg, 27);
 
 ureg_DP3(ureg, tmp_x, ureg_src(r[1]), ureg_src(r[1]));
-ureg_SQRT(ureg, tmp_y, _X(tmp));
+ureg_RSQ(ureg, tmp_y, _X(tmp));
+ureg_MUL(ureg, tmp_y, _Y(tmp), _X(tmp));
+ureg_CMP(ureg, tmp_y, ureg_negate(_Y(tmp)), _Y(tmp), ureg_imm1f(ureg, 
0.0f));
 ureg_MAD(ureg, tmp_x, _Y(tmp), _(cPsz2), _(cPsz2));
 ureg_MAD(ureg, tmp_x, _Y(tmp), _X(tmp), _(cPsz1));
 ureg_RCP(ureg, tmp_x, ureg_src(tmp));

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/nine: Move texture creation checks

2016-02-12 Thread Axel Davy
Module: Mesa
Branch: master
Commit: bb65b189f34fb497b69e1b267cb355a6829d4b6b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb65b189f34fb497b69e1b267cb355a6829d4b6b

Author: Axel Davy 
Date:   Tue Jan 26 17:32:22 2016 +0100

st/nine: Move texture creation checks

We were having checks at both Create*Texture functions
and in ctors.

Move all Create*Texture checks to ctors.

Signed-off-by: Axel Davy 
Reviewed-by: Patrick Rudolph 

---

 src/gallium/state_trackers/nine/cubetexture9.c   |  2 ++
 src/gallium/state_trackers/nine/device9.c| 13 -
 src/gallium/state_trackers/nine/texture9.c   |  9 +
 src/gallium/state_trackers/nine/volumetexture9.c |  2 ++
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/gallium/state_trackers/nine/cubetexture9.c 
b/src/gallium/state_trackers/nine/cubetexture9.c
index 460cc85..c6fa397 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -53,6 +53,8 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
 This, pParams, EdgeLength, Levels, Usage,
 Format, Pool, pSharedHandle);
 
+user_assert(EdgeLength, D3DERR_INVALIDCALL);
+user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
 user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) ||
 (Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), 
D3DERR_INVALIDCALL);
 
diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 475ef96..b6e75b4 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -925,15 +925,6 @@ NineDevice9_CreateTexture( struct NineDevice9 *This,
  D3DUSAGE_SOFTWAREPROCESSING | D3DUSAGE_TEXTAPI;
 
 *ppTexture = NULL;
-user_assert(Width && Height, D3DERR_INVALIDCALL);
-user_assert(!pSharedHandle || This->ex, D3DERR_INVALIDCALL);
-/* When is used shared handle, Pool must be
- * SYSTEMMEM with Levels 1 or DEFAULT with any Levels */
-user_assert(!pSharedHandle || Pool != D3DPOOL_SYSTEMMEM || Levels == 1,
-D3DERR_INVALIDCALL);
-user_assert(!pSharedHandle || Pool == D3DPOOL_SYSTEMMEM || Pool == 
D3DPOOL_DEFAULT,
-D3DERR_INVALIDCALL);
-user_assert((Usage != D3DUSAGE_AUTOGENMIPMAP || Levels <= 1), 
D3DERR_INVALIDCALL);
 
 hr = NineTexture9_new(This, Width, Height, Levels, Usage, Format, Pool,
   , pSharedHandle);
@@ -967,8 +958,6 @@ NineDevice9_CreateVolumeTexture( struct NineDevice9 *This,
  D3DUSAGE_SOFTWAREPROCESSING;
 
 *ppVolumeTexture = NULL;
-user_assert(Width && Height && Depth, D3DERR_INVALIDCALL);
-user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
 
 hr = NineVolumeTexture9_new(This, Width, Height, Depth, Levels,
 Usage, Format, Pool, , pSharedHandle);
@@ -1001,8 +990,6 @@ NineDevice9_CreateCubeTexture( struct NineDevice9 *This,
  D3DUSAGE_SOFTWAREPROCESSING;
 
 *ppCubeTexture = NULL;
-user_assert(EdgeLength, D3DERR_INVALIDCALL);
-user_assert(!pSharedHandle || Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
 
 hr = NineCubeTexture9_new(This, EdgeLength, Levels, Usage, Format, Pool,
   , pSharedHandle);
diff --git a/src/gallium/state_trackers/nine/texture9.c 
b/src/gallium/state_trackers/nine/texture9.c
index 0bc37d3..7338215 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -60,6 +60,15 @@ NineTexture9_ctor( struct NineTexture9 *This,
 nine_D3DUSAGE_to_str(Usage),
 d3dformat_to_string(Format), nine_D3DPOOL_to_str(Pool), pSharedHandle);
 
+user_assert(Width && Height, D3DERR_INVALIDCALL);
+user_assert(!pSharedHandle || pParams->device->ex, D3DERR_INVALIDCALL);
+/* When is used shared handle, Pool must be
+ * SYSTEMMEM with Levels 1 or DEFAULT with any Levels */
+user_assert(!pSharedHandle || Pool != D3DPOOL_SYSTEMMEM || Levels == 1,
+D3DERR_INVALIDCALL);
+user_assert(!pSharedHandle || Pool == D3DPOOL_SYSTEMMEM || Pool == 
D3DPOOL_DEFAULT,
+D3DERR_INVALIDCALL);
+user_assert((Usage != D3DUSAGE_AUTOGENMIPMAP || Levels <= 1), 
D3DERR_INVALIDCALL);
 user_assert(!(Usage & D3DUSAGE_AUTOGENMIPMAP) ||
 (Pool != D3DPOOL_SYSTEMMEM && Levels <= 1), 
D3DERR_INVALIDCALL);
 
diff --git a/src/gallium/state_trackers/nine/volumetexture9.c 
b/src/gallium/state_trackers/nine/volumetexture9.c
index e5b2b53..cdfe7f2 100644
--- a/src/gallium/state_trackers/nine/volumetexture9.c
+++ b/src/gallium/state_trackers/nine/volumetexture9.c
@@ -48,6 +48,8 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This,
 This, pParams, Width, Height, Depth, Levels,
 Usage, Format, Pool, pSharedHandle);
 
+

Mesa (master): mesa/clear: update ClearBufferuiv error handling for GL 4.5 spec

2016-02-12 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 3a0051bea998dc26feed9ed1468714b89de417c3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a0051bea998dc26feed9ed1468714b89de417c3

Author: Ilia Mirkin 
Date:   Fri Feb 12 12:56:10 2016 -0500

mesa/clear: update ClearBufferuiv error handling for GL 4.5 spec

This fixes

dEQP-GLES31.functional.debug.negative_coverage.get_error.buffer.clear_bufferuiv

and brings the logic up to spec with GL 4.5

Signed-off-by: Ilia Mirkin 
Reviewed-by: Brian Paul 

---

 src/mesa/main/clear.c | 29 +
 1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index 568f600..9dbac3e 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -445,32 +445,13 @@ _mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, 
const GLuint *value)
  }
   }
   break;
-   case GL_DEPTH:
-   case GL_STENCIL:
-  /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
-   *
-   * "The result of ClearBuffer is undefined if no conversion between
-   * the type of the specified value and the type of the buffer being
-   * cleared is defined (for example, if ClearBufferiv is called for a
-   * fixed- or floating-point buffer, or if ClearBufferfv is called
-   * for a signed or unsigned integer buffer). This is not an error."
-   *
-   * In this case we take "undefined" and "not an error" to mean "ignore."
-   * Even though we could do something sensible for GL_STENCIL, page 263
-   * (page 279 of the PDF) says:
-   *
-   * "Only ClearBufferiv should be used to clear stencil buffers."
+   default:
+  /* Page 498 of the PDF, section '17.4.3.1 Clearing Individual Buffers'
+   * of the OpenGL 4.5 spec states:
*
-   * Note that we still need to generate an error for the invalid
-   * drawbuffer case (see the GL_STENCIL case in _mesa_ClearBufferiv).
+   *"An INVALID_ENUM error is generated by ClearBufferuiv and
+   * ClearNamedFramebufferuiv if buffer is not COLOR."
*/
-  if (drawbuffer != 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferuiv(drawbuffer=%d)",
- drawbuffer);
- return;
-  }
-  return;
-   default:
   _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferuiv(buffer=%s)",
   _mesa_enum_to_string(buffer));
   return;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa/clear: remove dead code handling ClearBufferiv( GL_DEPTH)

2016-02-12 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 86fd9d6b8e70cdad2755c320e059321fd8c050a1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=86fd9d6b8e70cdad2755c320e059321fd8c050a1

Author: Ilia Mirkin 
Date:   Fri Feb 12 12:50:50 2016 -0500

mesa/clear: remove dead code handling ClearBufferiv(GL_DEPTH)

There's a hunk above which sets INVALID_ENUM for GL_DEPTH
unconditionally.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Brian Paul 

---

 src/mesa/main/clear.c | 19 ---
 1 file changed, 19 deletions(-)

diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index 3bfcc5c..5c40a03 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -386,25 +386,6 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const 
GLint *value)
  }
   }
   break;
-   case GL_DEPTH:
-  /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
-   *
-   * "The result of ClearBuffer is undefined if no conversion between
-   * the type of the specified value and the type of the buffer being
-   * cleared is defined (for example, if ClearBufferiv is called for a
-   * fixed- or floating-point buffer, or if ClearBufferfv is called
-   * for a signed or unsigned integer buffer). This is not an error."
-   *
-   * In this case we take "undefined" and "not an error" to mean "ignore."
-   * Note that we still need to generate an error for the invalid
-   * drawbuffer case (see the GL_STENCIL case above).
-   */
-  if (drawbuffer != 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferiv(drawbuffer=%d)",
- drawbuffer);
- return;
-  }
-  return;
default:
   _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferiv(buffer=%s)",
   _mesa_enum_to_string(buffer));

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa/clear: update ClearBufferfv error handling for GL 4.5 spec

2016-02-12 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: a663aa2a3793eaaead9332cdb315c31389254276
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a663aa2a3793eaaead9332cdb315c31389254276

Author: Ilia Mirkin 
Date:   Fri Feb 12 12:59:25 2016 -0500

mesa/clear: update ClearBufferfv error handling for GL 4.5 spec

This fixes

dEQP-GLES31.functional.debug.negative_coverage.get_error.buffer.clear_bufferfv

and brings the logic up to spec with GL 4.5

Signed-off-by: Ilia Mirkin 
Reviewed-by: Brian Paul 

---

 src/mesa/main/clear.c | 23 +--
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index 9dbac3e..92f69ab 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -543,26 +543,13 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, 
const GLfloat *value)
  }
   }
   break;
-   case GL_STENCIL:
-  /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
-   *
-   * "The result of ClearBuffer is undefined if no conversion between
-   * the type of the specified value and the type of the buffer being
-   * cleared is defined (for example, if ClearBufferiv is called for a
-   * fixed- or floating-point buffer, or if ClearBufferfv is called
-   * for a signed or unsigned integer buffer). This is not an error."
+   default:
+  /* Page 498 of the PDF, section '17.4.3.1 Clearing Individual Buffers'
+   * of the OpenGL 4.5 spec states:
*
-   * In this case we take "undefined" and "not an error" to mean "ignore."
-   * Note that we still need to generate an error for the invalid
-   * drawbuffer case (see the GL_DEPTH case above).
+   *"An INVALID_ENUM error is generated by ClearBufferfv and
+   * ClearNamedFramebufferfv if buffer is not COLOR or DEPTH."
*/
-  if (drawbuffer != 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferfv(drawbuffer=%d)",
- drawbuffer);
- return;
-  }
-  return;
-   default:
   _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferfv(buffer=%s)",
   _mesa_enum_to_string(buffer));
   return;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: reset offset/size to 0 when removing atomic binding

2016-02-12 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: f82ff6207ca98c153d5dc24319f86146d55ae230
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f82ff6207ca98c153d5dc24319f86146d55ae230

Author: Ilia Mirkin 
Date:   Fri Feb 12 13:49:08 2016 -0500

mesa: reset offset/size to 0 when removing atomic binding

Similar to commit dd9d2963d6 (mesa: AtomicBufferBindings should be
initialized to zero.), we should reset these to zero when unbinding.
This fixes a number of dEQP failures due to cross-test pollution. The
tests properly unbound everything, but when querying the values again,
the expectation was that they would be 0.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Brian Paul 
Reviewed-by: Francisco Jerez 

---

 src/mesa/main/bufferobj.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index de1aba4..9aec425 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -3007,8 +3007,8 @@ set_atomic_buffer_binding(struct gl_context *ctx,
_mesa_reference_buffer_object(ctx, >BufferObject, bufObj);
 
if (bufObj == ctx->Shared->NullBufferObj) {
-  binding->Offset = -1;
-  binding->Size = -1;
+  binding->Offset = 0;
+  binding->Size = 0;
} else {
   binding->Offset = offset;
   binding->Size = size;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: allow DEPTH_STENCIL_TEXTURE_MODE queries in GLES 3.1 contexts

2016-02-12 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: d33ef194799721b91305e9f764cfe44ba359a638
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d33ef194799721b91305e9f764cfe44ba359a638

Author: Ilia Mirkin 
Date:   Thu Feb 11 15:21:02 2016 -0500

mesa: allow DEPTH_STENCIL_TEXTURE_MODE queries in GLES 3.1 contexts

This fixes

dEQP-GLES31.functional.state_query.texture.texture_2d_multisample.depth_stencil_mode_integer

and a few related tests.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Nanley Chery 

---

 src/mesa/main/texparam.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 00cea3e..614c1ee 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -500,9 +500,7 @@ set_tex_parameteri(struct gl_context *ctx,
   goto invalid_pname;
 
case GL_DEPTH_STENCIL_TEXTURE_MODE:
-  if ((_mesa_is_desktop_gl(ctx) &&
-   ctx->Extensions.ARB_stencil_texturing) ||
-  _mesa_is_gles31(ctx)) {
+  if (_mesa_has_ARB_stencil_texturing(ctx) || _mesa_is_gles31(ctx)) {
  bool stencil = params[0] == GL_STENCIL_INDEX;
  if (!stencil && params[0] != GL_DEPTH_COMPONENT)
 goto invalid_param;
@@ -1819,7 +1817,7 @@ get_tex_parameterfv(struct gl_context *ctx,
  *params = (GLfloat) obj->DepthMode;
  break;
   case GL_DEPTH_STENCIL_TEXTURE_MODE:
- if (!_mesa_is_desktop_gl(ctx) || 
!ctx->Extensions.ARB_stencil_texturing)
+ if (!_mesa_has_ARB_stencil_texturing(ctx) && !_mesa_is_gles31(ctx))
 goto invalid_pname;
  *params = (GLfloat)
 (obj->StencilSampling ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT);
@@ -2054,7 +2052,7 @@ get_tex_parameteriv(struct gl_context *ctx,
  *params = (GLint) obj->DepthMode;
  break;
   case GL_DEPTH_STENCIL_TEXTURE_MODE:
- if (!_mesa_is_desktop_gl(ctx) || 
!ctx->Extensions.ARB_stencil_texturing)
+ if (!_mesa_has_ARB_stencil_texturing(ctx) && !_mesa_is_gles31(ctx))
 goto invalid_pname;
  *params = (GLint)
 (obj->StencilSampling ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: move _mesa_num_tex_faces() to teximage.h

2016-02-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 9675fb6c681bf3441ee1d25e18b38faea5144524
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9675fb6c681bf3441ee1d25e18b38faea5144524

Author: Brian Paul 
Date:   Thu Feb 11 08:16:30 2016 -0700

mesa: move _mesa_num_tex_faces() to teximage.h

So it's near the other cube map helper functions.

Reviewed-by: Roland Scheidegger 
Reviewed-by: Timothy Arceri 

---

 src/mesa/main/teximage.h | 19 +++
 src/mesa/main/texobj.h   | 19 ---
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index 7754a97..a7e54f7 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -49,6 +49,25 @@ _mesa_is_cube_face(GLenum target)
 
 
 /**
+ * Return number of faces for a texture target.  This will be 6 for
+ * cube maps and 1 otherwise.
+ * NOTE: this function is not used for cube map arrays which operate
+ * more like 2D arrays than cube maps.
+ */
+static inline GLuint
+_mesa_num_tex_faces(GLenum target)
+{
+   switch (target) {
+   case GL_TEXTURE_CUBE_MAP:
+   case GL_PROXY_TEXTURE_CUBE_MAP:
+  return 6;
+   default:
+  return 1;
+   }
+}
+
+
+/**
  * If the target is GL_TEXTURE_CUBE_MAP, return one of the
  * GL_TEXTURE_CUBE_MAP_POSITIVE/NEGATIVE_X/Y/Z targets corresponding to
  * the face parameter.
diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h
index 8421337..378d87a 100644
--- a/src/mesa/main/texobj.h
+++ b/src/mesa/main/texobj.h
@@ -120,25 +120,6 @@ _mesa_unlock_texture(struct gl_context *ctx, struct 
gl_texture_object *texObj)
 }
 
 
-/**
- * Return number of faces for a texture target.  This will be 6 for
- * cube maps (and cube map arrays) and 1 otherwise.
- * NOTE: this function is not used for cube map arrays which operate
- * more like 2D arrays than cube maps.
- */
-static inline GLuint
-_mesa_num_tex_faces(GLenum target)
-{
-   switch (target) {
-   case GL_TEXTURE_CUBE_MAP:
-   case GL_PROXY_TEXTURE_CUBE_MAP:
-  return 6;
-   default:
-  return 1;
-   }
-}
-
-
 /** Is the texture "complete" with respect to the given sampler state? */
 static inline GLboolean
 _mesa_is_texture_complete(const struct gl_texture_object *texObj,

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): docs: Visual Studio 2013 or later is now required

2016-02-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: ae70d0d68c06c3624fef345f70f9576b29a243bd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ae70d0d68c06c3624fef345f70f9576b29a243bd

Author: Brian Paul 
Date:   Thu Feb 11 07:29:22 2016 -0700

docs: Visual Studio 2013 or later is now required

---

 docs/install.html | 3 +++
 docs/relnotes/11.2.0.html | 4 
 2 files changed, 7 insertions(+)

diff --git a/docs/install.html b/docs/install.html
index c826d64..ae911d5 100644
--- a/docs/install.html
+++ b/docs/install.html
@@ -58,6 +58,9 @@ On Windows with MinGW, install flex and bison with:
 For MSVC on Windows, install
 http://winflexbison.sourceforge.net/;>Win flex-bison.
 
+
+For building on Windows, Microsoft Visual Studio 2013 or later is required.
+
 
 
 
diff --git a/docs/relnotes/11.2.0.html b/docs/relnotes/11.2.0.html
index 069eca2..baedb4c 100644
--- a/docs/relnotes/11.2.0.html
+++ b/docs/relnotes/11.2.0.html
@@ -74,6 +74,10 @@ TBD.
 
 Changes
 
+Microsoft Visual Studio 2013 or later is now required for building
+on Windows.
+Previously, Visual Studio 2008 and later were supported.
+
 TBD.
 
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: add _mesa_cube_face_target() helper

2016-02-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 82db969ac014531dcaba4e4637d6c691f5825e4b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=82db969ac014531dcaba4e4637d6c691f5825e4b

Author: Brian Paul 
Date:   Thu Feb 11 07:54:42 2016 -0700

mesa: add _mesa_cube_face_target() helper

Reviewed-by: Roland Scheidegger 
Reviewed-by: Timothy Arceri 

---

 src/mesa/main/teximage.h | 17 +
 1 file changed, 17 insertions(+)

diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index da02214..7754a97 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -49,6 +49,23 @@ _mesa_is_cube_face(GLenum target)
 
 
 /**
+ * If the target is GL_TEXTURE_CUBE_MAP, return one of the
+ * GL_TEXTURE_CUBE_MAP_POSITIVE/NEGATIVE_X/Y/Z targets corresponding to
+ * the face parameter.
+ * Else, return target as-is.
+ */
+static inline GLenum
+_mesa_cube_face_target(GLenum target, unsigned face)
+{
+   assert(face < 6);
+   if (target == GL_TEXTURE_CUBE_MAP)
+  return GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;
+   else
+  return target;
+}
+
+
+/**
  * For cube map faces, return a face index in [0,5].
  * For other targets return 0;
  */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: remove _ARB suffix from cube map enums

2016-02-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 6a08673c5eb4d55522888c3c2fd6af6946ce1264
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a08673c5eb4d55522888c3c2fd6af6946ce1264

Author: Brian Paul 
Date:   Thu Feb 11 07:45:50 2016 -0700

mesa: remove _ARB suffix from cube map enums

Just minor clean-up so we're consistent everywhere.

Reviewed-by: Roland Scheidegger 
Reviewed-by: Timothy Arceri 

---

 src/mesa/main/attrib.c  |  4 ++--
 src/mesa/main/enable.c  |  4 ++--
 src/mesa/main/genmipmap.c   |  2 +-
 src/mesa/main/get.c |  2 +-
 src/mesa/main/mipmap.c  | 14 +++---
 src/mesa/main/texgetimage.c | 14 +++---
 src/mesa/main/teximage.c| 34 +-
 src/mesa/main/teximage.h|  4 ++--
 src/mesa/main/texobj.c  | 26 +-
 src/mesa/main/texparam.c| 14 +++---
 src/mesa/main/texstate.c|  2 +-
 11 files changed, 60 insertions(+), 60 deletions(-)

diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 08f1317..61f7036 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -766,7 +766,7 @@ pop_texture_group(struct gl_context *ctx, struct 
texture_state *texstate)
   _mesa_set_enable(ctx, GL_TEXTURE_2D, !!(unit->Enabled & TEXTURE_2D_BIT));
   _mesa_set_enable(ctx, GL_TEXTURE_3D, !!(unit->Enabled & TEXTURE_3D_BIT));
   if (ctx->Extensions.ARB_texture_cube_map) {
- _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP_ARB,
+ _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP,
   !!(unit->Enabled & TEXTURE_CUBE_BIT));
   }
   if (ctx->Extensions.NV_texture_rectangle) {
@@ -837,7 +837,7 @@ pop_texture_group(struct gl_context *ctx, struct 
texture_state *texstate)
  /* don't restore state for unsupported targets to prevent
   * raising GL errors.
   */
- if (obj->Target == GL_TEXTURE_CUBE_MAP_ARB &&
+ if (obj->Target == GL_TEXTURE_CUBE_MAP &&
  !ctx->Extensions.ARB_texture_cube_map) {
 continue;
  }
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 3fd3c27..3985457 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -749,7 +749,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, 
GLboolean state)
  return;
 
   /* GL_ARB_texture_cube_map */
-  case GL_TEXTURE_CUBE_MAP_ARB:
+  case GL_TEXTURE_CUBE_MAP:
  if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
 goto invalid_enum_error;
  CHECK_EXTENSION(ARB_texture_cube_map, cap);
@@ -1450,7 +1450,7 @@ _mesa_IsEnabled( GLenum cap )
  return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled;
 
   /* GL_ARB_texture_cube_map */
-  case GL_TEXTURE_CUBE_MAP_ARB:
+  case GL_TEXTURE_CUBE_MAP:
  CHECK_EXTENSION(ARB_texture_cube_map);
  return is_texture_enabled(ctx, TEXTURE_CUBE_BIT);
 
diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c
index 4ec8385..6c2d31d 100644
--- a/src/mesa/main/genmipmap.c
+++ b/src/mesa/main/genmipmap.c
@@ -123,7 +123,7 @@ _mesa_generate_texture_mipmap(struct gl_context *ctx,
   GLuint face;
   for (face = 0; face < 6; face++) {
  ctx->Driver.GenerateMipmap(ctx,
-  GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + face, texObj);
+  GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texObj);
   }
}
else {
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 9005dc5..f40c570 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -642,7 +642,7 @@ find_custom_value(struct gl_context *ctx, const struct 
value_desc *d, union valu
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:
case GL_TEXTURE_3D:
-   case GL_TEXTURE_CUBE_MAP_ARB:
+   case GL_TEXTURE_CUBE_MAP:
case GL_TEXTURE_RECTANGLE_NV:
case GL_TEXTURE_EXTERNAL_OES:
   v->value_bool = _mesa_IsEnabled(d->pname);
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 5046995..7fd6fbf 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1715,12 +1715,12 @@ _mesa_generate_mipmap_level(GLenum target,
  dstWidth, dstData[0]);
   break;
case GL_TEXTURE_2D:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
   make_2d_mipmap(datatype, comps, border,
  srcWidth, srcHeight, srcData[0], srcRowStride,
  dstWidth, dstHeight, 

Mesa (master): mesa: simplify some code with new _mesa_cube_face_target() function

2016-02-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 6e09df24b5cd7da0f49622db15ca70f5b2a3594b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e09df24b5cd7da0f49622db15ca70f5b2a3594b

Author: Brian Paul 
Date:   Thu Feb 11 08:14:27 2016 -0700

mesa: simplify some code with new _mesa_cube_face_target() function

Reviewed-by: Roland Scheidegger 
Reviewed-by: Timothy Arceri 

---

 src/mesa/main/mipmap.c  | 7 +--
 src/mesa/main/texobj.c  | 7 +--
 src/mesa/main/textureview.c | 9 ++---
 3 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 7fd6fbf..5a02780 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1838,12 +1838,7 @@ _mesa_prepare_mipmap_level(struct gl_context *ctx,
 
for (face = 0; face < numFaces; face++) {
   struct gl_texture_image *dstImage;
-  GLenum target;
-
-  if (numFaces == 1)
- target = texObj->Target;
-  else
- target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;
+  const GLenum target = _mesa_cube_face_target(texObj->Target, face);
 
   dstImage = _mesa_get_tex_image(ctx, texObj, target, level);
   if (!dstImage) {
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index c63d443..d8407f0 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1036,12 +1036,7 @@ _mesa_get_fallback_texture(struct gl_context *ctx, 
gl_texture_index tex)
 
   /* need a loop here just for cube maps */
   for (face = 0; face < numFaces; face++) {
- GLenum faceTarget;
-
- if (target == GL_TEXTURE_CUBE_MAP)
-faceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;
- else
-faceTarget = target;
+ const GLenum faceTarget = _mesa_cube_face_target(target, face);
 
  /* initialize level[0] texture image */
  texImage = _mesa_get_tex_image(ctx, texObj, faceTarget, 0);
diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index 04b7d73..316d828 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -211,10 +211,7 @@ initialize_texture_fields(struct gl_context *ctx,
for (level = 0; level < levels; level++) {
   for (face = 0; face < numFaces; face++) {
  struct gl_texture_image *texImage;
- GLenum faceTarget = target;
-
- if (target == GL_TEXTURE_CUBE_MAP)
-faceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;
+ const GLenum faceTarget = _mesa_cube_face_target(target, face);
 
  texImage = _mesa_get_tex_image(ctx, texObj, faceTarget, level);
 
@@ -536,9 +533,7 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint 
origtexture,
newViewNumLevels = MIN2(numlevels, origTexObj->NumLevels - minlevel);
newViewNumLayers = MIN2(numlayers, origTexObj->NumLayers - minlayer);
 
-   faceTarget = origTexObj->Target;
-   if (faceTarget == GL_TEXTURE_CUBE_MAP)
-  faceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + minlayer;
+   faceTarget = _mesa_cube_face_target(origTexObj->Target, minlayer);
 
/* Get a reference to what will become this View's base level */
origTexImage = _mesa_select_tex_image(origTexObj, faceTarget, minlevel);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: make _mesa_tex_target_to_face() an inline function

2016-02-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: d73f5a3133688bbae955feb517ea6bd1cd8782a3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d73f5a3133688bbae955feb517ea6bd1cd8782a3

Author: Brian Paul 
Date:   Thu Feb 11 07:54:27 2016 -0700

mesa: make _mesa_tex_target_to_face() an inline function

Reviewed-by: Roland Scheidegger 
Reviewed-by: Timothy Arceri 

---

 src/mesa/main/teximage.c | 14 --
 src/mesa/main/teximage.h | 18 +++---
 2 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 68a9752..57765d7 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -116,20 +116,6 @@ adjust_for_oes_float_texture(GLenum format, GLenum type)
return format;
 }
 
-/**
- * For cube map faces, return a face index in [0,5].
- * For other targets return 0;
- */
-GLuint
-_mesa_tex_target_to_face(GLenum target)
-{
-   if (_mesa_is_cube_face(target))
-  return (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
-   else
-  return 0;
-}
-
-
 
 /**
  * Install gl_texture_image in a gl_texture_object according to the target
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index fe5b485..da02214 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -47,6 +47,21 @@ _mesa_is_cube_face(GLenum target)
target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
 }
 
+
+/**
+ * For cube map faces, return a face index in [0,5].
+ * For other targets return 0;
+ */
+static inline GLuint
+_mesa_tex_target_to_face(GLenum target)
+{
+   if (_mesa_is_cube_face(target))
+  return (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+   else
+  return 0;
+}
+
+
 /** Are any of the dimensions of given texture equal to zero? */
 static inline GLboolean
 _mesa_is_zero_size_texture(const struct gl_texture_image *texImage)
@@ -131,9 +146,6 @@ extern GLboolean
 _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
GLenum intFormat, GLenum *error);
 
-extern GLuint
-_mesa_tex_target_to_face(GLenum target);
-
 extern GLint
 _mesa_get_texture_dimensions(GLenum target);
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: include teximage.h

2016-02-12 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 320ccf710e337ae443128ae37c3dfa2f74efb2d0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=320ccf710e337ae443128ae37c3dfa2f74efb2d0

Author: Brian Paul 
Date:   Fri Feb 12 15:42:27 2016 -0700

i965: include teximage.h

To get _mesa_num_tex_faces() prototype.

---

 src/mesa/drivers/dri/i965/intel_tex_validate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_validate.c 
b/src/mesa/drivers/dri/i965/intel_tex_validate.c
index 2cf9c13..3a811e1 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_validate.c
@@ -24,6 +24,7 @@
 #include "main/mtypes.h"
 #include "main/macros.h"
 #include "main/samplerobj.h"
+#include "main/teximage.h"
 #include "main/texobj.h"
 
 #include "brw_context.h"

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: avoid segfault in GetProgramPipelineInfoLog when no length

2016-02-12 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: f56b5de877c165fd89fbc670c4bd64f4f9637643
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f56b5de877c165fd89fbc670c4bd64f4f9637643

Author: Ilia Mirkin 
Date:   Fri Feb 12 14:23:30 2016 -0500

mesa: avoid segfault in GetProgramPipelineInfoLog when no length

If there is no pipe info log, we would unconditionally deref length,
which was only optionally there. _mesa_copy_string handles the source
being null, as well as the length, so may as well just always call it.

Fixes a segfault in

dEQP-GLES31.functional.state_query.program_pipeline.info_log

Signed-off-by: Ilia Mirkin 
Reviewed-by: Brian Paul 

---

 src/mesa/main/pipelineobj.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
index 0e4a0af..af17be2 100644
--- a/src/mesa/main/pipelineobj.c
+++ b/src/mesa/main/pipelineobj.c
@@ -964,8 +964,5 @@ _mesa_GetProgramPipelineInfoLog(GLuint pipeline, GLsizei 
bufSize,
   return;
}
 
-   if (pipe->InfoLog)
-  _mesa_copy_string(infoLog, bufSize, length, pipe->InfoLog);
-   else
-  *length = 0;
+   _mesa_copy_string(infoLog, bufSize, length, pipe->InfoLog);
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: recognize enums GL_COLOR_ATTACHMENT8-31 as valid

2016-02-12 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: b7e246d89afb2c6072fd65f6bf01a1921afc6d2a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b7e246d89afb2c6072fd65f6bf01a1921afc6d2a

Author: Ilia Mirkin 
Date:   Fri Feb 12 13:12:09 2016 -0500

mesa: recognize enums GL_COLOR_ATTACHMENT8-31 as valid

Similar as for AUX1-3, these enums aren't invalid (i.e. -1) but also not
supported by mesa. Returning BUFFER_COUNT causes the proper error to be
returned by ReadBuffer and other functions. This resolves some failures
in

dEQP-GLES31.functional.debug.negative_coverage.get_error.buffer.read_buffer

Signed-off-by: Ilia Mirkin 
Reviewed-by: Brian Paul 

---

 src/mesa/main/buffers.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 83e238a..3ca4b66 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -159,6 +159,9 @@ draw_buffer_enum_to_bitmask(const struct gl_context *ctx, 
GLenum buffer)
   case GL_COLOR_ATTACHMENT7_EXT:
  return BUFFER_BIT_COLOR7;
   default:
+ /* not an error, but also not supported */
+ if (buffer >= GL_COLOR_ATTACHMENT8 && buffer <= GL_COLOR_ATTACHMENT31)
+return 1 << BUFFER_COUNT;
  /* error */
  return BAD_MASK;
}
@@ -214,6 +217,9 @@ read_buffer_enum_to_index(GLenum buffer)
   case GL_COLOR_ATTACHMENT7_EXT:
  return BUFFER_COLOR7;
   default:
+ /* not an error, but also not supported */
+ if (buffer >= GL_COLOR_ATTACHMENT8 && buffer <= GL_COLOR_ATTACHMENT31)
+return BUFFER_COUNT;
  /* error */
  return -1;
}

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa/clear: simplify ClearBufferiv error handling

2016-02-12 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 758162923b22fcf75ea024f228a2ed96b6e88997
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=758162923b22fcf75ea024f228a2ed96b6e88997

Author: Ilia Mirkin 
Date:   Fri Feb 12 12:54:42 2016 -0500

mesa/clear: simplify ClearBufferiv error handling

Might as well handle everything in the same error call.

Signed-off-by: Ilia Mirkin 
Reviewed-by: Brian Paul 

---

 src/mesa/main/clear.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index 5c40a03..568f600 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -325,18 +325,6 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const 
GLint *value)
   _mesa_update_state( ctx );
}
 
-   /* Page 498 of the PDF, section '17.4.3.1 Clearing Individual Buffers'
-* of the OpenGL 4.5 spec states:
-*
-*"An INVALID_ENUM error is generated by ClearBufferiv and
-* ClearNamedFramebufferiv if buffer is not COLOR or STENCIL."
-*/
-   if (buffer == GL_DEPTH || buffer == GL_DEPTH_STENCIL) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
-  "glClearBufferiv(buffer=GL_DEPTH || GL_DEPTH_STENCIL)");
-  return;
-   }
-
switch (buffer) {
case GL_STENCIL:
   /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
@@ -387,6 +375,12 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const 
GLint *value)
   }
   break;
default:
+  /* Page 498 of the PDF, section '17.4.3.1 Clearing Individual Buffers'
+   * of the OpenGL 4.5 spec states:
+   *
+   *"An INVALID_ENUM error is generated by ClearBufferiv and
+   * ClearNamedFramebufferiv if buffer is not COLOR or STENCIL."
+   */
   _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferiv(buffer=%s)",
   _mesa_enum_to_string(buffer));
   return;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/nine: Do not set SHARED flag for shared textures.

2016-02-12 Thread Axel Davy
Module: Mesa
Branch: master
Commit: 36b4bb303cec3de59621f41a8dea3aaeca3d12c5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=36b4bb303cec3de59621f41a8dea3aaeca3d12c5

Author: Axel Davy 
Date:   Tue Jan 26 17:04:21 2016 +0100

st/nine: Do not set SHARED flag for shared textures.

We do not support shared textures, thus no need to set
the shared flag.

Signed-off-by: Axel Davy 
Reviewed-by: Patrick Rudolph 

---

 src/gallium/state_trackers/nine/texture9.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/gallium/state_trackers/nine/texture9.c 
b/src/gallium/state_trackers/nine/texture9.c
index a11dad4..6d1f897 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -140,9 +140,6 @@ NineTexture9_ctor( struct NineTexture9 *This,
 DBG("Application asked for Software Vertex Processing, "
 "but this is unimplemented\n");
 
-if (pSharedHandle)
-info->bind |= PIPE_BIND_SHARED;
-
 if (pSharedHandle && *pSharedHandle) { /* Pool == D3DPOOL_SYSTEMMEM */
 user_buffer = (void *)*pSharedHandle;
 level_offsets = alloca(sizeof(unsigned) * (info->last_level + 1));

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/nine: Clean useless code in texture9.c

2016-02-12 Thread Axel Davy
Module: Mesa
Branch: master
Commit: d973a525d387f1562e796ec598951ee5d2f02540
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d973a525d387f1562e796ec598951ee5d2f02540

Author: Axel Davy 
Date:   Tue Jan 26 17:13:00 2016 +0100

st/nine: Clean useless code in texture9.c

This->base.base.resource is worth NULL
for SYSTEMMEM textures.

Signed-off-by: Axel Davy 
Reviewed-by: Patrick Rudolph 

---

 src/gallium/state_trackers/nine/texture9.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/gallium/state_trackers/nine/texture9.c 
b/src/gallium/state_trackers/nine/texture9.c
index 6d1f897..0bc37d3 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -48,7 +48,6 @@ NineTexture9_ctor( struct NineTexture9 *This,
 {
 struct pipe_screen *screen = pParams->device->screen;
 struct pipe_resource *info = >base.base.info;
-struct pipe_resource *resource;
 enum pipe_format pf;
 unsigned *level_offsets;
 unsigned l;
@@ -182,11 +181,6 @@ NineTexture9_ctor( struct NineTexture9 *This,
 sfdesc.MultiSampleType = D3DMULTISAMPLE_NONE;
 sfdesc.MultiSampleQuality = 0;
 
-if (Pool == D3DPOOL_SYSTEMMEM)
-resource = NULL;
-else
-resource = This->base.base.resource;
-
 for (l = 0; l <= info->last_level; ++l) {
 sfdesc.Width = u_minify(Width, l);
 sfdesc.Height = u_minify(Height, l);
@@ -196,7 +190,7 @@ NineTexture9_ctor( struct NineTexture9 *This,
 level_offsets[l] : NULL;
 
 hr = NineSurface9_new(This->base.base.base.device, NineUnknown(This),
-  resource, user_buffer_for_level,
+  This->base.base.resource, user_buffer_for_level,
   D3DRTYPE_TEXTURE, l, 0,
   , >surfaces[l]);
 if (FAILED(hr))

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/nine: Fix stateblocks crashes with lights

2016-02-12 Thread Axel Davy
Module: Mesa
Branch: master
Commit: 17078d92ea524c9f0e9dff8d17f8b2df752d24cc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=17078d92ea524c9f0e9dff8d17f8b2df752d24cc

Author: Axel Davy 
Date:   Sat Feb  6 19:29:10 2016 +0100

st/nine: Fix stateblocks crashes with lights

We had several issues of crashes with it.
This should fix it.

Signed-off-by: Axel Davy 
Reviewed-by: Patrick Rudolph 

---

 src/gallium/state_trackers/nine/stateblock9.c | 40 +--
 1 file changed, 32 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/nine/stateblock9.c 
b/src/gallium/state_trackers/nine/stateblock9.c
index 0d1a04b..4789346 100644
--- a/src/gallium/state_trackers/nine/stateblock9.c
+++ b/src/gallium/state_trackers/nine/stateblock9.c
@@ -86,7 +86,7 @@ NineStateBlock9_dtor( struct NineStateBlock9 *This )
  */
 static void
 nine_state_copy_common(struct nine_state *dst,
-   const struct nine_state *src,
+   struct nine_state *src,
struct nine_state *mask, /* aliases either src or dst */
const boolean apply,
struct nine_range_pool *pool)
@@ -267,17 +267,41 @@ nine_state_copy_common(struct nine_state *dst,
 }
 }
 if (mask->changed.group & NINE_STATE_FF_LIGHTING) {
-if (dst->ff.num_lights < mask->ff.num_lights) {
+unsigned num_lights = MAX2(dst->ff.num_lights, src->ff.num_lights);
+/* Can happen in Capture() if device state has created new lights after
+ * the stateblock was created.
+ * Can happen in Apply() if the stateblock had recorded the creation of
+ * new lights. */
+if (dst->ff.num_lights < num_lights) {
 dst->ff.light = REALLOC(dst->ff.light,
 dst->ff.num_lights * sizeof(D3DLIGHT9),
-mask->ff.num_lights * sizeof(D3DLIGHT9));
-for (i = dst->ff.num_lights; i < mask->ff.num_lights; ++i) {
-memset(>ff.light[i], 0, sizeof(D3DLIGHT9));
-dst->ff.light[i].Type = (D3DLIGHTTYPE)NINED3DLIGHT_INVALID;
+num_lights * sizeof(D3DLIGHT9));
+memset(>ff.light[dst->ff.num_lights], 0, (num_lights - 
dst->ff.num_lights) * sizeof(D3DLIGHT9));
+/* if mask == dst, a Type of 0 will trigger
+ * "dst->ff.light[i] = src->ff.light[i];" later,
+ * which is what we want in that case. */
+if (mask != dst) {
+for (i = src->ff.num_lights; i < num_lights; ++i)
+src->ff.light[i].Type = (D3DLIGHTTYPE)NINED3DLIGHT_INVALID;
 }
-dst->ff.num_lights = mask->ff.num_lights;
+dst->ff.num_lights = num_lights;
 }
-for (i = 0; i < mask->ff.num_lights; ++i)
+/* Can happen in Capture() if the stateblock had recorded the creation 
of
+ * new lights.
+ * Can happen in Apply() if device state has created new lights after
+ * the stateblock was created. */
+if (src->ff.num_lights < num_lights) {
+src->ff.light = REALLOC(src->ff.light,
+src->ff.num_lights * sizeof(D3DLIGHT9),
+num_lights * sizeof(D3DLIGHT9));
+memset(>ff.light[src->ff.num_lights], 0, (num_lights - 
src->ff.num_lights) * sizeof(D3DLIGHT9));
+for (i = src->ff.num_lights; i < num_lights; ++i)
+src->ff.light[i].Type = (D3DLIGHTTYPE)NINED3DLIGHT_INVALID;
+src->ff.num_lights = num_lights;
+}
+/* Note: mask is either src or dst, so at this point src, dst and mask
+ * have num_lights lights. */
+for (i = 0; i < num_lights; ++i)
 if (mask->ff.light[i].Type != NINED3DLIGHT_INVALID)
 dst->ff.light[i] = src->ff.light[i];
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/nine: Support ATI1/ATI2 for CubeTexture

2016-02-12 Thread Axel Davy
Module: Mesa
Branch: master
Commit: 3a2e0c77848120f44031d2deb91108ff8e951d85
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a2e0c77848120f44031d2deb91108ff8e951d85

Author: Axel Davy 
Date:   Tue Jan 26 18:14:02 2016 +0100

st/nine: Support ATI1/ATI2 for CubeTexture

Texture and CubeTexture use common code,
and thus ATI1/ATI2 is already implemented
for CubeTexture.

Signed-off-by: Axel Davy 
Reviewed-by: Patrick Rudolph 

---

 src/gallium/state_trackers/nine/adapter9.c   | 5 +++--
 src/gallium/state_trackers/nine/cubetexture9.c   | 4 
 src/gallium/state_trackers/nine/volumetexture9.c | 2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/gallium/state_trackers/nine/adapter9.c 
b/src/gallium/state_trackers/nine/adapter9.c
index 8428b1b..5e9c7f7 100644
--- a/src/gallium/state_trackers/nine/adapter9.c
+++ b/src/gallium/state_trackers/nine/adapter9.c
@@ -338,8 +338,9 @@ NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
 return D3DERR_NOTAVAILABLE;
 }
 
-/* we support ATI1 and ATI2 hack only for 2D textures */
-if (RType != D3DRTYPE_TEXTURE && (CheckFormat == D3DFMT_ATI1 || 
CheckFormat == D3DFMT_ATI2))
+/* we support ATI1 and ATI2 hack only for 2D and Cube textures */
+if (RType != D3DRTYPE_TEXTURE && RType != D3DRTYPE_CUBETEXTURE &&
+(CheckFormat == D3DFMT_ATI1 || CheckFormat == D3DFMT_ATI2))
 return D3DERR_NOTAVAILABLE;
 /* if (Usage & D3DUSAGE_NONSECURE) { don't know the implications of this } 
*/
 /* if (Usage & D3DUSAGE_SOFTWAREPROCESSING) { we can always support this } 
*/
diff --git a/src/gallium/state_trackers/nine/cubetexture9.c 
b/src/gallium/state_trackers/nine/cubetexture9.c
index 1749190..03b5fca 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -69,10 +69,6 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
 if (pf == PIPE_FORMAT_NONE)
 return D3DERR_INVALIDCALL;
 
-/* We support ATI1 and ATI2 hacks only for 2D textures */
-if (Format == D3DFMT_ATI1 || Format == D3DFMT_ATI2)
-return D3DERR_INVALIDCALL;
-
 if (compressed_format(Format)) {
 const unsigned w = util_format_get_blockwidth(pf);
 const unsigned h = util_format_get_blockheight(pf);
diff --git a/src/gallium/state_trackers/nine/volumetexture9.c 
b/src/gallium/state_trackers/nine/volumetexture9.c
index cdec21f..cd94a36 100644
--- a/src/gallium/state_trackers/nine/volumetexture9.c
+++ b/src/gallium/state_trackers/nine/volumetexture9.c
@@ -63,7 +63,7 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This,
 if (pf == PIPE_FORMAT_NONE)
 return D3DERR_INVALIDCALL;
 
-/* We support ATI1 and ATI2 hacks only for 2D textures */
+/* We support ATI1 and ATI2 hacks only for 2D and Cube textures */
 if (Format == D3DFMT_ATI1 || Format == D3DFMT_ATI2)
 return D3DERR_INVALIDCALL;
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/nine: Add format checks to create_zs_or_rt_surface

2016-02-12 Thread Axel Davy
Module: Mesa
Branch: master
Commit: dbcb4f46ad792ed4f0f3cc64449ccd6288a6f386
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dbcb4f46ad792ed4f0f3cc64449ccd6288a6f386

Author: Axel Davy 
Date:   Tue Jan 26 18:21:26 2016 +0100

st/nine: Add format checks to create_zs_or_rt_surface

Returns INVALIDCALL when trying to create a surface
of unsupported format.

In practice, apps are supposed to check for format
support before trying to create a render target
of that format. However some bad behaving apps
could just try to create the surface and deduce if
it failed that it wasn't supported.

Signed-off-by: Axel Davy 
Reviewed-by: Patrick Rudolph 

---

 src/gallium/state_trackers/nine/device9.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index b6e75b4..3ebff3a 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1126,6 +1126,9 @@ create_zs_or_rt_surface(struct NineDevice9 *This,
templ.nr_samples, templ.bind,
FALSE);
 
+if (templ.format == PIPE_FORMAT_NONE && Format != D3DFMT_NULL)
+return D3DERR_INVALIDCALL;
+
 desc.Format = Format;
 desc.Type = D3DRTYPE_SURFACE;
 desc.Usage = 0;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i915: include teximage.h

2016-02-12 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 2a0fc8286483034a627b5d66eaea45df7f2b0b49
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a0fc8286483034a627b5d66eaea45df7f2b0b49

Author: Kenneth Graunke 
Date:   Fri Feb 12 15:20:29 2016 -0800

i915: include teximage.h

To get _mesa_num_tex_faces() prototype.

---

 src/mesa/drivers/dri/i915/intel_tex_validate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/i915/intel_tex_validate.c 
b/src/mesa/drivers/dri/i915/intel_tex_validate.c
index 224a67f..c2111e5 100644
--- a/src/mesa/drivers/dri/i915/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/i915/intel_tex_validate.c
@@ -1,6 +1,7 @@
 #include "main/mtypes.h"
 #include "main/macros.h"
 #include "main/samplerobj.h"
+#include "main/teximage.h"
 #include "main/texobj.h"
 
 #include "intel_context.h"

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit