|
|
|
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* Map dest texture buffer (write to whole region) */ |
|
|
|
|
|
ctx->Driver.MapTextureImage(ctx, texImage, 0, |
|
|
|
|
|
0, 0, width, height, |
|
|
|
|
|
rwMode, |
|
|
|
|
|
&dstMap, &dstRowStride); |
|
|
|
|
|
assert(dstMap); |
|
|
|
|
|
success = _mesa_texstore(ctx, 2, texImage->_BaseFormat, |
|
|
|
|
|
texImage->TexFormat, |
|
|
|
|
|
dstMap, |
|
|
|
|
|
0, 0, 0, /* dstX/Y/Zoffset */ |
|
|
|
|
|
dstRowStride, |
|
|
|
|
|
&zeroImageOffset, |
|
|
|
|
|
width, height, 1, |
|
|
|
|
|
format, type, pixels, packing); |
|
|
|
|
|
|
|
|
|
|
|
ctx->Driver.UnmapTextureImage(ctx, texImage, 0); |
|
|
|
|
|
|
|
|
if (target == GL_TEXTURE_1D_ARRAY) { |
|
|
|
|
|
const GLint srcStride = |
|
|
|
|
|
_mesa_image_row_stride(packing, width, format, type); |
|
|
|
|
|
int y; |
|
|
|
|
|
|
|
|
|
|
|
success = GL_TRUE; |
|
|
|
|
|
|
|
|
|
|
|
for (y = 0; y < height; y++) { |
|
|
|
|
|
/* Map dest texture buffer (write to whole region) */ |
|
|
|
|
|
ctx->Driver.MapTextureImage(ctx, texImage, y, |
|
|
|
|
|
0, 0, width, 1, |
|
|
|
|
|
rwMode, |
|
|
|
|
|
&dstMap, &dstRowStride); |
|
|
|
|
|
assert(dstMap); |
|
|
|
|
|
success = _mesa_texstore(ctx, 2, texImage->_BaseFormat, |
|
|
|
|
|
texImage->TexFormat, |
|
|
|
|
|
dstMap, |
|
|
|
|
|
0, 0, 0, /* dstX/Y/Zoffset */ |
|
|
|
|
|
dstRowStride, |
|
|
|
|
|
&zeroImageOffset, |
|
|
|
|
|
width, 1, 1, |
|
|
|
|
|
format, type, pixels, packing); |
|
|
|
|
|
ctx->Driver.UnmapTextureImage(ctx, texImage, y); |
|
|
|
|
|
|
|
|
|
|
|
if (!success) |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
pixels += srcStride; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
/* Map dest texture buffer (write to whole region) */ |
|
|
|
|
|
ctx->Driver.MapTextureImage(ctx, texImage, 0, |
|
|
|
|
|
0, 0, width, height, |
|
|
|
|
|
rwMode, |
|
|
|
|
|
&dstMap, &dstRowStride); |
|
|
|
|
|
assert(dstMap); |
|
|
|
|
|
success = _mesa_texstore(ctx, 2, texImage->_BaseFormat, |
|
|
|
|
|
texImage->TexFormat, |
|
|
|
|
|
dstMap, |
|
|
|
|
|
0, 0, 0, /* dstX/Y/Zoffset */ |
|
|
|
|
|
dstRowStride, |
|
|
|
|
|
&zeroImageOffset, |
|
|
|
|
|
width, height, 1, |
|
|
|
|
|
format, type, pixels, packing); |
|
|
|
|
|
|
|
|
|
|
|
ctx->Driver.UnmapTextureImage(ctx, texImage, 0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (!success) |
|
|
if (!success) |
|
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); |
|
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); |
|
|
|
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (target == GL_TEXTURE_1D_ARRAY) { |
|
|
|
|
|
depth = height; |
|
|
|
|
|
height = 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
sliceMaps = (GLubyte **) malloc(depth * sizeof(GLubyte *)); |
|
|
sliceMaps = (GLubyte **) malloc(depth * sizeof(GLubyte *)); |
|
|
dstImageOffsets = (GLuint *) malloc(depth * sizeof(GLuint)); |
|
|
dstImageOffsets = (GLuint *) malloc(depth * sizeof(GLuint)); |
|
|
|
|
|
|