aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2016-11-24 18:02:31 -0500
committerIlia Mirkin <[email protected]>2016-11-29 20:55:00 -0500
commitddf0f097e74d57858238fcdb13003ab5c974abc3 (patch)
treeef18800e391204ac27245a8840d4cf3dfa3be263
parent8ed703cfa6628a6ee40de4c5635b493986da1a95 (diff)
swr: [rasterizer jit] use signed integer representation for logic op
Instead of (incorrectly) biasing the snorm value to make it look like a unorm, just use signed integer math. This fixes arb_color_buffer_float-render GL_RGBA8_SNORM Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Tim Rowley <[email protected]>
-rw-r--r--src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
index ad809c4e149..2fd011fcb94 100644
--- a/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
+++ b/src/gallium/drivers/swr/rasterizer/jitter/blend_jit.cpp
@@ -692,9 +692,13 @@ struct BlendJit : public Builder
dst[i] = BITCAST(dst[i], mSimdInt32Ty);
break;
case SWR_TYPE_SNORM:
- src[i] = FADD(src[i], VIMMED1(0.5f));
- dst[i] = FADD(dst[i], VIMMED1(0.5f));
- /* fallthrough */
+ src[i] = FP_TO_SI(
+ FMUL(src[i], VIMMED1(scale[i])),
+ mSimdInt32Ty);
+ dst[i] = FP_TO_SI(
+ FMUL(dst[i], VIMMED1(scale[i])),
+ mSimdInt32Ty);
+ break;
case SWR_TYPE_UNORM:
src[i] = FP_TO_UI(
FMUL(src[i], VIMMED1(scale[i])),
@@ -728,11 +732,14 @@ struct BlendJit : public Builder
result[i] = BITCAST(result[i], mSimdFP32Ty);
break;
case SWR_TYPE_SNORM:
+ result[i] = SHL(result[i], C(32 - info.bpc[i]));
+ result[i] = ASHR(result[i], C(32 - info.bpc[i]));
+ result[i] = FMUL(SI_TO_FP(result[i], mSimdFP32Ty),
+ VIMMED1(1.0f / scale[i]));
+ break;
case SWR_TYPE_UNORM:
result[i] = FMUL(UI_TO_FP(result[i], mSimdFP32Ty),
VIMMED1(1.0f / scale[i]));
- if (info.type[i] == SWR_TYPE_SNORM)
- result[i] = FADD(result[i], VIMMED1(-0.5f));
break;
}