[Mesa-dev] [Bug 91646] dlopen'ing libudev.so.1 from static library initializer corrupts TLS state

2015-08-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=91646

--- Comment #4 from Timo R. t...@rothenpieler.org ---
 That's unlikely to work, static local variables are no different to globals
 regarding initialization order,

To my knowledge, static local variables are initialized on the first call to
the function, whereas global variables are initialized in the libraries early
static initializer, which runs during library load.

 and, yeah, it seems like a hack because
 pipe_loader_probe() shouldn't be doing anything that could corrupt the TLS
 state when called at initialization time.

The simple act of calling dlopen on libudev.so.1 from within the early static
initializer is enough to corrupt the TLS state, but only if some later library
also links against libudev.so.1.
So not initializing the structure on library-load, but on first function call
might actualy help.

 It looks like this might be a regression from the series
 de5c2b6f2b53924bceab6f4b8255d8e9dcad21b4..
 cc32d25454c382a971e81ae584a4296fdf492e70(which are indeed not part of any
 released version yet), you may want to bisect which change introduced the
 problem.

Not sure when I'll get to this, but I'll see what i can do.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC 2/2] i965: add support for image AoA

2015-08-16 Thread Francisco Jerez
Timothy Arceri t_arc...@yahoo.com.au writes:

 On Sat, 2015-08-15 at 17:33 +0300, Francisco Jerez wrote:
 Timothy Arceri t_arc...@yahoo.com.au writes:
 
  On Wed, 2015-08-12 at 19:39 +1000, Timothy Arceri wrote:
   Cc: Francisco Jerez curroje...@riseup.net
   ---
This patch works for direct indexing of images, but I'm having some 
   trouble
getting indirect to work.
   
For example for:
tests/spec/arb_arrays_of_arrays/execution/image_store/basic-imageStore
-non-const-uniform-index.shader_test
   
Which has and image writeonly uniform image2D tex[2][2]
   
Indirect indexing will work for tex[0][0] and text[0][1] but not for
tex[1][0] and tex[1][1] they seem to always end up refering to the
image in 0.
  
  Just to add some more to this, I'm pretty sure my code is generating the
  correct offsets. If I hardcode the img_offset offset to 72 to get the 
  uniform
  value of tex[1][0] I get the value I expected, but if I set image.reladdr 
  to a
  register that contains 72 I don't what I expect.
  
  If I change the array to be a single dimension e.g. tex[4] and I hardcode 
  the
  offset as described above then it works as expected for both scenarios, it
  also works if I split the offset across img_offset and image.reladdr, 
  there is
  something going on with image.reladdr for multi-dimensional arrays that I 
  can'
  t quite put my finger on.
  
  Any hints appreciated.
  
 Odd, can you attach an assembly dump?
 
 Thanks.

 I wasn't sure what would be the most helpful so I've attached a few different
 dumps.

 image_dump = 1D array indirect piglit test, without this patch (Result=pass)
 image_dump2 = 2D array indirect piglit test, with this patch (Result=fail)
 image_dump3 = 1D array indirect piglit test, with this patch (Result=pass)

 image_dump4 = 1D array indirect piglit test, hardcoded register with 72 offset
   (Result=pass)
 image_dump5 = 2D array indirect piglit test, hardcoded register with 72 offset
 (Result=fail)

 image_dump4 vs image_dump5 is interesting because the output matches which is
 what I would have expected, but the result differs. Then with the offset below
 it seems to work as expected suggesting everything else is setup correctly.

 image_dump6 = 1D array indirect piglit test, hardcoded 72 offset in img_offset
(Result=pass)
 image_dump7 = 2D array indirect piglit test, hardcoded 72 offset in img_offset
(Result=pass)
  

Yeah... The assembly output looks correct to me in the cases that fail.
AFAICT what all the failing cases have in common is that the array of
image uniforms is demoted to pull constants (see demote_pull_constants()
and move_uniform_array_access_to_pull_constants()), so most likely
something goes wrong while doing that for multidimensional arrays.  I
have the suspicion that this is the source of the problem:

| --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
| +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
| @@ -226,6 +226,7 @@ fs_visitor::nir_setup_uniform(nir_variable *var)
|* our name.
|*/
| unsigned index = var-data.driver_location;
| +   bool set_image_location = true;
| for (unsigned u = 0; u  shader_prog-NumUniformStorage; u++) {
|struct gl_uniform_storage *storage = shader_prog-UniformStorage[u];
|
| @@ -244,7 +245,13 @@ fs_visitor::nir_setup_uniform(nir_variable *var)
|* because their size is driver-specific, so we need to allocate
|* space for them here at the end of the parameter array.
|*/
| - var-data.driver_location = uniforms;
| + if (set_image_location) {
| +/* For arrays of arrays we only want to set this once at the base
| + * location.
| + */
| +var-data.driver_location = uniforms;
| +set_image_location = false;
| + }
|   param_size[uniforms] =
|  BRW_IMAGE_PARAM_SIZE * MAX2(storage-array_elements, 1);

The assumption that this code was previously making was that a given
image array would be stored in a single gl_uniform_storage entry,
otherwise param_size[var-data.driver_location] won't match the real
size of the array and move_uniform_array_access_to_pull_constants() will
have no idea how large the array really is, so it will only be able to
move part of the array to the pull constant buffer and later on the
indirect array access will read past the end of the initialized area of
the constant buffer.

I think something like this would do what you want:

| if (var-type-without_array()-is_image()) {
|/* Images don't get a valid location assigned by nir_lower_io()
| * because their size is driver-specific, so we need to allocate
| * space for them here at the end of the parameter array.
| */
|var-data.driver_location = uniforms;
| }
|[...]
| for (unsigned u = 0; u  shader_prog-NumUniformStorage; u++) {
|if (storage-type-is_image()) {
|   

[Mesa-dev] [Bug 91646] dlopen'ing libudev.so.1 from static library initializer corrupts TLS state

2015-08-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=91646

--- Comment #5 from Francisco Jerez curroje...@riseup.net ---
(In reply to Timo R. from comment #4)
  That's unlikely to work, static local variables are no different to globals
  regarding initialization order,
 
 To my knowledge, static local variables are initialized on the first call to
 the function, whereas global variables are initialized in the libraries
 early static initializer, which runs during library load.
 

IIRC static local variables are allowed to be initialized statically under
roughly the same set of conditions in which global variables are -- That said
because the platform constructor has side-effects it looks like you're right
and the platform will necessarily have to be initialized dynamically the first
time the function is run.

  and, yeah, it seems like a hack because
  pipe_loader_probe() shouldn't be doing anything that could corrupt the TLS
  state when called at initialization time.
 
 The simple act of calling dlopen on libudev.so.1 from within the early
 static initializer is enough to corrupt the TLS state, but only if some
 later library also links against libudev.so.1.
 So not initializing the structure on library-load, but on first function
 call might actualy help.
 
The thing is you have no guarantee that the function it's now being initialized
from will not itself be called from a static-storage variable initializer, so
assuming that the conditions you describe are enough to corrupt the TLS state
this will only be hiding the problem.

  It looks like this might be a regression from the series
  de5c2b6f2b53924bceab6f4b8255d8e9dcad21b4..
  cc32d25454c382a971e81ae584a4296fdf492e70(which are indeed not part of any
  released version yet), you may want to bisect which change introduced the
  problem.
 
 Not sure when I'll get to this, but I'll see what i can do.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] st/mesa: also move yoffset to zoffset for 1d array textures

2015-08-16 Thread Marek Olšák
Reviewed-by: Marek Olšák marek.ol...@amd.com

On Sun, Aug 16, 2015 at 3:45 AM, Ilia Mirkin imir...@alum.mit.edu wrote:
 Do the same as in st_TexSubImage. This fixes
 arb_get_texture_sub_image-get on llvmpipe when it is set to prefer
 blits, and nouveau when it uses the 3d engine for blits.

 Signed-off-by: Ilia Mirkin imir...@alum.mit.edu
 ---
  src/mesa/state_tracker/st_cb_texture.c | 2 ++
  1 file changed, 2 insertions(+)

 diff --git a/src/mesa/state_tracker/st_cb_texture.c 
 b/src/mesa/state_tracker/st_cb_texture.c
 index 715d69c..4f2ef6b 100644
 --- a/src/mesa/state_tracker/st_cb_texture.c
 +++ b/src/mesa/state_tracker/st_cb_texture.c
 @@ -1071,6 +1071,8 @@ st_GetTexSubImage(struct gl_context * ctx,

 /* From now on, we need the gallium representation of dimensions. */
 if (gl_target == GL_TEXTURE_1D_ARRAY) {
 +  zoffset = yoffset;
 +  yoffset = 0;
depth = height;
height = 1;
 }
 --
 2.4.6

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


[Mesa-dev] [PATCH 59/71] st/nine: Implement ff vertex data passthrough

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_ff.c | 68 +++
 1 file changed, 61 insertions(+), 7 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_ff.c 
b/src/gallium/state_trackers/nine/nine_ff.c
index 1033050..6740274 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -67,7 +67,7 @@ struct nine_ff_vs_key
 uint32_t pad4 : 8;
 uint32_t tc_idx : 24;
 uint32_t pad5 : 8;
-uint32_t pad6;
+uint32_t passthrough;
 };
 uint64_t value64[3]; /* don't forget to resize VertexShader9.ff_key */
 uint32_t value32[6];
@@ -342,7 +342,7 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
 unsigned i, c;
 unsigned label[32], l = 0;
 unsigned num_r = 8;
-boolean need_rNrm = key-lighting || key-pointscale;
+boolean need_rNrm = key-lighting || key-pointscale || key-passthrough  
(1  NINE_DECLUSAGE_NORMAL);
 boolean need_rVtx = key-lighting || key-fog_mode;
 const unsigned texcoord_sn = get_texcoord_sn(device-screen);
 
@@ -405,9 +405,9 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
 if (key-vertexpointsize)
 vs-aPsz = build_vs_add_input(vs, NINE_DECLUSAGE_PSIZE);
 
-if (key-vertexblend_indexed)
+if (key-vertexblend_indexed || key-passthrough  (1  
NINE_DECLUSAGE_BLENDINDICES))
 vs-aInd = build_vs_add_input(vs, NINE_DECLUSAGE_BLENDINDICES);
-if (key-vertexblend)
+if (key-vertexblend || key-passthrough  (1  
NINE_DECLUSAGE_BLENDWEIGHT))
 vs-aWgt = build_vs_add_input(vs, NINE_DECLUSAGE_BLENDWEIGHT);
 if (key-vertextween) {
 vs-aVtx1 = build_vs_add_input(vs, NINE_DECLUSAGE_i(POSITION,1));
@@ -419,7 +419,7 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
 oPos = ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0); /* HPOS */
 oCol[0] = ureg_saturate(ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 0));
 oCol[1] = ureg_saturate(ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 1));
-if (key-fog) {
+if (key-fog || key-passthrough  (1  NINE_DECLUSAGE_FOG)) {
 oFog = ureg_DECL_output(ureg, TGSI_SEMANTIC_FOG, 0);
 oFog = ureg_writemask(oFog, TGSI_WRITEMASK_X);
 }
@@ -899,10 +899,58 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
 ureg_MUL(ureg, ureg_saturate(tmp_x), _X(tmp), _(_CONST(28)));
 }
 ureg_MOV(ureg, oFog, _X(tmp));
-} else if (key-fog) {
+} else if (key-fog  !(key-passthrough  (1  NINE_DECLUSAGE_FOG))) {
 ureg_MOV(ureg, oFog, ureg_scalar(vs-aCol[1], TGSI_SWIZZLE_W));
 }
 
+if (key-passthrough  (1  NINE_DECLUSAGE_BLENDWEIGHT)) {
+struct ureg_src input;
+struct ureg_dst output;
+input = vs-aWgt;
+output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 18);
+ureg_MOV(ureg, output, input);
+}
+if (key-passthrough  (1  NINE_DECLUSAGE_BLENDINDICES)) {
+struct ureg_src input;
+struct ureg_dst output;
+input = vs-aInd;
+output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 19);
+ureg_MOV(ureg, output, input);
+}
+if (key-passthrough  (1  NINE_DECLUSAGE_NORMAL)) {
+struct ureg_src input;
+struct ureg_dst output;
+input = vs-aNrm;
+output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 20);
+ureg_MOV(ureg, output, input);
+}
+if (key-passthrough  (1  NINE_DECLUSAGE_TANGENT)) {
+struct ureg_src input;
+struct ureg_dst output;
+input = build_vs_add_input(vs, NINE_DECLUSAGE_TANGENT);
+output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 21);
+ureg_MOV(ureg, output, input);
+}
+if (key-passthrough  (1  NINE_DECLUSAGE_BINORMAL)) {
+struct ureg_src input;
+struct ureg_dst output;
+input = build_vs_add_input(vs, NINE_DECLUSAGE_BINORMAL);
+output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 22);
+ureg_MOV(ureg, output, input);
+}
+if (key-passthrough  (1  NINE_DECLUSAGE_FOG)) {
+struct ureg_src input;
+struct ureg_dst output;
+input = build_vs_add_input(vs, NINE_DECLUSAGE_FOG);
+input = ureg_scalar(input, TGSI_SWIZZLE_X);
+output = oFog;
+ureg_MOV(ureg, output, input);
+}
+if (key-passthrough  (1  NINE_DECLUSAGE_DEPTH)) {
+(void) 0; /* TODO: replace z of position output ? */
+}
+
+
 if (key-position_t  device-driver_caps.window_space_position_support)
 ureg_property(ureg, TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION, TRUE);
 
@@ -1411,9 +1459,15 @@ nine_ff_get_vs(struct NineDevice9 *device)
 input_texture_coord[s] = 
nine_decltype_get_dim(state-vdecl-decls[i].Type);
 else
 DBG(FF given texture 

[Mesa-dev] [PATCH 52/71] st/nine: Finish Fog implementation

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_shader.c   | 47 +++--
 src/gallium/state_trackers/nine/nine_shader.h   | 47 +
 src/gallium/state_trackers/nine/nine_state.c| 43 +++---
 src/gallium/state_trackers/nine/nine_state.h|  5 +--
 src/gallium/state_trackers/nine/pixelshader9.c  | 13 ---
 src/gallium/state_trackers/nine/pixelshader9.h  | 13 ---
 src/gallium/state_trackers/nine/vertexshader9.c |  2 ++
 src/gallium/state_trackers/nine/vertexshader9.h |  3 ++
 8 files changed, 147 insertions(+), 26 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_shader.c 
b/src/gallium/state_trackers/nine/nine_shader.c
index d9a20a5..2e35ede 100644
--- a/src/gallium/state_trackers/nine/nine_shader.c
+++ b/src/gallium/state_trackers/nine/nine_shader.c
@@ -3199,9 +3199,50 @@ shader_add_ps_fog_stage(struct shader_translator *tx, 
struct ureg_src src_col)
 {
 struct ureg_program *ureg = tx-ureg;
 struct ureg_dst oCol0 = ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 0);
+struct ureg_src fog_end, fog_coeff, fog_density;
+struct ureg_src fog_vs, depth, fog_color;
+struct ureg_dst fog_factor;
 
-/* TODO: fog computation */
-ureg_MOV(ureg, oCol0, src_col);
+if (!tx-info-fog_enable) {
+ureg_MOV(ureg, oCol0, src_col);
+return;
+}
+
+if (tx-info-fog_mode != D3DFOG_NONE)
+depth = ureg_scalar(ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, 0,
+  TGSI_INTERPOLATE_LINEAR),
+  TGSI_SWIZZLE_Z);
+
+nine_info_mark_const_f_used(tx-info, 33);
+fog_color = NINE_CONSTANT_SRC(32);
+fog_factor = tx_scratch_scalar(tx);
+
+if (tx-info-fog_mode == D3DFOG_LINEAR) {
+fog_end = NINE_CONSTANT_SRC_SWIZZLE(33, X);
+fog_coeff = NINE_CONSTANT_SRC_SWIZZLE(33, Y);
+ureg_SUB(ureg, fog_factor, fog_end, depth);
+ureg_MUL(ureg, ureg_saturate(fog_factor), tx_src_scalar(fog_factor), 
fog_coeff);
+} else if (tx-info-fog_mode == D3DFOG_EXP) {
+fog_density = NINE_CONSTANT_SRC_SWIZZLE(33, X);
+ureg_MUL(ureg, fog_factor, depth, fog_density);
+ureg_MUL(ureg, fog_factor, tx_src_scalar(fog_factor), ureg_imm1f(ureg, 
-1.442695f));
+ureg_EX2(ureg, fog_factor, tx_src_scalar(fog_factor));
+} else if (tx-info-fog_mode == D3DFOG_EXP2) {
+fog_density = NINE_CONSTANT_SRC_SWIZZLE(33, X);
+ureg_MUL(ureg, fog_factor, depth, fog_density);
+ureg_MUL(ureg, fog_factor, tx_src_scalar(fog_factor), 
tx_src_scalar(fog_factor));
+ureg_MUL(ureg, fog_factor, tx_src_scalar(fog_factor), ureg_imm1f(ureg, 
-1.442695f));
+ureg_EX2(ureg, fog_factor, tx_src_scalar(fog_factor));
+} else {
+fog_vs = ureg_scalar(ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_FOG, 0,
+TGSI_INTERPOLATE_PERSPECTIVE),
+TGSI_SWIZZLE_X);
+ureg_MOV(ureg, fog_factor, fog_vs);
+}
+
+ureg_LRP(ureg, ureg_writemask(oCol0, TGSI_WRITEMASK_XYZ),
+ tx_src_scalar(fog_factor), src_col, fog_color);
+ureg_MOV(ureg, ureg_writemask(oCol0, TGSI_WRITEMASK_W), src_col);
 }
 
 #define GET_CAP(n) device-screen-get_param( \
@@ -3285,7 +3326,7 @@ nine_translate_shader(struct NineDevice9 *device, struct 
nine_shader_info *info)
 }
 }
 
-if (IS_VS  tx-version.major  3  ureg_dst_is_undef(tx-regs.oFog)) {
+if (IS_VS  tx-version.major  3  ureg_dst_is_undef(tx-regs.oFog)  
info-fog_enable) {
 tx-regs.oFog = ureg_DECL_output(tx-ureg, TGSI_SEMANTIC_FOG, 0);
 ureg_MOV(tx-ureg, ureg_writemask(tx-regs.oFog, TGSI_WRITEMASK_X), 
ureg_imm1f(tx-ureg, 0.0f));
 }
diff --git a/src/gallium/state_trackers/nine/nine_shader.h 
b/src/gallium/state_trackers/nine/nine_shader.h
index f2b1e8b..3ba79af 100644
--- a/src/gallium/state_trackers/nine/nine_shader.h
+++ b/src/gallium/state_trackers/nine/nine_shader.h
@@ -59,6 +59,9 @@ struct nine_shader_info
 uint16_t sampler_mask_shadow; /* in, which samplers use depth compare */
 uint8_t rt_mask; /* out, which render targets are being written */
 
+uint8_t fog_enable;
+uint8_t fog_mode;
+
 unsigned const_i_base; /* in vec4 (16 byte) units */
 unsigned const_b_base; /* in vec4 (16 byte) units */
 unsigned const_used_size;
@@ -138,4 +141,48 @@ nine_shader_variants_free(struct nine_shader_variant *list)
 }
 }
 
+struct nine_shader_variant64
+{
+struct nine_shader_variant64 *next;
+void *cso;
+uint64_t key;
+};
+
+static inline void *
+nine_shader_variant_get64(struct nine_shader_variant64 *list, uint64_t key)
+{
+while (list-key != key  list-next)
+list = list-next;
+if (list-key == key)
+return list-cso;
+return NULL;
+}
+
+static inline boolean
+nine_shader_variant_add64(struct nine_shader_variant64 

[Mesa-dev] [PATCH 55/71] st/nine: Change a few advertised caps

2015-08-16 Thread Axel Davy
There were flags all sm3 cards do advertise,
and we weren't.
Some games can trigger buggy rendering path
if the caps are not what they expect.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/adapter9.c | 26 +++---
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/src/gallium/state_trackers/nine/adapter9.c 
b/src/gallium/state_trackers/nine/adapter9.c
index ff1c33c..69e0fa2 100644
--- a/src/gallium/state_trackers/nine/adapter9.c
+++ b/src/gallium/state_trackers/nine/adapter9.c
@@ -545,7 +545,7 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
  /*D3DDEVCAPS_RTPATCHES |*/
  /*D3DDEVCAPS_RTPATCHHANDLEZERO |*/
  /*D3DDEVCAPS_SEPARATETEXTUREMEMORIES |*/
- /*D3DDEVCAPS_TEXTURENONLOCALVIDMEM |*/
+ D3DDEVCAPS_TEXTURENONLOCALVIDMEM |
  /* D3DDEVCAPS_TEXTURESYSTEMMEMORY |*/
  D3DDEVCAPS_TEXTUREVIDEOMEMORY |
  D3DDEVCAPS_TLVERTEXSYSTEMMEMORY |
@@ -561,7 +561,7 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
D3DPMISCCAPS_TSSARGTEMP |
D3DPMISCCAPS_BLENDOP |
D3DPIPECAP(INDEP_BLEND_ENABLE, 
D3DPMISCCAPS_INDEPENDENTWRITEMASKS) |
-   /*D3DPMISCCAPS_PERSTAGECONSTANT |*/
+   /*D3DPMISCCAPS_PERSTAGECONSTANT |*/ /* TODO */
/*D3DPMISCCAPS_POSTBLENDSRGBCONVERT |*/ /* TODO 
*/
D3DPMISCCAPS_FOGANDSPECULARALPHA |
D3DPIPECAP(BLEND_EQUATION_SEPARATE, 
D3DPMISCCAPS_SEPARATEALPHABLEND) |
@@ -573,7 +573,7 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
 
 pCaps-RasterCaps =
 D3DPIPECAP(ANISOTROPIC_FILTER, D3DPRASTERCAPS_ANISOTROPY) |
-/*D3DPRASTERCAPS_COLORPERSPECTIVE |*/
+D3DPRASTERCAPS_COLORPERSPECTIVE |
 D3DPRASTERCAPS_DITHER |
 D3DPRASTERCAPS_DEPTHBIAS |
 D3DPRASTERCAPS_FOGRANGE |
@@ -697,15 +697,12 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
 pCaps-MaxAnisotropy =
 (DWORD)screen-get_paramf(screen, PIPE_CAPF_MAX_TEXTURE_ANISOTROPY);
 
-pCaps-MaxVertexW = 1.0f; /* XXX */
-pCaps-GuardBandLeft = screen-get_paramf(screen,
-  PIPE_CAPF_GUARD_BAND_LEFT);
-pCaps-GuardBandTop = screen-get_paramf(screen,
- PIPE_CAPF_GUARD_BAND_TOP);
-pCaps-GuardBandRight = screen-get_paramf(screen,
-   PIPE_CAPF_GUARD_BAND_RIGHT);
-pCaps-GuardBandBottom = screen-get_paramf(screen,
-PIPE_CAPF_GUARD_BAND_BOTTOM);
+/* Values for GeForce 9600 GT */
+pCaps-MaxVertexW = 1e10f;
+pCaps-GuardBandLeft = -1e9f;
+pCaps-GuardBandTop = -1e9f;
+pCaps-GuardBandRight = 1e9f;
+pCaps-GuardBandBottom = 1e9f;
 pCaps-ExtentsAdjust = 0.0f;
 
 pCaps-StencilCaps =
@@ -724,8 +721,6 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
 /*D3DFVFCAPS_DONOTSTRIPELEMENTS |*/
 D3DFVFCAPS_PSIZE;
 
-/* XXX: Some of these are probably not in SM2.0 so cap them when I figure
- * them out. For now leave them all enabled. */
 pCaps-TextureOpCaps = D3DTEXOPCAPS_DISABLE |
D3DTEXOPCAPS_SELECTARG1 |
D3DTEXOPCAPS_SELECTARG2 |
@@ -796,7 +791,8 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
 pCaps-MaxVertexShaderConst = NINE_MAX_CONST_F;
 
 pCaps-PixelShaderVersion = D3DPS_VERSION(3,0);
-pCaps-PixelShader1xMaxValue = 8.0f; /* XXX: wine */
+/* Value for GeForce 9600 GT */
+pCaps-PixelShader1xMaxValue = 65504.f;
 
 pCaps-DevCaps2 = D3DDEVCAPS2_STREAMOFFSET |
   D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET |
-- 
2.1.0

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


[Mesa-dev] [PATCH 68/71] st/nine: Silent warning in update_vertex_buffer

2015-08-16 Thread Axel Davy
There was an unused variable
---
 src/gallium/state_trackers/nine/nine_state.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index 847cf1b..558d07a 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -644,7 +644,6 @@ update_vertex_buffers(struct NineDevice9 *device)
 struct pipe_vertex_buffer dummy_vtxbuf;
 uint32_t mask = state-changed.vtxbuf;
 unsigned i;
-unsigned start;
 
 DBG(mask=%x\n, mask);
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 34/71] st/nine: Return correct error codes in NineDevice9_Reset

2015-08-16 Thread Axel Davy
From: Patrick Rudolph s...@das-labor.org

Allow more than two errors, and return D3DERR_INVALIDCALL for failed display 
resolution changes.

Reviewed-by: Axel Davy axel.d...@ens.fr
Signed-off-by: Patrick Rudolph s...@das-labor.org
---
 src/gallium/state_trackers/nine/device9.c| 4 ++--
 src/gallium/state_trackers/nine/swapchain9.c | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index f84364e..96d27e1 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -769,8 +769,8 @@ NineDevice9_Reset( struct NineDevice9 *This,
 for (i = 0; i  This-nswapchains; ++i) {
 D3DPRESENT_PARAMETERS *params = pPresentationParameters[i];
 hr = NineSwapChain9_Resize(This-swapchains[i], params, NULL);
-if (FAILED(hr))
-return (hr == D3DERR_OUTOFVIDEOMEMORY) ? hr : D3DERR_DEVICELOST;
+if (hr != D3D_OK)
+return hr;
 }
 
 nine_pipe_context_clear(This);
diff --git a/src/gallium/state_trackers/nine/swapchain9.c 
b/src/gallium/state_trackers/nine/swapchain9.c
index b6bc9c8..bb40960 100644
--- a/src/gallium/state_trackers/nine/swapchain9.c
+++ b/src/gallium/state_trackers/nine/swapchain9.c
@@ -184,7 +184,9 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This,
 
 /* Note: It is the role of the backend to fill if necessary
  * BackBufferWidth and BackBufferHeight */
-ID3DPresent_SetPresentParameters(This-present, pParams, This-mode);
+hr = ID3DPresent_SetPresentParameters(This-present, pParams, This-mode);
+if (hr != D3D_OK)
+return hr;
 
 /* When we have flip behaviour, d3d9 expects we get back the screen buffer 
when we flip.
  * Here we don't get back the initial content of the screen. To emulate 
the behaviour
-- 
2.1.0

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


[Mesa-dev] [PATCH 57/71] st/nine: Programmable ps D3DTTSS_PROJECTED support

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/device9.c  |  3 ++
 src/gallium/state_trackers/nine/nine_shader.c  | 59 --
 src/gallium/state_trackers/nine/nine_shader.h  |  1 +
 src/gallium/state_trackers/nine/nine_state.c   |  5 ++-
 src/gallium/state_trackers/nine/nine_state.h   |  5 ++-
 src/gallium/state_trackers/nine/pixelshader9.c |  2 +
 src/gallium/state_trackers/nine/pixelshader9.h |  7 +++
 7 files changed, 74 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 8023f78..aa5734b 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -2637,6 +2637,9 @@ NineDevice9_SetTextureStageState( struct NineDevice9 
*This,
 case D3DTSS_BUMPENVLOFFSET:
 bumpmap_index = 4 * 8 + 2 * Stage + 1;
 break;
+case D3DTSS_TEXTURETRANSFORMFLAGS:
+state-changed.group |= NINE_STATE_PS1X_SHADER;
+break;
 default:
 break;
 }
diff --git a/src/gallium/state_trackers/nine/nine_shader.c 
b/src/gallium/state_trackers/nine/nine_shader.c
index 2e35ede..7e76d7d 100644
--- a/src/gallium/state_trackers/nine/nine_shader.c
+++ b/src/gallium/state_trackers/nine/nine_shader.c
@@ -681,6 +681,54 @@ tx_pred_alloc(struct shader_translator *tx, INT idx)
 tx-regs.p = ureg_DECL_predicate(tx-ureg);
 }
 
+/* NOTE: It's not very clear on which ps1.1-ps1.3 instructions
+ * the projection should be applied on the texture. It doesn't
+ * apply on texkill.
+ * The doc is very imprecise here (it says the projection is done
+ * before rasterization, thus in vs, which seems wrong since ps instructions
+ * are affected differently)
+ * For now we only apply to the ps TEX instruction and TEXBEM.
+ * Perhaps some other instructions would need it */
+static inline void
+apply_ps1x_projection(struct shader_translator *tx, struct ureg_dst dst,
+  struct ureg_src src, INT idx)
+{
+struct ureg_dst tmp;
+unsigned dim = 1 + ((tx-info-projected  (2 * idx))  3);
+
+/* no projection */
+if (dim == 1) {
+ureg_MOV(tx-ureg, dst, src);
+} else {
+tmp = tx_scratch_scalar(tx);
+ureg_RCP(tx-ureg, tmp, ureg_scalar(src, dim-1));
+ureg_MUL(tx-ureg, dst, tx_src_scalar(tmp), src);
+}
+}
+
+static inline void
+TEX_with_ps1x_projection(struct shader_translator *tx, struct ureg_dst dst,
+ unsigned target, struct ureg_src src0,
+ struct ureg_src src1, INT idx)
+{
+unsigned dim = 1 + ((tx-info-projected  (2 * idx))  3);
+struct ureg_dst tmp;
+
+/* dim == 1: no projection
+ * Looks like must be disabled when it makes no
+ * sense according the texture dimensions
+ */
+if (dim == 1 || dim = target) {
+ureg_TEX(tx-ureg, dst, target, src0, src1);
+} else if (dim == 4) {
+ureg_TXP(tx-ureg, dst, target, src0, src1);
+} else {
+tmp = tx_scratch(tx);
+apply_ps1x_projection(tx, tmp, src0, idx);
+ureg_TEX(tx-ureg, dst, target, ureg_src(tmp), src1);
+}
+}
+
 static inline void
 tx_texcoord_alloc(struct shader_translator *tx, INT idx)
 {
@@ -2155,7 +2203,7 @@ DECL_SPECIAL(TEXBEM)
 {
 struct ureg_program *ureg = tx-ureg;
 struct ureg_dst dst = tx_dst_param(tx, tx-insn.dst[0]);
-struct ureg_dst tmp, tmp2;
+struct ureg_dst tmp, tmp2, texcoord;
 struct ureg_src sample, m00, m01, m10, m11;
 struct ureg_src bumpenvlscale, bumpenvloffset;
 const int m = tx-insn.dst[0].idx;
@@ -2170,6 +2218,7 @@ DECL_SPECIAL(TEXBEM)
 
 tmp = tx_scratch(tx);
 tmp2 = tx_scratch(tx);
+texcoord = tx_scratch(tx);
 /*
  * Bump-env-matrix:
  * 00 is X
@@ -2192,9 +2241,11 @@ DECL_SPECIAL(TEXBEM)
 bumpenvloffset = NINE_CONSTANT_SRC_SWIZZLE(8 + 8 + m / 2, W);
 }
 
+apply_ps1x_projection(tx, texcoord, tx-regs.vT[m], m);
+
 /* u' = TextureCoordinates(stage m)u + D3DTSS_BUMPENVMAT00(stage m)*t(n)R  
*/
 ureg_MAD(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_X), m00,
- NINE_APPLY_SWIZZLE(ureg_src(tx-regs.tS[n]), X), tx-regs.vT[m]);
+ NINE_APPLY_SWIZZLE(ureg_src(tx-regs.tS[n]), X), 
ureg_src(texcoord));
 /* u' = u' + D3DTSS_BUMPENVMAT10(stage m)*t(n)G */
 ureg_MAD(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_X), m10,
  NINE_APPLY_SWIZZLE(ureg_src(tx-regs.tS[n]), Y),
@@ -2202,7 +2253,7 @@ DECL_SPECIAL(TEXBEM)
 
 /* v' = TextureCoordinates(stage m)v + D3DTSS_BUMPENVMAT01(stage m)*t(n)R 
*/
 ureg_MAD(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Y), m01,
- NINE_APPLY_SWIZZLE(ureg_src(tx-regs.tS[n]), X), tx-regs.vT[m]);
+ NINE_APPLY_SWIZZLE(ureg_src(tx-regs.tS[n]), X), 
ureg_src(texcoord));
 /* v' = v' + D3DTSS_BUMPENVMAT11(stage m)*t(n)G*/
 ureg_MAD(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_Y), m11,
  

[Mesa-dev] [PATCH 45/71] st/nine: Rework constant buffer state handling

2015-08-16 Thread Axel Davy
We have two paths:
. One that uses a fixed constant buffer, and updates it when needed
. One that uses a user constant buffer, and upload it when needed.

This patch separates the preparation of the constant buffer
and the commit.

It also removes NineDevice9_RestoreNonCSOState, which was
used to restore all states. Instead the commit of the constant
buffer is moved to nine_state, and the other field settings
moved to other functions where more appropriate.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/device9.c|  69 +--
 src/gallium/state_trackers/nine/device9.h|   4 -
 src/gallium/state_trackers/nine/nine_state.c | 795 ++-
 src/gallium/state_trackers/nine/nine_state.h |   5 +
 src/gallium/state_trackers/nine/swapchain9.c |   2 +-
 5 files changed, 435 insertions(+), 440 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 1416a38..c568761 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -119,68 +119,6 @@ NineDevice9_SetDefaultState( struct NineDevice9 *This, 
boolean is_reset )
 This, (IDirect3DSurface9 *)This-swapchains[0]-zsbuf);
 }
 
-void
-NineDevice9_RestoreNonCSOState( struct NineDevice9 *This, unsigned mask )
-{
-struct pipe_context *pipe = This-pipe;
-
-DBG(This=%p mask=%u\n, This, mask);
-
-if (mask  0x1) {
-struct pipe_constant_buffer cb;
-cb.buffer_offset = 0;
-cb.buffer_size = This-vs_const_size;
-
-if (This-prefer_user_constbuf) {
-cb.buffer = NULL;
-cb.user_buffer = This-state.vs_const_f;
-if (!This-driver_caps.user_cbufs) {
-u_upload_data(This-constbuf_uploader,
-  0,
-  cb.buffer_size,
-  cb.user_buffer,
-  cb.buffer_offset,
-  cb.buffer);
-u_upload_unmap(This-constbuf_uploader);
-cb.user_buffer = NULL;
-}
-} else {
-cb.buffer = This-constbuf_vs;
-cb.user_buffer = NULL;
-}
-pipe-set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, cb);
-
-cb.buffer_size = This-ps_const_size;
-if (This-prefer_user_constbuf) {
-cb.user_buffer = This-state.ps_const_f;
-if (!This-driver_caps.user_cbufs) {
-u_upload_data(This-constbuf_uploader,
-  0,
-  cb.buffer_size,
-  cb.user_buffer,
-  cb.buffer_offset,
-  cb.buffer);
-u_upload_unmap(This-constbuf_uploader);
-cb.user_buffer = NULL;
-}
-} else {
-cb.buffer = This-constbuf_ps;
-}
-pipe-set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, 0, cb);
-}
-
-if (mask  0x2) {
-struct pipe_poly_stipple stipple;
-memset(stipple, ~0, sizeof(stipple));
-pipe-set_polygon_stipple(pipe, stipple);
-}
-
-This-state.changed.group = NINE_STATE_ALL;
-This-state.changed.vtxbuf = (1ULL  This-caps.MaxStreams) - 1;
-This-state.changed.ucp = (1  PIPE_MAX_CLIP_PLANES) - 1;
-This-state.changed.texture = NINE_PS_SAMPLERS_MASK | 
NINE_VS_SAMPLERS_MASK;
-}
-
 #define GET_PCAP(n) pScreen-get_param(pScreen, PIPE_CAP_##n)
 HRESULT
 NineDevice9_ctor( struct NineDevice9 *This,
@@ -455,7 +393,12 @@ NineDevice9_ctor( struct NineDevice9 *This,
 nine_ff_init(This); /* initialize fixed function code */
 
 NineDevice9_SetDefaultState(This, FALSE);
-NineDevice9_RestoreNonCSOState(This, ~0);
+
+{
+struct pipe_poly_stipple stipple;
+memset(stipple, ~0, sizeof(stipple));
+This-pipe-set_polygon_stipple(This-pipe, stipple);
+}
 
 This-update = This-state;
 nine_update_state(This);
diff --git a/src/gallium/state_trackers/nine/device9.h 
b/src/gallium/state_trackers/nine/device9.h
index 8b955a7..f109f3c 100644
--- a/src/gallium/state_trackers/nine/device9.h
+++ b/src/gallium/state_trackers/nine/device9.h
@@ -184,10 +184,6 @@ NineDevice9_GetCSO( struct NineDevice9 *This );
 const D3DCAPS9 *
 NineDevice9_GetCaps( struct NineDevice9 *This );
 
-/* Mask: 0x1 = constant buffers, 0x2 = stipple */
-void
-NineDevice9_RestoreNonCSOState( struct NineDevice9 *This, unsigned mask );
-
 /*** Direct3D public ***/
 
 HRESULT WINAPI
diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index 8c2b6eb..1b9622b 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -61,6 +61,275 @@ prepare_rasterizer(struct NineDevice9 *device)
 device-state.commit |= NINE_STATE_COMMIT_RASTERIZER;
 }
 
+#define DO_UPLOAD_CONST_F(buf,p,c,d) \
+   

[Mesa-dev] [PATCH 60/71] st/nine: Implement special DOTPRODUCT3 behaviour

2015-08-16 Thread Axel Davy
Taken from wine tests

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_ff.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/state_trackers/nine/nine_ff.c 
b/src/gallium/state_trackers/nine/nine_ff.c
index 6740274..59ea2cb 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -1366,6 +1366,10 @@ nine_ff_build_ps(struct NineDevice9 *device, struct 
nine_ff_ps_key *key)
 colorarg[2] != alphaarg[2])
 dst.WriteMask = TGSI_WRITEMASK_XYZ;
 
+/* Special DOTPRODUCT behaviour (see wine tests) */
+if (key-ts[s].colorop == D3DTOP_DOTPRODUCT3)
+dst.WriteMask = TGSI_WRITEMASK_XYZW;
+
 if (used_c  0x1) arg[0] = ps_get_ts_arg(ps, colorarg[0]);
 if (used_c  0x2) arg[1] = ps_get_ts_arg(ps, colorarg[1]);
 if (used_c  0x4) arg[2] = ps_get_ts_arg(ps, colorarg[2]);
-- 
2.1.0

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


[Mesa-dev] [PATCH 43/71] st/nine: Improve fallback when driver doesn't support user buffers.

2015-08-16 Thread Axel Davy
For now the path updated is only used by Amd drivers, but a later
patch will make it used by all drivers. Some drivers like llvmpipe
doesn't support the uploading of constants from user buffers, so improve
the path to work for all drivers

Inspired from the gl state tracker.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/device9.c| 70 +---
 src/gallium/state_trackers/nine/device9.h|  5 +-
 src/gallium/state_trackers/nine/nine_ff.c| 23 +
 src/gallium/state_trackers/nine/nine_state.c | 23 +
 4 files changed, 103 insertions(+), 18 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index a327bf8..1416a38 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -129,23 +129,43 @@ NineDevice9_RestoreNonCSOState( struct NineDevice9 *This, 
unsigned mask )
 if (mask  0x1) {
 struct pipe_constant_buffer cb;
 cb.buffer_offset = 0;
+cb.buffer_size = This-vs_const_size;
 
 if (This-prefer_user_constbuf) {
 cb.buffer = NULL;
 cb.user_buffer = This-state.vs_const_f;
+if (!This-driver_caps.user_cbufs) {
+u_upload_data(This-constbuf_uploader,
+  0,
+  cb.buffer_size,
+  cb.user_buffer,
+  cb.buffer_offset,
+  cb.buffer);
+u_upload_unmap(This-constbuf_uploader);
+cb.user_buffer = NULL;
+}
 } else {
 cb.buffer = This-constbuf_vs;
 cb.user_buffer = NULL;
 }
-cb.buffer_size = This-vs_const_size;
 pipe-set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, cb);
 
+cb.buffer_size = This-ps_const_size;
 if (This-prefer_user_constbuf) {
 cb.user_buffer = This-state.ps_const_f;
+if (!This-driver_caps.user_cbufs) {
+u_upload_data(This-constbuf_uploader,
+  0,
+  cb.buffer_size,
+  cb.user_buffer,
+  cb.buffer_offset,
+  cb.buffer);
+u_upload_unmap(This-constbuf_uploader);
+cb.user_buffer = NULL;
+}
 } else {
 cb.buffer = This-constbuf_ps;
 }
-cb.buffer_size = This-ps_const_size;
 pipe-set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, 0, cb);
 }
 
@@ -412,16 +432,20 @@ NineDevice9_ctor( struct NineDevice9 *This,
 }
 
 /* Allocate upload helper for drivers that suck (from st pov ;). */
-{
-unsigned bind = 0;
 
-This-driver_caps.user_vbufs = GET_PCAP(USER_VERTEX_BUFFERS);
-This-driver_caps.user_ibufs = GET_PCAP(USER_INDEX_BUFFERS);
+This-driver_caps.user_vbufs = GET_PCAP(USER_VERTEX_BUFFERS);
+This-driver_caps.user_ibufs = GET_PCAP(USER_INDEX_BUFFERS);
+This-driver_caps.user_cbufs = GET_PCAP(USER_CONSTANT_BUFFERS);
 
-if (!This-driver_caps.user_vbufs) bind |= PIPE_BIND_VERTEX_BUFFER;
-if (!This-driver_caps.user_ibufs) bind |= PIPE_BIND_INDEX_BUFFER;
-if (bind)
-This-upload = u_upload_create(This-pipe, 1  20, 4, bind);
+if (!This-driver_caps.user_vbufs)
+This-vertex_uploader = u_upload_create(This-pipe, 65536, 4, 
PIPE_BIND_VERTEX_BUFFER);
+if (!This-driver_caps.user_ibufs)
+This-index_uploader = u_upload_create(This-pipe, 128 * 1024, 4, 
PIPE_BIND_INDEX_BUFFER);
+if (!This-driver_caps.user_cbufs) {
+unsigned alignment = GET_PCAP(CONSTANT_BUFFER_OFFSET_ALIGNMENT);
+
+This-constbuf_uploader = u_upload_create(This-pipe, 
This-vs_const_size,
+  alignment, 
PIPE_BIND_CONSTANT_BUFFER);
 }
 
 This-driver_caps.window_space_position_support = 
GET_PCAP(TGSI_VS_WINDOW_SPACE_POSITION);
@@ -454,8 +478,12 @@ NineDevice9_dtor( struct NineDevice9 *This )
 nine_ff_fini(This);
 nine_state_clear(This-state, TRUE);
 
-if (This-upload)
-u_upload_destroy(This-upload);
+if (This-vertex_uploader)
+u_upload_destroy(This-vertex_uploader);
+if (This-index_uploader)
+u_upload_destroy(This-index_uploader);
+if (This-constbuf_uploader)
+u_upload_destroy(This-constbuf_uploader);
 
 nine_bind(This-record, NULL);
 
@@ -2963,13 +2991,16 @@ NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This,
 vtxbuf.buffer = NULL;
 vtxbuf.user_buffer = pVertexStreamZeroData;
 
-if (!This-driver_caps.user_vbufs)
-u_upload_data(This-upload,
+if (!This-driver_caps.user_vbufs) {
+u_upload_data(This-vertex_uploader,
   0,
   (info.max_index + 1) * VertexStreamZeroStride, /* XXX */
  

[Mesa-dev] [PATCH 54/71] st/nine: Advertise Fog flags

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/adapter9.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/nine/adapter9.c 
b/src/gallium/state_trackers/nine/adapter9.c
index c5ffcb1..ff1c33c 100644
--- a/src/gallium/state_trackers/nine/adapter9.c
+++ b/src/gallium/state_trackers/nine/adapter9.c
@@ -567,7 +567,7 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
D3DPIPECAP(BLEND_EQUATION_SEPARATE, 
D3DPMISCCAPS_SEPARATEALPHABLEND) |
D3DPIPECAP(MIXED_COLORBUFFER_FORMATS, 
D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS) |
D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING |
-   /*D3DPMISCCAPS_FOGVERTEXCLAMPED*/0;
+   D3DPMISCCAPS_FOGVERTEXCLAMPED;
 if (!screen-get_param(screen, PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION))
 pCaps-PrimitiveMiscCaps |= D3DPMISCCAPS_CLIPTLVERTS;
 
@@ -576,17 +576,17 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
 /*D3DPRASTERCAPS_COLORPERSPECTIVE |*/
 D3DPRASTERCAPS_DITHER |
 D3DPRASTERCAPS_DEPTHBIAS |
-/*D3DPRASTERCAPS_FOGRANGE |*/
-/*D3DPRASTERCAPS_FOGTABLE |*/
-/*D3DPRASTERCAPS_FOGVERTEX |*/
+D3DPRASTERCAPS_FOGRANGE |
+D3DPRASTERCAPS_FOGTABLE |
+D3DPRASTERCAPS_FOGVERTEX |
 D3DPRASTERCAPS_MIPMAPLODBIAS |
 D3DPRASTERCAPS_MULTISAMPLE_TOGGLE |
 D3DPRASTERCAPS_SCISSORTEST |
 D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS |
 /*D3DPRASTERCAPS_WBUFFER |*/
-/*D3DPRASTERCAPS_WFOG |*/
+D3DPRASTERCAPS_WFOG |
 /*D3DPRASTERCAPS_ZBUFFERLESSHSR |*/
-/*D3DPRASTERCAPS_ZFOG |*/
+D3DPRASTERCAPS_ZFOG |
 D3DPRASTERCAPS_ZTEST;
 
 pCaps-ZCmpCaps = D3DPCMPCAPS_NEVER |
-- 
2.1.0

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


[Mesa-dev] [PATCH 47/71] st/nine: Fix fixed function fog support

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_ff.c | 53 +++
 1 file changed, 19 insertions(+), 34 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_ff.c 
b/src/gallium/state_trackers/nine/nine_ff.c
index c08f5d3..9638d9c 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -64,7 +64,8 @@ struct nine_ff_vs_key
 uint32_t fog_range : 1;
 uint32_t color0in_one : 1;
 uint32_t color1in_one : 1;
-uint32_t pad1 : 8;
+uint32_t fog : 1;
+uint32_t pad1 : 7;
 uint32_t tc_gen : 24; /* 8 * 3 bits */
 uint32_t pad2 : 8;
 uint32_t tc_idx : 24;
@@ -110,7 +111,7 @@ struct nine_ff_ps_key
 uint32_t projected : 1;
 /* that's 32 bit exactly */
 } ts[8];
-uint32_t fog : 1; /* for vFog with programmable VS */
+uint32_t fog : 1; /* for vFog coming from VS */
 uint32_t fog_mode : 2;
 uint32_t specular : 1; /* 9 32-bit words with this */
 uint8_t colorarg_b4[3];
@@ -223,7 +224,6 @@ static void nine_ureg_tgsi_dump(struct ureg_program *ureg, 
boolean override)
  * CONST[28].x___ RS.FogEnd
  * CONST[28]._y__ 1.0f / (RS.FogEnd - RS.FogStart)
  * CONST[28].__z_ RS.FogDensity
- * CONST[29]  RS.FogColor
 
  * CONST[30].x___ TWEENFACTOR
  *
@@ -336,7 +336,6 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
 const struct nine_ff_vs_key *key = vs-key;
 struct ureg_program *ureg = ureg_create(TGSI_PROCESSOR_VERTEX);
 struct ureg_dst oPos, oCol[2], oTex[8], oPsz, oFog;
-struct ureg_dst rCol[2]; /* oCol if no fog, TEMP otherwise */
 struct ureg_dst rVtx, rNrm;
 struct ureg_dst r[8];
 struct ureg_dst AR;
@@ -421,19 +420,16 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
 oPos = ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0); /* HPOS */
 oCol[0] = ureg_saturate(ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 0));
 oCol[1] = ureg_saturate(ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 1));
+if (key-fog) {
+oFog = ureg_DECL_output(ureg, TGSI_SEMANTIC_FOG, 0);
+oFog = ureg_writemask(oFog, TGSI_WRITEMASK_X);
+}
 
 if (key-vertexpointsize || key-pointscale) {
 oPsz = ureg_DECL_output_masked(ureg, TGSI_SEMANTIC_PSIZE, 0,
TGSI_WRITEMASK_X, 0, 1);
 oPsz = ureg_writemask(oPsz, TGSI_WRITEMASK_X);
 }
-if (key-fog_mode) {
-/* We apply fog to the vertex colors, oFog is for programmable shaders 
only ?
- */
-oFog = ureg_DECL_output_masked(ureg, TGSI_SEMANTIC_FOG, 0,
-   TGSI_WRITEMASK_X, 0, 1);
-oFog = ureg_writemask(oFog, TGSI_WRITEMASK_X);
-}
 
 /* Declare TEMPs:
  */
@@ -445,14 +441,6 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
 if (key-lighting || key-vertexblend)
 AR = ureg_DECL_address(ureg);
 
-if (key-fog_mode) {
-rCol[0] = r[2];
-rCol[1] = r[3];
-} else {
-rCol[0] = oCol[0];
-rCol[1] = oCol[1];
-}
-
 rVtx = ureg_writemask(r[1], TGSI_WRITEMASK_XYZ);
 rNrm = ureg_writemask(r[2], TGSI_WRITEMASK_XYZ);
 
@@ -852,22 +840,22 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
 ureg_MAD(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XYZ), vs-mtlA, 
ureg_src(tmp), vs-mtlE);
 ureg_ADD(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W  ), vs-mtlA, 
vs-mtlE);
 }
-ureg_MAD(ureg, rCol[0], ureg_src(rD), vs-mtlD, ureg_src(tmp));
-ureg_MUL(ureg, rCol[1], ureg_src(rS), vs-mtlS);
+ureg_MAD(ureg, oCol[0], ureg_src(rD), vs-mtlD, ureg_src(tmp));
+ureg_MUL(ureg, oCol[1], ureg_src(rS), vs-mtlS);
 } else
 /* COLOR */
 if (key-darkness) {
 if (key-mtl_emissive == 0  key-mtl_ambient == 0) {
-ureg_MAD(ureg, rCol[0], vs-mtlD, ureg_imm4f(ureg, 0.0f, 0.0f, 
0.0f, 1.0f), _CONST(19));
+ureg_MAD(ureg, oCol[0], vs-mtlD, ureg_imm4f(ureg, 0.0f, 0.0f, 
0.0f, 1.0f), _CONST(19));
 } else {
-ureg_MAD(ureg, ureg_writemask(rCol[0], TGSI_WRITEMASK_XYZ), 
vs-mtlA, _CONST(25), vs-mtlE);
+ureg_MAD(ureg, ureg_writemask(oCol[0], TGSI_WRITEMASK_XYZ), 
vs-mtlA, _CONST(25), vs-mtlE);
 ureg_ADD(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W), 
vs-mtlA, vs-mtlE);
-ureg_ADD(ureg, ureg_writemask(rCol[0], TGSI_WRITEMASK_W), 
vs-mtlD, _W(tmp));
+ureg_ADD(ureg, ureg_writemask(oCol[0], TGSI_WRITEMASK_W), 
vs-mtlD, _W(tmp));
 }
-ureg_MUL(ureg, rCol[1], ureg_imm4f(ureg, 0.0f, 0.0f, 0.0f, 1.0f), 
vs-mtlS);
+ureg_MUL(ureg, oCol[1], ureg_imm4f(ureg, 0.0f, 0.0f, 0.0f, 1.0f), 
vs-mtlS);
 } else {
-ureg_MOV(ureg, 

[Mesa-dev] [PATCH 12/71] gallium: Add blending to pipe blit

2015-08-16 Thread Axel Davy
From: Christoph Bumiller e0425...@student.tuwien.ac.at

This type of blending is used for gallium nine software cursor

Signed-off-by: David Heidelberg da...@ixit.cz
---
 src/gallium/include/pipe/p_state.h   | 1 +
 src/gallium/state_trackers/nine/device9.c| 1 +
 src/gallium/state_trackers/nine/swapchain9.c | 2 ++
 src/mesa/state_tracker/st_cb_blit.c  | 1 +
 4 files changed, 5 insertions(+)

diff --git a/src/gallium/include/pipe/p_state.h 
b/src/gallium/include/pipe/p_state.h
index a233610..6dce0aa 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -660,6 +660,7 @@ struct pipe_blit_info
 
boolean render_condition_enable; /** whether the blit should honor the
 current render condition */
+   boolean alpha_blend; /* dst.rgb = src.rgb * src.a + dst.rgb * (1 - src.a) */
 };
 
 
diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 38af8e3..a1c05b4 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1460,6 +1460,7 @@ NineDevice9_StretchRect( struct NineDevice9 *This,
 blit.filter = Filter == D3DTEXF_LINEAR ?
PIPE_TEX_FILTER_LINEAR : PIPE_TEX_FILTER_NEAREST;
 blit.scissor_enable = FALSE;
+blit.alpha_blend = FALSE;
 
 /* If both of a src and dst dimension are negative, flip them. */
 if (blit.dst.box.width  0  blit.src.box.width  0) {
diff --git a/src/gallium/state_trackers/nine/swapchain9.c 
b/src/gallium/state_trackers/nine/swapchain9.c
index eb84d08..b8ad403 100644
--- a/src/gallium/state_trackers/nine/swapchain9.c
+++ b/src/gallium/state_trackers/nine/swapchain9.c
@@ -588,6 +588,7 @@ handle_draw_cursor_and_hud( struct NineSwapChain9 *This, 
struct pipe_resource *r
 blit.src.box.width, blit.src.box.height,
 blit.dst.box.x, blit.dst.box.y);
 
+blit.alpha_blend = TRUE;
 This-pipe-blit(This-pipe, blit);
 }
 
@@ -705,6 +706,7 @@ present( struct NineSwapChain9 *This,
 blit.mask = PIPE_MASK_RGBA;
 blit.filter = PIPE_TEX_FILTER_NEAREST;
 blit.scissor_enable = FALSE;
+blit.alpha_blend = FALSE;
 
 This-pipe-blit(This-pipe, blit);
 }
diff --git a/src/mesa/state_tracker/st_cb_blit.c 
b/src/mesa/state_tracker/st_cb_blit.c
index 1396906..4fdef7f 100644
--- a/src/mesa/state_tracker/st_cb_blit.c
+++ b/src/mesa/state_tracker/st_cb_blit.c
@@ -192,6 +192,7 @@ st_BlitFramebuffer(struct gl_context *ctx,
 
blit.filter = pFilter;
blit.render_condition_enable = TRUE;
+   blit.alpha_blend = FALSE;
 
if (mask  GL_COLOR_BUFFER_BIT) {
   struct gl_renderbuffer_attachment *srcAtt =
-- 
2.1.0

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


[Mesa-dev] [PATCH 46/71] st/nine: Rework ff constant buffers

2015-08-16 Thread Axel Davy
Always use a user constant buffer for ff.
It means we have to:
. commit the user constant buffer for ff when we use it
. commit back the non-ff constant buffer when we stop using it

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/device9.c|   8 ++
 src/gallium/state_trackers/nine/nine_ff.c| 118 +--
 src/gallium/state_trackers/nine/nine_state.c |  12 ++-
 src/gallium/state_trackers/nine/nine_state.h |   6 +-
 4 files changed, 57 insertions(+), 87 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index c568761..8023f78 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -3244,6 +3244,10 @@ NineDevice9_SetVertexShader( struct NineDevice9 *This,
 
 DBG(This=%p pShader=%p\n, This, pShader);
 
+/* ff - non-ff: commit back non-ff constants */
+if (!state-vs  pShader)
+state-commit |= NINE_STATE_COMMIT_CONST_VS;
+
 nine_bind(state-vs, pShader);
 
 state-changed.group |= NINE_STATE_VS;
@@ -3572,6 +3576,10 @@ NineDevice9_SetPixelShader( struct NineDevice9 *This,
 
 DBG(This=%p pShader=%p\n, This, pShader);
 
+/* ff - non-ff: commit back non-ff constants */
+if (!state-ps  pShader)
+state-commit |= NINE_STATE_COMMIT_CONST_PS;
+
 nine_bind(state-ps, pShader);
 
 state-changed.group |= NINE_STATE_PS;
diff --git a/src/gallium/state_trackers/nine/nine_ff.c 
b/src/gallium/state_trackers/nine/nine_ff.c
index ca76864..c08f5d3 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -1763,28 +1763,22 @@ nine_ff_load_viewport_info(struct NineDevice9 *device)
 void
 nine_ff_update(struct NineDevice9 *device)
 {
-struct pipe_context *pipe = device-pipe;
 struct nine_state *state = device-state;
+struct pipe_constant_buffer cb;
 
 DBG(vs=%p ps=%p\n, device-state.vs, device-state.ps);
 
 /* NOTE: the only reference belongs to the hash table */
-if (!device-state.vs)
+if (!device-state.vs) {
 device-ff.vs = nine_ff_get_vs(device);
-if (!device-state.ps)
+device-state.changed.group |= NINE_STATE_VS;
+}
+if (!device-state.ps) {
 device-ff.ps = nine_ff_get_ps(device);
+device-state.changed.group |= NINE_STATE_PS;
+}
 
 if (!device-state.vs) {
-if (device-state.ff.clobber.vs_const) {
-device-state.ff.clobber.vs_const = FALSE;
-device-state.changed.group |=
-NINE_STATE_FF_VSTRANSF |
-NINE_STATE_FF_MATERIAL |
-NINE_STATE_FF_LIGHTING |
-NINE_STATE_FF_OTHER;
-device-state.ff.changed.transform[0] |= 0xff000c;
-device-state.ff.changed.transform[8] |= 0xff;
-}
 nine_ff_load_vs_transforms(device);
 nine_ff_load_tex_matrices(device);
 nine_ff_load_lights(device);
@@ -1793,79 +1787,45 @@ nine_ff_update(struct NineDevice9 *device)
 
 memset(state-ff.changed.transform, 0, 
sizeof(state-ff.changed.transform));
 
-device-state.changed.group |= NINE_STATE_VS;
-device-state.changed.group |= NINE_STATE_VS_CONST;
-
-if (device-prefer_user_constbuf) {
-struct pipe_context *pipe = device-pipe;
-struct pipe_constant_buffer cb;
-cb.buffer_offset = 0;
-cb.buffer = NULL;
-cb.user_buffer = device-ff.vs_const;
-cb.buffer_size = NINE_FF_NUM_VS_CONST * 4 * sizeof(float);
-
-if (!device-driver_caps.user_cbufs) {
-u_upload_data(device-constbuf_uploader,
-  0,
-  cb.buffer_size,
-  cb.user_buffer,
-  cb.buffer_offset,
-  cb.buffer);
-u_upload_unmap(device-constbuf_uploader);
-cb.user_buffer = NULL;
-}
-pipe-set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, cb);
-} else {
-struct pipe_box box;
-u_box_1d(0, NINE_FF_NUM_VS_CONST * 4 * sizeof(float), box);
-pipe-transfer_inline_write(pipe, device-constbuf_vs, 0,
-0, box,
-device-ff.vs_const, 0, 0);
-nine_ranges_insert(device-state.changed.vs_const_f, 0, 
NINE_FF_NUM_VS_CONST,
-   device-range_pool);
+cb.buffer_offset = 0;
+cb.buffer = NULL;
+cb.user_buffer = device-ff.vs_const;
+cb.buffer_size = NINE_FF_NUM_VS_CONST * 4 * sizeof(float);
+
+if (!device-driver_caps.user_cbufs) {
+u_upload_data(device-constbuf_uploader,
+  0,
+  cb.buffer_size,
+  cb.user_buffer,
+  cb.buffer_offset,
+ 

[Mesa-dev] [PATCH 63/71] st/nine: Calculate dummy sampler state only once

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/device9.c| 21 ++---
 src/gallium/state_trackers/nine/device9.h|  3 ++-
 src/gallium/state_trackers/nine/nine_state.c | 35 
 3 files changed, 24 insertions(+), 35 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index aa5734b..b5ff774 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -336,6 +336,8 @@ NineDevice9_ctor( struct NineDevice9 *This,
 {
 struct pipe_resource tmplt;
 struct pipe_sampler_view templ;
+struct pipe_sampler_state samp;
+memset(samp, 0, sizeof(samp));
 
 tmplt.target = PIPE_TEXTURE_2D;
 tmplt.width0 = 1;
@@ -364,9 +366,22 @@ NineDevice9_ctor( struct NineDevice9 *This,
 templ.swizzle_a = PIPE_SWIZZLE_ONE;
 templ.target = This-dummy_texture-target;
 
-This-dummy_sampler = This-pipe-create_sampler_view(This-pipe, 
This-dummy_texture, templ);
-if (!This-dummy_sampler)
+This-dummy_sampler_view = This-pipe-create_sampler_view(This-pipe, 
This-dummy_texture, templ);
+if (!This-dummy_sampler_view)
 return D3DERR_DRIVERINTERNALERROR;
+
+samp.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
+samp.max_lod = 15.0f;
+samp.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
+samp.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
+samp.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
+samp.min_img_filter = PIPE_TEX_FILTER_NEAREST;
+samp.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
+samp.compare_mode = PIPE_TEX_COMPARE_NONE;
+samp.compare_func = PIPE_FUNC_LEQUAL;
+samp.normalized_coords = 1;
+samp.seamless_cube_map = 1;
+This-dummy_sampler_state = samp;
 }
 
 /* Allocate upload helper for drivers that suck (from st pov ;). */
@@ -430,7 +445,7 @@ NineDevice9_dtor( struct NineDevice9 *This )
 
 nine_bind(This-record, NULL);
 
-pipe_sampler_view_reference(This-dummy_sampler, NULL);
+pipe_sampler_view_reference(This-dummy_sampler_view, NULL);
 pipe_resource_reference(This-dummy_texture, NULL);
 pipe_resource_reference(This-constbuf_vs, NULL);
 pipe_resource_reference(This-constbuf_ps, NULL);
diff --git a/src/gallium/state_trackers/nine/device9.h 
b/src/gallium/state_trackers/nine/device9.h
index f109f3c..98d9c4d 100644
--- a/src/gallium/state_trackers/nine/device9.h
+++ b/src/gallium/state_trackers/nine/device9.h
@@ -84,7 +84,8 @@ struct NineDevice9
 uint16_t max_ps_const_f;
 
 struct pipe_resource *dummy_texture;
-struct pipe_sampler_view *dummy_sampler;
+struct pipe_sampler_view *dummy_sampler_view;
+struct pipe_sampler_state dummy_sampler_state;
 
 struct gen_mipmap_state *gen_mipmap;
 
diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index a7d884c..9d89c31 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -705,7 +705,6 @@ update_textures_and_samplers(struct NineDevice9 *device)
 struct pipe_context *pipe = device-pipe;
 struct nine_state *state = device-state;
 struct pipe_sampler_view *view[NINE_MAX_SAMPLERS];
-struct pipe_sampler_state samp;
 unsigned num_textures;
 unsigned i;
 boolean commit_views;
@@ -745,24 +744,11 @@ update_textures_and_samplers(struct NineDevice9 *device)
  * unbind dummy sampler directly when they are not needed
  * anymore, but they're going to be removed as long as texture
  * or sampler states are changed. */
-view[i] = device-dummy_sampler;
+view[i] = device-dummy_sampler_view;
 num_textures = i + 1;
 
-memset(samp, 0, sizeof(samp));
-samp.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
-samp.max_lod = 15.0f;
-samp.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
-samp.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
-samp.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
-samp.min_img_filter = PIPE_TEX_FILTER_NEAREST;
-samp.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
-samp.compare_mode = PIPE_TEX_COMPARE_NONE;
-samp.compare_func = PIPE_FUNC_LEQUAL;
-samp.normalized_coords = 1;
-samp.seamless_cube_map = 1;
-
 cso_single_sampler(device-cso, PIPE_SHADER_FRAGMENT,
-   s - NINE_SAMPLER_PS(0), samp);
+   s - NINE_SAMPLER_PS(0), 
device-dummy_sampler_state);
 
 commit_views = TRUE;
 commit_samplers = TRUE;
@@ -812,24 +798,11 @@ update_textures_and_samplers(struct NineDevice9 *device)
  * unbind dummy sampler directly when they are not needed
  * anymore, but they're going to be removed as long 

[Mesa-dev] [PATCH 48/71] st/nine: Begin programmable shader fog support

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_shader.c | 49 +++
 1 file changed, 42 insertions(+), 7 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_shader.c 
b/src/gallium/state_trackers/nine/nine_shader.c
index a11c4c7..d9a20a5 100644
--- a/src/gallium/state_trackers/nine/nine_shader.c
+++ b/src/gallium/state_trackers/nine/nine_shader.c
@@ -1095,9 +1095,18 @@ _tx_dst_param(struct shader_translator *tx, const struct 
sm1_dst_param *param)
 assert(param-idx = 0  param-idx  4);
 assert(!param-rel);
 tx-info-rt_mask |= 1  param-idx;
-if (ureg_dst_is_undef(tx-regs.oCol[param-idx]))
-tx-regs.oCol[param-idx] =
-   ureg_DECL_output(tx-ureg, TGSI_SEMANTIC_COLOR, param-idx);
+if (ureg_dst_is_undef(tx-regs.oCol[param-idx])) {
+/* ps  3: oCol[0] will have fog blending afterward
+ * vs  3: oD1.w (D3DPMISCCAPS_FOGANDSPECULARALPHA) set to 0 even 
if set */
+if (!IS_VS  tx-version.major  3  param-idx == 0) {
+tx-regs.oCol[0] = ureg_DECL_temporary(tx-ureg);
+} else if (IS_VS  tx-version.major  3  param-idx == 1) {
+tx-regs.oCol[1] = ureg_DECL_temporary(tx-ureg);
+} else {
+tx-regs.oCol[param-idx] =
+ureg_DECL_output(tx-ureg, TGSI_SEMANTIC_COLOR, 
param-idx);
+}
+}
 dst = tx-regs.oCol[param-idx];
 if (IS_VS  tx-version.major  3)
 dst = ureg_saturate(dst);
@@ -3185,6 +3194,16 @@ tgsi_processor_from_type(unsigned shader_type)
 }
 }
 
+static void
+shader_add_ps_fog_stage(struct shader_translator *tx, struct ureg_src src_col)
+{
+struct ureg_program *ureg = tx-ureg;
+struct ureg_dst oCol0 = ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 0);
+
+/* TODO: fog computation */
+ureg_MOV(ureg, oCol0, src_col);
+}
+
 #define GET_CAP(n) device-screen-get_param( \
   device-screen, PIPE_CAP_##n)
 #define GET_SHADER_CAP(n) device-screen-get_shader_param( \
@@ -3256,10 +3275,26 @@ nine_translate_shader(struct NineDevice9 *device, 
struct nine_shader_info *info)
 goto out;
 }
 
-if (IS_PS  (tx-version.major  2)  tx-num_temp) {
-ureg_MOV(tx-ureg, ureg_DECL_output(tx-ureg, TGSI_SEMANTIC_COLOR, 0),
- ureg_src(tx-regs.r[0]));
-info-rt_mask |= 0x1;
+if (IS_PS  tx-version.major  3) {
+if (tx-version.major  2) {
+assert(tx-num_temp); /* there must be color output */
+info-rt_mask |= 0x1;
+shader_add_ps_fog_stage(tx, ureg_src(tx-regs.r[0]));
+} else {
+shader_add_ps_fog_stage(tx, ureg_src(tx-regs.oCol[0]));
+}
+}
+
+if (IS_VS  tx-version.major  3  ureg_dst_is_undef(tx-regs.oFog)) {
+tx-regs.oFog = ureg_DECL_output(tx-ureg, TGSI_SEMANTIC_FOG, 0);
+ureg_MOV(tx-ureg, ureg_writemask(tx-regs.oFog, TGSI_WRITEMASK_X), 
ureg_imm1f(tx-ureg, 0.0f));
+}
+
+/* vs  3: oD1.w (D3DPMISCCAPS_FOGANDSPECULARALPHA) set to 0 even if set */
+if (IS_VS  tx-version.major  3  
!ureg_dst_is_undef(tx-regs.oCol[1])) {
+struct ureg_dst dst = ureg_DECL_output(tx-ureg, TGSI_SEMANTIC_COLOR, 
1);
+ureg_MOV(tx-ureg, ureg_writemask(dst, TGSI_WRITEMASK_XYZ), 
ureg_src(tx-regs.oCol[1]));
+ureg_MOV(tx-ureg, ureg_writemask(dst, TGSI_WRITEMASK_W), 
ureg_imm1f(tx-ureg, 0.0f));
 }
 
 if (info-position_t)
-- 
2.1.0

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


[Mesa-dev] [PATCH 40/71] st/nine: Reorder DSA state settings

2015-08-16 Thread Axel Davy
Separate state preparation and state commit

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_pipe.c  |  5 +++--
 src/gallium/state_trackers/nine/nine_pipe.h  |  2 +-
 src/gallium/state_trackers/nine/nine_state.c | 27 +++
 src/gallium/state_trackers/nine/nine_state.h |  7 +++
 4 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_pipe.c 
b/src/gallium/state_trackers/nine/nine_pipe.c
index ddf8e8b..0538957 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.c
+++ b/src/gallium/state_trackers/nine/nine_pipe.c
@@ -27,7 +27,8 @@
 #include cso_cache/cso_context.h
 
 void
-nine_convert_dsa_state(struct cso_context *ctx, const DWORD *rs)
+nine_convert_dsa_state(struct pipe_depth_stencil_alpha_state *dsa_state,
+   const DWORD *rs)
 {
 struct pipe_depth_stencil_alpha_state dsa;
 
@@ -65,7 +66,7 @@ nine_convert_dsa_state(struct cso_context *ctx, const DWORD 
*rs)
 dsa.alpha.ref_value = (float)rs[D3DRS_ALPHAREF] / 255.0f;
 }
 
-cso_set_depth_stencil_alpha(ctx, dsa);
+*dsa_state = dsa;
 }
 
 /* TODO: Keep a static copy in device so we don't have to memset every time ? 
*/
diff --git a/src/gallium/state_trackers/nine/nine_pipe.h 
b/src/gallium/state_trackers/nine/nine_pipe.h
index 9fde06d..2f2e9cb 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.h
+++ b/src/gallium/state_trackers/nine/nine_pipe.h
@@ -37,7 +37,7 @@ struct cso_context;
 extern const enum pipe_format nine_d3d9_to_pipe_format_map[120];
 extern const D3DFORMAT nine_pipe_to_d3d9_format_map[PIPE_FORMAT_COUNT];
 
-void nine_convert_dsa_state(struct cso_context *, const DWORD *);
+void nine_convert_dsa_state(struct pipe_depth_stencil_alpha_state *, const 
DWORD *);
 void nine_convert_rasterizer_state(struct cso_context *, const DWORD *);
 void nine_convert_blend_state(struct cso_context *, const DWORD *);
 void nine_convert_sampler_state(struct cso_context *, int idx, const DWORD *);
diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index 47e4148..7875d31 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -39,6 +39,13 @@
 
 /* State preparation only */
 
+static inline void
+prepare_dsa(struct NineDevice9 *device)
+{
+nine_convert_dsa_state(device-state.pipe.dsa, device-state.rs);
+device-state.commit |= NINE_STATE_COMMIT_DSA;
+}
+
 /* State preparation incremental */
 
 /* State preparation + State commit */
@@ -189,12 +196,6 @@ update_blend(struct NineDevice9 *device)
 }
 
 static inline void
-update_dsa(struct NineDevice9 *device)
-{
-nine_convert_dsa_state(device-cso, device-state.rs);
-}
-
-static inline void
 update_rasterizer(struct NineDevice9 *device)
 {
 nine_convert_rasterizer_state(device-cso, device-state.rs);
@@ -844,6 +845,12 @@ update_textures_and_samplers(struct NineDevice9 *device)
 /* State commit only */
 
 static inline void
+commit_dsa(struct NineDevice9 *device)
+{
+cso_set_depth_stencil_alpha(device-cso, device-state.pipe.dsa);
+}
+
+static inline void
 commit_scissor(struct NineDevice9 *device)
 {
 struct pipe_context *pipe = device-pipe;
@@ -943,7 +950,7 @@ nine_update_state(struct NineDevice9 *device)
 commit_scissor(device);
 
 if (group  NINE_STATE_DSA)
-update_dsa(device);
+prepare_dsa(device);
 if (group  NINE_STATE_BLEND)
 update_blend(device);
 
@@ -1003,6 +1010,11 @@ nine_update_state(struct NineDevice9 *device)
 if (state-changed.vtxbuf)
 update_vertex_buffers(device);
 
+if (state-commit  NINE_STATE_COMMIT_DSA)
+commit_dsa(device);
+
+state-commit = 0;
+
 device-state.changed.group =
 (NINE_STATE_FF | NINE_STATE_VS_CONST | NINE_STATE_PS_CONST);
 
@@ -1636,4 +1648,3 @@ const char *nine_d3drs_to_string(DWORD State)
 return (invalid);
 }
 }
-
diff --git a/src/gallium/state_trackers/nine/nine_state.h 
b/src/gallium/state_trackers/nine/nine_state.h
index 452b4f2..e833225 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -78,6 +78,8 @@
 #define NINE_STATE_ALL  0x0ff
 #define NINE_STATE_UNHANDLED   (1  24)
 
+#define NINE_STATE_COMMIT_DSA  (1  0)
+
 
 #define NINE_MAX_SIMULTANEOUS_RENDERTARGETS 4
 #define NINE_MAX_CONST_F_PS3 224
@@ -208,6 +210,11 @@ struct nine_state
 
 DWORD tex_stage[NINE_MAX_SAMPLERS][NINED3DTSS_COUNT];
 } ff;
+
+uint32_t commit;
+struct {
+struct pipe_depth_stencil_alpha_state dsa;
+} pipe;
 };
 
 /* map D3DRS - NINE_STATE_x
-- 
2.1.0

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


[Mesa-dev] [PATCH 38/71] st/nine: Remove group_mask argument from nine_update_state

2015-08-16 Thread Axel Davy
It was only used to discriminate update framebuffer vs update
everything. Instead use two functions.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/device9.c| 14 +++---
 src/gallium/state_trackers/nine/nine_state.c | 23 ++-
 src/gallium/state_trackers/nine/nine_state.h |  3 ++-
 src/gallium/state_trackers/nine/swapchain9.c |  2 +-
 4 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 1ca04a4..4aa5892 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -434,7 +434,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
 NineDevice9_RestoreNonCSOState(This, ~0);
 
 This-update = This-state;
-nine_update_state(This, ~0);
+nine_update_state(This);
 
 ID3DPresentGroup_Release(This-present);
 
@@ -1902,7 +1902,7 @@ NineDevice9_Clear( struct NineDevice9 *This,
 return D3D_OK;
 d3dcolor_to_pipe_color_union(rgba, Color);
 
-nine_update_state(This, NINE_STATE_FB);
+nine_update_state_framebuffer(This);
 
 rect.x1 = This-state.viewport.X;
 rect.y1 = This-state.viewport.Y;
@@ -2882,7 +2882,7 @@ NineDevice9_DrawPrimitive( struct NineDevice9 *This,
 DBG(iface %p, PrimitiveType %u, StartVertex %u, PrimitiveCount %u\n,
 This, PrimitiveType, StartVertex, PrimitiveCount);
 
-nine_update_state(This, ~0);
+nine_update_state(This);
 
 init_draw_info(info, This, PrimitiveType, PrimitiveCount);
 info.indexed = FALSE;
@@ -2915,7 +2915,7 @@ NineDevice9_DrawIndexedPrimitive( struct NineDevice9 
*This,
 user_assert(This-state.idxbuf, D3DERR_INVALIDCALL);
 user_assert(This-state.vdecl, D3DERR_INVALIDCALL);
 
-nine_update_state(This, ~0);
+nine_update_state(This);
 
 init_draw_info(info, This, PrimitiveType, PrimitiveCount);
 info.indexed = TRUE;
@@ -2947,7 +2947,7 @@ NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This,
 user_assert(pVertexStreamZeroData  VertexStreamZeroStride,
 D3DERR_INVALIDCALL);
 
-nine_update_state(This, ~0);
+nine_update_state(This);
 
 init_draw_info(info, This, PrimitiveType, PrimitiveCount);
 info.indexed = FALSE;
@@ -3009,7 +3009,7 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 
*This,
 user_assert(IndexDataFormat == D3DFMT_INDEX16 ||
 IndexDataFormat == D3DFMT_INDEX32, D3DERR_INVALIDCALL);
 
-nine_update_state(This, ~0);
+nine_update_state(This);
 
 init_draw_info(info, This, PrimitiveType, PrimitiveCount);
 info.indexed = TRUE;
@@ -3093,7 +3093,7 @@ NineDevice9_ProcessVertices( struct NineDevice9 *This,
 if (!screen-get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS))
 STUB(D3DERR_INVALIDCALL);
 
-nine_update_state(This, ~0);
+nine_update_state(This);
 
 /* TODO: Create shader with stream output. */
 STUB(D3DERR_INVALIDCALL);
diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index 403cd23..68f14d2 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -885,8 +885,21 @@ update_textures_and_samplers(struct NineDevice9 *device)
  NINE_STATE_VS | \
  NINE_STATE_PS)
 
+void
+nine_update_state_framebuffer(struct NineDevice9 *device)
+{
+struct nine_state *state = device-state;
+
+validate_textures(device);
+
+if (state-changed.group  NINE_STATE_FB)
+update_framebuffer(device);
+
+state-changed.group = ~NINE_STATE_FB;
+}
+
 boolean
-nine_update_state(struct NineDevice9 *device, uint32_t mask)
+nine_update_state(struct NineDevice9 *device)
 {
 struct pipe_context *pipe = device-pipe;
 struct nine_state *state = device-state;
@@ -905,16 +918,16 @@ nine_update_state(struct NineDevice9 *device, uint32_t 
mask)
 validate_textures(device); /* may clobber state */
 
 /* ff_update may change VS/PS dirty bits */
-if ((mask  NINE_STATE_FF)  unlikely(!state-vs || !state-ps))
+if (unlikely(!state-vs || !state-ps))
 nine_ff_update(device);
-group = state-changed.group  mask;
+group = state-changed.group;
 
 if (group  NINE_STATE_SHADER_VARIANT_GROUP)
 group |= update_shader_variant_keys(device);
 
 if (group  NINE_STATE_FREQ_GROUP_0) {
 if (group  NINE_STATE_FB)
-group = update_framebuffer(device)  mask;
+group = update_framebuffer(device);
 if (group  NINE_STATE_VIEWPORT)
 update_viewport(device);
 if (group  NINE_STATE_SCISSOR)
@@ -981,7 +994,7 @@ nine_update_state(struct NineDevice9 *device, uint32_t mask)
 if (state-changed.vtxbuf)
 update_vertex_buffers(device);
 
-device-state.changed.group = ~mask |
+device-state.changed.group =
 (NINE_STATE_FF | NINE_STATE_VS_CONST | NINE_STATE_PS_CONST);
 
 

[Mesa-dev] [PATCH 26/71] st/nine: Fix GenerateMipSubLevels potential crash

2015-08-16 Thread Axel Davy
From: Patrick Rudolph s...@das-labor.org

For the case of D3DPOOL_MANAGED textures, This-base.resource can be NULL
at the start of the function. In This case, UploadSelf will take care
of the defining. Assign resource after the UploadSelf call
to prevent NULL pointer exception.

Reviewed-by: Axel Davy axel.d...@ens.fr
Signed-off-by: Patrick Rudolph s...@das-labor.org
---
 src/gallium/state_trackers/nine/basetexture9.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/nine/basetexture9.c 
b/src/gallium/state_trackers/nine/basetexture9.c
index 110df79..48fccb2 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -385,8 +385,7 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
 void WINAPI
 NineBaseTexture9_GenerateMipSubLevels( struct NineBaseTexture9 *This )
 {
-struct pipe_resource *resource = This-base.resource;
-
+struct pipe_resource *resource;
 unsigned base_level = 0;
 unsigned last_level = This-base.info.last_level - This-managed.lod;
 unsigned first_layer = 0;
@@ -409,6 +408,8 @@ NineBaseTexture9_GenerateMipSubLevels( struct 
NineBaseTexture9 *This )
 
 last_layer = util_max_layer(This-view[0]-texture, base_level);
 
+resource = This-base.resource;
+
 util_gen_mipmap(This-pipe, resource,
 resource-format, base_level, last_level,
 first_layer, last_layer, filter);
-- 
2.1.0

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


[Mesa-dev] [PATCH 37/71] st/nine: Implement TEXBEM, TEXBEML and BEM

2015-08-16 Thread Axel Davy
From: Tiziano Bacocco tizb...@gmail.com

Signed-off-by: Tiziano Bacocco tizb...@gmail.com
---
 src/gallium/state_trackers/nine/device9.c  |  32 ++-
 src/gallium/state_trackers/nine/nine_shader.c  | 126 +++--
 src/gallium/state_trackers/nine/nine_shader.h  |   1 +
 src/gallium/state_trackers/nine/nine_state.c   |  10 ++
 src/gallium/state_trackers/nine/nine_state.h   |   2 +
 src/gallium/state_trackers/nine/pixelshader9.c |   1 +
 src/gallium/state_trackers/nine/pixelshader9.h |   1 +
 7 files changed, 165 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index e0f3e39..1ca04a4 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -342,8 +342,9 @@ NineDevice9_ctor( struct NineDevice9 *This,
 This-state.vs_const_f = CALLOC(This-vs_const_size, 1);
 This-state.ps_const_f = CALLOC(This-ps_const_size, 1);
 This-state.vs_lconstf_temp = CALLOC(This-vs_const_size,1);
+This-state.ps_lconstf_temp = CALLOC(This-ps_const_size,1);
 if (!This-state.vs_const_f || !This-state.ps_const_f ||
-!This-state.vs_lconstf_temp)
+!This-state.vs_lconstf_temp || !This-state.ps_lconstf_temp)
 return E_OUTOFMEMORY;
 
 if (strstr(pScreen-get_name(pScreen), AMD) ||
@@ -466,6 +467,7 @@ NineDevice9_dtor( struct NineDevice9 *This )
 FREE(This-state.vs_const_f);
 FREE(This-state.ps_const_f);
 FREE(This-state.vs_lconstf_temp);
+FREE(This-state.ps_lconstf_temp);
 
 if (This-swapchains) {
 for (i = 0; i  This-nswapchains; ++i)
@@ -2636,6 +2638,7 @@ NineDevice9_SetTextureStageState( struct NineDevice9 
*This,
   DWORD Value )
 {
 struct nine_state *state = This-update;
+int bumpmap_index = -1;
 
 DBG(Stage=%u Type=%u Value=%08x\n, Stage, Type, Value);
 nine_dump_D3DTSS_value(DBG_FF, Type, Value);
@@ -2644,6 +2647,33 @@ NineDevice9_SetTextureStageState( struct NineDevice9 
*This,
 user_assert(Type  Elements(state-ff.tex_stage[0]), D3DERR_INVALIDCALL);
 
 state-ff.tex_stage[Stage][Type] = Value;
+switch (Type) {
+case D3DTSS_BUMPENVMAT00:
+bumpmap_index = 4 * Stage;
+break;
+case D3DTSS_BUMPENVMAT10:
+bumpmap_index = 4 * Stage + 1;
+break;
+case D3DTSS_BUMPENVMAT01:
+bumpmap_index = 4 * Stage + 2;
+break;
+case D3DTSS_BUMPENVMAT11:
+bumpmap_index = 4 * Stage + 3;
+break;
+case D3DTSS_BUMPENVLSCALE:
+bumpmap_index = 4 * 8 + 2 * Stage;
+break;
+case D3DTSS_BUMPENVLOFFSET:
+bumpmap_index = 4 * 8 + 2 * Stage + 1;
+break;
+default:
+break;
+}
+
+if (bumpmap_index = 0) {
+state-bumpmap_vars[bumpmap_index] = Value;
+state-changed.group |= NINE_STATE_PS_CONST;
+}
 
 state-changed.group |= NINE_STATE_FF_PSSTAGES;
 state-ff.changed.tex_stage[Stage][Type / 32] |= 1  (Type % 32);
diff --git a/src/gallium/state_trackers/nine/nine_shader.c 
b/src/gallium/state_trackers/nine/nine_shader.c
index 754f5af..a11c4c7 100644
--- a/src/gallium/state_trackers/nine/nine_shader.c
+++ b/src/gallium/state_trackers/nine/nine_shader.c
@@ -89,6 +89,15 @@ static inline const char *d3dsio_to_string(unsigned opcode);
 #define NINE_SWIZZLE4(x,y,z,w) \
TGSI_SWIZZLE_##x, TGSI_SWIZZLE_##y, TGSI_SWIZZLE_##z, TGSI_SWIZZLE_##w
 
+#define NINE_CONSTANT_SRC(index) \
+   ureg_src_register(TGSI_FILE_CONSTANT, index)
+
+#define NINE_APPLY_SWIZZLE(src, s) \
+   ureg_swizzle(src, NINE_SWIZZLE4(s, s, s, s))
+
+#define NINE_CONSTANT_SRC_SWIZZLE(index, s) \
+   NINE_APPLY_SWIZZLE(NINE_CONSTANT_SRC(index), s)
+
 #define NINED3DSPDM_SATURATE (D3DSPDM_SATURATE  D3DSP_DSTMOD_SHIFT)
 #define NINED3DSPDM_PARTIALP (D3DSPDM_PARTIALPRECISION  D3DSP_DSTMOD_SHIFT)
 #define NINED3DSPDM_CENTROID (D3DSPDM_MSAMPCENTROID  D3DSP_DSTMOD_SHIFT)
@@ -2135,12 +2144,76 @@ DECL_SPECIAL(TEXKILL)
 
 DECL_SPECIAL(TEXBEM)
 {
-STUB(D3DERR_INVALIDCALL);
-}
+struct ureg_program *ureg = tx-ureg;
+struct ureg_dst dst = tx_dst_param(tx, tx-insn.dst[0]);
+struct ureg_dst tmp, tmp2;
+struct ureg_src sample, m00, m01, m10, m11;
+struct ureg_src bumpenvlscale, bumpenvloffset;
+const int m = tx-insn.dst[0].idx;
+const int n = tx-insn.src[0].idx;
 
-DECL_SPECIAL(TEXBEML)
-{
-STUB(D3DERR_INVALIDCALL);
+assert(tx-version.major == 1);
+
+sample = ureg_DECL_sampler(ureg, m);
+tx-info-sampler_mask |= 1  m;
+
+tx_texcoord_alloc(tx, m);
+
+tmp = tx_scratch(tx);
+tmp2 = tx_scratch(tx);
+/*
+ * Bump-env-matrix:
+ * 00 is X
+ * 01 is Y
+ * 10 is Z
+ * 11 is W
+ */
+nine_info_mark_const_f_used(tx-info, 8 + 8 + m/2);
+m00 = NINE_CONSTANT_SRC_SWIZZLE(8 + m, X);
+m01 = NINE_CONSTANT_SRC_SWIZZLE(8 + m, Y);
+m10 = NINE_CONSTANT_SRC_SWIZZLE(8 + m, Z);
+

[Mesa-dev] [PATCH 44/71] st/nine: Rework blend states

2015-08-16 Thread Axel Davy
Separate state preparation and state commit

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_pipe.c  |  4 ++--
 src/gallium/state_trackers/nine/nine_pipe.h  |  2 +-
 src/gallium/state_trackers/nine/nine_state.c | 23 ---
 src/gallium/state_trackers/nine/nine_state.h |  2 ++
 4 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_pipe.c 
b/src/gallium/state_trackers/nine/nine_pipe.c
index ff5ec60..668ce38 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.c
+++ b/src/gallium/state_trackers/nine/nine_pipe.c
@@ -144,7 +144,7 @@ nine_convert_blend_state_fixup(struct pipe_blend_state 
*blend, const DWORD *rs)
 }
 
 void
-nine_convert_blend_state(struct cso_context *ctx, const DWORD *rs)
+nine_convert_blend_state(struct pipe_blend_state *blend_state, const DWORD *rs)
 {
 struct pipe_blend_state blend;
 
@@ -188,7 +188,7 @@ nine_convert_blend_state(struct cso_context *ctx, const 
DWORD *rs)
 
 /* blend.force_srgb = !!rs[D3DRS_SRGBWRITEENABLE]; */
 
-cso_set_blend(ctx, blend);
+*blend_state = blend;
 }
 
 void
diff --git a/src/gallium/state_trackers/nine/nine_pipe.h 
b/src/gallium/state_trackers/nine/nine_pipe.h
index e2680f6..8611786 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.h
+++ b/src/gallium/state_trackers/nine/nine_pipe.h
@@ -39,7 +39,7 @@ extern const D3DFORMAT 
nine_pipe_to_d3d9_format_map[PIPE_FORMAT_COUNT];
 
 void nine_convert_dsa_state(struct pipe_depth_stencil_alpha_state *, const 
DWORD *);
 void nine_convert_rasterizer_state(struct pipe_rasterizer_state *, const DWORD 
*);
-void nine_convert_blend_state(struct cso_context *, const DWORD *);
+void nine_convert_blend_state(struct pipe_blend_state *, const DWORD *);
 void nine_convert_sampler_state(struct cso_context *, int idx, const DWORD *);
 
 void nine_pipe_context_clear(struct NineDevice9 *);
diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index 2fb2f7a..8c2b6eb 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -41,6 +41,13 @@
 /* State preparation only */
 
 static inline void
+prepare_blend(struct NineDevice9 *device)
+{
+nine_convert_blend_state(device-state.pipe.blend, device-state.rs);
+device-state.commit |= NINE_STATE_COMMIT_BLEND;
+}
+
+static inline void
 prepare_dsa(struct NineDevice9 *device)
 {
 nine_convert_dsa_state(device-state.pipe.dsa, device-state.rs);
@@ -197,12 +204,6 @@ update_viewport(struct NineDevice9 *device)
 pipe-set_viewport_states(pipe, 0, 1, pvport);
 }
 
-static inline void
-update_blend(struct NineDevice9 *device)
-{
-nine_convert_blend_state(device-cso, device-state.rs);
-}
-
 /* Loop through VS inputs and pick the vertex elements with the declared
  * usage from the vertex declaration, then insert the instance divisor from
  * the stream source frequency setting.
@@ -869,6 +870,12 @@ update_textures_and_samplers(struct NineDevice9 *device)
 /* State commit only */
 
 static inline void
+commit_blend(struct NineDevice9 *device)
+{
+cso_set_blend(device-cso, device-state.pipe.blend);
+}
+
+static inline void
 commit_dsa(struct NineDevice9 *device)
 {
 cso_set_depth_stencil_alpha(device-cso, device-state.pipe.dsa);
@@ -982,7 +989,7 @@ nine_update_state(struct NineDevice9 *device)
 if (group  NINE_STATE_DSA)
 prepare_dsa(device);
 if (group  NINE_STATE_BLEND)
-update_blend(device);
+prepare_blend(device);
 
 if (group  NINE_STATE_VS)
 group |= update_vs(device);
@@ -1040,6 +1047,8 @@ nine_update_state(struct NineDevice9 *device)
 if (state-changed.vtxbuf)
 update_vertex_buffers(device);
 
+if (state-commit  NINE_STATE_COMMIT_BLEND)
+commit_blend(device);
 if (state-commit  NINE_STATE_COMMIT_DSA)
 commit_dsa(device);
 if (state-commit  NINE_STATE_COMMIT_RASTERIZER)
diff --git a/src/gallium/state_trackers/nine/nine_state.h 
b/src/gallium/state_trackers/nine/nine_state.h
index bd2ad38..60e5d8f 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -80,6 +80,7 @@
 
 #define NINE_STATE_COMMIT_DSA  (1  0)
 #define NINE_STATE_COMMIT_RASTERIZER (1  1)
+#define NINE_STATE_COMMIT_BLEND (1  2)
 
 
 #define NINE_MAX_SIMULTANEOUS_RENDERTARGETS 4
@@ -216,6 +217,7 @@ struct nine_state
 struct {
 struct pipe_depth_stencil_alpha_state dsa;
 struct pipe_rasterizer_state rast;
+struct pipe_blend_state blend;
 } pipe;
 };
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 69/71] st/nine: Silent warning in NineCubeTexture9_ctor

2015-08-16 Thread Axel Davy
The compiler was complaining the value may be uninitialised
when it is used (which is wrong). Initialize to NULL to silent
the warning.
---
 src/gallium/state_trackers/nine/cubetexture9.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/cubetexture9.c 
b/src/gallium/state_trackers/nine/cubetexture9.c
index a2bb9b9..abba263 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -43,7 +43,7 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
 struct pipe_screen *screen = pParams-device-screen;
 enum pipe_format pf;
 unsigned i, l, f, offset, face_size = 0;
-unsigned *level_offsets;
+unsigned *level_offsets = NULL;
 D3DSURFACE_DESC sfdesc;
 void *p;
 HRESULT hr;
-- 
2.1.0

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


[Mesa-dev] [PATCH 39/71] st/nine: Reorder nine_state.

2015-08-16 Thread Axel Davy
Instead of mixing state preparation (filling pipe_)
and state commit (pipe-set_*),
begin doing so in two separate functions.

This will allow to implement efficient Stateblocks,
and eventually lead to optimisation where the complete
pipe_*** structure is only partially updated.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_state.c | 74 
 1 file changed, 43 insertions(+), 31 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index 68f14d2..47e4148 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -37,6 +37,12 @@
 
 #define DBG_CHANNEL DBG_DEVICE
 
+/* State preparation only */
+
+/* State preparation incremental */
+
+/* State preparation + State commit */
+
 static uint32_t
 update_framebuffer(struct NineDevice9 *device)
 {
@@ -177,14 +183,6 @@ update_viewport(struct NineDevice9 *device)
 }
 
 static inline void
-update_scissor(struct NineDevice9 *device)
-{
-struct pipe_context *pipe = device-pipe;
-
-pipe-set_scissor_states(pipe, 0, 1, device-state.scissor);
-}
-
-static inline void
 update_blend(struct NineDevice9 *device)
 {
 nine_convert_blend_state(device-cso, device-state.rs);
@@ -665,27 +663,6 @@ update_vertex_buffers(struct NineDevice9 *device)
 state-changed.vtxbuf = 0;
 }
 
-static inline void
-update_index_buffer(struct NineDevice9 *device)
-{
-struct pipe_context *pipe = device-pipe;
-if (device-state.idxbuf)
-pipe-set_index_buffer(pipe, device-state.idxbuf-buffer);
-else
-pipe-set_index_buffer(pipe, NULL);
-}
-
-/* TODO: only go through dirty textures */
-static void
-validate_textures(struct NineDevice9 *device)
-{
-struct NineBaseTexture9 *tex, *ptr;
-LIST_FOR_EACH_ENTRY_SAFE(tex, ptr, device-update_textures, list) {
-list_delinit(tex-list);
-NineBaseTexture9_Validate(tex);
-}
-}
-
 static inline boolean
 update_sampler_derived(struct nine_state *state, unsigned s)
 {
@@ -864,6 +841,27 @@ update_textures_and_samplers(struct NineDevice9 *device)
 state-changed.texture = 0;
 }
 
+/* State commit only */
+
+static inline void
+commit_scissor(struct NineDevice9 *device)
+{
+struct pipe_context *pipe = device-pipe;
+
+pipe-set_scissor_states(pipe, 0, 1, device-state.scissor);
+}
+
+static inline void
+commit_index_buffer(struct NineDevice9 *device)
+{
+struct pipe_context *pipe = device-pipe;
+if (device-state.idxbuf)
+pipe-set_index_buffer(pipe, device-state.idxbuf-buffer);
+else
+pipe-set_index_buffer(pipe, NULL);
+}
+
+/* State Update */
 
 #define NINE_STATE_FREQ_GROUP_0 \
(NINE_STATE_FB | \
@@ -885,6 +883,17 @@ update_textures_and_samplers(struct NineDevice9 *device)
  NINE_STATE_VS | \
  NINE_STATE_PS)
 
+/* TODO: only go through dirty textures */
+static void
+validate_textures(struct NineDevice9 *device)
+{
+struct NineBaseTexture9 *tex, *ptr;
+LIST_FOR_EACH_ENTRY_SAFE(tex, ptr, device-update_textures, list) {
+list_delinit(tex-list);
+NineBaseTexture9_Validate(tex);
+}
+}
+
 void
 nine_update_state_framebuffer(struct NineDevice9 *device)
 {
@@ -931,7 +940,7 @@ nine_update_state(struct NineDevice9 *device)
 if (group  NINE_STATE_VIEWPORT)
 update_viewport(device);
 if (group  NINE_STATE_SCISSOR)
-update_scissor(device);
+commit_scissor(device);
 
 if (group  NINE_STATE_DSA)
 update_dsa(device);
@@ -973,7 +982,7 @@ nine_update_state(struct NineDevice9 *device)
 update_textures_and_samplers(device);
 
 if (group  NINE_STATE_IDXBUF)
-update_index_buffer(device);
+commit_index_buffer(device);
 
 if ((group  (NINE_STATE_VDECL | NINE_STATE_VS)) ||
 state-changed.stream_freq  ~1)
@@ -1002,6 +1011,7 @@ nine_update_state(struct NineDevice9 *device)
 return TRUE;
 }
 
+/* State defaults */
 
 static const DWORD nine_render_state_defaults[NINED3DRS_LAST + 1] =
 {
@@ -1469,6 +1479,8 @@ const uint32_t nine_render_state_group[NINED3DRS_LAST + 
1] =
 [D3DRS_BLENDOPALPHA] = NINE_STATE_BLEND
 };
 
+/* Misc */
+
 D3DMATRIX *
 nine_state_access_transform(struct nine_state *state, D3DTRANSFORMSTATETYPE t,
 boolean alloc)
-- 
2.1.0

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


[Mesa-dev] [PATCH 33/71] st/nine: Fail on D3DUSAGE_DYNAMIC for D3DPOOL_SCRATCH textures

2015-08-16 Thread Axel Davy
From: Patrick Rudolph s...@das-labor.org

Texture with pool D3DPOOL_SCRATCH and D3DPOOL_MANAGED cannot be used with flag 
D3DUSAGE_DYNAMIC.

Signed-off-by: Patrick Rudolph s...@das-labor.org
---
 src/gallium/state_trackers/nine/basetexture9.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/basetexture9.c 
b/src/gallium/state_trackers/nine/basetexture9.c
index 48fccb2..d13138b 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -57,7 +57,8 @@ NineBaseTexture9_ctor( struct NineBaseTexture9 *This,
 user_assert(!(Usage  (D3DUSAGE_RENDERTARGET | D3DUSAGE_DEPTHSTENCIL)) ||
 Pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
 user_assert(!(Usage  D3DUSAGE_DYNAMIC) ||
-Pool != D3DPOOL_MANAGED, D3DERR_INVALIDCALL);
+!(Pool == D3DPOOL_MANAGED ||
+  Pool == D3DPOOL_SCRATCH), D3DERR_INVALIDCALL);
 
 hr = NineResource9_ctor(This-base, pParams, initResource, alloc, Type, 
Pool, Usage);
 if (FAILED(hr))
-- 
2.1.0

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


[Mesa-dev] [PATCH 49/71] st/nine: Fix nine_ff_ps_key padding

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 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 9638d9c..4428ce6 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -113,10 +113,12 @@ struct nine_ff_ps_key
 } ts[8];
 uint32_t fog : 1; /* for vFog coming from VS */
 uint32_t fog_mode : 2;
-uint32_t specular : 1; /* 9 32-bit words with this */
+uint32_t specular : 1;
+uint32_t pad1 : 28;/* 9 32-bit words with this */
 uint8_t colorarg_b4[3];
 uint8_t colorarg_b5[3];
 uint8_t alphaarg_b4[3]; /* 11 32-bit words plus a byte */
+uint8_t pad2[3];
 };
 uint64_t value64[6]; /* don't forget to resize PixelShader9.ff_key */
 uint32_t value32[12];
-- 
2.1.0

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


[Mesa-dev] [PATCH 50/71] st/nine: Remove useless variables

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
Reviewed-by: David Heidelberg da...@ixit.cz
---
 src/gallium/state_trackers/nine/pixelshader9.h  | 1 -
 src/gallium/state_trackers/nine/vertexshader9.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/src/gallium/state_trackers/nine/pixelshader9.h 
b/src/gallium/state_trackers/nine/pixelshader9.h
index 9715d90..fc0a9a2 100644
--- a/src/gallium/state_trackers/nine/pixelshader9.h
+++ b/src/gallium/state_trackers/nine/pixelshader9.h
@@ -43,7 +43,6 @@ struct NinePixelShader9
 
 uint8_t bumpenvmat_needed;
 uint16_t sampler_mask;
-uint16_t sampler_mask_shadow;
 uint8_t rt_mask;
 
 uint64_t ff_key[6];
diff --git a/src/gallium/state_trackers/nine/vertexshader9.h 
b/src/gallium/state_trackers/nine/vertexshader9.h
index 66c602c..6e2810c 100644
--- a/src/gallium/state_trackers/nine/vertexshader9.h
+++ b/src/gallium/state_trackers/nine/vertexshader9.h
@@ -43,7 +43,6 @@ struct NineVertexShader9
 } byte_code;
 
 uint8_t sampler_mask;
-uint8_t sampler_mask_shadow;
 
 boolean position_t; /* if true, disable vport transform */
 boolean point_size; /* if true, set rasterizer.point_size_per_vertex to 1 
*/
-- 
2.1.0

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


[Mesa-dev] [PATCH 58/71] st/nine: Change nine_state_update order

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_state.c | 139 +++
 1 file changed, 76 insertions(+), 63 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index a439217..04b5f18 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -949,22 +949,38 @@ commit_ps(struct NineDevice9 *device)
 }
 /* State Update */
 
-#define NINE_STATE_FREQ_GROUP_0 \
-   (NINE_STATE_FB | \
-NINE_STATE_VIEWPORT |   \
-NINE_STATE_SCISSOR |\
-NINE_STATE_BLEND |  \
-NINE_STATE_DSA |\
-NINE_STATE_RASTERIZER | \
-NINE_STATE_VS | \
-NINE_STATE_PS | \
-NINE_STATE_BLEND_COLOR |\
-NINE_STATE_STENCIL_REF |\
-NINE_STATE_SAMPLE_MASK |\
-NINE_STATE_FOG_SHADER | \
+#define NINE_STATE_SHADER_CHANGE_VS \
+   (NINE_STATE_VS | \
+NINE_STATE_TEXTURE |\
+NINE_STATE_FOG_SHADER)
+
+#define NINE_STATE_SHADER_CHANGE_PS \
+   (NINE_STATE_PS | \
+NINE_STATE_TEXTURE |\
+NINE_STATE_FOG_SHADER | \
 NINE_STATE_PS1X_SHADER)
 
-#define NINE_STATE_FREQ_GROUP_1 ~NINE_STATE_FREQ_GROUP_0
+#define NINE_STATE_FREQUENT \
+   (NINE_STATE_RASTERIZER | \
+NINE_STATE_TEXTURE |\
+NINE_STATE_SAMPLER |\
+NINE_STATE_VS_CONST |   \
+NINE_STATE_PS_CONST)
+
+#define NINE_STATE_COMMON \
+   (NINE_STATE_FB |   \
+NINE_STATE_BLEND |\
+NINE_STATE_DSA |  \
+NINE_STATE_VIEWPORT | \
+NINE_STATE_VDECL |\
+NINE_STATE_IDXBUF)
+
+#define NINE_STATE_RARE  \
+   (NINE_STATE_SCISSOR | \
+NINE_STATE_BLEND_COLOR | \
+NINE_STATE_STENCIL_REF | \
+NINE_STATE_SAMPLE_MASK)
+
 
 /* TODO: only go through dirty textures */
 static void
@@ -997,9 +1013,7 @@ nine_update_state(struct NineDevice9 *device)
 struct nine_state *state = device-state;
 uint32_t group;
 
-DBG(changed state groups: %x | %x\n,
-state-changed.group  NINE_STATE_FREQ_GROUP_0,
-state-changed.group  NINE_STATE_FREQ_GROUP_1);
+DBG(changed state groups: %x\n, state-changed.group);
 
 /* NOTE: We may want to use the cso cache for everything, or let
  * NineDevice9.RestoreNonCSOState actually set the states, then we wouldn't
@@ -1014,60 +1028,34 @@ nine_update_state(struct NineDevice9 *device)
 nine_ff_update(device);
 group = state-changed.group;
 
-if (group  (NINE_STATE_FREQ_GROUP_0 | NINE_STATE_TEXTURE)) {
-if (group  NINE_STATE_FB)
-group = update_framebuffer(device);
-if (group  NINE_STATE_VIEWPORT)
-update_viewport(device);
-if (group  NINE_STATE_SCISSOR)
-commit_scissor(device);
+if (group  (NINE_STATE_SHADER_CHANGE_VS | NINE_STATE_SHADER_CHANGE_PS)) {
+if (group  NINE_STATE_SHADER_CHANGE_VS)
+group |= prepare_vs(device, (group  NINE_STATE_VS) != 0); /* may 
set NINE_STATE_RASTERIZER and NINE_STATE_SAMPLER*/
+if (group  NINE_STATE_SHADER_CHANGE_PS)
+group |= prepare_ps(device, (group  NINE_STATE_PS) != 0);
+}
 
-if (group  NINE_STATE_DSA)
-prepare_dsa(device);
+if (group  (NINE_STATE_COMMON | NINE_STATE_VS)) {
+if (group  NINE_STATE_FB)
+group |= update_framebuffer(device); /* may set 
NINE_STATE_RASTERIZER */
 if (group  NINE_STATE_BLEND)
 prepare_blend(device);
+if (group  NINE_STATE_DSA)
+prepare_dsa(device);
+if (group  NINE_STATE_VIEWPORT)
+update_viewport(device);
+if ((group  (NINE_STATE_VDECL | NINE_STATE_VS)) ||
+state-changed.stream_freq  ~1)
+update_vertex_elements(device);
+if (group  NINE_STATE_IDXBUF)
+commit_index_buffer(device);
+}
 
-if (group  (NINE_STATE_VS | NINE_STATE_TEXTURE | 
NINE_STATE_FOG_SHADER))
-group |= prepare_vs(device, (group  NINE_STATE_VS) != 0);
-
+if (likely(group  (NINE_STATE_FREQUENT | NINE_STATE_VS | NINE_STATE_PS))) 
{
 if (group  NINE_STATE_RASTERIZER)
 prepare_rasterizer(device);
-
-if (group  (NINE_STATE_PS | NINE_STATE_TEXTURE | 
NINE_STATE_FOG_SHADER | NINE_STATE_PS1X_SHADER))
-group |= prepare_ps(device, (group  NINE_STATE_PS) != 0);
-
-if (group  NINE_STATE_BLEND_COLOR) {
-struct pipe_blend_color color;
-d3dcolor_to_rgba(color.color[0], state-rs[D3DRS_BLENDFACTOR]);
-pipe-set_blend_color(pipe, color);
-}
-if (group  NINE_STATE_SAMPLE_MASK) {
-pipe-set_sample_mask(pipe, state-rs[D3DRS_MULTISAMPLEMASK]);
-}
-if (group  NINE_STATE_STENCIL_REF) {
-struct pipe_stencil_ref ref;
-ref.ref_value[0] = state-rs[D3DRS_STENCILREF];
-ref.ref_value[1] = 

[Mesa-dev] [PATCH 53/71] st/nine: Revert to userbuf path when needed

2015-08-16 Thread Axel Davy
Automatically switch to userbuf path when
we would need to upload fog or bumpmat
constants

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_state.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index 53efa56..e185b02 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -61,6 +61,9 @@ prepare_rasterizer(struct NineDevice9 *device)
 device-state.commit |= NINE_STATE_COMMIT_RASTERIZER;
 }
 
+static void
+prepare_ps_constants_userbuf(struct NineDevice9 *device);
+
 #define DO_UPLOAD_CONST_F(buf,p,c,d) \
 do { \
 DBG(upload ConstantF [%u .. %u]\n, x, (x) + (c) - 1); \
@@ -122,6 +125,14 @@ upload_constants(struct NineDevice9 *device, unsigned 
shader_type)
 device-state.changed.group = ~NINE_STATE_VS_CONST;
 } else {
 DBG(PS\n);
+/* features only implemented on the userbuf path */
+if (device-state.ps-bumpenvmat_needed || (
+device-state.ps-byte_code.version  0x30 
+device-state.rs[D3DRS_FOGENABLE])) {
+device-prefer_user_constbuf = TRUE;
+prepare_ps_constants_userbuf(device);
+return;
+}
 buf = device-constbuf_ps;
 
 const_f = device-state.ps_const_f;
-- 
2.1.0

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


[Mesa-dev] [PATCH 61/71] st/nine: Remove NINED3DRS_ZBIASSCALE

2015-08-16 Thread Axel Davy
It wasn't giving the expected result.

This fixes some object being transparents
in games like FEAR.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_pipe.c  | 12 +++-
 src/gallium/state_trackers/nine/nine_state.c | 20 
 src/gallium/state_trackers/nine/nine_state.h |  3 +--
 3 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_pipe.c 
b/src/gallium/state_trackers/nine/nine_pipe.c
index 668ce38..9ac5700 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.c
+++ b/src/gallium/state_trackers/nine/nine_pipe.c
@@ -118,7 +118,17 @@ nine_convert_rasterizer_state(struct pipe_rasterizer_state 
*rast_state, const DW
 asfloat(rs[D3DRS_POINTSIZE_MIN]),
 asfloat(rs[D3DRS_POINTSIZE_MAX]));
 }
-rast.offset_units = asfloat(rs[D3DRS_DEPTHBIAS]) * 
asfloat(rs[NINED3DRS_ZBIASSCALE]);
+/* offset_units has the ogl/d3d11 meaning.
+ * d3d9: offset = scale * dz + bias
+ * ogl/d3d11: offset = scale * dz + r * bias
+ * with r implementation dependant and is supposed to be
+ * the smallest value the depth buffer format can hold.
+ * In practice on current and past hw it seems to be 2^-23
+ * for all formats except float formats where it varies depending
+ * on the content.
+ * For now use 1  23, but in the future perhaps add a way in gallium
+ * to get r for the format or get the gallium behaviour */
+rast.offset_units = asfloat(rs[D3DRS_DEPTHBIAS]) * (float)(1  23);
 rast.offset_scale = asfloat(rs[D3DRS_SLOPESCALEDEPTHBIAS]);
  /* rast.offset_clamp = 0.0f; */
 
diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index 04b5f18..a7d884c 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -496,26 +496,6 @@ update_framebuffer(struct NineDevice9 *device)
 
 pipe-set_framebuffer_state(pipe, fb); /* XXX: cso ? */
 
-if (fb-zsbuf) {
-DWORD scale;
-switch (fb-zsbuf-format) {
-case PIPE_FORMAT_Z32_FLOAT:
-case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
-scale = fui(1.0f);
-break;
-case PIPE_FORMAT_Z16_UNORM:
-scale = fui((float)(1  16));
-break;
-default:
-scale = fui((float)(1  24));
-break;
-}
-if (state-rs[NINED3DRS_ZBIASSCALE] != scale) {
-state-rs[NINED3DRS_ZBIASSCALE] = scale;
-state-changed.group |= NINE_STATE_RASTERIZER;
-}
-}
-
 return state-changed.group;
 }
 
diff --git a/src/gallium/state_trackers/nine/nine_state.h 
b/src/gallium/state_trackers/nine/nine_state.h
index 109c0bb..0f3c2fa 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -33,8 +33,7 @@
 
 #define NINED3DRS_VSPOINTSIZE (D3DRS_BLENDOPALPHA + 1)
 #define NINED3DRS_RTMASK  (D3DRS_BLENDOPALPHA + 2)
-#define NINED3DRS_ZBIASSCALE  (D3DRS_BLENDOPALPHA + 3)
-#define NINED3DRS_ALPHACOVERAGE  (D3DRS_BLENDOPALPHA + 4)
+#define NINED3DRS_ALPHACOVERAGE  (D3DRS_BLENDOPALPHA + 3)
 
 #define D3DRS_LAST   D3DRS_BLENDOPALPHA
 #define NINED3DRS_LAST   NINED3DRS_ALPHACOVERAGE /* 213 */
-- 
2.1.0

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


[Mesa-dev] [PATCH 67/71] st/nine: Catch setting the same shader

2015-08-16 Thread Axel Davy
This is quite rare that an app does set again
the same shaders, but it isn't an expensive check
either.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/device9.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 7b2a2f1..f136b04 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -3259,6 +3259,9 @@ NineDevice9_SetVertexShader( struct NineDevice9 *This,
 
 DBG(This=%p pShader=%p\n, This, pShader);
 
+if (!This-is_recording  state-vs == (struct NineVertexShader9*)pShader)
+  return D3D_OK;
+
 /* ff - non-ff: commit back non-ff constants */
 if (!state-vs  pShader)
 state-commit |= NINE_STATE_COMMIT_CONST_VS;
@@ -3612,6 +3615,9 @@ NineDevice9_SetPixelShader( struct NineDevice9 *This,
 
 DBG(This=%p pShader=%p\n, This, pShader);
 
+if (!This-is_recording  state-ps == (struct NinePixelShader9*)pShader)
+  return D3D_OK;
+
 /* ff - non-ff: commit back non-ff constants */
 if (!state-ps  pShader)
 state-commit |= NINE_STATE_COMMIT_CONST_PS;
-- 
2.1.0

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


[Mesa-dev] [PATCH 62/71] st/nine: Better check shader constant limits

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_shader.c | 36 ---
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_shader.c 
b/src/gallium/state_trackers/nine/nine_shader.c
index 7e76d7d..9680c5a 100644
--- a/src/gallium/state_trackers/nine/nine_shader.c
+++ b/src/gallium/state_trackers/nine/nine_shader.c
@@ -453,6 +453,9 @@ struct shader_translator
 BYTE minor;
 } version;
 unsigned processor; /* TGSI_PROCESSOR_VERTEX/FRAMGENT */
+unsigned num_constf_allowed;
+unsigned num_consti_allowed;
+unsigned num_constb_allowed;
 
 boolean native_integers;
 boolean inline_subroutines;
@@ -514,7 +517,6 @@ struct shader_translator
 
 #define IS_VS (tx-processor == TGSI_PROCESSOR_VERTEX)
 #define IS_PS (tx-processor == TGSI_PROCESSOR_FRAGMENT)
-#define NINE_MAX_CONST_F_SHADER (tx-processor == TGSI_PROCESSOR_VERTEX ? 
NINE_MAX_CONST_F : NINE_MAX_CONST_F_PS3)
 
 #define FAILURE_VOID(cond) if ((cond)) {tx-failure=1;return;}
 
@@ -537,7 +539,7 @@ static boolean
 tx_lconstf(struct shader_translator *tx, struct ureg_src *src, INT index)
 {
INT i;
-   if (index  0 || index = NINE_MAX_CONST_F_SHADER) {
+   if (index  0 || index = tx-num_constf_allowed) {
tx-failure = TRUE;
return FALSE;
}
@@ -552,7 +554,7 @@ tx_lconstf(struct shader_translator *tx, struct ureg_src 
*src, INT index)
 static boolean
 tx_lconsti(struct shader_translator *tx, struct ureg_src *src, INT index)
 {
-   if (index  0 || index = NINE_MAX_CONST_I) {
+   if (index  0 || index = tx-num_consti_allowed) {
tx-failure = TRUE;
return FALSE;
}
@@ -563,7 +565,7 @@ tx_lconsti(struct shader_translator *tx, struct ureg_src 
*src, INT index)
 static boolean
 tx_lconstb(struct shader_translator *tx, struct ureg_src *src, INT index)
 {
-   if (index  0 || index = NINE_MAX_CONST_B) {
+   if (index  0 || index = tx-num_constb_allowed) {
tx-failure = TRUE;
return FALSE;
}
@@ -577,9 +579,7 @@ tx_set_lconstf(struct shader_translator *tx, INT index, 
float f[4])
 {
 unsigned n;
 
-FAILURE_VOID(index  0 || index = NINE_MAX_CONST_F_SHADER)
-if (IS_VS  index = NINE_MAX_CONST_F_SHADER)
-WARN(lconstf index %i too high, indirect access won't work\n, index);
+FAILURE_VOID(index  0 || index = tx-num_constf_allowed)
 
 for (n = 0; n  tx-num_lconstf; ++n)
 if (tx-lconstf[n].idx == index)
@@ -601,7 +601,7 @@ tx_set_lconstf(struct shader_translator *tx, INT index, 
float f[4])
 static void
 tx_set_lconsti(struct shader_translator *tx, INT index, int i[4])
 {
-FAILURE_VOID(index  0 || index = NINE_MAX_CONST_I)
+FAILURE_VOID(index  0 || index = tx-num_consti_allowed)
 tx-lconsti[index].idx = index;
 tx-lconsti[index].reg = tx-native_integers ?
ureg_imm4i(tx-ureg, i[0], i[1], i[2], i[3]) :
@@ -610,7 +610,7 @@ tx_set_lconsti(struct shader_translator *tx, INT index, int 
i[4])
 static void
 tx_set_lconstb(struct shader_translator *tx, INT index, BOOL b)
 {
-FAILURE_VOID(index  0 || index = NINE_MAX_CONST_B)
+FAILURE_VOID(index  0 || index = tx-num_constb_allowed)
 tx-lconstb[index].idx = index;
 tx-lconstb[index].reg = tx-native_integers ?
ureg_imm1u(tx-ureg, b ? 0x : 0) :
@@ -3345,6 +3345,24 @@ nine_translate_shader(struct NineDevice9 *device, struct 
nine_shader_info *info)
 tx-texcoord_sn = tx-want_texcoord ?
 TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC;
 
+if (IS_VS) {
+tx-num_constf_allowed = NINE_MAX_CONST_F;
+} else if (tx-version.major  2) {/* IS_PS v1 */
+tx-num_constf_allowed = 8;
+} else if (tx-version.major == 2) {/* IS_PS v2 */
+tx-num_constf_allowed = 32;
+} else {/* IS_PS v3 */
+tx-num_constf_allowed = NINE_MAX_CONST_F_PS3;
+}
+
+if (tx-version.major  2) {
+tx-num_consti_allowed = 0;
+tx-num_constb_allowed = 0;
+} else {
+tx-num_consti_allowed = NINE_MAX_CONST_I;
+tx-num_constb_allowed = NINE_MAX_CONST_B;
+}
+
 /* VS must always write position. Declare it here to make it the 1st 
output.
  * (Some drivers like nv50 are buggy and rely on that.)
  */
-- 
2.1.0

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


[Mesa-dev] [PATCH 29/71] st/nine: Fix resource SetPriority/GetPriority

2015-08-16 Thread Axel Davy
From: Patrick Rudolph s...@das-labor.org

Return 0 for non MANAGED textures and surfaces.
Fixes failing wine d3d9 tests device.c test_resource_priority.

Reviewed-by: Axel Davy axel.d...@ens.fr
Signed-off-by: Patrick Rudolph s...@das-labor.org
---
 src/gallium/state_trackers/nine/resource9.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/nine/resource9.c 
b/src/gallium/state_trackers/nine/resource9.c
index b6a13e1..6d91533 100644
--- a/src/gallium/state_trackers/nine/resource9.c
+++ b/src/gallium/state_trackers/nine/resource9.c
@@ -208,10 +208,13 @@ DWORD WINAPI
 NineResource9_SetPriority( struct NineResource9 *This,
DWORD PriorityNew )
 {
-DWORD prev = This-priority;
-
+DWORD prev;
 DBG(This=%p, PriorityNew=%d\n, This, PriorityNew);
 
+if (This-pool != D3DPOOL_MANAGED || This-type == D3DRTYPE_SURFACE)
+return 0;
+
+prev = This-priority;
 This-priority = PriorityNew;
 return prev;
 }
@@ -219,6 +222,9 @@ NineResource9_SetPriority( struct NineResource9 *This,
 DWORD WINAPI
 NineResource9_GetPriority( struct NineResource9 *This )
 {
+if (This-pool != D3DPOOL_MANAGED || This-type == D3DRTYPE_SURFACE)
+return 0;
+
 return This-priority;
 }
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 41/71] st/nine: Rework rasterizer states

2015-08-16 Thread Axel Davy
Separate state preparation and state commit

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_pipe.c  |  8 
 src/gallium/state_trackers/nine/nine_pipe.h  |  2 +-
 src/gallium/state_trackers/nine/nine_state.c | 23 ---
 src/gallium/state_trackers/nine/nine_state.h |  2 ++
 4 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_pipe.c 
b/src/gallium/state_trackers/nine/nine_pipe.c
index 0538957..ff5ec60 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.c
+++ b/src/gallium/state_trackers/nine/nine_pipe.c
@@ -69,13 +69,13 @@ nine_convert_dsa_state(struct 
pipe_depth_stencil_alpha_state *dsa_state,
 *dsa_state = dsa;
 }
 
-/* TODO: Keep a static copy in device so we don't have to memset every time ? 
*/
 void
-nine_convert_rasterizer_state(struct cso_context *ctx, const DWORD *rs)
+nine_convert_rasterizer_state(struct pipe_rasterizer_state *rast_state, const 
DWORD *rs)
 {
 struct pipe_rasterizer_state rast;
 
-memset(rast, 0, sizeof(rast)); /* memcmp safety */
+/* Note: we don't have a memset since we use a static copy that was memset 
once
+ * and we always rewrite all states we change. */
 
 rast.flatshade = rs[D3DRS_SHADEMODE] == D3DSHADE_FLAT;
  /* rast.light_twoside = 0; */
@@ -122,7 +122,7 @@ nine_convert_rasterizer_state(struct cso_context *ctx, 
const DWORD *rs)
 rast.offset_scale = asfloat(rs[D3DRS_SLOPESCALEDEPTHBIAS]);
  /* rast.offset_clamp = 0.0f; */
 
-cso_set_rasterizer(ctx, rast);
+*rast_state = rast;
 }
 
 static inline void
diff --git a/src/gallium/state_trackers/nine/nine_pipe.h 
b/src/gallium/state_trackers/nine/nine_pipe.h
index 2f2e9cb..e2680f6 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.h
+++ b/src/gallium/state_trackers/nine/nine_pipe.h
@@ -38,7 +38,7 @@ extern const enum pipe_format 
nine_d3d9_to_pipe_format_map[120];
 extern const D3DFORMAT nine_pipe_to_d3d9_format_map[PIPE_FORMAT_COUNT];
 
 void nine_convert_dsa_state(struct pipe_depth_stencil_alpha_state *, const 
DWORD *);
-void nine_convert_rasterizer_state(struct cso_context *, const DWORD *);
+void nine_convert_rasterizer_state(struct pipe_rasterizer_state *, const DWORD 
*);
 void nine_convert_blend_state(struct cso_context *, const DWORD *);
 void nine_convert_sampler_state(struct cso_context *, int idx, const DWORD *);
 
diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index 7875d31..b29556b 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -46,6 +46,13 @@ prepare_dsa(struct NineDevice9 *device)
 device-state.commit |= NINE_STATE_COMMIT_DSA;
 }
 
+static inline void
+prepare_rasterizer(struct NineDevice9 *device)
+{
+nine_convert_rasterizer_state(device-state.pipe.rast, device-state.rs);
+device-state.commit |= NINE_STATE_COMMIT_RASTERIZER;
+}
+
 /* State preparation incremental */
 
 /* State preparation + State commit */
@@ -195,12 +202,6 @@ update_blend(struct NineDevice9 *device)
 nine_convert_blend_state(device-cso, device-state.rs);
 }
 
-static inline void
-update_rasterizer(struct NineDevice9 *device)
-{
-nine_convert_rasterizer_state(device-cso, device-state.rs);
-}
-
 /* Loop through VS inputs and pick the vertex elements with the declared
  * usage from the vertex declaration, then insert the instance divisor from
  * the stream source frequency setting.
@@ -859,6 +860,12 @@ commit_scissor(struct NineDevice9 *device)
 }
 
 static inline void
+commit_rasterizer(struct NineDevice9 *device)
+{
+cso_set_rasterizer(device-cso, device-state.pipe.rast);
+}
+
+static inline void
 commit_index_buffer(struct NineDevice9 *device)
 {
 struct pipe_context *pipe = device-pipe;
@@ -958,7 +965,7 @@ nine_update_state(struct NineDevice9 *device)
 group |= update_vs(device);
 
 if (group  NINE_STATE_RASTERIZER)
-update_rasterizer(device);
+prepare_rasterizer(device);
 
 if (group  NINE_STATE_PS)
 group |= update_ps(device);
@@ -1012,6 +1019,8 @@ nine_update_state(struct NineDevice9 *device)
 
 if (state-commit  NINE_STATE_COMMIT_DSA)
 commit_dsa(device);
+if (state-commit  NINE_STATE_COMMIT_RASTERIZER)
+commit_rasterizer(device);
 
 state-commit = 0;
 
diff --git a/src/gallium/state_trackers/nine/nine_state.h 
b/src/gallium/state_trackers/nine/nine_state.h
index e833225..bd2ad38 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -79,6 +79,7 @@
 #define NINE_STATE_UNHANDLED   (1  24)
 
 #define NINE_STATE_COMMIT_DSA  (1  0)
+#define NINE_STATE_COMMIT_RASTERIZER (1  1)
 
 
 #define NINE_MAX_SIMULTANEOUS_RENDERTARGETS 4
@@ -214,6 +215,7 @@ struct nine_state
 uint32_t commit;
 struct {
 struct pipe_depth_stencil_alpha_state dsa;
+struct pipe_rasterizer_state 

[Mesa-dev] [PATCH 35/71] st/nine: Prevent possible crash

2015-08-16 Thread Axel Davy
From: Patrick Rudolph s...@das-labor.org

In case NineBaseTexture9_ctor returns an error This-surfaces[l] might be NULL.

Reviewed-by: Axel Davy axel.d...@ens.fr
Signed-off-by: Patrick Rudolph s...@das-labor.org
---
 src/gallium/state_trackers/nine/texture9.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/texture9.c 
b/src/gallium/state_trackers/nine/texture9.c
index af97082..bc325c1 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -229,7 +229,8 @@ NineTexture9_dtor( struct NineTexture9 *This )
 if (This-surfaces) {
 /* The surfaces should have 0 references and be unbound now. */
 for (l = 0; l = This-base.base.info.last_level; ++l)
-NineUnknown_Destroy(This-surfaces[l]-base.base);
+if (This-surfaces[l])
+NineUnknown_Destroy(This-surfaces[l]-base.base);
 FREE(This-surfaces);
 }
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 71/71] st/nine: Silent warning in nine_ff

2015-08-16 Thread Axel Davy
non-debug build was complaining

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_ff.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/state_trackers/nine/nine_ff.c 
b/src/gallium/state_trackers/nine/nine_ff.c
index 59ea2cb..fe8933b 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -1541,6 +1541,7 @@ nine_ff_get_vs(struct NineDevice9 *device)
 memcpy(vs-ff_key, key, sizeof(vs-ff_key));
 
 err = util_hash_table_set(device-ff.ht_vs, vs-ff_key, vs);
+(void)err;
 assert(err == PIPE_OK);
 device-ff.num_vs++;
 NineUnknown_ConvertRefToBind(NineUnknown(vs));
@@ -1643,6 +1644,7 @@ nine_ff_get_ps(struct NineDevice9 *device)
 memcpy(ps-ff_key, key, sizeof(ps-ff_key));
 
 err = util_hash_table_set(device-ff.ht_ps, ps-ff_key, ps);
+(void)err;
 assert(err == PIPE_OK);
 device-ff.num_ps++;
 NineUnknown_ConvertRefToBind(NineUnknown(ps));
-- 
2.1.0

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


[Mesa-dev] [PATCH 70/71] st/nine: Silent warning in sm1_declusage_to_tgsi

2015-08-16 Thread Axel Davy
non-debug build was complaining

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_shader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/nine_shader.c 
b/src/gallium/state_trackers/nine/nine_shader.c
index 9680c5a..28f2787 100644
--- a/src/gallium/state_trackers/nine/nine_shader.c
+++ b/src/gallium/state_trackers/nine/nine_shader.c
@@ -1890,7 +1890,7 @@ sm1_declusage_to_tgsi(struct tgsi_declaration_semantic 
*sem,
 sem-Index = 0;
 break;
 default:
-assert(!Invalid DECLUSAGE.);
+unreachable(!Invalid DECLUSAGE.);
 break;
 }
 }
-- 
2.1.0

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


[Mesa-dev] [PATCH 24/71] st/nine: Fix StretchRect checks

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/device9.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 2ac49a1..28daeba 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1582,8 +1582,12 @@ NineDevice9_StretchRect( struct NineDevice9 *This,
 
 user_assert(!scaled || dst != src, D3DERR_INVALIDCALL);
 user_assert(!scaled ||
-!NineSurface9_IsOffscreenPlain(dst) ||
+!NineSurface9_IsOffscreenPlain(dst), D3DERR_INVALIDCALL);
+user_assert(!NineSurface9_IsOffscreenPlain(dst) ||
 NineSurface9_IsOffscreenPlain(src), D3DERR_INVALIDCALL);
+user_assert(NineSurface9_IsOffscreenPlain(dst) ||
+dst-desc.Usage  (D3DUSAGE_RENDERTARGET | 
D3DUSAGE_DEPTHSTENCIL),
+D3DERR_INVALIDCALL);
 user_assert(!scaled ||
 (!util_format_is_compressed(dst-base.info.format) 
  !util_format_is_compressed(src-base.info.format)),
-- 
2.1.0

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


[Mesa-dev] [PATCH 1/3] tgsi: set implicit array size for tess stages

2015-08-16 Thread Marcos Paulo de Souza
From: Marcos Paulo de Souza marcos.souza@gmail.com

---
 src/gallium/auxiliary/tgsi/tgsi_text.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c 
b/src/gallium/auxiliary/tgsi/tgsi_text.c
index a6675c5..24e2dbd 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -259,7 +259,7 @@ struct translate_ctx
struct tgsi_token *tokens_end;
struct tgsi_header *header;
unsigned processor : 4;
-   int implied_array_size : 5;
+   unsigned implied_array_size : 6;
unsigned num_immediates;
 };
 
@@ -1623,6 +1623,10 @@ static boolean translate( struct translate_ctx *ctx )
if (!parse_header( ctx ))
   return FALSE;
 
+   if (ctx-processor == TGSI_PROCESSOR_TESS_CTRL ||
+   ctx-processor == TGSI_PROCESSOR_TESS_EVAL)
+   ctx-implied_array_size = 32 ;
+
while (*ctx-cur != '\0') {
   uint label_val = 0;
   if (!eat_white( ctx-cur )) {
-- 
2.4.3

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


[Mesa-dev] [PATCH 3/3] nouveau: recognize tess stages in nouveau_compiler

2015-08-16 Thread Marcos Paulo de Souza
From: Marcos Paulo de Souza marcos.souza@gmail.com

---
 src/gallium/drivers/nouveau/nouveau_compiler.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c 
b/src/gallium/drivers/nouveau/nouveau_compiler.c
index 8660498..495450b 100644
--- a/src/gallium/drivers/nouveau/nouveau_compiler.c
+++ b/src/gallium/drivers/nouveau/nouveau_compiler.c
@@ -190,6 +190,10 @@ main(int argc, char *argv[])
   type = PIPE_SHADER_GEOMETRY;
else if (!strncmp(text, COMP, 4))
   type = PIPE_SHADER_COMPUTE;
+   else if (!strncmp(text, TESS_CTRL, 9))
+  type = PIPE_SHADER_TESS_CTRL;
+   else if (!strncmp(text, TESS_EVAL, 9))
+  type = PIPE_SHADER_TESS_EVAL;
else {
   _debug_printf(Unrecognized TGSI header\n);
   return 1;
-- 
2.4.3

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


[Mesa-dev] [PATCH 2/3] tgsi: Fix index printed in tgsi_dump and dst outputs

2015-08-16 Thread Marcos Paulo de Souza
From: Marcos Paulo de Souza marcos.souza@gmail.com

Before this patch, the tgsi_dumps was printing declaration as:
DCL IN[][0][0], GENERIC[0]

and now it is parsed correctly:
DCL IN[][0], GENERIC[0]

In the same way, for tess stages, the output addr now is parsed correctly, 
doing like src parser from:
LRP OUT[0][3], TEMP[1]., TEMP[3], TEMP[2]

to:
LRP OUT[ADDR[1].x][3], TEMP[1]., TEMP[3], TEMP[2]
---
 src/gallium/auxiliary/tgsi/tgsi_text.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c 
b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 24e2dbd..141a3b1 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -684,7 +684,13 @@ parse_register_dcl(
* input primitive. so we want to declare just
* the index relevant to the semantics which is in
* the second bracket */
-  if (ctx-processor == TGSI_PROCESSOR_GEOMETRY  *file == 
TGSI_FILE_INPUT) {
+
+  /* tessellation has similar constraints to geometry shader */
+  bool is_in = *file == TGSI_FILE_INPUT;
+  bool is_out = *file == TGSI_FILE_OUTPUT;
+  if ((ctx-processor == TGSI_PROCESSOR_GEOMETRY  is_i) ||
+  (ctx-processor == TGSI_PROCESSOR_TESS_EVAL  is_in) ||
+  (ctx-processor == TGSI_PROCESSOR_TESS_CTRL  (is_in || is_out))) {
  brackets[0] = brackets[1];
  *num_brackets = 1;
   } else {
@@ -740,6 +746,14 @@ parse_dst_operand(
   dst-Dimension.Indirect = 0;
   dst-Dimension.Dimension = 0;
   dst-Dimension.Index = bracket[0].index;
+
+  if (bracket[0].ind_file != TGSI_FILE_NULL) {
+ dst-Dimension.Indirect = 1;
+ dst-DimIndirect.File = bracket[0].ind_file;
+ dst-DimIndirect.Index = bracket[0].ind_index;
+ dst-DimIndirect.Swizzle = bracket[0].ind_comp;
+ dst-DimIndirect.ArrayID = bracket[0].ind_array;
+  }
   bracket[0] = bracket[1];
}
dst-Register.Index = bracket[0].index;
-- 
2.4.3

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


[Mesa-dev] [PATCH 01/71] st/nine: Require gcc = 4.6

2015-08-16 Thread Axel Davy
From: David Heidelberg da...@ixit.cz

Fixes bug: fdo #89978

Signed-off-by: David Heidelberg da...@ixit.cz
Cc: 10.4 10.5 10.6 mesa-sta...@lists.freedesktop.org
---
 configure.ac | 4 
 1 file changed, 4 insertions(+)

diff --git a/configure.ac b/configure.ac
index 4e751e3..c355092 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1632,6 +1632,10 @@ if test x$enable_nine = xyes; then
 if test x$with_gallium_drivers = xswrast; then
 AC_MSG_ERROR([nine requires at least one non-swrast gallium driver])
 fi
+if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a 
$GCC_VERSION_MINOR -lt 6; then
+AC_MSG_ERROR([gcc = 4.6 is required to build nine])
+fi
+
 if test x$enable_dri3 = xno; then
 AC_MSG_WARN([using nine together with wine requires DRI3 enabled 
system])
 fi
-- 
2.5.0

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


[Mesa-dev] [PATCH 66/71] st/nine: Avoid Constant upload when there is no change

2015-08-16 Thread Axel Davy
It is very common for d3d9 apps to set again the constants
they need before every draw call, even if nothing changed.

Since we are mostly gpu bound, it is better to check
for change, and upload constants again (and thus use
gpu bandwith) only if the constants changed.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/device9.c | 42 +++
 1 file changed, 42 insertions(+)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index dbe0e16..7b2a2f1 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -3297,6 +3297,12 @@ NineDevice9_SetVertexShaderConstantF( struct NineDevice9 
*This,
return D3D_OK;
 user_assert(pConstantData, D3DERR_INVALIDCALL);
 
+if (!This-is_recording) {
+if (!memcmp(state-vs_const_f[StartRegister * 4], pConstantData,
+Vector4fCount * 4 * sizeof(state-vs_const_f[0])))
+return D3D_OK;
+}
+
 memcpy(state-vs_const_f[StartRegister * 4],
pConstantData,
Vector4fCount * 4 * sizeof(state-vs_const_f[0]));
@@ -3346,6 +3352,11 @@ NineDevice9_SetVertexShaderConstantI( struct NineDevice9 
*This,
 user_assert(pConstantData, D3DERR_INVALIDCALL);
 
 if (This-driver_caps.vs_integer) {
+if (!This-is_recording) {
+if (!memcmp(state-vs_const_i[StartRegister][0], pConstantData,
+Vector4iCount * sizeof(state-vs_const_i[0])))
+return D3D_OK;
+}
 memcpy(state-vs_const_i[StartRegister][0],
pConstantData,
Vector4iCount * sizeof(state-vs_const_i[0]));
@@ -3410,6 +3421,16 @@ NineDevice9_SetVertexShaderConstantB( struct NineDevice9 
*This,
 user_assert(StartRegister + BoolCount = NINE_MAX_CONST_B, 
D3DERR_INVALIDCALL);
 user_assert(pConstantData, D3DERR_INVALIDCALL);
 
+if (!This-is_recording) {
+bool noChange = true;
+for (i = 0; i  BoolCount; i++) {
+if (!!state-vs_const_b[StartRegister + i] != !!pConstantData[i])
+  noChange = false;
+}
+if (noChange)
+return D3D_OK;
+}
+
 for (i = 0; i  BoolCount; i++)
 state-vs_const_b[StartRegister + i] = pConstantData[i] ? bool_true : 
0;
 
@@ -3635,6 +3656,12 @@ NineDevice9_SetPixelShaderConstantF( struct NineDevice9 
*This,
return D3D_OK;
 user_assert(pConstantData, D3DERR_INVALIDCALL);
 
+if (!This-is_recording) {
+if (!memcmp(state-ps_const_f[StartRegister * 4], pConstantData,
+Vector4fCount * 4 * sizeof(state-ps_const_f[0])))
+return D3D_OK;
+}
+
 memcpy(state-ps_const_f[StartRegister * 4],
pConstantData,
Vector4fCount * 4 * sizeof(state-ps_const_f[0]));
@@ -3684,6 +3711,11 @@ NineDevice9_SetPixelShaderConstantI( struct NineDevice9 
*This,
 user_assert(pConstantData, D3DERR_INVALIDCALL);
 
 if (This-driver_caps.ps_integer) {
+if (!This-is_recording) {
+if (!memcmp(state-ps_const_i[StartRegister][0], pConstantData,
+Vector4iCount * sizeof(state-ps_const_i[0])))
+return D3D_OK;
+}
 memcpy(state-ps_const_i[StartRegister][0],
pConstantData,
Vector4iCount * sizeof(state-ps_const_i[0]));
@@ -3747,6 +3779,16 @@ NineDevice9_SetPixelShaderConstantB( struct NineDevice9 
*This,
 user_assert(StartRegister + BoolCount = NINE_MAX_CONST_B, 
D3DERR_INVALIDCALL);
 user_assert(pConstantData, D3DERR_INVALIDCALL);
 
+if (!This-is_recording) {
+bool noChange = true;
+for (i = 0; i  BoolCount; i++) {
+if (!!state-ps_const_b[StartRegister + i] != !!pConstantData[i])
+  noChange = false;
+}
+if (noChange)
+return D3D_OK;
+}
+
 for (i = 0; i  BoolCount; i++)
 state-ps_const_b[StartRegister + i] = pConstantData[i] ? bool_true : 
0;
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 51/71] st/nine: Rework shader states

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_state.c| 188 +++-
 src/gallium/state_trackers/nine/nine_state.h|   4 +-
 src/gallium/state_trackers/nine/pixelshader9.c  |  30 +++-
 src/gallium/state_trackers/nine/pixelshader9.h  |  41 +-
 src/gallium/state_trackers/nine/vertexshader9.c |  31 +++-
 src/gallium/state_trackers/nine/vertexshader9.h |  28 +++-
 6 files changed, 207 insertions(+), 115 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index 3a02a8e..610798a 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -328,6 +328,70 @@ prepare_ps_constants_userbuf(struct NineDevice9 *device)
 state-commit |= NINE_STATE_COMMIT_CONST_PS;
 }
 
+static inline uint32_t
+prepare_vs(struct NineDevice9 *device, uint8_t shader_changed)
+{
+struct nine_state *state = device-state;
+struct NineVertexShader9 *vs = state-vs;
+uint32_t changed_group = 0;
+int has_key_changed = 0;
+
+if (likely(vs))
+has_key_changed = NineVertexShader9_UpdateKey(vs, state);
+
+if (!shader_changed  !has_key_changed)
+return 0;
+
+/* likely because we dislike FF */
+if (likely(vs)) {
+state-cso.vs = NineVertexShader9_GetVariant(vs);
+} else {
+vs = device-ff.vs;
+state-cso.vs = vs-ff_cso;
+}
+
+if (state-rs[NINED3DRS_VSPOINTSIZE] != vs-point_size) {
+state-rs[NINED3DRS_VSPOINTSIZE] = vs-point_size;
+changed_group |= NINE_STATE_RASTERIZER;
+}
+
+if ((state-bound_samplers_mask_vs  vs-sampler_mask) != vs-sampler_mask)
+/* Bound dummy sampler. */
+changed_group |= NINE_STATE_SAMPLER;
+
+state-commit |= NINE_STATE_COMMIT_VS;
+return changed_group;
+}
+
+static inline uint32_t
+prepare_ps(struct NineDevice9 *device, uint8_t shader_changed)
+{
+struct nine_state *state = device-state;
+struct NinePixelShader9 *ps = state-ps;
+uint32_t changed_group = 0;
+int has_key_changed = 0;
+
+if (likely(ps))
+has_key_changed = NinePixelShader9_UpdateKey(ps, state);
+
+if (!shader_changed  !has_key_changed)
+return 0;
+
+if (likely(ps)) {
+state-cso.ps = NinePixelShader9_GetVariant(ps);
+} else {
+ps = device-ff.ps;
+state-cso.ps = ps-ff_cso;
+}
+
+if ((state-bound_samplers_mask_ps  ps-sampler_mask) != ps-sampler_mask)
+/* Bound dummy sampler. */
+changed_group |= NINE_STATE_SAMPLER;
+
+state-commit |= NINE_STATE_COMMIT_PS;
+return changed_group;
+}
+
 /* State preparation incremental */
 
 /* State preparation + State commit */
@@ -563,92 +627,6 @@ update_vertex_elements(struct NineDevice9 *device)
 state-changed.stream_freq = 0;
 }
 
-static inline uint32_t
-update_shader_variant_keys(struct NineDevice9 *device)
-{
-struct nine_state *state = device-state;
-uint32_t mask = 0;
-uint32_t vs_key = state-samplers_shadow;
-uint32_t ps_key = state-samplers_shadow;
-
-vs_key = (vs_key  NINE_VS_SAMPLERS_MASK)  NINE_SAMPLER_VS(0);
-ps_key = (ps_key  NINE_PS_SAMPLERS_MASK)  NINE_SAMPLER_PS(0);
-
-if (state-vs) vs_key = state-vs-sampler_mask;
-if (state-ps) {
-if (unlikely(state-ps-byte_code.version  0x20)) {
-/* no depth textures, but variable targets */
-uint32_t m = state-ps-sampler_mask;
-ps_key = 0;
-while (m) {
-int s = ffs(m) - 1;
-m = ~(1  s);
-ps_key |= (state-texture[s] ? state-texture[s]-pstype : 1) 
 (s * 2);
-}
-} else {
-ps_key = state-ps-sampler_mask;
-}
-}
-
-if (state-vs  state-vs_key != vs_key) {
-state-vs_key = vs_key;
-mask |= NINE_STATE_VS;
-}
-if (state-ps  state-ps_key != ps_key) {
-state-ps_key = ps_key;
-mask |= NINE_STATE_PS;
-}
-return mask;
-}
-
-static inline uint32_t
-update_vs(struct NineDevice9 *device)
-{
-struct nine_state *state = device-state;
-struct NineVertexShader9 *vs = state-vs;
-uint32_t changed_group = 0;
-
-/* likely because we dislike FF */
-if (likely(vs)) {
-state-cso.vs = NineVertexShader9_GetVariant(vs, state-vs_key);
-} else {
-vs = device-ff.vs;
-state-cso.vs = vs-variant.cso;
-}
-device-pipe-bind_vs_state(device-pipe, state-cso.vs);
-
-if (state-rs[NINED3DRS_VSPOINTSIZE] != vs-point_size) {
-state-rs[NINED3DRS_VSPOINTSIZE] = vs-point_size;
-changed_group |= NINE_STATE_RASTERIZER;
-}
-
-if ((state-bound_samplers_mask_vs  vs-sampler_mask) != vs-sampler_mask)
-/* Bound dummy sampler. */
-changed_group |= NINE_STATE_SAMPLER;
-return changed_group;
-}
-
-static inline uint32_t
-update_ps(struct NineDevice9 *device)
-{
-struct nine_state *state = 

[Mesa-dev] [PATCH 65/71] st/nine: Fix the number of texture stages

2015-08-16 Thread Axel Davy
The number of texture stages is 8.

'tex_stage' array was too big, and thus
the checks with 'Elements(state-ff.tex_stage)' were passing,
causing some invalid API calls to pass, and crash because of
out of bounds write since bumpmap_vars was just the correct size.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_state.h  | 8 +---
 src/gallium/state_trackers/nine/stateblock9.c | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_state.h 
b/src/gallium/state_trackers/nine/nine_state.h
index 4351e3e..b34da70 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -102,6 +102,8 @@
  NINE_MAX_CONST_I * 4 * sizeof(int))
 
 
+#define NINE_MAX_TEXTURE_STAGES 8
+
 #define NINE_MAX_LIGHTS65536
 #define NINE_MAX_LIGHTS_ACTIVE 8
 
@@ -156,7 +158,7 @@ struct nine_state
 intps_const_i[NINE_MAX_CONST_I][4];
 BOOL   ps_const_b[NINE_MAX_CONST_B];
 float *ps_lconstf_temp;
-uint32_t bumpmap_vars[48];
+uint32_t bumpmap_vars[6 * NINE_MAX_TEXTURE_STAGES];
 
 struct {
 void *vs;
@@ -191,7 +193,7 @@ struct nine_state
 struct {
 struct {
 uint32_t group;
-uint32_t tex_stage[NINE_MAX_SAMPLERS][(NINED3DTSS_COUNT + 31) / 
32];
+uint32_t tex_stage[NINE_MAX_TEXTURE_STAGES][(NINED3DTSS_COUNT + 
31) / 32];
 uint32_t transform[(NINED3DTS_COUNT + 31) / 32];
 } changed;
 
@@ -208,7 +210,7 @@ struct nine_state
 
 D3DMATERIAL9 material;
 
-DWORD tex_stage[NINE_MAX_SAMPLERS][NINED3DTSS_COUNT];
+DWORD tex_stage[NINE_MAX_TEXTURE_STAGES][NINED3DTSS_COUNT];
 } ff;
 
 uint32_t commit;
diff --git a/src/gallium/state_trackers/nine/stateblock9.c 
b/src/gallium/state_trackers/nine/stateblock9.c
index 032b9ff..6d6e1be 100644
--- a/src/gallium/state_trackers/nine/stateblock9.c
+++ b/src/gallium/state_trackers/nine/stateblock9.c
@@ -251,7 +251,7 @@ nine_state_copy_common(struct nine_state *dst,
 dst-ff.material = src-ff.material;
 
 if (mask-changed.group  NINE_STATE_FF_PSSTAGES) {
-for (s = 0; s  NINE_MAX_SAMPLERS; ++s) {
+for (s = 0; s  NINE_MAX_TEXTURE_STAGES; ++s) {
 for (i = 0; i  NINED3DTSS_COUNT; ++i)
 if (mask-ff.changed.tex_stage[s][i / 32]  (1  (i % 32)))
 dst-ff.tex_stage[s][i] = src-ff.tex_stage[s][i];
-- 
2.1.0

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


[Mesa-dev] [PATCH 64/71] st/nine: Use CSO cache for sampler views

2015-08-16 Thread Axel Davy
The CSO cache unbinds views that are not needed anymore,
which we don't do.
It checks for change before committing the views.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/device9.c|  3 ---
 src/gallium/state_trackers/nine/nine_pipe.c  |  4 ++--
 src/gallium/state_trackers/nine/nine_state.c | 20 +++-
 src/gallium/state_trackers/nine/nine_state.h |  1 -
 4 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index b5ff774..dbe0e16 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -2711,9 +2711,6 @@ NineDevice9_SetSamplerState( struct NineDevice9 *This,
 state-samp[Sampler][Type] = Value;
 state-changed.group |= NINE_STATE_SAMPLER;
 state-changed.sampler[Sampler] |= 1  Type;
-
-if (Type == D3DSAMP_SRGBTEXTURE)
-state-changed.srgb = TRUE;
 }
 
 return D3D_OK;
diff --git a/src/gallium/state_trackers/nine/nine_pipe.c 
b/src/gallium/state_trackers/nine/nine_pipe.c
index 9ac5700..741b5e6 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.c
+++ b/src/gallium/state_trackers/nine/nine_pipe.c
@@ -256,8 +256,8 @@ nine_pipe_context_clear(struct NineDevice9 *This)
 cso_set_samplers(cso, PIPE_SHADER_VERTEX, 0, NULL);
 cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, 0, NULL);
 
-pipe-set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 0, NULL);
-pipe-set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0, 0, NULL);
+cso_set_sampler_views(cso, PIPE_SHADER_VERTEX, 0, NULL);
+cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, 0, NULL);
 
 pipe-set_vertex_buffers(pipe, 0, This-caps.MaxStreams, NULL);
 pipe-set_index_buffer(pipe, NULL);
diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index 9d89c31..847cf1b 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -702,19 +702,16 @@ update_sampler_derived(struct nine_state *state, unsigned 
s)
 static void
 update_textures_and_samplers(struct NineDevice9 *device)
 {
-struct pipe_context *pipe = device-pipe;
 struct nine_state *state = device-state;
 struct pipe_sampler_view *view[NINE_MAX_SAMPLERS];
 unsigned num_textures;
 unsigned i;
-boolean commit_views;
 boolean commit_samplers;
 uint16_t sampler_mask = state-ps ? state-ps-sampler_mask :
 device-ff.ps-sampler_mask;
 
 /* TODO: Can we reduce iterations here ? */
 
-commit_views = FALSE;
 commit_samplers = FALSE;
 state-bound_samplers_mask_ps = 0;
 for (num_textures = 0, i = 0; i  NINE_MAX_SAMPLERS_PS; ++i) {
@@ -750,7 +747,6 @@ update_textures_and_samplers(struct NineDevice9 *device)
 cso_single_sampler(device-cso, PIPE_SHADER_FRAGMENT,
s - NINE_SAMPLER_PS(0), 
device-dummy_sampler_state);
 
-commit_views = TRUE;
 commit_samplers = TRUE;
 state-changed.sampler[s] = ~0;
 }
@@ -758,16 +754,11 @@ update_textures_and_samplers(struct NineDevice9 *device)
 state-bound_samplers_mask_ps |= (1  s);
 }
 
-commit_views |= (state-changed.texture  NINE_PS_SAMPLERS_MASK) != 0;
-commit_views |= state-changed.srgb;
-if (commit_views)
-pipe-set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
-num_textures, view);
+cso_set_sampler_views(device-cso, PIPE_SHADER_FRAGMENT, num_textures, 
view);
 
 if (commit_samplers)
 cso_single_sampler_done(device-cso, PIPE_SHADER_FRAGMENT);
 
-commit_views = FALSE;
 commit_samplers = FALSE;
 sampler_mask = state-vs ? state-vs-sampler_mask : 0;
 state-bound_samplers_mask_vs = 0;
@@ -804,23 +795,18 @@ update_textures_and_samplers(struct NineDevice9 *device)
 cso_single_sampler(device-cso, PIPE_SHADER_VERTEX,
s - NINE_SAMPLER_VS(0), 
device-dummy_sampler_state);
 
-commit_views = TRUE;
 commit_samplers = TRUE;
 state-changed.sampler[s] = ~0;
 }
 
 state-bound_samplers_mask_vs |= (1  s);
 }
-commit_views |= (state-changed.texture  NINE_VS_SAMPLERS_MASK) != 0;
-commit_views |= state-changed.srgb;
-if (commit_views)
-pipe-set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0,
-num_textures, view);
+
+cso_set_sampler_views(device-cso, PIPE_SHADER_VERTEX, num_textures, view);
 
 if (commit_samplers)
 cso_single_sampler_done(device-cso, PIPE_SHADER_VERTEX);
 
-state-changed.srgb = FALSE;
 state-changed.texture = 0;
 }
 
diff --git a/src/gallium/state_trackers/nine/nine_state.h 
b/src/gallium/state_trackers/nine/nine_state.h
index 0f3c2fa..4351e3e 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ 

[Mesa-dev] [PATCH 56/71] st/nine: Complete ff texture transform implementation

2015-08-16 Thread Axel Davy
Wine tests were used to get it right.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_ff.c   | 161 ++--
 src/gallium/state_trackers/nine/nine_ff.h   |  81 
 src/gallium/state_trackers/nine/vertexshader9.h |   2 +-
 3 files changed, 174 insertions(+), 70 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_ff.c 
b/src/gallium/state_trackers/nine/nine_ff.c
index 4428ce6..1033050 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -31,13 +31,6 @@
 #define NINE_FF_NUM_VS_CONST 256
 #define NINE_FF_NUM_PS_CONST 24
 
-#define NINED3DTSS_TCI_DISABLE   0
-#define NINED3DTSS_TCI_PASSTHRU  1
-#define NINED3DTSS_TCI_CAMERASPACENORMAL 2
-#define NINED3DTSS_TCI_CAMERASPACEPOSITION   3
-#define NINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR   4
-#define NINED3DTSS_TCI_SPHEREMAP 5
-
 struct fvec4
 {
 float x, y, z, w;
@@ -66,15 +59,18 @@ struct nine_ff_vs_key
 uint32_t color1in_one : 1;
 uint32_t fog : 1;
 uint32_t pad1 : 7;
-uint32_t tc_gen : 24; /* 8 * 3 bits */
-uint32_t pad2 : 8;
-uint32_t tc_idx : 24;
+uint32_t tc_dim_input: 16; /* 8 * 2 bits */
+uint32_t pad2 : 16;
+uint32_t tc_dim_output: 24; /* 8 * 3 bits */
 uint32_t pad3 : 8;
-uint32_t tc_dim : 24; /* 8 * 3 bits */
+uint32_t tc_gen : 24; /* 8 * 3 bits */
 uint32_t pad4 : 8;
+uint32_t tc_idx : 24;
+uint32_t pad5 : 8;
+uint32_t pad6;
 };
-uint64_t value64[2]; /* don't forget to resize VertexShader9.ff_key */
-uint32_t value32[4];
+uint64_t value64[3]; /* don't forget to resize VertexShader9.ff_key */
+uint32_t value32[6];
 };
 };
 
@@ -108,13 +104,14 @@ struct nine_ff_ps_key
 uint32_t alphaarg2 : 3;
 uint32_t resultarg : 1; /* CURRENT:0 or TEMP:1 */
 uint32_t textarget : 2; /* 1D/2D/3D/CUBE */
-uint32_t projected : 1;
+uint32_t pad   : 1;
 /* that's 32 bit exactly */
 } ts[8];
+uint32_t projected : 16;
 uint32_t fog : 1; /* for vFog coming from VS */
 uint32_t fog_mode : 2;
 uint32_t specular : 1;
-uint32_t pad1 : 28;/* 9 32-bit words with this */
+uint32_t pad1 : 12; /* 9 32-bit words with this */
 uint8_t colorarg_b4[3];
 uint8_t colorarg_b5[3];
 uint8_t alphaarg_b4[3]; /* 11 32-bit words plus a byte */
@@ -337,11 +334,11 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
 {
 const struct nine_ff_vs_key *key = vs-key;
 struct ureg_program *ureg = ureg_create(TGSI_PROCESSOR_VERTEX);
-struct ureg_dst oPos, oCol[2], oTex[8], oPsz, oFog;
+struct ureg_dst oPos, oCol[2], oPsz, oFog;
 struct ureg_dst rVtx, rNrm;
 struct ureg_dst r[8];
 struct ureg_dst AR;
-struct ureg_dst tmp, tmp_x, tmp_z;
+struct ureg_dst tmp, tmp_x, tmp_y, tmp_z;
 unsigned i, c;
 unsigned label[32], l = 0;
 unsigned num_r = 8;
@@ -439,6 +436,7 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
 r[i] = ureg_DECL_local_temporary(ureg);
 tmp = r[0];
 tmp_x = ureg_writemask(tmp, TGSI_WRITEMASK_X);
+tmp_y = ureg_writemask(tmp, TGSI_WRITEMASK_Y);
 tmp_z = ureg_writemask(tmp, TGSI_WRITEMASK_Z);
 if (key-lighting || key-vertexblend)
 AR = ureg_DECL_address(ureg);
@@ -551,8 +549,6 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
 ureg_CLAMP(ureg, oPsz, vs-aPsz, _(cPsz1), _(cPsz1));
 #endif
 } else if (key-pointscale) {
-struct ureg_dst tmp_x = ureg_writemask(tmp, TGSI_WRITEMASK_X);
-struct ureg_dst tmp_y = ureg_writemask(tmp, TGSI_WRITEMASK_Y);
 struct ureg_src cPsz1 = ureg_DECL_constant(ureg, 26);
 struct ureg_src cPsz2 = ureg_DECL_constant(ureg, 27);
 
@@ -573,72 +569,85 @@ nine_ff_build_vs(struct NineDevice9 *device, struct 
vs_build_ctx *vs)
 #endif
 }
 
-/* Texture coordinate generation:
- * XXX: D3DTTFF_PROJECTED, transform matrix
- */
 for (i = 0; i  8; ++i) {
-struct ureg_dst dst[5];
-struct ureg_src src;
-unsigned c;
+struct ureg_dst oTex, input_coord, transformed, t;
+unsigned c, writemask;
 const unsigned tci = (key-tc_gen  (i * 3))  0x7;
 const unsigned idx = (key-tc_idx  (i * 3))  0x7;
-const unsigned dim = (key-tc_dim  (i * 3))  0x7;
+unsigned dim_input = 1 + ((key-tc_dim_input  (i * 2))  0x3);
+const unsigned dim_output = (key-tc_dim_output  (i * 3))  0x7;
 
+/* No texture output of index s */
 if (tci == 

[Mesa-dev] [Bug 91643] mesa-demos-8.2.0 (latest released version) fails to build against mesa-10.6.4-2.mga6.tainted.src.rpm

2015-08-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=91643

--- Comment #6 from Tobias Klausmann tobias.klausm...@mni.thm.de ---
Oh right, i was not aware of this. I guess mesa-demo should make this the
default then.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 16/71] st/nine: Simplify NineVolume9_CopyVolume

2015-08-16 Thread Axel Davy
We had only one usage for this function.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/device9.c |  4 +-
 src/gallium/state_trackers/nine/volume9.c | 90 ++-
 src/gallium/state_trackers/nine/volume9.h |  8 +--
 3 files changed, 21 insertions(+), 81 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 57831c4..b72045e 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1353,8 +1353,8 @@ NineDevice9_UpdateTexture( struct NineDevice9 *This,
 struct NineVolumeTexture9 *src = NineVolumeTexture9(srcb);
 
 for (l = 0; l = last_level; ++l, ++m)
-NineVolume9_CopyVolume(dst-volumes[l],
-   src-volumes[m], 0, 0, 0, NULL);
+NineVolume9_CopyMemToDefault(dst-volumes[l],
+ src-volumes[m], 0, 0, 0, NULL);
 } else{
 assert(!invalid texture type);
 }
diff --git a/src/gallium/state_trackers/nine/volume9.c 
b/src/gallium/state_trackers/nine/volume9.c
index 3b5b312..5495548 100644
--- a/src/gallium/state_trackers/nine/volume9.c
+++ b/src/gallium/state_trackers/nine/volume9.c
@@ -309,42 +309,31 @@ NineVolume9_UnlockBox( struct NineVolume9 *This )
 return D3D_OK;
 }
 
-
+/* When this function is called, we have already checked
+ * The copy regions fit the volumes */
 HRESULT
-NineVolume9_CopyVolume( struct NineVolume9 *This,
-struct NineVolume9 *From,
-unsigned dstx, unsigned dsty, unsigned dstz,
-struct pipe_box *pSrcBox )
+NineVolume9_CopyMemToDefault( struct NineVolume9 *This,
+  struct NineVolume9 *From,
+  unsigned dstx, unsigned dsty, unsigned dstz,
+  struct pipe_box *pSrcBox )
 {
 struct pipe_context *pipe = This-pipe;
 struct pipe_resource *r_dst = This-resource;
-struct pipe_resource *r_src = From-resource;
-struct pipe_transfer *transfer;
 struct pipe_box src_box;
 struct pipe_box dst_box;
-uint8_t *p_dst;
 const uint8_t *p_src;
 
 DBG(This=%p From=%p dstx=%u dsty=%u dstz=%u pSrcBox=%p\n,
 This, From, dstx, dsty, dstz, pSrcBox);
 
-assert(This-desc.Pool != D3DPOOL_MANAGED 
-   From-desc.Pool != D3DPOOL_MANAGED);
-user_assert(This-desc.Format == From-desc.Format, D3DERR_INVALIDCALL);
+assert(This-desc.Pool == D3DPOOL_DEFAULT 
+   From-desc.Pool == D3DPOOL_SYSTEMMEM);
 
 dst_box.x = dstx;
 dst_box.y = dsty;
 dst_box.z = dstz;
 
 if (pSrcBox) {
-/* make sure it doesn't range outside the source volume */
-user_assert(pSrcBox-x = 0 
-(pSrcBox-width - pSrcBox-x) = From-desc.Width 
-pSrcBox-y = 0 
-(pSrcBox-height - pSrcBox-y) = From-desc.Height 
-pSrcBox-z = 0 
-(pSrcBox-depth - pSrcBox-z) = From-desc.Depth,
-D3DERR_INVALIDCALL);
 src_box = *pSrcBox;
 } else {
 src_box.x = 0;
@@ -354,69 +343,20 @@ NineVolume9_CopyVolume( struct NineVolume9 *This,
 src_box.height = From-desc.Height;
 src_box.depth = From-desc.Depth;
 }
-/* limits */
-dst_box.width = This-desc.Width - dst_box.x;
-dst_box.height = This-desc.Height - dst_box.y;
-dst_box.depth = This-desc.Depth - dst_box.z;
-
-user_assert(src_box.width = dst_box.width 
-src_box.height = dst_box.height 
-src_box.depth = dst_box.depth, D3DERR_INVALIDCALL);
 
 dst_box.width = src_box.width;
 dst_box.height = src_box.height;
 dst_box.depth = src_box.depth;
 
-if (r_dst  r_src) {
-pipe-resource_copy_region(pipe,
-   r_dst, This-level,
-   dst_box.x, dst_box.y, dst_box.z,
-   r_src, From-level,
-   src_box);
-} else
-if (r_dst) {
-p_src = NineVolume9_GetSystemMemPointer(From,
-src_box.x, src_box.y, src_box.z);
-
-pipe-transfer_inline_write(pipe, r_dst, This-level,
-0, /* WRITE|DISCARD are implicit */
-dst_box, p_src,
-From-stride, From-layer_stride);
-} else
-if (r_src) {
-p_dst = NineVolume9_GetSystemMemPointer(This, 0, 0, 0);
-p_src = pipe-transfer_map(pipe, r_src, From-level,
-   PIPE_TRANSFER_READ,
-   src_box, transfer);
-if (!p_src)
-return D3DERR_DRIVERINTERNALERROR;
-
-util_copy_box(p_dst, This-info.format,
-  This-stride, This-layer_stride,
-  dst_box.x, 

[Mesa-dev] [PATCH 15/71] st/nine: Split NineSurface9_CopySurface

2015-08-16 Thread Axel Davy
NineSurface9_CopySurface was supporting more cases than what
we needed, and doing checks that were innapropriate for
some NineSurface9_CopySurface use cases.

This patch splits it into two for the two use cases, and moves
the checks to the caller.

This patch also adds a few checks to NineDevice9_UpdateSurface

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/device9.c|  81 +++-
 src/gallium/state_trackers/nine/nine_pipe.h  |  17 +++
 src/gallium/state_trackers/nine/surface9.c   | 176 ++-
 src/gallium/state_trackers/nine/surface9.h   |  14 ++-
 src/gallium/state_trackers/nine/swapchain9.c |   6 +-
 5 files changed, 169 insertions(+), 125 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index a1c05b4..57831c4 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1185,6 +1185,8 @@ NineDevice9_UpdateSurface( struct NineDevice9 *This,
 {
 struct NineSurface9 *dst = NineSurface9(pDestinationSurface);
 struct NineSurface9 *src = NineSurface9(pSourceSurface);
+int copy_width, copy_height;
+RECT destRect;
 
 DBG(This=%p pSourceSurface=%p pDestinationSurface=%p 
 pSourceRect=%p pDestPoint=%p\n, This,
@@ -1196,13 +1198,75 @@ NineDevice9_UpdateSurface( struct NineDevice9 *This,
 if (pDestPoint)
 DBG(pDestPoint = (%u,%u)\n, pDestPoint-x, pDestPoint-y);
 
+user_assert(dst  src, D3DERR_INVALIDCALL);
+
 user_assert(dst-base.pool == D3DPOOL_DEFAULT, D3DERR_INVALIDCALL);
 user_assert(src-base.pool == D3DPOOL_SYSTEMMEM, D3DERR_INVALIDCALL);
 
 user_assert(dst-desc.MultiSampleType == D3DMULTISAMPLE_NONE, 
D3DERR_INVALIDCALL);
 user_assert(src-desc.MultiSampleType == D3DMULTISAMPLE_NONE, 
D3DERR_INVALIDCALL);
 
-return NineSurface9_CopySurface(dst, src, pDestPoint, pSourceRect);
+user_assert(!src-lock_count, D3DERR_INVALIDCALL);
+user_assert(!dst-lock_count, D3DERR_INVALIDCALL);
+
+user_assert(dst-desc.Format == src-desc.Format, D3DERR_INVALIDCALL);
+user_assert(!depth_stencil_format(dst-desc.Format), D3DERR_INVALIDCALL);
+
+if (pSourceRect) {
+copy_width = pSourceRect-right - pSourceRect-left;
+copy_height = pSourceRect-bottom - pSourceRect-top;
+
+user_assert(pSourceRect-left = 0 
+copy_width  0 
+pSourceRect-right = src-desc.Width 
+pSourceRect-top = 0 
+copy_height  0 
+pSourceRect-bottom = src-desc.Height,
+D3DERR_INVALIDCALL);
+} else {
+copy_width = src-desc.Width;
+copy_height = src-desc.Height;
+}
+
+destRect.right = copy_width;
+destRect.bottom = copy_height;
+
+if (pDestPoint) {
+user_assert(pDestPoint-x = 0  pDestPoint-y = 0,
+D3DERR_INVALIDCALL);
+destRect.right += pDestPoint-x;
+destRect.bottom += pDestPoint-y;
+}
+
+user_assert(destRect.right = dst-desc.Width 
+destRect.bottom = dst-desc.Height,
+D3DERR_INVALIDCALL);
+
+if (compressed_format(dst-desc.Format)) {
+const unsigned w = util_format_get_blockwidth(dst-base.info.format);
+const unsigned h = util_format_get_blockheight(dst-base.info.format);
+
+if (pDestPoint) {
+user_assert(!(pDestPoint-x % w)  !(pDestPoint-y % h),
+D3DERR_INVALIDCALL);
+}
+
+if (pSourceRect) {
+user_assert(!(pSourceRect-left % w)  !(pSourceRect-top % h),
+D3DERR_INVALIDCALL);
+}
+if (!(copy_width == src-desc.Width 
+  copy_width == dst-desc.Width 
+  copy_height == src-desc.Height 
+  copy_height == dst-desc.Height)) {
+user_assert(!(copy_width  % w)  !(copy_height % h),
+D3DERR_INVALIDCALL);
+}
+}
+
+NineSurface9_CopyMemToDefault(dst, src, pDestPoint, pSourceRect);
+
+return D3D_OK;
 }
 
 HRESULT WINAPI
@@ -1267,8 +1331,8 @@ NineDevice9_UpdateTexture( struct NineDevice9 *This,
 struct NineTexture9 *src = NineTexture9(srcb);
 
 for (l = 0; l = last_level; ++l, ++m)
-NineSurface9_CopySurface(dst-surfaces[l],
- src-surfaces[m], NULL, NULL);
+NineSurface9_CopyMemToDefault(dst-surfaces[l],
+  src-surfaces[m], NULL, NULL);
 } else
 if (dstb-base.type == D3DRTYPE_CUBETEXTURE) {
 struct NineCubeTexture9 *dst = NineCubeTexture9(dstb);
@@ -1278,8 +1342,8 @@ NineDevice9_UpdateTexture( struct NineDevice9 *This,
 /* GPUs usually have them stored as arrays of mip-mapped 2D textures. 
*/
 for (z = 0; z  6; ++z) {
 for (l = 0; l = last_level; ++l, ++m) {
-

[Mesa-dev] [PATCH 21/71] st/nine: Only update dirty rect for UpdateTexture

2015-08-16 Thread Axel Davy
UpdateTexture is supposed to optimise by uploading only for the
dirty region of the source (d3d9 doc, wine tests).
This patch adds the behaviour for surfaces, but not entirely for
volumes.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/device9.c   | 47 -
 src/gallium/state_trackers/nine/nine_pipe.h | 44 +++
 2 files changed, 83 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index b72045e..91c1eaa 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1278,6 +1278,7 @@ NineDevice9_UpdateTexture( struct NineDevice9 *This,
 struct NineBaseTexture9 *srcb = NineBaseTexture9(pSourceTexture);
 unsigned l, m;
 unsigned last_level = dstb-base.info.last_level;
+RECT rect;
 
 DBG(This=%p pSourceTexture=%p pDestinationTexture=%p\n, This,
 pSourceTexture, pDestinationTexture);
@@ -1303,10 +1304,6 @@ NineDevice9_UpdateTexture( struct NineDevice9 *This,
 
 user_assert(dstb-base.type == srcb-base.type, D3DERR_INVALIDCALL);
 
-/* TODO: We can restrict the update to the dirty portions of the source.
- * Yes, this seems silly, but it's what MSDN says ...
- */
-
 /* Find src level that matches dst level 0: */
 user_assert(srcb-base.info.width0 = dstb-base.info.width0 
 srcb-base.info.height0 = dstb-base.info.height0 
@@ -1330,9 +1327,25 @@ NineDevice9_UpdateTexture( struct NineDevice9 *This,
 struct NineTexture9 *dst = NineTexture9(dstb);
 struct NineTexture9 *src = NineTexture9(srcb);
 
-for (l = 0; l = last_level; ++l, ++m)
+if (src-dirty_rect.width == 0)
+return D3D_OK;
+
+pipe_box_to_rect(rect, src-dirty_rect);
+for (l = 0; l  m; ++l)
+rect_minify_inclusive(rect);
+
+for (l = 0; l = last_level; ++l, ++m) {
+fit_rect_format_inclusive(dst-base.base.info.format,
+  rect,
+  dst-surfaces[l]-desc.Width,
+  dst-surfaces[l]-desc.Height);
 NineSurface9_CopyMemToDefault(dst-surfaces[l],
-  src-surfaces[m], NULL, NULL);
+  src-surfaces[m],
+  (POINT *)rect,
+  rect);
+rect_minify_inclusive(rect);
+}
+u_box_origin_2d(0, 0, src-dirty_rect);
 } else
 if (dstb-base.type == D3DRTYPE_CUBETEXTURE) {
 struct NineCubeTexture9 *dst = NineCubeTexture9(dstb);
@@ -1341,10 +1354,25 @@ NineDevice9_UpdateTexture( struct NineDevice9 *This,
 
 /* GPUs usually have them stored as arrays of mip-mapped 2D textures. 
*/
 for (z = 0; z  6; ++z) {
+if (src-dirty_rect[z].width == 0)
+continue;
+
+pipe_box_to_rect(rect, src-dirty_rect[z]);
+for (l = 0; l  m; ++l)
+rect_minify_inclusive(rect);
+
 for (l = 0; l = last_level; ++l, ++m) {
- NineSurface9_CopyMemToDefault(dst-surfaces[l * 6 + z],
-   src-surfaces[m * 6 + z], NULL, 
NULL);
+fit_rect_format_inclusive(dst-base.base.info.format,
+  rect,
+  dst-surfaces[l * 6 + z]-desc.Width,
+  dst-surfaces[l * 6 + 
z]-desc.Height);
+NineSurface9_CopyMemToDefault(dst-surfaces[l * 6 + z],
+  src-surfaces[m * 6 + z],
+  (POINT *)rect,
+  rect);
+rect_minify_inclusive(rect);
 }
+u_box_origin_2d(0, 0, src-dirty_rect[z]);
 m -= l;
 }
 } else
@@ -1352,9 +1380,12 @@ NineDevice9_UpdateTexture( struct NineDevice9 *This,
 struct NineVolumeTexture9 *dst = NineVolumeTexture9(dstb);
 struct NineVolumeTexture9 *src = NineVolumeTexture9(srcb);
 
+if (src-dirty_box.width == 0)
+return D3D_OK;
 for (l = 0; l = last_level; ++l, ++m)
 NineVolume9_CopyMemToDefault(dst-volumes[l],
  src-volumes[m], 0, 0, 0, NULL);
+u_box_3d(0, 0, 0, 0, 0, 0, src-dirty_box);
 } else{
 assert(!invalid texture type);
 }
diff --git a/src/gallium/state_trackers/nine/nine_pipe.h 
b/src/gallium/state_trackers/nine/nine_pipe.h
index 2da39cb..9fde06d 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.h
+++ b/src/gallium/state_trackers/nine/nine_pipe.h
@@ -27,6 +27,7 @@
 #include pipe/p_format.h
 #include pipe/p_screen.h
 #include pipe/p_state.h /* 

[Mesa-dev] [PATCH 13/71] util/u_blitter: implement alpha blending for pipe-blit

2015-08-16 Thread Axel Davy
From: Marek Olšák marek.ol...@amd.com

---
 src/gallium/auxiliary/util/u_blitter.c  | 54 ++---
 src/gallium/auxiliary/util/u_blitter.h  |  3 +-
 src/gallium/auxiliary/util/u_surface.c  |  3 ++
 src/gallium/drivers/i915/i915_surface.c |  3 +-
 src/gallium/drivers/r300/r300_blit.c|  3 +-
 src/gallium/drivers/r600/r600_blit.c|  3 +-
 src/gallium/drivers/radeonsi/si_blit.c  |  3 +-
 7 files changed, 49 insertions(+), 23 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_blitter.c 
b/src/gallium/auxiliary/util/u_blitter.c
index 85206ea..9bba07a 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -104,7 +104,7 @@ struct blitter_context_priv
void *fs_resolve_uint[PIPE_MAX_TEXTURE_TYPES][NUM_RESOLVE_FRAG_SHADERS][2];
 
/* Blend state. */
-   void *blend[PIPE_MASK_RGBA+1]; /** blend state with writemask */
+   void *blend[PIPE_MASK_RGBA+1][2]; /** blend state with writemask */
void *blend_clear[GET_CLEAR_BLEND_STATE_IDX(PIPE_CLEAR_COLOR)+1];
 
/* Depth stencil alpha state. */
@@ -159,7 +159,7 @@ struct blitter_context *util_blitter_create(struct 
pipe_context *pipe)
struct pipe_rasterizer_state rs_state;
struct pipe_sampler_state sampler_state;
struct pipe_vertex_element velem[2];
-   unsigned i;
+   unsigned i, j;
 
ctx = CALLOC_STRUCT(blitter_context_priv);
if (!ctx)
@@ -208,8 +208,20 @@ struct blitter_context *util_blitter_create(struct 
pipe_context *pipe)
memset(blend, 0, sizeof(blend));
 
for (i = 0; i = PIPE_MASK_RGBA; i++) {
-  blend.rt[0].colormask = i;
-  ctx-blend[i] = pipe-create_blend_state(pipe, blend);
+  for (j = 0; j  2; j++) {
+ memset(blend.rt[0], 0, sizeof(blend.rt[0]));
+ blend.rt[0].colormask = i;
+ if (j) {
+blend.rt[0].blend_enable = 1;
+blend.rt[0].rgb_func = PIPE_BLEND_ADD;
+blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_SRC_ALPHA;
+blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
+blend.rt[0].alpha_func = PIPE_BLEND_ADD;
+blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_SRC_ALPHA;
+blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
+ }
+ ctx-blend[i][j] = pipe-create_blend_state(pipe, blend);
+  }
}
 
/* depth stencil alpha state objects */
@@ -409,9 +421,10 @@ void util_blitter_destroy(struct blitter_context *blitter)
struct pipe_context *pipe = blitter-pipe;
int i, j, f;
 
-   for (i = 0; i = PIPE_MASK_RGBA; i++) {
-  pipe-delete_blend_state(pipe, ctx-blend[i]);
-   }
+   for (i = 0; i = PIPE_MASK_RGBA; i++)
+  for (j = 0; j  2; j++)
+ pipe-delete_blend_state(pipe, ctx-blend[i][j]);
+
for (i = 0; i  Elements(ctx-blend_clear); i++) {
   if (ctx-blend_clear[i])
  pipe-delete_blend_state(pipe, ctx-blend_clear[i]);
@@ -1217,7 +1230,7 @@ static void *get_clear_blend_state(struct 
blitter_context_priv *ctx,
 
/* Return an existing blend state. */
if (!clear_buffers)
-  return ctx-blend[0];
+  return ctx-blend[0][0];
 
index = GET_CLEAR_BLEND_STATE_IDX(clear_buffers);
 
@@ -1483,7 +1496,8 @@ void util_blitter_copy_texture(struct blitter_context 
*blitter,
/* Copy. */
util_blitter_blit_generic(blitter, dst_view, dstbox,
  src_view, srcbox, src-width0, src-height0,
- PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL);
+ PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL,
+ FALSE);
 
pipe_surface_reference(dst_view, NULL);
pipe_sampler_view_reference(src_view, NULL);
@@ -1496,7 +1510,8 @@ void util_blitter_blit_generic(struct blitter_context 
*blitter,
const struct pipe_box *srcbox,
unsigned src_width0, unsigned src_height0,
unsigned mask, unsigned filter,
-   const struct pipe_scissor_state *scissor)
+   const struct pipe_scissor_state *scissor,
+   boolean alpha_blend)
 {
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_context *pipe = ctx-base.pipe;
@@ -1550,7 +1565,7 @@ void util_blitter_blit_generic(struct blitter_context 
*blitter,
fb_state.zsbuf = NULL;
 
if (blit_depth || blit_stencil) {
-  pipe-bind_blend_state(pipe, ctx-blend[0]);
+  pipe-bind_blend_state(pipe, ctx-blend[0][0]);
 
   if (blit_depth  blit_stencil) {
  pipe-bind_depth_stencil_alpha_state(pipe,
@@ -1573,7 +1588,9 @@ void util_blitter_blit_generic(struct blitter_context 
*blitter,
   }
 
} else {
-  pipe-bind_blend_state(pipe, ctx-blend[mask  PIPE_MASK_RGBA]);
+  unsigned colormask = mask  PIPE_MASK_RGBA;
+
+  pipe-bind_blend_state(pipe, ctx-blend[colormask][alpha_blend]);
  

[Mesa-dev] [PATCH 22/71] st/nine: Track managed textures

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/basetexture9.c | 7 ++-
 src/gallium/state_trackers/nine/basetexture9.h | 3 ++-
 src/gallium/state_trackers/nine/device9.c  | 1 +
 src/gallium/state_trackers/nine/device9.h  | 1 +
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/nine/basetexture9.c 
b/src/gallium/state_trackers/nine/basetexture9.c
index 728aafd..c38a310 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -85,6 +85,9 @@ NineBaseTexture9_ctor( struct NineBaseTexture9 *This,

util_format_has_depth(util_format_description(This-base.info.format));
 
 list_inithead(This-list);
+list_inithead(This-list2);
+if (Pool == D3DPOOL_MANAGED)
+list_add(This-list2, This-base.base.device-managed_textures);
 
 return D3D_OK;
 }
@@ -98,7 +101,9 @@ NineBaseTexture9_dtor( struct NineBaseTexture9 *This )
 pipe_sampler_view_reference(This-view[1], NULL);
 
 if (This-list.prev != NULL  This-list.next != NULL)
-list_del(This-list),
+list_del(This-list);
+if (This-list2.prev != NULL  This-list2.next != NULL)
+list_del(This-list2);
 
 NineResource9_dtor(This-base);
 }
diff --git a/src/gallium/state_trackers/nine/basetexture9.h 
b/src/gallium/state_trackers/nine/basetexture9.h
index 9d6fb0c..9489824 100644
--- a/src/gallium/state_trackers/nine/basetexture9.h
+++ b/src/gallium/state_trackers/nine/basetexture9.h
@@ -30,7 +30,8 @@
 struct NineBaseTexture9
 {
 struct NineResource9 base;
-struct list_head list;
+struct list_head list; /* for update_textures */
+struct list_head list2; /* for managed_textures */
 
 /* g3d */
 struct pipe_context *pipe;
diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 91c1eaa..34199ca 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -186,6 +186,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
 if (FAILED(hr)) { return hr; }
 
 list_inithead(This-update_textures);
+list_inithead(This-managed_textures);
 
 This-screen = pScreen;
 This-caps = *pCaps;
diff --git a/src/gallium/state_trackers/nine/device9.h 
b/src/gallium/state_trackers/nine/device9.h
index 7460745..a5a5ab2 100644
--- a/src/gallium/state_trackers/nine/device9.h
+++ b/src/gallium/state_trackers/nine/device9.h
@@ -69,6 +69,7 @@ struct NineDevice9
 struct nine_state state;   /* device state */
 
 struct list_head update_textures;
+struct list_head managed_textures;
 
 boolean is_recording;
 boolean in_scene;
-- 
2.1.0

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


[Mesa-dev] [PATCH 06/71] st/nine: Account POINTSIZE_MIN and POINTSIZE_MAX for point size

2015-08-16 Thread Axel Davy
From: Patrick Rudolph s...@das-labor.org

When using D3DRS_POINTSIZE make sure the value is at least
D3DRS_POINTSIZE_MIN but not greater than D3DRS_POINTSIZE_MAX.

Reviewed-by: Axel Davy axel.d...@ens.fr
Signed-off-by: Patrick Rudolph s...@das-labor.org
---
 src/gallium/state_trackers/nine/nine_pipe.c  |  8 +++-
 src/gallium/state_trackers/nine/nine_state.c |  4 ++--
 src/gallium/state_trackers/nine/nine_state.h | 21 ++---
 3 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/gallium/state_trackers/nine/nine_pipe.c 
b/src/gallium/state_trackers/nine/nine_pipe.c
index c0b74b8..ddf8e8b 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.c
+++ b/src/gallium/state_trackers/nine/nine_pipe.c
@@ -110,7 +110,13 @@ nine_convert_rasterizer_state(struct cso_context *ctx, 
const DWORD *rs)
  /* rast.line_stipple_pattern = 0; */
 rast.sprite_coord_enable = rs[D3DRS_POINTSPRITEENABLE] ? 0xff : 0x00;
 rast.line_width = 1.0f;
-rast.point_size = rs[NINED3DRS_VSPOINTSIZE] ? 1.0f : 
asfloat(rs[D3DRS_POINTSIZE]); /* XXX: D3DRS_POINTSIZE_MIN/MAX */
+if (rs[NINED3DRS_VSPOINTSIZE]) {
+rast.point_size = 1.0f;
+} else {
+rast.point_size = CLAMP(asfloat(rs[D3DRS_POINTSIZE]),
+asfloat(rs[D3DRS_POINTSIZE_MIN]),
+asfloat(rs[D3DRS_POINTSIZE_MAX]));
+}
 rast.offset_units = asfloat(rs[D3DRS_DEPTHBIAS]) * 
asfloat(rs[NINED3DRS_ZBIASSCALE]);
 rast.offset_scale = asfloat(rs[D3DRS_SLOPESCALEDEPTHBIAS]);
  /* rast.offset_clamp = 0.0f; */
diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index 6c83585..db861c4 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -1394,7 +1394,7 @@ const uint32_t nine_render_state_group[NINED3DRS_LAST + 
1] =
 [D3DRS_VERTEXBLEND] = NINE_STATE_FF_OTHER,
 [D3DRS_CLIPPLANEENABLE] = NINE_STATE_RASTERIZER,
 [D3DRS_POINTSIZE] = NINE_STATE_RASTERIZER,
-[D3DRS_POINTSIZE_MIN] = NINE_STATE_MISC_CONST,
+[D3DRS_POINTSIZE_MIN] = NINE_STATE_RASTERIZER,
 [D3DRS_POINTSPRITEENABLE] = NINE_STATE_RASTERIZER,
 [D3DRS_POINTSCALEENABLE] = NINE_STATE_FF_OTHER,
 [D3DRS_POINTSCALE_A] = NINE_STATE_FF_OTHER,
@@ -1404,7 +1404,7 @@ const uint32_t nine_render_state_group[NINED3DRS_LAST + 
1] =
 [D3DRS_MULTISAMPLEMASK] = NINE_STATE_SAMPLE_MASK,
 [D3DRS_PATCHEDGESTYLE] = NINE_STATE_UNHANDLED,
 [D3DRS_DEBUGMONITORTOKEN] = NINE_STATE_UNHANDLED,
-[D3DRS_POINTSIZE_MAX] = NINE_STATE_MISC_CONST,
+[D3DRS_POINTSIZE_MAX] = NINE_STATE_RASTERIZER,
 [D3DRS_INDEXEDVERTEXBLENDENABLE] = NINE_STATE_FF_OTHER,
 [D3DRS_COLORWRITEENABLE] = NINE_STATE_BLEND,
 [D3DRS_TWEENFACTOR] = NINE_STATE_FF_OTHER,
diff --git a/src/gallium/state_trackers/nine/nine_state.h 
b/src/gallium/state_trackers/nine/nine_state.h
index 2bf3f63..cac9af6 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -67,17 +67,16 @@
 #define NINE_STATE_BLEND_COLOR (1  16)
 #define NINE_STATE_STENCIL_REF (1  17)
 #define NINE_STATE_SAMPLE_MASK (1  18)
-#define NINE_STATE_MISC_CONST  (1  19)
-#define NINE_STATE_FF  (0x1f  20)
-#define NINE_STATE_FF_VS   (0x17  20)
-#define NINE_STATE_FF_PS   (0x18  20)
-#define NINE_STATE_FF_LIGHTING (1  20)
-#define NINE_STATE_FF_MATERIAL (1  21)
-#define NINE_STATE_FF_VSTRANSF (1  22)
-#define NINE_STATE_FF_PSSTAGES (1  23)
-#define NINE_STATE_FF_OTHER(1  24)
-#define NINE_STATE_ALL  0x1ff
-#define NINE_STATE_UNHANDLED   (1  25)
+#define NINE_STATE_FF  (0x1f  19)
+#define NINE_STATE_FF_VS   (0x17  19)
+#define NINE_STATE_FF_PS   (0x18  19)
+#define NINE_STATE_FF_LIGHTING (1  19)
+#define NINE_STATE_FF_MATERIAL (1  20)
+#define NINE_STATE_FF_VSTRANSF (1  21)
+#define NINE_STATE_FF_PSSTAGES (1  22)
+#define NINE_STATE_FF_OTHER(1  23)
+#define NINE_STATE_ALL  0x0ff
+#define NINE_STATE_UNHANDLED   (1  24)
 
 
 #define NINE_MAX_SIMULTANEOUS_RENDERTARGETS 4
-- 
2.1.0

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


[Mesa-dev] [PATCH 07/71] st/nine: fix D3DRS_DITHERENABLE wrong state group

2015-08-16 Thread Axel Davy
D3DRS_DITHERENABLE was assigned to the rasterizer state
group, but it was used for the blend group.

Assign it to the blend group.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/nine_state.c 
b/src/gallium/state_trackers/nine/nine_state.c
index db861c4..4bf5908 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -1353,7 +1353,7 @@ const uint32_t nine_render_state_group[NINED3DRS_LAST + 
1] =
 [D3DRS_ZFUNC] = NINE_STATE_DSA,
 [D3DRS_ALPHAREF] = NINE_STATE_DSA,
 [D3DRS_ALPHAFUNC] = NINE_STATE_DSA,
-[D3DRS_DITHERENABLE] = NINE_STATE_RASTERIZER,
+[D3DRS_DITHERENABLE] = NINE_STATE_BLEND,
 [D3DRS_ALPHABLENDENABLE] = NINE_STATE_BLEND,
 [D3DRS_FOGENABLE] = NINE_STATE_FF_OTHER,
 [D3DRS_SPECULARENABLE] = NINE_STATE_FF_LIGHTING,
-- 
2.1.0

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


[Mesa-dev] [PATCH 03/71] st/nine: Fix Swizzle for ATI2 format

2015-08-16 Thread Axel Davy
We had red and green in the wrong channels
for the ATI2 format (RGTC2).

Found thanks to wine tests.

Signed-off-by: Axel Davy axel.d...@ens.fr
Reviewed-by: David Heidelberg da...@ixit.cz
---
 src/gallium/state_trackers/nine/basetexture9.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/gallium/state_trackers/nine/basetexture9.c 
b/src/gallium/state_trackers/nine/basetexture9.c
index 17a8f44..eabf32b 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -530,6 +530,11 @@ NineBaseTexture9_UpdateSamplerView( struct 
NineBaseTexture9 *This,
 swizzle[2] = PIPE_SWIZZLE_RED;
 swizzle[3] = PIPE_SWIZZLE_RED;
 }
+} else if (resource-format == PIPE_FORMAT_RGTC2_UNORM) {
+swizzle[0] = PIPE_SWIZZLE_GREEN;
+swizzle[1] = PIPE_SWIZZLE_RED;
+swizzle[2] = PIPE_SWIZZLE_ONE;
+swizzle[3] = PIPE_SWIZZLE_ONE;
 } else if (resource-format != PIPE_FORMAT_A8_UNORM 
resource-format != PIPE_FORMAT_RGTC1_UNORM) {
 /* exceptions:
-- 
2.1.0

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


[Mesa-dev] [PATCH 08/71] st/nine: Hide hardware cursor when we don't use it

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
Reviewed-by: David Heidelberg da...@ixit.cz
---
 src/gallium/state_trackers/nine/device9.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 55948cb..fce19b2 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -599,11 +599,11 @@ NineDevice9_SetCursorProperties( struct NineDevice9 *This,
  UINT YHotSpot,
  IDirect3DSurface9 *pCursorBitmap )
 {
-/* TODO: hardware cursor */
 struct NineSurface9 *surf = NineSurface9(pCursorBitmap);
 struct pipe_context *pipe = This-pipe;
 struct pipe_box box;
 struct pipe_transfer *transfer;
+BOOL hw_cursor;
 void *ptr;
 
 DBG_FLAG(DBG_SWAPCHAIN, This=%p XHotSpot=%u YHotSpot=%u 
@@ -613,6 +613,7 @@ NineDevice9_SetCursorProperties( struct NineDevice9 *This,
 
 This-cursor.w = MIN2(surf-desc.Width, This-cursor.image-width0);
 This-cursor.h = MIN2(surf-desc.Height, This-cursor.image-height0);
+hw_cursor = This-cursor.w == 32  This-cursor.h == 32;
 
 u_box_origin_2d(This-cursor.w, This-cursor.h, box);
 
@@ -643,16 +644,21 @@ NineDevice9_SetCursorProperties( struct NineDevice9 *This,
  lock.pBits, lock.Pitch,
  This-cursor.w, This-cursor.h);
 
-if (!This-cursor.software 
-This-cursor.w == 32  This-cursor.h == 32)
-ID3DPresent_SetCursor(This-swapchains[0]-present,
-  lock.pBits, This-cursor.hotspot,
-  This-cursor.visible);
+if (hw_cursor)
+hw_cursor = ID3DPresent_SetCursor(This-swapchains[0]-present,
+  lock.pBits,
+  This-cursor.hotspot,
+  This-cursor.visible) == D3D_OK;
 
 NineSurface9_UnlockRect(surf);
 }
 pipe-transfer_unmap(pipe, transfer);
 
+/* hide cursor if we emulate it */
+if (!hw_cursor)
+ID3DPresent_SetCursor(This-swapchains[0]-present, NULL, NULL, FALSE);
+This-cursor.software = !hw_cursor;
+
 return D3D_OK;
 }
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 31/71] st/nine: Impose restrictions on DXTN texture sizes

2015-08-16 Thread Axel Davy
This is the expected behaviour.
Fixes more than 1 wine tests failures.

Signed-off-by: Axel Davy axel.d...@ens.fr
Reviewed-by: David Heidelberg da...@ixit.cz
---
 src/gallium/state_trackers/nine/cubetexture9.c   | 7 +++
 src/gallium/state_trackers/nine/device9.c| 7 +++
 src/gallium/state_trackers/nine/texture9.c   | 7 +++
 src/gallium/state_trackers/nine/volumetexture9.c | 7 +++
 4 files changed, 28 insertions(+)

diff --git a/src/gallium/state_trackers/nine/cubetexture9.c 
b/src/gallium/state_trackers/nine/cubetexture9.c
index c1e6cbd..a2bb9b9 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -70,6 +70,13 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
 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);
+
+user_assert(!(EdgeLength % w)  !(EdgeLength % h), 
D3DERR_INVALIDCALL);
+}
+
 info-screen = pParams-device-screen;
 info-target = PIPE_TEXTURE_CUBE;
 info-format = pf;
diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 224f7c8..f84364e 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1125,6 +1125,13 @@ create_zs_or_rt_surface(struct NineDevice9 *This,
 default: break;
 }
 
+if (compressed_format(Format)) {
+const unsigned w = util_format_get_blockwidth(templ.format);
+const unsigned h = util_format_get_blockheight(templ.format);
+
+user_assert(!(Width % w)  !(Height % h), D3DERR_INVALIDCALL);
+}
+
 if (Pool == D3DPOOL_DEFAULT  Format != D3DFMT_NULL) {
 /* resource_create doesn't return an error code, so check format here 
*/
 user_assert(templ.format != PIPE_FORMAT_NONE, D3DERR_INVALIDCALL);
diff --git a/src/gallium/state_trackers/nine/texture9.c 
b/src/gallium/state_trackers/nine/texture9.c
index 6822865..af97082 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -101,6 +101,13 @@ NineTexture9_ctor( struct NineTexture9 *This,
 if (Format != D3DFMT_NULL  pf == PIPE_FORMAT_NONE)
 return D3DERR_INVALIDCALL;
 
+if (compressed_format(Format)) {
+const unsigned w = util_format_get_blockwidth(pf);
+const unsigned h = util_format_get_blockheight(pf);
+
+user_assert(!(Width % w)  !(Height % h), D3DERR_INVALIDCALL);
+}
+
 info-screen = screen;
 info-target = PIPE_TEXTURE_2D;
 info-format = pf;
diff --git a/src/gallium/state_trackers/nine/volumetexture9.c 
b/src/gallium/state_trackers/nine/volumetexture9.c
index 4b5614d..e5b2b53 100644
--- a/src/gallium/state_trackers/nine/volumetexture9.c
+++ b/src/gallium/state_trackers/nine/volumetexture9.c
@@ -64,6 +64,13 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This,
 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);
+/* Compressed formats are not compressed on depth component */
+user_assert(!(Width % w)  !(Height % h), D3DERR_INVALIDCALL);
+}
+
 info-screen = pParams-device-screen;
 info-target = PIPE_TEXTURE_3D;
 info-format = pf;
-- 
2.1.0

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


[Mesa-dev] [PATCH 28/71] st/nine: Clean GetPrivateData

2015-08-16 Thread Axel Davy
From: Patrick Rudolph s...@das-labor.org

Move the assert to return error codes in the correct order.
Always set the pSizeOfData to the required buffer size.
Fixes failing wine test device.c test_private_data()

Reviewed-by: Axel Davy axel.d...@ens.fr
Signed-off-by: Patrick Rudolph s...@das-labor.org
---
 src/gallium/state_trackers/nine/resource9.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/nine/resource9.c 
b/src/gallium/state_trackers/nine/resource9.c
index bbc8320..b6a13e1 100644
--- a/src/gallium/state_trackers/nine/resource9.c
+++ b/src/gallium/state_trackers/nine/resource9.c
@@ -161,20 +161,22 @@ NineResource9_GetPrivateData( struct NineResource9 *This,
   DWORD *pSizeOfData )
 {
 struct pheader *header;
+DWORD sizeofdata;
 
 DBG(This=%p refguid=%p pData=%p pSizeOfData=%p\n,
 This, refguid, pData, pSizeOfData);
 
-user_assert(pSizeOfData, E_POINTER);
-
 header = util_hash_table_get(This-pdata, refguid);
 if (!header) { return D3DERR_NOTFOUND; }
 
+user_assert(pSizeOfData, E_POINTER);
+sizeofdata = *pSizeOfData;
+*pSizeOfData = header-size;
+
 if (!pData) {
-*pSizeOfData = header-size;
 return D3D_OK;
 }
-if (*pSizeOfData  header-size) {
+if (sizeofdata  header-size) {
 return D3DERR_MOREDATA;
 }
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 14/71] st/nine: Simplify Volume9 dirty region tracking

2015-08-16 Thread Axel Davy
Similar to what was done for Surface9, track the dirty region
only in VolumeTexture9.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/basetexture9.c |  9 +--
 src/gallium/state_trackers/nine/volume9.c  | 82 ++
 src/gallium/state_trackers/nine/volume9.h  | 11 +---
 3 files changed, 35 insertions(+), 67 deletions(-)

diff --git a/src/gallium/state_trackers/nine/basetexture9.c 
b/src/gallium/state_trackers/nine/basetexture9.c
index eabf32b..cc74cc9 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -310,14 +310,12 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 
*This )
 tex-dirty_box.width, tex-dirty_box.height, 
tex-dirty_box.depth);
 
 if (tex-dirty_box.width) {
-for (l = 0; l = last_level; ++l) {
+for (l = min_level_dirty; l = last_level; ++l) {
 u_box_minify_2d(box, tex-dirty_box, l);
-NineVolume9_AddDirtyRegion(tex-volumes[l], 
tex-dirty_box);
+NineVolume9_UploadSelf(tex-volumes[l], box);
 }
 memset(tex-dirty_box, 0, sizeof(tex-dirty_box));
 }
-for (l = min_level_dirty; l = last_level; ++l)
-NineVolume9_UploadSelf(tex-volumes[l]);
 } else {
 assert(!invalid texture type);
 }
@@ -361,8 +359,7 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
 box.width = u_minify(This-base.info.width0, l);
 box.height = u_minify(This-base.info.height0, l);
 box.depth = u_minify(This-base.info.depth0, l);
-NineVolume9_AddDirtyRegion(tex-volumes[l], box);
-NineVolume9_UploadSelf(tex-volumes[l]);
+NineVolume9_UploadSelf(tex-volumes[l], box);
 }
 } else {
 assert(!invalid texture type);
diff --git a/src/gallium/state_trackers/nine/volume9.c 
b/src/gallium/state_trackers/nine/volume9.c
index 8694d3d..3b5b312 100644
--- a/src/gallium/state_trackers/nine/volume9.c
+++ b/src/gallium/state_trackers/nine/volume9.c
@@ -23,6 +23,7 @@
 #include device9.h
 #include volume9.h
 #include basetexture9.h /* for marking dirty */
+#include volumetexture9.h
 #include nine_helpers.h
 #include nine_pipe.h
 #include nine_dump.h
@@ -182,47 +183,23 @@ NineVolume9_GetDesc( struct NineVolume9 *This,
 return D3D_OK;
 }
 
-static inline boolean
-NineVolume9_IsDirty(struct NineVolume9 *This)
-{
-return This-dirty_box[0].width != 0;
-}
-
 inline void
 NineVolume9_AddDirtyRegion( struct NineVolume9 *This,
 const struct pipe_box *box )
 {
-struct pipe_box cover_a, cover_b;
-float vol[2];
+D3DBOX dirty_region;
+struct NineVolumeTexture9 *tex = NineVolumeTexture9(This-base.container);
 
 if (!box) {
-u_box_3d(0, 0, 0, This-desc.Width, This-desc.Height,
- This-desc.Depth, This-dirty_box[0]);
-memset(This-dirty_box[1], 0, sizeof(This-dirty_box[1]));
-return;
-}
-if (!This-dirty_box[0].width) {
-This-dirty_box[0] = *box;
-return;
-}
-
-u_box_union_3d(cover_a, This-dirty_box[0], box);
-vol[0] = u_box_volume_3d(cover_a);
-
-if (This-dirty_box[1].width == 0) {
-vol[1] = u_box_volume_3d(This-dirty_box[0]);
-if (vol[0]  (vol[1] * 1.5f))
-This-dirty_box[1] = *box;
-else
-This-dirty_box[0] = cover_a;
+NineVolumeTexture9_AddDirtyBox(tex, NULL);
 } else {
-u_box_union_3d(cover_b, This-dirty_box[1], box);
-vol[1] = u_box_volume_3d(cover_b);
-
-if (vol[0]  vol[1])
-This-dirty_box[1] = cover_b;
-else
-This-dirty_box[0] = cover_a;
+dirty_region.Left = box-x  This-level_actual;
+dirty_region.Top = box-y  This-level_actual;
+dirty_region.Front = box-z  This-level_actual;
+dirty_region.Right = dirty_region.Left + (box-width  
This-level_actual);
+dirty_region.Bottom = dirty_region.Top + (box-height  
This-level_actual);
+dirty_region.Back = dirty_region.Front + (box-depth  
This-level_actual);
+NineVolumeTexture9_AddDirtyBox(tex, dirty_region);
 }
 }
 
@@ -312,8 +289,7 @@ NineVolume9_LockBox( struct NineVolume9 *This,
 
 if (!(Flags  (D3DLOCK_NO_DIRTY_UPDATE | D3DLOCK_READONLY))) {
 NineVolume9_MarkContainerDirty(This);
-if (This-desc.Pool == D3DPOOL_MANAGED)
-NineVolume9_AddDirtyRegion(This, box);
+NineVolume9_AddDirtyRegion(This, box);
 }
 
 ++This-lock_count;
@@ -446,33 +422,35 @@ NineVolume9_CopyVolume( struct NineVolume9 *This,
 }
 
 HRESULT
-NineVolume9_UploadSelf( struct NineVolume9 *This )
+NineVolume9_UploadSelf( struct NineVolume9 *This,
+const struct pipe_box *damaged )
 {
 struct pipe_context 

[Mesa-dev] [PATCH 17/71] st/nine: SetAutoGenFilterType should regenerate the sublevels

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/basetexture9.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/state_trackers/nine/basetexture9.c 
b/src/gallium/state_trackers/nine/basetexture9.c
index cc74cc9..728aafd 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -153,6 +153,8 @@ NineBaseTexture9_SetAutoGenFilterType( struct 
NineBaseTexture9 *This,
 user_assert(FilterType != D3DTEXF_NONE, D3DERR_INVALIDCALL);
 
 This-mipfilter = FilterType;
+This-dirty_mip = TRUE;
+NineBaseTexture9_GenerateMipSubLevels(This);
 
 return D3D_OK;
 }
-- 
2.1.0

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


[Mesa-dev] [PATCH 10/71] st/nine: Do not call ID3DPresent_GetCursorPos for sw cursor

2015-08-16 Thread Axel Davy
For sw cursor we do not tell wine the cursor position (the app
tells us directly). We shouldn't use ID3DPresent_GetCursorPos.

device-cursor.pos already contains the coordinates the app
gave us.

Signed-off-by: Axel Davy axel.d...@ens.fr
Reviewed-by: David Heidelberg da...@ixit.cz
---
 src/gallium/state_trackers/nine/swapchain9.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/nine/swapchain9.c 
b/src/gallium/state_trackers/nine/swapchain9.c
index a62e6ad..eb84d08 100644
--- a/src/gallium/state_trackers/nine/swapchain9.c
+++ b/src/gallium/state_trackers/nine/swapchain9.c
@@ -575,9 +575,10 @@ handle_draw_cursor_and_hud( struct NineSwapChain9 *This, 
struct pipe_resource *r
 blit.filter = PIPE_TEX_FILTER_NEAREST;
 blit.scissor_enable = FALSE;
 
-ID3DPresent_GetCursorPos(This-present, device-cursor.pos);
-
-/* NOTE: blit messes up when box.x + box.width  0, fix driver */
+/* NOTE: blit messes up when box.x + box.width  0, fix driver
+ * NOTE2: device-cursor.pos contains coordinates relative to the 
screen.
+ * This happens to be also the position of the cursor when we are 
fullscreen.
+ * We don't use sw cursor for Windowed mode */
 blit.dst.box.x = MAX2(device-cursor.pos.x, 0) - 
device-cursor.hotspot.x;
 blit.dst.box.y = MAX2(device-cursor.pos.y, 0) - 
device-cursor.hotspot.y;
 blit.dst.box.width = blit.src.box.width;
-- 
2.1.0

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


[Mesa-dev] [PATCH 02/71] target/d3dadapter9: Return Windows like card names

2015-08-16 Thread Axel Davy
From: Patrick Rudolph s...@das-labor.org

Add support for multiple cards and fill in Windows like card name, driver name 
and version info.
Use fallback for unknown vendors and unknown card names.

Reviewed-by: Axel Davy axel.d...@ens.fr
Signed-off-by: Patrick Rudolph s...@das-labor.org
---
 src/gallium/targets/d3dadapter9/Makefile.am   |   1 +
 src/gallium/targets/d3dadapter9/description.c | 324 ++
 src/gallium/targets/d3dadapter9/drm.c |  76 +++---
 3 files changed, 359 insertions(+), 42 deletions(-)
 create mode 100644 src/gallium/targets/d3dadapter9/description.c

diff --git a/src/gallium/targets/d3dadapter9/Makefile.am 
b/src/gallium/targets/d3dadapter9/Makefile.am
index fe5b0b1..e26ca33 100644
--- a/src/gallium/targets/d3dadapter9/Makefile.am
+++ b/src/gallium/targets/d3dadapter9/Makefile.am
@@ -54,6 +54,7 @@ pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = d3d.pc
 
 d3dadapter9_la_SOURCES = \
+   description.c \
getproc.c \
drm.c
 
diff --git a/src/gallium/targets/d3dadapter9/description.c 
b/src/gallium/targets/d3dadapter9/description.c
new file mode 100644
index 000..c0a8678
--- /dev/null
+++ b/src/gallium/targets/d3dadapter9/description.c
@@ -0,0 +1,324 @@
+/*
+ * Copyright 2015 Patrick Rudolph s...@das-labor.org
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the Software),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include string.h
+#include adapter9.h
+
+#define DBG_CHANNEL DBG_ADAPTER
+
+/* prototypes */
+void
+d3d_match_vendor_id( D3DADAPTER_IDENTIFIER9* drvid,
+unsigned fallback_ven,
+unsigned fallback_dev,
+const char* fallback_name );
+void d3d_fill_driver_version(D3DADAPTER_IDENTIFIER9* drvid);
+void d3d_fill_cardname(D3DADAPTER_IDENTIFIER9* drvid);
+
+enum d3d_vendor_id
+{
+HW_VENDOR_SOFTWARE  = 0x,
+HW_VENDOR_AMD   = 0x1002,
+HW_VENDOR_NVIDIA= 0x10de,
+HW_VENDOR_VMWARE= 0x15ad,
+HW_VENDOR_INTEL = 0x8086,
+};
+
+struct card_lookup_table {
+const char *mesaname;
+const char *d3d9name;
+}
+cards_amd[] = {
+{HAWAII,  AMD Radeon R9 290},
+{KAVERI,  AMD Radeon(TM) R7 Graphics},
+{KABINI,  AMD Radeon HD 8400 / R3 Series},
+{BONAIRE, AMD Radeon HD 8770},
+{OLAND,   AMD Radeon HD 8670},
+{HAINAN,  AMD Radeon HD 8600M Series},
+{TAHITI,  AMD Radeon HD 7900 Series},
+{PITCAIRN,AMD Radeon HD 7800 Series},
+{CAPE VERDE,  AMD Radeon HD 7700 Series},
+{ARUBA,   AMD Radeon HD 7660D},
+{CAYMAN,  AMD Radeon HD 6900 Series},
+{BARTS,   AMD Radeon HD 6800 Series},
+{TURKS,   AMD Radeon HD 6600 Series},
+{SUMO2,   AMD Radeon HD 6410D},
+{SUMO,AMD Radeon HD 6550D},
+{CAICOS,  AMD Radeon HD 6400 Series},
+{PALM,AMD Radeon HD 6300 series Graphics},
+{HEMLOCK, ATI Radeon HD 5900 Series},
+{CYPRESS, ATI Radeon HD 5800 Series},
+{JUNIPER, ATI Radeon HD 5700 Series},
+{REDWOOD, ATI Radeon HD 5600 Series},
+{CEDAR,   ATI Radeon HD 5500 Series},
+{R700,ATI Radeon HD 4800 Series},
+{RV790,   ATI Radeon HD 4800 Series},
+{RV770,   ATI Radeon HD 4800 Series},
+{RV740,   ATI Radeon HD 4700 Series},
+{RV730,   ATI Radeon HD 4600 Series},
+{RV710,   ATI Radeon HD 4350},
+{RS880,   ATI Mobility Radeon HD 4200},
+{RS780,  

[Mesa-dev] [PATCH 19/71] st/nine: Track dirty region for SYSTEMMEM too

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/cubetexture9.c   |  6 --
 src/gallium/state_trackers/nine/surface9.c   |  4 ++--
 src/gallium/state_trackers/nine/texture9.c   | 10 ++
 src/gallium/state_trackers/nine/volumetexture9.c |  8 +---
 4 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/src/gallium/state_trackers/nine/cubetexture9.c 
b/src/gallium/state_trackers/nine/cubetexture9.c
index e9224d0..1215745 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -265,9 +265,11 @@ NineCubeTexture9_AddDirtyRect( struct NineCubeTexture9 
*This,
 }
 return D3D_OK;
 }
-This-base.managed.dirty = TRUE;
 
-BASETEX_REGISTER_UPDATE(This-base);
+if (This-base.base.pool == D3DPOOL_MANAGED) {
+This-base.managed.dirty = TRUE;
+BASETEX_REGISTER_UPDATE(This-base);
+}
 
 if (!pDirtyRect) {
 u_box_origin_2d(This-base.base.info.width0,
diff --git a/src/gallium/state_trackers/nine/surface9.c 
b/src/gallium/state_trackers/nine/surface9.c
index 3e9465a..eb941ce 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -273,7 +273,7 @@ NineSurface9_AddDirtyRect( struct NineSurface9 *This,
 This-texture == D3DRTYPE_CUBETEXTURE ||
 This-texture == D3DRTYPE_TEXTURE);
 
-if (This-base.pool != D3DPOOL_MANAGED)
+if (This-base.pool == D3DPOOL_DEFAULT)
 return;
 
 /* Add a dirty rect to level 0 of the parent texture */
@@ -287,7 +287,7 @@ NineSurface9_AddDirtyRect( struct NineSurface9 *This,
 NineTexture9(This-base.base.container);
 
 NineTexture9_AddDirtyRect(tex, dirty_rect);
-} else { /* This-texture == D3DRTYPE_CUBETEXTURE */
+} else if (This-texture == D3DRTYPE_CUBETEXTURE) {
 struct NineCubeTexture9 *ctex =
 NineCubeTexture9(This-base.base.container);
 
diff --git a/src/gallium/state_trackers/nine/texture9.c 
b/src/gallium/state_trackers/nine/texture9.c
index a7a679e..0127301 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -295,20 +295,22 @@ NineTexture9_AddDirtyRect( struct NineTexture9 *This,
 pDirtyRect ? pDirtyRect-left : 0, pDirtyRect ? pDirtyRect-top : 0,
 pDirtyRect ? pDirtyRect-right : 0, pDirtyRect ? pDirtyRect-bottom : 
0);
 
-/* Tracking dirty regions on DEFAULT or SYSTEMMEM resources is pointless,
+/* Tracking dirty regions on DEFAULT resources is pointless,
  * because we always write to the final storage. Just marked it dirty in
  * case we need to generate mip maps.
  */
-if (This-base.base.pool != D3DPOOL_MANAGED) {
+if (This-base.base.pool == D3DPOOL_DEFAULT) {
 if (This-base.base.usage  D3DUSAGE_AUTOGENMIPMAP) {
 This-base.dirty_mip = TRUE;
 BASETEX_REGISTER_UPDATE(This-base);
 }
 return D3D_OK;
 }
-This-base.managed.dirty = TRUE;
 
-BASETEX_REGISTER_UPDATE(This-base);
+if (This-base.base.pool == D3DPOOL_MANAGED) {
+This-base.managed.dirty = TRUE;
+BASETEX_REGISTER_UPDATE(This-base);
+}
 
 if (!pDirtyRect) {
 u_box_origin_2d(This-base.base.info.width0,
diff --git a/src/gallium/state_trackers/nine/volumetexture9.c 
b/src/gallium/state_trackers/nine/volumetexture9.c
index 1193e12..720ae57 100644
--- a/src/gallium/state_trackers/nine/volumetexture9.c
+++ b/src/gallium/state_trackers/nine/volumetexture9.c
@@ -193,12 +193,14 @@ NineVolumeTexture9_AddDirtyBox( struct NineVolumeTexture9 
*This,
 {
 DBG(This=%p pDirtybox=%p\n, This, pDirtyBox);
 
-if (This-base.base.pool != D3DPOOL_MANAGED) {
+if (This-base.base.pool == D3DPOOL_DEFAULT) {
 return D3D_OK;
 }
-This-base.managed.dirty = TRUE;
 
-BASETEX_REGISTER_UPDATE(This-base);
+if (This-base.base.pool == D3DPOOL_MANAGED) {
+This-base.managed.dirty = TRUE;
+BASETEX_REGISTER_UPDATE(This-base);
+}
 
 if (!pDirtyBox) {
 This-dirty_box.x = 0;
-- 
2.1.0

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


[Mesa-dev] [PATCH 11/71] st/nine: Revert to sw cursor in case of failure to set hw cursor

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
Reviewed-by: David Heidelberg da...@ixit.cz
---
 src/gallium/state_trackers/nine/device9.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 9f6c90e..38af8e3 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -682,7 +682,7 @@ NineDevice9_SetCursorPosition( struct NineDevice9 *This,
 This-cursor.pos.y = Y;
 
 if (!This-cursor.software)
-ID3DPresent_SetCursorPos(swap-present, This-cursor.pos);
+This-cursor.software = ID3DPresent_SetCursorPos(swap-present, 
This-cursor.pos) != D3D_OK;
 }
 
 BOOL WINAPI
@@ -695,7 +695,7 @@ NineDevice9_ShowCursor( struct NineDevice9 *This,
 
 This-cursor.visible = bShow  (This-cursor.hotspot.x != -1);
 if (!This-cursor.software)
-ID3DPresent_SetCursor(This-swapchains[0]-present, NULL, NULL, bShow);
+This-cursor.software = 
ID3DPresent_SetCursor(This-swapchains[0]-present, NULL, NULL, bShow) != 
D3D_OK;
 
 return old;
 }
-- 
2.1.0

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


[Mesa-dev] [PATCH 05/71] st/nine: Align texture memory

2015-08-16 Thread Axel Davy
From: Patrick Rudolph s...@das-labor.org

Align texture memory on 32 byte boundry to allow SSE/AVX memcpy to work on 
locked rects.
This fixes issue #88.

Reviewed-by: David Heidelberg da...@ixit.cz
Reviewed-by: Axel Davy axel.d...@ens.fr
Signed-off-by: Patrick Rudolph s...@das-labor.org
---
 src/gallium/state_trackers/nine/cubetexture9.c | 2 +-
 src/gallium/state_trackers/nine/surface9.c | 4 ++--
 src/gallium/state_trackers/nine/texture9.c | 4 ++--
 src/gallium/state_trackers/nine/volume9.c  | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/nine/cubetexture9.c 
b/src/gallium/state_trackers/nine/cubetexture9.c
index edea1f2..b3ef245 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -106,7 +106,7 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
 face_size = nine_format_get_size_and_offsets(pf, level_offsets,
  EdgeLength, EdgeLength,
  info-last_level);
-This-managed_buffer = MALLOC(6 * face_size);
+This-managed_buffer = align_malloc(6 * face_size, 32);
 if (!This-managed_buffer)
 return E_OUTOFMEMORY;
 }
diff --git a/src/gallium/state_trackers/nine/surface9.c 
b/src/gallium/state_trackers/nine/surface9.c
index 7533cb3..164b34e 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -104,11 +104,11 @@ NineSurface9_ctor( struct NineSurface9 *This,
 /* Ram buffer with no parent. Has to allocate the resource itself */
 if (!pResource  !pContainer) {
 assert(!user_buffer);
-This-data = MALLOC(
+This-data = align_malloc(
 nine_format_get_level_alloc_size(This-base.info.format,
  pDesc-Width,
  pDesc-Height,
- 0));
+ 0), 32);
 if (!This-data)
 return E_OUTOFMEMORY;
 }
diff --git a/src/gallium/state_trackers/nine/texture9.c 
b/src/gallium/state_trackers/nine/texture9.c
index 5900e76..6b4b9e3 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -152,10 +152,10 @@ NineTexture9_ctor( struct NineTexture9 *This,
  * apps access sublevels of texture even if they locked only first
  * level) */
 level_offsets = alloca(sizeof(unsigned) * (info-last_level + 1));
-user_buffer = MALLOC(
+user_buffer = align_malloc(
 nine_format_get_size_and_offsets(pf, level_offsets,
  Width, Height,
- info-last_level));
+ info-last_level), 32);
 This-managed_buffer = user_buffer;
 if (!This-managed_buffer)
 return E_OUTOFMEMORY;
diff --git a/src/gallium/state_trackers/nine/volume9.c 
b/src/gallium/state_trackers/nine/volume9.c
index 4dfc559..8694d3d 100644
--- a/src/gallium/state_trackers/nine/volume9.c
+++ b/src/gallium/state_trackers/nine/volume9.c
@@ -43,7 +43,7 @@ NineVolume9_AllocateData( struct NineVolume9 *This )
 DBG((%p(This=%p),level=%u) Allocating 0x%x bytes of system memory.\n,
 This-base.container, This, This-level, size);
 
-This-data = (uint8_t *)MALLOC(size);
+This-data = (uint8_t *)align_malloc(size, 32);
 if (!This-data)
 return E_OUTOFMEMORY;
 return D3D_OK;
-- 
2.1.0

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


[Mesa-dev] [PATCH 09/71] st/nine: Force hw cursor for Windowed mode

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
Reviewed-by: David Heidelberg da...@ixit.cz
---
 src/gallium/state_trackers/nine/device9.c | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index fce19b2..9f6c90e 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -611,9 +611,15 @@ NineDevice9_SetCursorProperties( struct NineDevice9 *This,
 
 user_assert(pCursorBitmap, D3DERR_INVALIDCALL);
 
-This-cursor.w = MIN2(surf-desc.Width, This-cursor.image-width0);
-This-cursor.h = MIN2(surf-desc.Height, This-cursor.image-height0);
-hw_cursor = This-cursor.w == 32  This-cursor.h == 32;
+if (This-swapchains[0]-params.Windowed) {
+This-cursor.w = MIN2(surf-desc.Width, 32);
+This-cursor.h = MIN2(surf-desc.Height, 32);
+hw_cursor = 1; /* always use hw cursor for windowed mode */
+} else {
+This-cursor.w = MIN2(surf-desc.Width, This-cursor.image-width0);
+This-cursor.h = MIN2(surf-desc.Height, This-cursor.image-height0);
+hw_cursor = This-cursor.w == 32  This-cursor.h == 32;
+}
 
 u_box_origin_2d(This-cursor.w, This-cursor.h, box);
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 36/71] st/nine: Fix use of uninitialized values

2015-08-16 Thread Axel Davy
From: Patrick Rudolph s...@das-labor.org

Set all values to 0 after allocation. Found using valgrind.

Reviewed-by: Axel Davy axel.d...@ens.fr
Signed-off-by: Patrick Rudolph s...@das-labor.org
---
 src/gallium/state_trackers/nine/device9.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 96d27e1..e0f3e39 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -2138,8 +2138,10 @@ NineDevice9_SetLight( struct NineDevice9 *This,
 return E_OUTOFMEMORY;
 state-ff.num_lights = N;
 
-for (; n  Index; ++n)
+for (; n  Index; ++n) {
+memset(state-ff.light[n], 0, sizeof(D3DLIGHT9));
 state-ff.light[n].Type = (D3DLIGHTTYPE)NINED3DLIGHT_INVALID;
+}
 }
 state-ff.light[Index] = *pLight;
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 42/71] st/nine: Avoid useless updates in SetSamplerState

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
Reviewed-by: David Heidelberg da...@ixit.cz
---
 src/gallium/state_trackers/nine/device9.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 4aa5892..a327bf8 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -2718,12 +2718,14 @@ NineDevice9_SetSamplerState( struct NineDevice9 *This,
 if (Sampler = D3DDMAPSAMPLER)
 Sampler = Sampler - D3DDMAPSAMPLER + NINE_MAX_SAMPLERS_PS;
 
-state-samp[Sampler][Type] = Value;
-state-changed.group |= NINE_STATE_SAMPLER;
-state-changed.sampler[Sampler] |= 1  Type;
+if (state-samp[Sampler][Type] != Value || unlikely(This-is_recording)) {
+state-samp[Sampler][Type] = Value;
+state-changed.group |= NINE_STATE_SAMPLER;
+state-changed.sampler[Sampler] |= 1  Type;
 
-if (Type == D3DSAMP_SRGBTEXTURE)
-state-changed.srgb = TRUE;
+if (Type == D3DSAMP_SRGBTEXTURE)
+state-changed.srgb = TRUE;
+}
 
 return D3D_OK;
 }
-- 
2.1.0

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


[Mesa-dev] [PATCH 18/71] st/nine: Add missing BASETEX_REGISTER_UPDATE calls

2015-08-16 Thread Axel Davy
If the texture is bound and dirty_mip is true,
BASETEX_REGISTER_UPDATE adds the texture to the list
of things to update before the next draw call.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/cubetexture9.c | 4 +++-
 src/gallium/state_trackers/nine/texture9.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/nine/cubetexture9.c 
b/src/gallium/state_trackers/nine/cubetexture9.c
index b3ef245..e9224d0 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -259,8 +259,10 @@ NineCubeTexture9_AddDirtyRect( struct NineCubeTexture9 
*This,
 user_assert(FaceType  6, D3DERR_INVALIDCALL);
 
 if (This-base.base.pool != D3DPOOL_MANAGED) {
-if (This-base.base.usage  D3DUSAGE_AUTOGENMIPMAP)
+if (This-base.base.usage  D3DUSAGE_AUTOGENMIPMAP) {
 This-base.dirty_mip = TRUE;
+BASETEX_REGISTER_UPDATE(This-base);
+}
 return D3D_OK;
 }
 This-base.managed.dirty = TRUE;
diff --git a/src/gallium/state_trackers/nine/texture9.c 
b/src/gallium/state_trackers/nine/texture9.c
index 6b4b9e3..a7a679e 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -300,8 +300,10 @@ NineTexture9_AddDirtyRect( struct NineTexture9 *This,
  * case we need to generate mip maps.
  */
 if (This-base.base.pool != D3DPOOL_MANAGED) {
-if (This-base.base.usage  D3DUSAGE_AUTOGENMIPMAP)
+if (This-base.base.usage  D3DUSAGE_AUTOGENMIPMAP) {
 This-base.dirty_mip = TRUE;
+BASETEX_REGISTER_UPDATE(This-base);
+}
 return D3D_OK;
 }
 This-base.managed.dirty = TRUE;
-- 
2.1.0

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


[Mesa-dev] [PATCH 32/71] st/nine: Fix Lock Checks for Compressed textures

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/surface9.c | 10 ++
 src/gallium/state_trackers/nine/volume9.c  |  9 +
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/nine/surface9.c 
b/src/gallium/state_trackers/nine/surface9.c
index 78c29ca..14c1ce9 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -347,12 +347,14 @@ NineSurface9_LockRect( struct NineSurface9 *This,
 user_assert(This-desc.MultiSampleType == D3DMULTISAMPLE_NONE,
 D3DERR_INVALIDCALL);
 
-if (pRect  This-base.pool == D3DPOOL_DEFAULT 
-util_format_is_compressed(This-base.info.format)) {
+if (pRect  This-desc.Pool == D3DPOOL_DEFAULT 
+compressed_format (This-desc.Format)) {
 const unsigned w = util_format_get_blockwidth(This-base.info.format);
 const unsigned h = util_format_get_blockheight(This-base.info.format);
-user_assert(!(pRect-left % w)  !(pRect-right % w) 
-!(pRect-top % h)  !(pRect-bottom % h),
+user_assert((pRect-left == 0  pRect-right == This-desc.Width 
+ pRect-top == 0  pRect-bottom == This-desc.Height) ||
+(!(pRect-left % w)  !(pRect-right % w) 
+!(pRect-top % h)  !(pRect-bottom % h)),
 D3DERR_INVALIDCALL);
 }
 
diff --git a/src/gallium/state_trackers/nine/volume9.c 
b/src/gallium/state_trackers/nine/volume9.c
index 6311103..0b90056 100644
--- a/src/gallium/state_trackers/nine/volume9.c
+++ b/src/gallium/state_trackers/nine/volume9.c
@@ -244,12 +244,13 @@ NineVolume9_LockBox( struct NineVolume9 *This,
 user_assert(!((Flags  D3DLOCK_DISCARD)  (Flags  D3DLOCK_READONLY)),
 D3DERR_INVALIDCALL);
 
-if (pBox  This-desc.Pool == D3DPOOL_DEFAULT 
-util_format_is_compressed(This-info.format)) {
+if (pBox  compressed_format (This-desc.Format)) { /* For volume all 
pools are checked */
 const unsigned w = util_format_get_blockwidth(This-info.format);
 const unsigned h = util_format_get_blockheight(This-info.format);
-user_assert(!(pBox-Left % w)  !(pBox-Right % w) 
-!(pBox-Top % h)  !(pBox-Bottom % h),
+user_assert((pBox-Left == 0  pBox-Right == This-desc.Width 
+ pBox-Top == 0  pBox-Bottom == This-desc.Height) ||
+(!(pBox-Left % w)  !(pBox-Right % w) 
+ !(pBox-Top % h)  !(pBox-Bottom % h)),
 D3DERR_INVALIDCALL);
 }
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 27/71] st/nine: fix failing wine test device.c test_lockrect_invalid()

2015-08-16 Thread Axel Davy
From: Patrick Rudolph s...@das-labor.org

Mimic WindowsXp behaviour and allow negative values in the rectangle passed.
Add comment to point out behaviour used.

Reviewed-by: Axel Davy axel.d...@ens.fr
Signed-off-by: Patrick Rudolph s...@das-labor.org
---
 src/gallium/state_trackers/nine/surface9.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/nine/surface9.c 
b/src/gallium/state_trackers/nine/surface9.c
index eb941ce..d20e62a 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -363,13 +363,9 @@ NineSurface9_LockRect( struct NineSurface9 *This,
 usage |= PIPE_TRANSFER_DONTBLOCK;
 
 if (pRect) {
+/* Windows XP accepts invalid locking rectangles, Windows 7 rejects
+ * them. Use Windows XP behaviour for now. */
 rect_to_pipe_box(box, pRect);
-if (u_box_clip_2d(box, box, This-desc.Width,
-  This-desc.Height)  0) {
-DBG(pRect clipped by Width=%u Height=%u\n,
-This-desc.Width, This-desc.Height);
-return D3DERR_INVALIDCALL;
-}
 } else {
 u_box_origin_2d(This-desc.Width, This-desc.Height, box);
 }
-- 
2.1.0

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


[Mesa-dev] [PATCH 04/71] st/nine: Always set point_quad_rasterization to 1

2015-08-16 Thread Axel Davy
Both Points and Point Sprites are rasterized like quads,
according to d3d9 doc and gallium rasterizer doc.

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/nine_pipe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/nine_pipe.c 
b/src/gallium/state_trackers/nine/nine_pipe.c
index 4cf37b9..c0b74b8 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.c
+++ b/src/gallium/state_trackers/nine/nine_pipe.c
@@ -92,7 +92,7 @@ nine_convert_rasterizer_state(struct cso_context *ctx, const 
DWORD *rs)
  /* rast.poly_stipple_enable = 0; */
  /* rast.point_smooth = 0; */
 rast.sprite_coord_mode = PIPE_SPRITE_COORD_UPPER_LEFT;
-rast.point_quad_rasterization = !!rs[D3DRS_POINTSPRITEENABLE];
+rast.point_quad_rasterization = 1;
 rast.point_size_per_vertex = rs[NINED3DRS_VSPOINTSIZE];
 rast.multisample = !!rs[D3DRS_MULTISAMPLEANTIALIAS];
 rast.line_smooth = !!rs[D3DRS_ANTIALIASEDLINEENABLE];
-- 
2.1.0

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


[Mesa-dev] [PATCH 20/71] st/nine: Textures start dirty

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/cubetexture9.c   | 6 +-
 src/gallium/state_trackers/nine/texture9.c   | 3 +++
 src/gallium/state_trackers/nine/volumetexture9.c | 3 +++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/cubetexture9.c 
b/src/gallium/state_trackers/nine/cubetexture9.c
index 1215745..c1e6cbd 100644
--- a/src/gallium/state_trackers/nine/cubetexture9.c
+++ b/src/gallium/state_trackers/nine/cubetexture9.c
@@ -150,8 +150,12 @@ NineCubeTexture9_ctor( struct NineCubeTexture9 *This,
 }
 }
 
-for (i = 0; i  6; ++i) /* width = 0 means empty, depth stays 1 */
+for (i = 0; i  6; ++i) {
+/* Textures start initially dirty */
+This-dirty_rect[i].width = EdgeLength;
+This-dirty_rect[i].height = EdgeLength;
 This-dirty_rect[i].depth = 1;
+}
 
 return D3D_OK;
 }
diff --git a/src/gallium/state_trackers/nine/texture9.c 
b/src/gallium/state_trackers/nine/texture9.c
index 0127301..6822865 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -202,6 +202,9 @@ NineTexture9_ctor( struct NineTexture9 *This,
 return hr;
 }
 
+/* Textures start initially dirty */
+This-dirty_rect.width = Width;
+This-dirty_rect.height = Height;
 This-dirty_rect.depth = 1; /* widht == 0 means empty, depth stays 1 */
 
 if (pSharedHandle  !*pSharedHandle) {/* Pool == D3DPOOL_SYSTEMMEM */
diff --git a/src/gallium/state_trackers/nine/volumetexture9.c 
b/src/gallium/state_trackers/nine/volumetexture9.c
index 720ae57..4b5614d 100644
--- a/src/gallium/state_trackers/nine/volumetexture9.c
+++ b/src/gallium/state_trackers/nine/volumetexture9.c
@@ -116,6 +116,9 @@ NineVolumeTexture9_ctor( struct NineVolumeTexture9 *This,
 return hr;
 }
 
+/* Textures start initially dirty */
+NineVolumeTexture9_AddDirtyBox(This, NULL);
+
 return D3D_OK;
 }
 
-- 
2.1.0

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


[Mesa-dev] [PATCH 25/71] st/nine: Fix FillColor Flag check

2015-08-16 Thread Axel Davy
IT is better check if the surface was created with RT flag,
instead of checking capability (llvmpipe was complaining)

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/device9.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 28daeba..224f7c8 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -1683,11 +1683,8 @@ NineDevice9_ColorFill( struct NineDevice9 *This,
 }
 d3dcolor_to_pipe_color_union(rgba, color);
 
-fallback =
-!This-screen-is_format_supported(This-screen, 
surf-base.info.format,
-   surf-base.info.target,
-   surf-base.info.nr_samples,
-   PIPE_BIND_RENDER_TARGET);
+fallback = !(surf-base.info.bind  PIPE_BIND_RENDER_TARGET);
+
 if (!fallback) {
 psurf = NineSurface9_GetSurface(surf, 0);
 if (!psurf)
-- 
2.1.0

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


[Mesa-dev] [PATCH 23/71] st/nine: Implement EvictManagedResources

2015-08-16 Thread Axel Davy
Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/nine/basetexture9.c | 15 +++
 src/gallium/state_trackers/nine/basetexture9.h |  3 +++
 src/gallium/state_trackers/nine/device9.c  | 12 
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/nine/basetexture9.c 
b/src/gallium/state_trackers/nine/basetexture9.c
index c38a310..110df79 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -587,6 +587,21 @@ NineBaseTexture9_PreLoad( struct NineBaseTexture9 *This )
 NineBaseTexture9_UploadSelf(This);
 }
 
+void
+NineBaseTexture9_UnLoad( struct NineBaseTexture9 *This )
+{
+if (This-base.pool != D3DPOOL_MANAGED ||
+This-managed.lod_resident == -1)
+return;
+
+pipe_resource_reference(This-base.resource, NULL);
+This-managed.lod_resident = -1;
+This-managed.dirty = TRUE;
+
+/* If the texture is bound, we have to re-upload it */
+BASETEX_REGISTER_UPDATE(This);
+}
+
 #ifdef DEBUG
 void
 NineBaseTexture9_Dump( struct NineBaseTexture9 *This )
diff --git a/src/gallium/state_trackers/nine/basetexture9.h 
b/src/gallium/state_trackers/nine/basetexture9.h
index 9489824..b19a621 100644
--- a/src/gallium/state_trackers/nine/basetexture9.h
+++ b/src/gallium/state_trackers/nine/basetexture9.h
@@ -95,6 +95,9 @@ NineBaseTexture9_GenerateMipSubLevels( struct 
NineBaseTexture9 *This );
 void WINAPI
 NineBaseTexture9_PreLoad( struct NineBaseTexture9 *This );
 
+void
+NineBaseTexture9_UnLoad( struct NineBaseTexture9 *This );
+
 /* For D3DPOOL_MANAGED only (after SetLOD change): */
 HRESULT
 NineBaseTexture9_CreatePipeResource( struct NineBaseTexture9 *This,
diff --git a/src/gallium/state_trackers/nine/device9.c 
b/src/gallium/state_trackers/nine/device9.c
index 34199ca..2ac49a1 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -548,10 +548,14 @@ NineDevice9_GetAvailableTextureMem( struct NineDevice9 
*This )
 HRESULT WINAPI
 NineDevice9_EvictManagedResources( struct NineDevice9 *This )
 {
-/* We don't really need to do anything here, but might want to free up
- * the GPU virtual address space by killing pipe_resources.
- */
-STUB(D3D_OK);
+struct NineBaseTexture9 *tex;
+
+DBG(This=%p\n, This);
+LIST_FOR_EACH_ENTRY(tex, This-managed_textures, list2) {
+NineBaseTexture9_UnLoad(tex);
+}
+
+return D3D_OK;
 }
 
 HRESULT WINAPI
-- 
2.1.0

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


[Mesa-dev] [PATCH 30/71] st/nine: Return NULL pointer in lock error cases

2015-08-16 Thread Axel Davy
From: Patrick Rudolph s...@das-labor.org

Tests showed, that in case of errors, the pBits pointer is set to NULL.
The pBits field isn't set to NULL in case of an already locked object.

Reviewed-by: Axel Davy axel.d...@ens.fr
Signed-off-by: Patrick Rudolph s...@das-labor.org
---
 src/gallium/state_trackers/nine/surface9.c | 11 +++
 src/gallium/state_trackers/nine/volume9.c  | 10 +++---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/gallium/state_trackers/nine/surface9.c 
b/src/gallium/state_trackers/nine/surface9.c
index d20e62a..78c29ca 100644
--- a/src/gallium/state_trackers/nine/surface9.c
+++ b/src/gallium/state_trackers/nine/surface9.c
@@ -323,6 +323,13 @@ NineSurface9_LockRect( struct NineSurface9 *This,
 nine_D3DLOCK_to_str(Flags));
 NineSurface9_Dump(This);
 
+/* check if it's already locked */
+user_assert(This-lock_count == 0, D3DERR_INVALIDCALL);
+
+/* set pBits to NULL after lock_count check */
+user_assert(pLockedRect, E_POINTER);
+pLockedRect-pBits = NULL;
+
 #ifdef NINE_STRICT
 user_assert(This-base.pool != D3DPOOL_DEFAULT ||
 (resource  (resource-flags  NINE_RESOURCE_FLAG_LOCKABLE)),
@@ -337,10 +344,6 @@ NineSurface9_LockRect( struct NineSurface9 *This,
 user_assert(!((Flags  D3DLOCK_DISCARD)  (Flags  D3DLOCK_READONLY)),
 D3DERR_INVALIDCALL);
 
-/* check if it's already locked */
-user_assert(This-lock_count == 0, D3DERR_INVALIDCALL);
-user_assert(pLockedRect, E_POINTER);
-
 user_assert(This-desc.MultiSampleType == D3DMULTISAMPLE_NONE,
 D3DERR_INVALIDCALL);
 
diff --git a/src/gallium/state_trackers/nine/volume9.c 
b/src/gallium/state_trackers/nine/volume9.c
index 5495548..6311103 100644
--- a/src/gallium/state_trackers/nine/volume9.c
+++ b/src/gallium/state_trackers/nine/volume9.c
@@ -231,15 +231,19 @@ NineVolume9_LockBox( struct NineVolume9 *This,
 pBox ? pBox-Front : 0, pBox ? pBox-Back : 0,
 nine_D3DLOCK_to_str(Flags));
 
+/* check if it's already locked */
+user_assert(This-lock_count == 0, D3DERR_INVALIDCALL);
+
+/* set pBits to NULL after lock_count check */
+user_assert(pLockedVolume, E_POINTER);
+pLockedVolume-pBits = NULL;
+
 user_assert(This-desc.Pool != D3DPOOL_DEFAULT ||
 (This-desc.Usage  D3DUSAGE_DYNAMIC), D3DERR_INVALIDCALL);
 
 user_assert(!((Flags  D3DLOCK_DISCARD)  (Flags  D3DLOCK_READONLY)),
 D3DERR_INVALIDCALL);
 
-user_assert(This-lock_count == 0, D3DERR_INVALIDCALL);
-user_assert(pLockedVolume, E_POINTER);
-
 if (pBox  This-desc.Pool == D3DPOOL_DEFAULT 
 util_format_is_compressed(This-info.format)) {
 const unsigned w = util_format_get_blockwidth(This-info.format);
-- 
2.1.0

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


[Mesa-dev] [PATCH 01/71] st/nine: Require gcc = 4.6

2015-08-16 Thread Axel Davy
From: David Heidelberg da...@ixit.cz

Fixes bug: fdo #89978

Signed-off-by: David Heidelberg da...@ixit.cz
Cc: 10.4 10.5 10.6 mesa-sta...@lists.freedesktop.org
---
 configure.ac | 4 
 1 file changed, 4 insertions(+)

diff --git a/configure.ac b/configure.ac
index 4e751e3..c355092 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1632,6 +1632,10 @@ if test x$enable_nine = xyes; then
 if test x$with_gallium_drivers = xswrast; then
 AC_MSG_ERROR([nine requires at least one non-swrast gallium driver])
 fi
+if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a 
$GCC_VERSION_MINOR -lt 6; then
+AC_MSG_ERROR([gcc = 4.6 is required to build nine])
+fi
+
 if test x$enable_dri3 = xno; then
 AC_MSG_WARN([using nine together with wine requires DRI3 enabled 
system])
 fi
-- 
2.1.0

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


[Mesa-dev] [PATCH 3/3] nouveau: recognize tess stages in nouveau_compiler

2015-08-16 Thread Marcos Paulo de Souza
From: Marcos Paulo de Souza marcos.souza@gmail.com

---
 src/gallium/drivers/nouveau/nouveau_compiler.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c 
b/src/gallium/drivers/nouveau/nouveau_compiler.c
index 8660498..495450b 100644
--- a/src/gallium/drivers/nouveau/nouveau_compiler.c
+++ b/src/gallium/drivers/nouveau/nouveau_compiler.c
@@ -190,6 +190,10 @@ main(int argc, char *argv[])
   type = PIPE_SHADER_GEOMETRY;
else if (!strncmp(text, COMP, 4))
   type = PIPE_SHADER_COMPUTE;
+   else if (!strncmp(text, TESS_CTRL, 9))
+  type = PIPE_SHADER_TESS_CTRL;
+   else if (!strncmp(text, TESS_EVAL, 9))
+  type = PIPE_SHADER_TESS_EVAL;
else {
   _debug_printf(Unrecognized TGSI header\n);
   return 1;
-- 
2.4.3

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


[Mesa-dev] [PATCH 2/3] tgsi: Fix index printed in tgsi_dump and dst outputs

2015-08-16 Thread Marcos Paulo de Souza
From: Marcos Paulo de Souza marcos.souza@gmail.com

Before this patch, the tgsi_dumps was printing declaration as:
DCL IN[][0][0], GENERIC[0]

and now it is parsed correctly:
DCL IN[][0], GENERIC[0]

In the same way, for tess stages, the output addr now is parsed correctly, 
doing like src parser from:
LRP OUT[0][3], TEMP[1]., TEMP[3], TEMP[2]

to:
LRP OUT[ADDR[1].x][3], TEMP[1]., TEMP[3], TEMP[2]
---
 src/gallium/auxiliary/tgsi/tgsi_text.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c 
b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 24e2dbd..075f2cb 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -684,7 +684,13 @@ parse_register_dcl(
* input primitive. so we want to declare just
* the index relevant to the semantics which is in
* the second bracket */
-  if (ctx-processor == TGSI_PROCESSOR_GEOMETRY  *file == 
TGSI_FILE_INPUT) {
+
+  /* tessellation has similar constraints to geometry shader */
+  bool is_in = *file == TGSI_FILE_INPUT;
+  bool is_out = *file == TGSI_FILE_OUTPUT;
+  if ((ctx-processor == TGSI_PROCESSOR_GEOMETRY  is_in) ||
+  (ctx-processor == TGSI_PROCESSOR_TESS_EVAL  is_in) ||
+  (ctx-processor == TGSI_PROCESSOR_TESS_CTRL  (is_in || is_out))) {
  brackets[0] = brackets[1];
  *num_brackets = 1;
   } else {
@@ -740,6 +746,14 @@ parse_dst_operand(
   dst-Dimension.Indirect = 0;
   dst-Dimension.Dimension = 0;
   dst-Dimension.Index = bracket[0].index;
+
+  if (bracket[0].ind_file != TGSI_FILE_NULL) {
+ dst-Dimension.Indirect = 1;
+ dst-DimIndirect.File = bracket[0].ind_file;
+ dst-DimIndirect.Index = bracket[0].ind_index;
+ dst-DimIndirect.Swizzle = bracket[0].ind_comp;
+ dst-DimIndirect.ArrayID = bracket[0].ind_array;
+  }
   bracket[0] = bracket[1];
}
dst-Register.Index = bracket[0].index;
-- 
2.4.3

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


[Mesa-dev] [PATCHv2 0/3] Add tess stages to mesa/nouveau_compiler

2015-08-16 Thread Marcos Paulo de Souza
From: Marcos Paulo de Souza marcos.souza@gmail.com

Hi guys,

first of all, sorry for the flood... my last bunch of patches were sent as a 
mistake... but
now the compiling problem was solved :)

I'm happy o send my first patches to mesa, and I have to say a huge thank you 
to Ilia Mirkin for all the
help and tips to fix this problem in tess stages.

I hope you like these patches!

Marcos Paulo de Souza (3):
  tgsi: set implicit array size for tess stages
  tgsi: Fix index printed in tgsi_dump and dst outputs
  nouveau: recognize tess stages in nouveau_compiler

 src/gallium/auxiliary/tgsi/tgsi_text.c | 22 --
 src/gallium/drivers/nouveau/nouveau_compiler.c |  4 
 2 files changed, 24 insertions(+), 2 deletions(-)

-- 
2.4.3

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


[Mesa-dev] [PATCH 1/3] tgsi: set implicit array size for tess stages

2015-08-16 Thread Marcos Paulo de Souza
From: Marcos Paulo de Souza marcos.souza@gmail.com

---
 src/gallium/auxiliary/tgsi/tgsi_text.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c 
b/src/gallium/auxiliary/tgsi/tgsi_text.c
index a6675c5..24e2dbd 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -259,7 +259,7 @@ struct translate_ctx
struct tgsi_token *tokens_end;
struct tgsi_header *header;
unsigned processor : 4;
-   int implied_array_size : 5;
+   unsigned implied_array_size : 6;
unsigned num_immediates;
 };
 
@@ -1623,6 +1623,10 @@ static boolean translate( struct translate_ctx *ctx )
if (!parse_header( ctx ))
   return FALSE;
 
+   if (ctx-processor == TGSI_PROCESSOR_TESS_CTRL ||
+   ctx-processor == TGSI_PROCESSOR_TESS_EVAL)
+   ctx-implied_array_size = 32 ;
+
while (*ctx-cur != '\0') {
   uint label_val = 0;
   if (!eat_white( ctx-cur )) {
-- 
2.4.3

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


[Mesa-dev] [Bug 89018] Civilization: Beyond Earth terrain section not rendered

2015-08-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=89018

Daniel Exner dex+fdobugzi...@dragonslave.de changed:

   What|Removed |Added

 CC||dex+fdobugzilla@dragonslave
   ||.de

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 00/71] New Gallium Nine Fixes and Improvements

2015-08-16 Thread Axel Davy
Some patches we had in our pending queue for quite some time.

Overall not quite interesting set of patches, just minor
fixes or improvements.

As usual you can find the patch serie there:
https://github.com/iXit/Mesa-3D/commits/mesa_submit

Patch 2 is an interesting feature since instead of
advertizing gallium card names, we do advertize
the ones they have on win. Wine does the same.

Patches 3-7 are fixes

Patches 8-13 finish our implementation of software
cursor (used when hw cursor can't be used)

Patches 14-23 implement correct surface dirty region
tracking, and use it to avoid useless updates, like
specified in the documentation.

Patches 24-36 are fixes to our checks, and do solve
several Wine tests.

Patches 37-60 are several patches to rework how
we do handle state changes, and add support
for bumpmats and fog.
Initially the state rework was designed to simplify and
improve performance and there was a big switch where you'd
update only the corresponding gallium struct field
depending on the d3d9 state you'd change.
However it was not good for performance afterall.
As a result two or three of the patches are not
very useful for now, as they are just useless refactoring.
I hesitated to send them, but I'd still like have them
in.

Patches 61-67 are some more fixes or improvements

Patches 68-71 do silent some compilation warnings

Axel Davy (55):
  st/nine: Fix Swizzle for ATI2 format
  st/nine: Always set point_quad_rasterization to 1
  st/nine: fix D3DRS_DITHERENABLE wrong state group
  st/nine: Hide hardware cursor when we don't use it
  st/nine: Force hw cursor for Windowed mode
  st/nine: Do not call ID3DPresent_GetCursorPos for sw cursor
  st/nine: Revert to sw cursor in case of failure to set hw cursor
  st/nine: Simplify Volume9 dirty region tracking
  st/nine: Split NineSurface9_CopySurface
  st/nine: Simplify NineVolume9_CopyVolume
  st/nine: SetAutoGenFilterType should regenerate the sublevels
  st/nine: Add missing BASETEX_REGISTER_UPDATE calls
  st/nine: Track dirty region for SYSTEMMEM too
  st/nine: Textures start dirty
  st/nine: Only update dirty rect for UpdateTexture
  st/nine: Track managed textures
  st/nine: Implement EvictManagedResources
  st/nine: Fix StretchRect checks
  st/nine: Fix FillColor Flag check
  st/nine: Impose restrictions on DXTN texture sizes
  st/nine: Fix Lock Checks for Compressed textures
  st/nine: Remove group_mask argument from nine_update_state
  st/nine: Reorder nine_state.
  st/nine: Reorder DSA state settings
  st/nine: Rework rasterizer states
  st/nine: Avoid useless updates in SetSamplerState
  st/nine: Improve fallback when driver doesn't support user buffers.
  st/nine: Rework blend states
  st/nine: Rework constant buffer state handling
  st/nine: Rework ff constant buffers
  st/nine: Fix fixed function fog support
  st/nine: Begin programmable shader fog support
  st/nine: Fix nine_ff_ps_key padding
  st/nine: Remove useless variables
  st/nine: Rework shader states
  st/nine: Finish Fog implementation
  st/nine: Revert to userbuf path when needed
  st/nine: Advertise Fog flags
  st/nine: Change a few advertised caps
  st/nine: Complete ff texture transform implementation
  st/nine: Programmable ps D3DTTSS_PROJECTED support
  st/nine: Change nine_state_update order
  st/nine: Implement ff vertex data passthrough
  st/nine: Implement special DOTPRODUCT3 behaviour
  st/nine: Remove NINED3DRS_ZBIASSCALE
  st/nine: Better check shader constant limits
  st/nine: Calculate dummy sampler state only once
  st/nine: Use CSO cache for sampler views
  st/nine: Fix the number of texture stages
  st/nine: Avoid Constant upload when there is no change
  st/nine: Catch setting the same shader
  st/nine: Silent warning in update_vertex_buffer
  st/nine: Silent warning in NineCubeTexture9_ctor
  st/nine: Silent warning in sm1_declusage_to_tgsi
  st/nine: Silent warning in nine_ff

Christoph Bumiller (1):
  gallium: Add blending to pipe blit

David Heidelberg (1):
  st/nine: Require gcc = 4.6

Marek Olšák (1):
  util/u_blitter: implement alpha blending for pipe-blit

Patrick Rudolph (12):
  target/d3dadapter9: Return Windows like card names
  st/nine: Align texture memory
  st/nine: Account POINTSIZE_MIN and POINTSIZE_MAX for point size
  st/nine: Fix GenerateMipSubLevels potential crash
  st/nine: fix failing wine test device.c test_lockrect_invalid()
  st/nine: Clean GetPrivateData
  st/nine: Fix resource SetPriority/GetPriority
  st/nine: Return NULL pointer in lock error cases
  st/nine: Fail on D3DUSAGE_DYNAMIC for D3DPOOL_SCRATCH textures
  st/nine: Return correct error codes in NineDevice9_Reset
  st/nine: Prevent possible crash
  st/nine: Fix use of uninitialized values

Tiziano Bacocco (1):
  st/nine: Implement TEXBEM,TEXBEML and BEM

 configure.ac |4 +
 src/gallium/auxiliary/util/u_blitter.c   |   54 +-
 src/gallium/auxiliary/util/u_blitter.h   |3 +-
 src/gallium/auxiliary/util/u_surface.c   

Re: [Mesa-dev] [PATCH] mesa/texformat: Use format conversion function in _mesa_choose_tex_format

2015-08-16 Thread Nanley Chery
The last line of the commit message should say:

   GL_RGBA4_S3TC  (0x83A3)  - COMPRESSED_RGBA_S3TC_DXT5_EXT (0x83F3)

On Wed, Aug 12, 2015 at 4:19 PM, Nanley Chery nanleych...@gmail.com wrote:

 From: Nanley Chery nanley.g.ch...@intel.com

 This function's cases for non-generic compressed formats duplicate
 the GL to MESA translation in _mesa_glenum_to_compressed_format().
 This patch replaces the switch cases with a call to the translation
 function. There are no behavioral changes except for the RGB[A]4 formats:

case GL_RGB4_S3TC:
  return MESA_FORMAT_RGB_DXT1  (old) - MESA_FORMAT_RGBA_DXT1 (new)
case GL_RGBA4_S3TC:
  return MESA_FORMAT_RGBA_DXT3 (old) - MESA_FORMAT_RGBA_DXT5 (new)

 Although unclear, the old behavior was likely a bug, given that online
 documentation (few and far between) imply a format mapping of the
 following:

GL_RGB_S3TC(0x83A0)  - COMPRESSED_RGB_S3TC_DXT1_EXT  (0x83F0)
GL_RGB4_S3TC   (0x83A1)  - COMPRESSED_RGBA_S3TC_DXT1_EXT (0x83F1)
GL_RGBA_S3TC   (0x83A2)  - COMPRESSED_RGBA_S3TC_DXT3_EXT (0x83F2)
GL_RGBA4_S3TC  (0x83A2)  - COMPRESSED_RGBA_S3TC_DXT5_EXT (0x83F2)

 Cc: Brian Paul bri...@vmware.com
 Cc: Ian Romanick ian.d.roman...@intel.com
 Signed-off-by: Nanley Chery nanley.g.ch...@intel.com
 ---
  src/mesa/main/texformat.c | 94
 +++
  1 file changed, 13 insertions(+), 81 deletions(-)

 diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
 index f4d17e1..fd9f335 100644
 --- a/src/mesa/main/texformat.c
 +++ b/src/mesa/main/texformat.c
 @@ -38,6 +38,7 @@
  #include mtypes.h
  #include texcompress.h
  #include texformat.h
 +#include glformats.h

  #define RETURN_IF_SUPPORTED(f) do {\
 if (ctx-TextureFormatSupported[f]) \
 @@ -276,87 +277,6 @@ _mesa_choose_tex_format(struct gl_context *ctx,
 GLenum target,
   RETURN_IF_SUPPORTED(MESA_FORMAT_YCBCR_REV);
break;

 -   /* For non-generic compressed format we assert two things:
 -*
 -* 1. The format has already been validated against the set of
 available
 -*extensions.
 -*
 -* 2. The driver only enables the extension if it supports all of the
 -*formats that are part of that extension.
 -*/
 -   case GL_COMPRESSED_RGB_FXT1_3DFX:
 -  return MESA_FORMAT_RGB_FXT1;
 -   case GL_COMPRESSED_RGBA_FXT1_3DFX:
 -  return MESA_FORMAT_RGBA_FXT1;
 -   case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
 -   case GL_RGB_S3TC:
 -   case GL_RGB4_S3TC:
 -  return MESA_FORMAT_RGB_DXT1;
 -   case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
 -  return MESA_FORMAT_RGBA_DXT1;
 -   case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
 -   case GL_RGBA_S3TC:
 -   case GL_RGBA4_S3TC:
 -  return MESA_FORMAT_RGBA_DXT3;
 -   case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
 -  return MESA_FORMAT_RGBA_DXT5;
 -   case GL_COMPRESSED_RED_RGTC1:
 -  return MESA_FORMAT_R_RGTC1_UNORM;
 -   case GL_COMPRESSED_SIGNED_RED_RGTC1:
 -  return MESA_FORMAT_R_RGTC1_SNORM;
 -   case GL_COMPRESSED_RG_RGTC2:
 -  return MESA_FORMAT_RG_RGTC2_UNORM;
 -   case GL_COMPRESSED_SIGNED_RG_RGTC2:
 -  return MESA_FORMAT_RG_RGTC2_SNORM;
 -   case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
 -  return MESA_FORMAT_L_LATC1_UNORM;
 -   case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
 -  return MESA_FORMAT_L_LATC1_SNORM;
 -   case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
 -  return MESA_FORMAT_LA_LATC2_UNORM;
 -   case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
 -  return MESA_FORMAT_LA_LATC2_SNORM;
 -   case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
 -  return MESA_FORMAT_LA_LATC2_UNORM;
 -   case GL_ETC1_RGB8_OES:
 -  return MESA_FORMAT_ETC1_RGB8;
 -   case GL_COMPRESSED_RGB8_ETC2:
 -  return MESA_FORMAT_ETC2_RGB8;
 -   case GL_COMPRESSED_SRGB8_ETC2:
 -  return MESA_FORMAT_ETC2_SRGB8;
 -   case GL_COMPRESSED_RGBA8_ETC2_EAC:
 -  return MESA_FORMAT_ETC2_RGBA8_EAC;
 -   case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
 -  return MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC;
 -   case GL_COMPRESSED_R11_EAC:
 -  return MESA_FORMAT_ETC2_R11_EAC;
 -   case GL_COMPRESSED_RG11_EAC:
 -  return MESA_FORMAT_ETC2_RG11_EAC;
 -   case GL_COMPRESSED_SIGNED_R11_EAC:
 -  return MESA_FORMAT_ETC2_SIGNED_R11_EAC;
 -   case GL_COMPRESSED_SIGNED_RG11_EAC:
 -  return MESA_FORMAT_ETC2_SIGNED_RG11_EAC;
 -   case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
 -  return MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1;
 -   case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
 -  return MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1;
 -   case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
 -  return MESA_FORMAT_SRGB_DXT1;
 -   case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
 -  return MESA_FORMAT_SRGBA_DXT1;
 -   case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
 -  return MESA_FORMAT_SRGBA_DXT3;
 -   case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
 -  return MESA_FORMAT_SRGBA_DXT5;
 -   case GL_COMPRESSED_RGBA_BPTC_UNORM:
 -  return 

[Mesa-dev] [Bug 91646] dlopen'ing libudev.so.1 from static library initializer corrupts TLS state

2015-08-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=91646

--- Comment #3 from Francisco Jerez curroje...@riseup.net ---
(In reply to Tobias Jakobi from comment #2)
 Created attachment 117708 [details] [review]
 hack fix
 
 Untested hack/fix that is also not thread-safe.

That's unlikely to work, static local variables are no different to globals
regarding initialization order, and, yeah, it seems like a hack because
pipe_loader_probe() shouldn't be doing anything that could corrupt the TLS
state when called at initialization time.

It looks like this might be a regression from the series
de5c2b6f2b53924bceab6f4b8255d8e9dcad21b4..cc32d25454c382a971e81ae584a4296fdf492e70(which
are indeed not part of any released version yet), you may want to bisect which
change introduced the problem.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] tgsi/nouveau: Add support for tesselation ctrl and tesselation eval

2015-08-16 Thread Marcos Paulo de souza

Hi Ilia,

Em 14-08-2015 01:45, Ilia Mirkin escreveu:

On Fri, Aug 14, 2015 at 12:43 AM, Marcos Souza
marcos.souza@gmail.com wrote:

HI Ilia

2015-08-14 1:31 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu:

On Fri, Aug 14, 2015 at 12:25 AM, Marcos Souza
marcos.souza@gmail.com wrote:

Hi Ilia,

2015-08-14 1:02 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu:

On Thu, Aug 13, 2015 at 11:55 PM, Marcos Souza
marcos.souza@gmail.com wrote:

Hi Ilia,

So i found the point here it addrs that double brackets, and the
following
patch solves it, but this is a right solution? If someone could guide
me
here, I could fix it :)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c
b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index 8ceb5b4..046471e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -302,10 +302,14 @@ iter_declaration(
TXT([]);
 }

-   if (decl-Declaration.Dimension) {

The issue is that the declaration is getting a dimension set by the
parser, which in turn is causing it to print funny. It shouldn't be
getting a dimension in the first place for those.


The following patch fix the problem, is it the right place to put it?

I don't think so. Just glanced at the code, look at

parse_register_dcl

   /* for geometry shader we don't really care about
* the first brackets it's always the size of the
* input primitive. so we want to declare just
* the index relevant to the semantics which is in
* the second bracket */
   if (ctx-processor == TGSI_PROCESSOR_GEOMETRY  *file ==
TGSI_FILE_INPUT) {
  brackets[0] = brackets[1];
  *num_brackets = 1;
   }

Basically you need to extend this logic to similarly exclude

(a) tess ctrl inputs and outputs
(b) tess eval inputs

Technically you need to exclude patch/tessinner/tessouter from that,
but in practice they won't have an extra set of brackets either.


Sorry for flooding the list, but I'm relaly excited about it :)

So, this is the change you asked. It also solved the problem:
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c
b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 8647e4e..95c1daf 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -684,7 +684,12 @@ parse_register_dcl(
 * input primitive. so we want to declare just
 * the index relevant to the semantics which is in
 * the second bracket */
-  if (ctx-processor == TGSI_PROCESSOR_GEOMETRY  *file ==
TGSI_FILE_INPUT) {
+
+  /* similarly from tessalation */

tessellation

OK.



+  int exclude = (ctx-processor == TGSI_PROCESSOR_TESS_EVAL  *file ==
TGSI_FILE_INPUT) ||
+  (ctx-processor == TGSI_PROCESSOR_TESS_CTRL  (*file ==
TGSI_FILE_INPUT ||
+ *file == TGSI_FILE_OUTPUT));

Why is this separate from the geometry thing?
I just separated because it's easier to read, since we have a lot of 
ANDs and ORs. But, if you think it's better, I could put it all together 
will geometry.



+  if ((ctx-processor == TGSI_PROCESSOR_GEOMETRY  *file ==
TGSI_FILE_INPUT) || exclude) {
   brackets[0] = brackets[1];
   *num_brackets = 1;
} else {

What do you think Ilia?

Generally sounds good.

Now I'll take a look about the last problem of LRP and MOV.


   -ilia


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


Re: [Mesa-dev] [PATCH] tgsi/nouveau: Add support for tesselation ctrl and tesselation eval

2015-08-16 Thread Marcos Souza
Hi Ilia,

2015-08-14 1:02 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu:

 On Thu, Aug 13, 2015 at 11:55 PM, Marcos Souza
 marcos.souza@gmail.com wrote:
  Hi Ilia,
 
  So i found the point here it addrs that double brackets, and the
 following
  patch solves it, but this is a right solution? If someone could guide me
  here, I could fix it :)
 
  diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c
  b/src/gallium/auxiliary/tgsi/tgsi_dump.c
  index 8ceb5b4..046471e 100644
  --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
  +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
  @@ -302,10 +302,14 @@ iter_declaration(
 TXT([]);
  }
 
  -   if (decl-Declaration.Dimension) {

 The issue is that the declaration is getting a dimension set by the
 parser, which in turn is causing it to print funny. It shouldn't be
 getting a dimension in the first place for those.


The following patch fix the problem, is it the right place to put it?

diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c
b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 8647e4e..f734d58 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -1185,7 +1185,10 @@ static boolean parse_declaration( struct
translate_ctx *ctx )
   decl.Range.First = brackets[1].first;
   decl.Range.Last = brackets[1].last;

-  decl.Declaration.Dimension = 1;
+  if (!(ctx-processor == TGSI_PROCESSOR_TESS_CTRL ||
+ ctx-processor == TGSI_PROCESSOR_TESS_EVAL))
+ decl.Declaration.Dimension = 1;
+
   decl.Dim.Index2D = brackets[0].first;
}





  -  CHR('[');
  -  SID(decl-Dim.Index2D);
  -  CHR(']');
  +   /* FIXME: patched version could have tree dimensions?? */
  +   if (patch  (iter-processor.Processor == TGSI_PROCESSOR_TESS_CTRL
 ||
  +  iter-processor.Processor == TGSI_PROCESSOR_TESS_EVAL)) {
  +  if (decl-Declaration.Dimension) {
  + CHR('[');
  + SID(decl-Dim.Index2D);
  + CHR(']');
  +  }
  }
 
  After this patch, tess_eval output is the same before and after, but
  tess_ctrl is a little different:
  [marcos@x mesa]$ diff tess_ctrl tess_ctrl_new
  29c29
15: LRP OUT[ADDR[1].x][3], TEMP[1]., TEMP[3], TEMP[2]
  ---
   15: LRP OUT[0][3], TEMP[1]., TEMP[3], TEMP[2]
  40c40
26: MOV OUT[ADDR[1].x][2], TEMP[0]
  ---
   26: MOV OUT[0][2], TEMP[0]
 
  I'll try to investigate and send a new patch in the weekend.
 
  Thanks for all help Ilia and others!
 
  2015-08-13 18:43 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu:
 
  [mesa-dev readded, please don't drop CC's]
 
  I found it by feeding the shader to nouveau_compiler with
  NV50_PROG_DEBUG=1 set, which dumps the input tgsi. Those two should
  match up.
 
  On Thu, Aug 13, 2015 at 5:39 PM, Marcos Paulo de souza
  marcos.souza@gmail.com wrote:
   Hi Ilia,
  
   So, how can I test it? Do I need to especify some patameter to verify
   this
   type of problem?
  
   Thanks for the quick revision!
  
  
   Em 13-08-2015 16:03, Ilia Mirkin escreveu:
  
   Hi Macros,
  
   Looks like it's not parsed in exactly right. It will parse something
   like
  
   TESS_EVAL
   PROPERTY TES_PRIM_MODE 7
   PROPERTY TES_SPACING 2
   PROPERTY TES_VERTEX_ORDER_CW 0
   PROPERTY TES_POINT_MODE 0
   DCL IN[][0], GENERIC[0]
   DCL IN[][1], GENERIC[1]
  
   as
  
   TESS_EVAL
   PROPERTY TES_PRIM_MODE 7
   PROPERTY TES_SPACING 2
   PROPERTY TES_VERTEX_ORDER_CW 0
   PROPERTY TES_POINT_MODE 0
   DCL IN[][0][0], GENERIC[0]
   DCL IN[][0][1], GENERIC[1]
  
   Perhaps the same issue happens for geometry shaders, but that doesn't
   make it right :) You might have to look at the printing logic to get
 a
   better understanding of what's going wrong.
  
   Also you should send patches to nouveau separately from patches to
 the
   rest of the infra. Ideally this would have been 2 patches, e.g.
  
   tgsi: set implicit array size for tess stages
   nouveau: recognize tess stages in nouveau_compiler
  
   or something like that.
  
   On Wed, Aug 12, 2015 at 9:25 PM, Marcos Paulo de Souza
   marcos.souza@gmail.com wrote:
  
   From: Marcos Paulo de Souza marcos.souza@gmail.com
  
   Signed-off-by: Marcos Paulo de Souza marcos.souza.org
   Suggested-by: Ilia Mirkin imir...@alum.mit.edu
   ---
 src/gallium/auxiliary/tgsi/tgsi_text.c | 6 +-
 src/gallium/drivers/nouveau/nouveau_compiler.c | 4 
 2 files changed, 9 insertions(+), 1 deletion(-)
  
   diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c
   b/src/gallium/auxiliary/tgsi/tgsi_text.c
   index a6675c5..8647e4e 100644
   --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
   +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
   @@ -259,7 +259,7 @@ struct translate_ctx
struct tgsi_token *tokens_end;
struct tgsi_header *header;
unsigned processor : 4;
   -   int implied_array_size : 5;
   +   int implied_array_size : 6;
unsigned num_immediates;
 };
  
   @@ -1623,6 +1623,10 @@ static boolean translate( 

Re: [Mesa-dev] [PATCH] tgsi/nouveau: Add support for tesselation ctrl and tesselation eval

2015-08-16 Thread Marcos Souza
HI Ilia

2015-08-14 1:31 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu:

 On Fri, Aug 14, 2015 at 12:25 AM, Marcos Souza
 marcos.souza@gmail.com wrote:
  Hi Ilia,
 
  2015-08-14 1:02 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu:
 
  On Thu, Aug 13, 2015 at 11:55 PM, Marcos Souza
  marcos.souza@gmail.com wrote:
   Hi Ilia,
  
   So i found the point here it addrs that double brackets, and the
   following
   patch solves it, but this is a right solution? If someone could guide
 me
   here, I could fix it :)
  
   diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c
   b/src/gallium/auxiliary/tgsi/tgsi_dump.c
   index 8ceb5b4..046471e 100644
   --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
   +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
   @@ -302,10 +302,14 @@ iter_declaration(
  TXT([]);
   }
  
   -   if (decl-Declaration.Dimension) {
 
  The issue is that the declaration is getting a dimension set by the
  parser, which in turn is causing it to print funny. It shouldn't be
  getting a dimension in the first place for those.
 
 
  The following patch fix the problem, is it the right place to put it?

 I don't think so. Just glanced at the code, look at

 parse_register_dcl

   /* for geometry shader we don't really care about
* the first brackets it's always the size of the
* input primitive. so we want to declare just
* the index relevant to the semantics which is in
* the second bracket */
   if (ctx-processor == TGSI_PROCESSOR_GEOMETRY  *file ==
 TGSI_FILE_INPUT) {
  brackets[0] = brackets[1];
  *num_brackets = 1;
   }

 Basically you need to extend this logic to similarly exclude

 (a) tess ctrl inputs and outputs
 (b) tess eval inputs

 Technically you need to exclude patch/tessinner/tessouter from that,
 but in practice they won't have an extra set of brackets either.


Sorry for flooding the list, but I'm relaly excited about it :)

So, this is the change you asked. It also solved the problem:
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c
b/src/gallium/auxiliary/tgsi/tgsi_text.c
index 8647e4e..95c1daf 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -684,7 +684,12 @@ parse_register_dcl(
* input primitive. so we want to declare just
* the index relevant to the semantics which is in
* the second bracket */
-  if (ctx-processor == TGSI_PROCESSOR_GEOMETRY  *file ==
TGSI_FILE_INPUT) {
+
+  /* similarly from tessalation */
+  int exclude = (ctx-processor == TGSI_PROCESSOR_TESS_EVAL  *file
== TGSI_FILE_INPUT) ||
+  (ctx-processor == TGSI_PROCESSOR_TESS_CTRL  (*file ==
TGSI_FILE_INPUT ||
+ *file == TGSI_FILE_OUTPUT));
+  if ((ctx-processor == TGSI_PROCESSOR_GEOMETRY  *file ==
TGSI_FILE_INPUT) || exclude) {
  brackets[0] = brackets[1];
  *num_brackets = 1;
   } else {

What do you think Ilia?

Thanks!


 
  diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c
  b/src/gallium/auxiliary/tgsi/tgsi_text.c
  index 8647e4e..f734d58 100644
  --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
  +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
  @@ -1185,7 +1185,10 @@ static boolean parse_declaration( struct
  translate_ctx *ctx )
 decl.Range.First = brackets[1].first;
 decl.Range.Last = brackets[1].last;
 
  -  decl.Declaration.Dimension = 1;
  +  if (!(ctx-processor == TGSI_PROCESSOR_TESS_CTRL ||
  + ctx-processor == TGSI_PROCESSOR_TESS_EVAL))
  + decl.Declaration.Dimension = 1;
  +
 decl.Dim.Index2D = brackets[0].first;
  }
 
 
 
 
 
   -  CHR('[');
   -  SID(decl-Dim.Index2D);
   -  CHR(']');
   +   /* FIXME: patched version could have tree dimensions?? */
   +   if (patch  (iter-processor.Processor ==
 TGSI_PROCESSOR_TESS_CTRL
   ||
   +  iter-processor.Processor == TGSI_PROCESSOR_TESS_EVAL)) {
   +  if (decl-Declaration.Dimension) {
   + CHR('[');
   + SID(decl-Dim.Index2D);
   + CHR(']');
   +  }
   }
  
   After this patch, tess_eval output is the same before and after, but
   tess_ctrl is a little different:
   [marcos@x mesa]$ diff tess_ctrl tess_ctrl_new
   29c29
 15: LRP OUT[ADDR[1].x][3], TEMP[1]., TEMP[3], TEMP[2]
   ---
15: LRP OUT[0][3], TEMP[1]., TEMP[3], TEMP[2]
   40c40
 26: MOV OUT[ADDR[1].x][2], TEMP[0]
   ---
26: MOV OUT[0][2], TEMP[0]
  
   I'll try to investigate and send a new patch in the weekend.
  
   Thanks for all help Ilia and others!
  
   2015-08-13 18:43 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu:
  
   [mesa-dev readded, please don't drop CC's]
  
   I found it by feeding the shader to nouveau_compiler with
   NV50_PROG_DEBUG=1 set, which dumps the input tgsi. Those two should
   match up.
  
   On Thu, Aug 13, 2015 at 5:39 PM, Marcos Paulo de souza
   marcos.souza@gmail.com wrote:
Hi Ilia,
   
So, how can I test it? Do I need to especify some 

Re: [Mesa-dev] [PATCH] tgsi/nouveau: Add support for tesselation ctrl and tesselation eval

2015-08-16 Thread Marcos Souza
Hi Ilia,

So i found the point here it addrs that double brackets, and the following
patch solves it, but this is a right solution? If someone could guide me
here, I could fix it :)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c
b/src/gallium/auxiliary/tgsi/tgsi_dump.c
index 8ceb5b4..046471e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_dump.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c
@@ -302,10 +302,14 @@ iter_declaration(
   TXT([]);
}

-   if (decl-Declaration.Dimension) {
-  CHR('[');
-  SID(decl-Dim.Index2D);
-  CHR(']');
+   /* FIXME: patched version could have tree dimensions?? */
+   if (patch  (iter-processor.Processor == TGSI_PROCESSOR_TESS_CTRL ||
+  iter-processor.Processor == TGSI_PROCESSOR_TESS_EVAL)) {
+  if (decl-Declaration.Dimension) {
+ CHR('[');
+ SID(decl-Dim.Index2D);
+ CHR(']');
+  }
}

After this patch, tess_eval output is the same before and after, but
tess_ctrl is a little different:
[marcos@x mesa]$ diff tess_ctrl tess_ctrl_new
29c29
  15: LRP OUT[ADDR[1].x][3], TEMP[1]., TEMP[3], TEMP[2]
---
  15: LRP OUT[0][3], TEMP[1]., TEMP[3], TEMP[2]
40c40
  26: MOV OUT[ADDR[1].x][2], TEMP[0]
---
  26: MOV OUT[0][2], TEMP[0]

I'll try to investigate and send a new patch in the weekend.

Thanks for all help Ilia and others!

2015-08-13 18:43 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu:

 [mesa-dev readded, please don't drop CC's]

 I found it by feeding the shader to nouveau_compiler with
 NV50_PROG_DEBUG=1 set, which dumps the input tgsi. Those two should
 match up.

 On Thu, Aug 13, 2015 at 5:39 PM, Marcos Paulo de souza
 marcos.souza@gmail.com wrote:
  Hi Ilia,
 
  So, how can I test it? Do I need to especify some patameter to verify
 this
  type of problem?
 
  Thanks for the quick revision!
 
 
  Em 13-08-2015 16:03, Ilia Mirkin escreveu:
 
  Hi Macros,
 
  Looks like it's not parsed in exactly right. It will parse something
 like
 
  TESS_EVAL
  PROPERTY TES_PRIM_MODE 7
  PROPERTY TES_SPACING 2
  PROPERTY TES_VERTEX_ORDER_CW 0
  PROPERTY TES_POINT_MODE 0
  DCL IN[][0], GENERIC[0]
  DCL IN[][1], GENERIC[1]
 
  as
 
  TESS_EVAL
  PROPERTY TES_PRIM_MODE 7
  PROPERTY TES_SPACING 2
  PROPERTY TES_VERTEX_ORDER_CW 0
  PROPERTY TES_POINT_MODE 0
  DCL IN[][0][0], GENERIC[0]
  DCL IN[][0][1], GENERIC[1]
 
  Perhaps the same issue happens for geometry shaders, but that doesn't
  make it right :) You might have to look at the printing logic to get a
  better understanding of what's going wrong.
 
  Also you should send patches to nouveau separately from patches to the
  rest of the infra. Ideally this would have been 2 patches, e.g.
 
  tgsi: set implicit array size for tess stages
  nouveau: recognize tess stages in nouveau_compiler
 
  or something like that.
 
  On Wed, Aug 12, 2015 at 9:25 PM, Marcos Paulo de Souza
  marcos.souza@gmail.com wrote:
 
  From: Marcos Paulo de Souza marcos.souza@gmail.com
 
  Signed-off-by: Marcos Paulo de Souza marcos.souza.org
  Suggested-by: Ilia Mirkin imir...@alum.mit.edu
  ---
src/gallium/auxiliary/tgsi/tgsi_text.c | 6 +-
src/gallium/drivers/nouveau/nouveau_compiler.c | 4 
2 files changed, 9 insertions(+), 1 deletion(-)
 
  diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c
  b/src/gallium/auxiliary/tgsi/tgsi_text.c
  index a6675c5..8647e4e 100644
  --- a/src/gallium/auxiliary/tgsi/tgsi_text.c
  +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
  @@ -259,7 +259,7 @@ struct translate_ctx
   struct tgsi_token *tokens_end;
   struct tgsi_header *header;
   unsigned processor : 4;
  -   int implied_array_size : 5;
  +   int implied_array_size : 6;
   unsigned num_immediates;
};
 
  @@ -1623,6 +1623,10 @@ static boolean translate( struct translate_ctx
  *ctx )
   if (!parse_header( ctx ))
  return FALSE;
 
  +   if (ctx-processor == TGSI_PROCESSOR_TESS_CTRL ||
  +   ctx-processor == TGSI_PROCESSOR_TESS_EVAL)
  +   ctx-implied_array_size = 32 ;
  +
   while (*ctx-cur != '\0') {
  uint label_val = 0;
  if (!eat_white( ctx-cur )) {
  diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c
  b/src/gallium/drivers/nouveau/nouveau_compiler.c
  index 8660498..495450b 100644
  --- a/src/gallium/drivers/nouveau/nouveau_compiler.c
  +++ b/src/gallium/drivers/nouveau/nouveau_compiler.c
  @@ -190,6 +190,10 @@ main(int argc, char *argv[])
  type = PIPE_SHADER_GEOMETRY;
   else if (!strncmp(text, COMP, 4))
  type = PIPE_SHADER_COMPUTE;
  +   else if (!strncmp(text, TESS_CTRL, 9))
  +  type = PIPE_SHADER_TESS_CTRL;
  +   else if (!strncmp(text, TESS_EVAL, 9))
  +  type = PIPE_SHADER_TESS_EVAL;
   else {
  _debug_printf(Unrecognized TGSI header\n);
  return 1;
  --
  2.4.3
 
  ___
  mesa-dev mailing list
  mesa-dev@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/mesa-dev
 
 




-- 
Att,

Marcos 

Re: [Mesa-dev] [PATCH] tgsi/nouveau: Add support for tesselation ctrl and tesselation eval

2015-08-16 Thread Marcos Souza
2015-08-14 1:55 GMT-03:00 Ilia Mirkin imir...@alum.mit.edu:

 On Fri, Aug 14, 2015 at 12:52 AM, Marcos Paulo de souza
 marcos.souza@gmail.com wrote:
  Now I'll take a look about the last problem of LRP and MOV.

 That should ideally have solved itself too... if not, do you have the
 full shader that demonstrates the problem?


Yes, there it is:

TESS_CTRL
PROPERTY TCS_VERTICES_OUT 9
DCL IN[][0], POSITION
DCL SV[0], INVOCATIONID
DCL SV[1], VERTICESIN
DCL OUT[0], TESSOUTER
DCL OUT[1], TESSINNER
DCL OUT[][2], GENERIC[0]
DCL OUT[][3], GENERIC[1]
DCL TEMP[0..3], LOCAL
DCL ADDR[0..1]
IMM[0] FLT32 {   21., 0.5000, 0., 1.}
IMM[1] INT32 {3, 4, 0, 0}
  0: MOV OUT[1].x, IMM[0].
  1: MOV OUT[1].y, IMM[0].
  2: MOV OUT[0].x, IMM[0].
  3: MOV OUT[0].y, IMM[0].
  4: MOV OUT[0].z, IMM[0].
  5: MOV OUT[0].w, IMM[0].
  6: MOD TEMP[0].x, SV[0]., IMM[1].
  7: I2F TEMP[0].x, TEMP[0].
  8: MUL TEMP[0].x, TEMP[0]., IMM[0].
  9: IDIV TEMP[1].x, SV[0]., IMM[1].
 10: I2F TEMP[1].x, TEMP[1].
 11: MUL TEMP[1].x, TEMP[1]., IMM[0].
 12: LRP TEMP[2], TEMP[0]., IN[1][0], IN[0][0]
 13: LRP TEMP[3], TEMP[0]., IN[3][0], IN[2][0]
 14: UARL ADDR[1].x, SV[0].
 15: LRP OUT[ADDR[1].x][3], TEMP[1]., TEMP[3], TEMP[2]
 16: USEQ TEMP[2].x, SV[1]., IMM[1].
 17: UIF TEMP[2]. :0
 18:   MOV TEMP[2].zw, IMM[0].wwzw
 19:   MOV TEMP[2].x, TEMP[0].
 20:   MOV TEMP[2].y, TEMP[1].
 21:   MOV TEMP[0], TEMP[2]
 22: ELSE :0
 23:   MOV TEMP[0], IMM[0].
 24: ENDIF
 25: UARL ADDR[1].x, SV[0].
 26: MOV OUT[ADDR[1].x][2], TEMP[0]
 27: END

Can you give me some tip to fix it, or do you think this can be sent in
another patch rather than the tgsi and the nouai part?

Thanks



-- 
Att,

Marcos Paulo de Souza
Github: https://github.com/marcosps/
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa 11.0.0 release plan

2015-08-16 Thread Rob Clark
On Tue, Aug 11, 2015 at 1:45 PM, Emil Velikov emil.l.veli...@gmail.com wrote:
 On 29/07/15 19:20, Emil Velikov wrote:
 Hi all,

 Below is the preliminary release schedule for Mesa 11.0.0

 August 21st 2015 - Feature freeze/Release candidate 1
 August 28th 2015 - Release candidate 2
 September 04th 2015 - Release candidate 3
 September 11th 2015 - Release candidate 4/Mesa 11.0.0

 Considering the quiet acknowledgement, the above schedule will be taking
 place.

 Reminder: do push all your feature changes before the end of 21st August
 if you'd want them in for the next release.

btw, at what point is it too late to bump libdrm version dependency?
I think I've tracked down root cause for stk hang issue, but fixing it
will require an dependency on new libdrm.. need to do a bit more
testing, but I'm 99% sure at this point..

also, is there a recommended way to do something like '#if LIBDRM_XYZ
= abc' in the code?  If so I could make the mesa fix something that
is back-portable to older release branches and enabled conditionally
iff new enough libdrm_freedreno.  Not sure if there is a recommended
way to handle that sort of scenario?


BR,
-R


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


Re: [Mesa-dev] [PATCH 05/12] glsl: fix isinf() for doubles

2015-08-16 Thread Edward O'Callaghan
Reviewed-by: Edward O'Callaghan eocallag...@alterapraxis.com

-- 
  Edward O'Callaghan
  edward.ocallag...@koparo.com

On Sat, Aug 15, 2015, at 09:56 AM, Timothy Arceri wrote:
 Reviewed-by: Timothy Arceri t_arc...@yahoo.com.au
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 06/12] glsl: fix ir_constant::equals() for doubles

2015-08-16 Thread Edward O'Callaghan
Reviewed-by: Edward O'Callaghan eocallag...@alterapraxis.com


-- 
  Edward O'Callaghan
  edward.ocallag...@koparo.com

On Sat, Aug 15, 2015, at 09:52 AM, Timothy Arceri wrote:
 Reviewed-by: Timothy Arceri t_arc...@yahoo.com.au
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 01/12] nir/builder: include nir.h

2015-08-16 Thread Edward O'Callaghan
Reviewed-by: Edward O'Callaghan eocallag...@alterapraxis.com


-- 
  Edward O'Callaghan
  edward.ocallag...@koparo.com

On Sat, Aug 15, 2015, at 08:30 AM, Connor Abbott wrote:
 This makes intelligent autocomplete plugins much happier.
 
 Signed-off-by: Connor Abbott connor.w.abb...@intel.com
 ---
  src/glsl/nir/nir_builder.h | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/src/glsl/nir/nir_builder.h b/src/glsl/nir/nir_builder.h
 index 9223e83..1745453 100644
 --- a/src/glsl/nir/nir_builder.h
 +++ b/src/glsl/nir/nir_builder.h
 @@ -24,6 +24,8 @@
  #ifndef NIR_BUILDER_H
  #define NIR_BUILDER_H
  
 +#include nir.h
 +
  struct exec_list;
  
  typedef struct nir_builder {
 -- 
 2.4.3
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 03/12] nir: fix constant folding of bfi

2015-08-16 Thread Edward O'Callaghan
Reviewed-by: Edward O'Callaghan eocallag...@alterapraxis.com


-- 
  Edward O'Callaghan
  edward.ocallag...@koparo.com

On Sat, Aug 15, 2015, at 08:30 AM, Connor Abbott wrote:
 Signed-off-by: Connor Abbott connor.w.abb...@intel.com
 ---
  src/glsl/nir/nir_opcodes.py | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/src/glsl/nir/nir_opcodes.py b/src/glsl/nir/nir_opcodes.py
 index df5b7e2..77c766b 100644
 --- a/src/glsl/nir/nir_opcodes.py
 +++ b/src/glsl/nir/nir_opcodes.py
 @@ -510,7 +510,7 @@ opcode(bcsel, 0, tunsigned, [0, 0, 0],
[tbool, tunsigned, tunsigned], , src0 ? src1 : src2)
  
  triop(bfi, tunsigned, 
 -unsigned mask = src0, insert = src1  mask, base = src2;
 +unsigned mask = src0, insert = src1, base = src2;
  if (mask == 0) {
 dst = base;
  } else {
 @@ -519,7 +519,7 @@ if (mask == 0) {
tmp = 1;
insert = 1;
 }
 -   dst = (base  ~mask) | insert;
 +   dst = (base  ~mask) | (insert  mask);
  }
  )
  
 -- 
 2.4.3
 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [RFC 1/3] mesa: Driver.DiscardFramebuffer - Driver.DiscardTexture

2015-08-16 Thread Rob Clark
From: Rob Clark robcl...@freedesktop.org

No one was implementing this driver hook, so let's first turn it into
something more useful and better matching the rest of the Driver API.

Signed-off-by: Rob Clark robcl...@freedesktop.org
---
 src/mesa/drivers/common/driverfuncs.c |  2 +-
 src/mesa/main/dd.h|  6 +++---
 src/mesa/main/fbobject.c  | 17 +++--
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/common/driverfuncs.c 
b/src/mesa/drivers/common/driverfuncs.c
index 6fe42b1..92aabf0 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -176,7 +176,7 @@ _mesa_init_driver_functions(struct dd_function_table 
*driver)
driver-ValidateFramebuffer = _mesa_validate_framebuffer;
 
driver-BlitFramebuffer = _swrast_BlitFramebuffer;
-   driver-DiscardFramebuffer = NULL;
+   driver-DiscardTexture = NULL;
 
_mesa_init_texture_barrier_functions(driver);
 
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 1fc4ca4..ddc2e77 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -723,9 +723,9 @@ struct dd_function_table {
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
-   void (*DiscardFramebuffer)(struct gl_context *ctx,
-  GLenum target, GLsizei numAttachments,
-  const GLenum *attachments);
+   void (*DiscardTexture)(struct gl_context *ctx,
+  struct gl_framebuffer *fb,
+  struct gl_renderbuffer_attachment *att);
 
/**
 * \name Query objects
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 8418340..42eec89 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -4182,8 +4182,21 @@ _mesa_DiscardFramebufferEXT(GLenum target, GLsizei 
numAttachments,
   }
}
 
-   if (ctx-Driver.DiscardFramebuffer)
-  ctx-Driver.DiscardFramebuffer(ctx, target, numAttachments, attachments);
+   if (ctx-Driver.DiscardTexture) {
+  for (i = 0; i  numAttachments; i++) {
+ struct gl_renderbuffer_attachment *att;
+
+ if (_mesa_is_user_fbo(fb))
+att = get_attachment(ctx, fb, attachments[i]);
+ else /* winsys_fbo */
+att = _mesa_get_fb0_attachment(ctx, fb, attachments[i]);
+
+ if (!att)
+continue;
+
+ ctx-Driver.DiscardTexture(ctx, fb, att);
+  }
+   }
 
return;
 
-- 
2.4.3

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


[Mesa-dev] [RFC 3/3] mesa/st: wire up DiscardTexture

2015-08-16 Thread Rob Clark
From: Rob Clark robcl...@freedesktop.org

Turn it into call to optional pipe-invalidate_resource().

Signed-off-by: Rob Clark robcl...@freedesktop.org
---
 src/mesa/state_tracker/st_cb_fbo.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/mesa/state_tracker/st_cb_fbo.c 
b/src/mesa/state_tracker/st_cb_fbo.c
index 5707590..597dbf4 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -833,7 +833,17 @@ st_UnmapRenderbuffer(struct gl_context *ctx,
strb-transfer = NULL;
 }
 
+static void
+st_DiscardTexture(struct gl_context *ctx,
+  struct gl_framebuffer *fb,
+  struct gl_renderbuffer_attachment *att)
+{
+   struct st_context *st = st_context(ctx);
+   struct pipe_resource *pt = st_get_texobj_resource(att-Texture);
 
+   if (st-pipe-invalidate_resource  pt)
+  st-pipe-invalidate_resource(st-pipe, pt);
+}
 
 void st_init_fbo_functions(struct dd_function_table *functions)
 {
@@ -850,6 +860,8 @@ void st_init_fbo_functions(struct dd_function_table 
*functions)
 
functions-MapRenderbuffer = st_MapRenderbuffer;
functions-UnmapRenderbuffer = st_UnmapRenderbuffer;
+
+   functions-DiscardTexture = st_DiscardTexture;
 }
 
 
-- 
2.4.3

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


  1   2   >