Re: [Mesa-dev] [PATCH] gallium: fixed modulo zero crashes in tgsi interpreter (v2)

2017-06-10 Thread Roland Scheidegger
Pushed, thanks! Roland Am 09.06.2017 um 15:39 schrieb Marius Gräfe: > softpipe throws integer division by zero exceptions on windows > when using % with integers in a geometry shader. > > v2: Made error results consistent with existing div/mod zero handling in > tgsi. 64 bit signed integer d

Re: [Mesa-dev] [PATCH] gallium: fixed modulo zero crashes in tgsi interpreter

2017-06-09 Thread Brian Paul
Let's not impose behavior that would burden drivers (for example: "idiv by zero must result in ~0u"). Just updating the docs to say the results of div/mod by zero is undefined (unless we know something specific is needed) would be fine. As it is now, some div/mod operations are documented to

[Mesa-dev] [PATCH] gallium: fixed modulo zero crashes in tgsi interpreter (v2)

2017-06-09 Thread Marius Gräfe
softpipe throws integer division by zero exceptions on windows when using % with integers in a geometry shader. v2: Made error results consistent with existing div/mod zero handling in tgsi. 64 bit signed integer division by zero returns zero like in micro_idiv, unsigned returns ~0u like i

Re: [Mesa-dev] [PATCH] gallium: fixed modulo zero crashes in tgsi interpreter

2017-06-09 Thread Marius Gräfe
I can fix the remaining integer div/mod opcodes, no problem. I think a consistent error value would be beneficial, would opt for ~0u for 32-bit values and ~0ull for 64 bit values to keep it consistent with the only existing requirement (that is d3d10). Should I just submit another patch based o

Re: [Mesa-dev] [PATCH] gallium: fixed modulo zero crashes in tgsi interpreter

2017-06-08 Thread Roland Scheidegger
The behavior is probably undefined for most of the opcodes (signed 32bit div, all 64bit div/mod), the docs don't state anything. But in general, this is all undefined in all apis (opencl, glsl, spir-v), with the only exception being d3d10 - which only has udiv and umod, hence these stating in the g

Re: [Mesa-dev] [PATCH] gallium: fixed modulo zero crashes in tgsi interpreter

2017-06-08 Thread Brian Paul
Marius, As long as you're working on this, would you review src/gallium/docs/source/tgsi.rst to check if all the div/mod instructions document div/mod by zero behavior? Thanks. -Brian On 06/08/2017 11:10 AM, Roland Scheidegger wrote: I don't really know if it makes sense to have different

Re: [Mesa-dev] [PATCH] gallium: fixed modulo zero crashes in tgsi interpreter

2017-06-08 Thread Roland Scheidegger
I don't really know if it makes sense to have different "error values" for signed vs. unsigned modulo 0 - maybe the "all bits set" approach would do too (the gallivm code does this, because it is actually easier). But since it's undefined in any case pretty much everywhere, I suppose any value will

[Mesa-dev] [PATCH] gallium: fixed modulo zero crashes in tgsi interpreter

2017-06-08 Thread Marius Gräfe
softpipe throws integer division by zero exceptions on windows when using % with integers in a geometry shader. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/ga