소스 검색

Fixed a memory bug for odd height targets caused by interval padding.

David Piuva 5 년 전
부모
커밋
9d11818df8
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      Source/DFPSR/render/shader/Shader.cpp

+ 4 - 1
Source/DFPSR/render/shader/Shader.cpp

@@ -228,6 +228,9 @@ inline static void fillShapeSuper(const Shader& shader, ImageRgbaU8Impl *colorBu
 	const int colorRowSize = imageInternal::getRowSize(colorBuffer);
 	const int colorRowSize = imageInternal::getRowSize(colorBuffer);
 	const int depthRowSize = imageInternal::getRowSize(depthBuffer);
 	const int depthRowSize = imageInternal::getRowSize(depthBuffer);
 	const PackOrder& targetPackingOrder = imageInternal::getPackOrder(colorBuffer);
 	const PackOrder& targetPackingOrder = imageInternal::getPackOrder(colorBuffer);
+	const int colorHeight = imageInternal::getHeight(colorBuffer);
+	const int depthHeight = imageInternal::getHeight(depthBuffer);
+	const int maxHeight = colorHeight > depthHeight ? colorHeight : depthHeight;
 
 
 	// Initialize row pointers for color buffer
 	// Initialize row pointers for color buffer
 	SafePointer<uint32_t> pixelDataUpper, pixelDataLower, pixelDataUpperRow, pixelDataLowerRow;
 	SafePointer<uint32_t> pixelDataUpper, pixelDataLower, pixelDataUpperRow, pixelDataLowerRow;
@@ -269,7 +272,7 @@ inline static void fillShapeSuper(const Shader& shader, ImageRgbaU8Impl *colorBu
 		int innerBlockEnd = roundDownEven(innerEnd);
 		int innerBlockEnd = roundDownEven(innerEnd);
 		// Avoid reading outside of the given bound
 		// Avoid reading outside of the given bound
 		bool hasTop = upperRow.right > upperRow.left;
 		bool hasTop = upperRow.right > upperRow.left;
-		bool hasBottom = lowerRow.right > lowerRow.left;
+		bool hasBottom = lowerRow.right > lowerRow.left && y2 < maxHeight;
 		if (hasTop || hasBottom) {
 		if (hasTop || hasBottom) {
 			// Initialize pointers
 			// Initialize pointers
 			if (COLOR_WRITE) {
 			if (COLOR_WRITE) {