OSDN Git Service

Don't use Long1 for stencil operations.
authorNicolas Capens <capn@google.com>
Mon, 7 Nov 2016 20:30:33 +0000 (15:30 -0500)
committerNicolas Capens <capn@google.com>
Thu, 1 Dec 2016 17:20:30 +0000 (17:20 +0000)
Bug swiftshader:15

Change-Id: I4fa5356109e35ac13f9f8d5a97e9059262901051
Reviewed-on: https://swiftshader-review.googlesource.com/7950
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-on: https://swiftshader-review.googlesource.com/8156
Reviewed-by: Alexis Hétu <sugoi@google.com>
src/Renderer/Surface.cpp
src/Shader/PixelRoutine.cpp

index 02ad43b..25e64e8 100644 (file)
@@ -3051,6 +3051,7 @@ namespace sw
                int height2 = (height + 1) & ~1;
 
                // FIXME: Unpacking byte4 to short4 in the sampler currently involves reading 8 bytes,
+               // and stencil operations also read 8 bytes per four 8-bit stencil values,
                // so we have to allocate 4 extra bytes to avoid buffer overruns.
                return allocateZero(size(width2, height2, depth, format) + 4);
        }
index 2f2b43d..2025da7 100644 (file)
@@ -321,7 +321,7 @@ namespace sw
                        buffer += q * *Pointer<Int>(data + OFFSET(DrawData,stencilSliceB));
                }
 
-               Byte8 value = As<Byte8>(Long1(*Pointer<UInt>(buffer)));
+               Byte8 value = *Pointer<Byte8>(buffer);
                Byte8 valueCCW = value;
 
                if(!state.noStencilMask)
@@ -763,7 +763,7 @@ namespace sw
                        buffer += q * *Pointer<Int>(data + OFFSET(DrawData,stencilSliceB));
                }
 
-               Byte8 bufferValue = As<Byte8>(Long1(*Pointer<UInt>(buffer)));
+               Byte8 bufferValue = *Pointer<Byte8>(buffer);
 
                Byte8 newValue;
                stencilOperation(newValue, bufferValue, state.stencilPassOperation, state.stencilZFailOperation, state.stencilFailOperation, false, zMask, sMask);