Commit 398c5a2a by Gregoire Payen de La Garanderie Committed by Jamie Madill

Support for 3D texture transfers with a non-null z offset.

Also fixes the unpack buffer offset which must be in pixel instead of bytes in the shader parameter. BUG=angle:508 Change-Id: I908460a76c300d96054a02206e1f2e3ad2b8e9d0 Reviewed-on: https://chromium-review.googlesource.com/241440Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarGregoire Payen de La Garanderie <Gregory.Payen@imgtec.com>
parent bc234461
......@@ -164,7 +164,7 @@ void PixelTransfer11::setBufferToTextureCopyParams(const gl::Box &destArea, cons
unsigned int alignmentBytes = static_cast<unsigned int>(unpack.alignment);
unsigned int alignmentPixels = (alignmentBytes <= bytesPerPixel ? 1 : alignmentBytes / bytesPerPixel);
parametersOut->FirstPixelOffset = offset;
parametersOut->FirstPixelOffset = offset / bytesPerPixel;
parametersOut->PixelsPerRow = static_cast<unsigned int>(destArea.width);
parametersOut->RowStride = roundUp(parametersOut->PixelsPerRow, alignmentPixels);
parametersOut->RowsPerSlice = static_cast<unsigned int>(destArea.height);
......@@ -172,6 +172,7 @@ void PixelTransfer11::setBufferToTextureCopyParams(const gl::Box &destArea, cons
parametersOut->PositionOffset[1] = texelCenterY + ((destSize.height - destArea.y - 1) / float(destSize.height)) * 2.0f - 1.0f;
parametersOut->PositionScale[0] = 2.0f / static_cast<float>(destSize.width);
parametersOut->PositionScale[1] = -2.0f / static_cast<float>(destSize.height);
parametersOut->FirstSlice = destArea.z;
}
gl::Error PixelTransfer11::copyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTargetD3D *destRenderTarget,
......
......@@ -60,6 +60,7 @@ class PixelTransfer11
float PositionScale[2];
int TexLocationOffset[2];
int TexLocationScale[2];
unsigned int FirstSlice;
};
static void setBufferToTextureCopyParams(const gl::Box &destArea, const gl::Extents &destSize, GLenum internalFormat,
......
......@@ -26,6 +26,7 @@ cbuffer BufferCopyParams : register(b0)
float2 PositionScale;
int2 TexLocationOffset;
int2 TexLocationScale;
uint FirstSlice;
}
void ComputePositionAndIndex(uint vertexID, out VS_OUTPUT outVertex)
......@@ -42,7 +43,7 @@ void ComputePositionAndIndex(uint vertexID, out VS_OUTPUT outVertex)
outVertex.position = float4(PositionOffset + PositionScale * coords, 0.0f, 1.0f);
outVertex.index = FirstPixelOffset + slice * SliceStride + row * RowStride + col;
outVertex.slice = slice;
outVertex.slice = FirstSlice + slice;
}
void VS_BufferToTexture(in uint vertexID : SV_VertexID, out VS_OUTPUT outVertex)
......
......@@ -16,6 +16,7 @@
// float2 PositionScale; // Offset: 24 Size: 8 [unused]
// int2 TexLocationOffset; // Offset: 32 Size: 8 [unused]
// int2 TexLocationScale; // Offset: 40 Size: 8 [unused]
// uint FirstSlice; // Offset: 48 Size: 4 [unused]
//
// }
//
......@@ -55,21 +56,21 @@ ret
const BYTE g_PS_BufferToTexture_4F[] =
{
68, 88, 66, 67, 216, 100,
97, 27, 233, 138, 253, 241,
125, 101, 228, 208, 94, 168,
88, 190, 1, 0, 0, 0,
216, 3, 0, 0, 5, 0,
68, 88, 66, 67, 176, 15,
76, 123, 100, 38, 152, 23,
150, 99, 165, 184, 222, 157,
235, 80, 1, 0, 0, 0,
252, 3, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0,
104, 2, 0, 0, 192, 2,
0, 0, 244, 2, 0, 0,
92, 3, 0, 0, 82, 68,
69, 70, 44, 2, 0, 0,
140, 2, 0, 0, 228, 2,
0, 0, 24, 3, 0, 0,
128, 3, 0, 0, 82, 68,
69, 70, 80, 2, 0, 0,
1, 0, 0, 0, 120, 0,
0, 0, 2, 0, 0, 0,
28, 0, 0, 0, 0, 4,
255, 255, 0, 1, 0, 0,
249, 1, 0, 0, 92, 0,
28, 2, 0, 0, 92, 0,
0, 0, 2, 0, 0, 0,
5, 0, 0, 0, 1, 0,
0, 0, 255, 255, 255, 255,
......@@ -85,41 +86,45 @@ const BYTE g_PS_BufferToTexture_4F[] =
117, 102, 102, 101, 114, 67,
111, 112, 121, 80, 97, 114,
97, 109, 115, 0, 171, 171,
101, 0, 0, 0, 8, 0,
101, 0, 0, 0, 9, 0,
0, 0, 144, 0, 0, 0,
48, 0, 0, 0, 0, 0,
64, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
80, 1, 0, 0, 0, 0,
104, 1, 0, 0, 0, 0,
0, 0, 4, 0, 0, 0,
0, 0, 0, 0, 100, 1,
0, 0, 0, 0, 124, 1,
0, 0, 0, 0, 0, 0,
116, 1, 0, 0, 4, 0,
140, 1, 0, 0, 4, 0,
0, 0, 4, 0, 0, 0,
0, 0, 0, 0, 100, 1,
0, 0, 0, 0, 124, 1,
0, 0, 0, 0, 0, 0,
129, 1, 0, 0, 8, 0,
153, 1, 0, 0, 8, 0,
0, 0, 4, 0, 0, 0,
0, 0, 0, 0, 100, 1,
0, 0, 0, 0, 124, 1,
0, 0, 0, 0, 0, 0,
139, 1, 0, 0, 12, 0,
163, 1, 0, 0, 12, 0,
0, 0, 4, 0, 0, 0,
0, 0, 0, 0, 100, 1,
0, 0, 0, 0, 124, 1,
0, 0, 0, 0, 0, 0,
152, 1, 0, 0, 16, 0,
176, 1, 0, 0, 16, 0,
0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 168, 1,
0, 0, 0, 0, 192, 1,
0, 0, 0, 0, 0, 0,
184, 1, 0, 0, 24, 0,
208, 1, 0, 0, 24, 0,
0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 168, 1,
0, 0, 0, 0, 192, 1,
0, 0, 0, 0, 0, 0,
198, 1, 0, 0, 32, 0,
222, 1, 0, 0, 32, 0,
0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 216, 1,
0, 0, 0, 0, 240, 1,
0, 0, 0, 0, 0, 0,
232, 1, 0, 0, 40, 0,
0, 2, 0, 0, 40, 0,
0, 0, 8, 0, 0, 0,
0, 0, 0, 0, 216, 1,
0, 0, 0, 0, 240, 1,
0, 0, 0, 0, 0, 0,
17, 2, 0, 0, 48, 0,
0, 0, 4, 0, 0, 0,
0, 0, 0, 0, 124, 1,
0, 0, 0, 0, 0, 0,
70, 105, 114, 115, 116, 80,
105, 120, 101, 108, 79, 102,
......@@ -149,15 +154,17 @@ const BYTE g_PS_BufferToTexture_4F[] =
0, 0, 84, 101, 120, 76,
111, 99, 97, 116, 105, 111,
110, 83, 99, 97, 108, 101,
0, 77, 105, 99, 114, 111,
115, 111, 102, 116, 32, 40,
82, 41, 32, 72, 76, 83,
76, 32, 83, 104, 97, 100,
101, 114, 32, 67, 111, 109,
112, 105, 108, 101, 114, 32,
54, 46, 51, 46, 57, 54,
48, 48, 46, 49, 54, 51,
56, 52, 0, 171, 73, 83,
0, 70, 105, 114, 115, 116,
83, 108, 105, 99, 101, 0,
77, 105, 99, 114, 111, 115,
111, 102, 116, 32, 40, 82,
41, 32, 72, 76, 83, 76,
32, 83, 104, 97, 100, 101,
114, 32, 67, 111, 109, 112,
105, 108, 101, 114, 32, 54,
46, 51, 46, 57, 54, 48,
48, 46, 49, 54, 51, 56,
52, 0, 171, 171, 73, 83,
71, 78, 80, 0, 0, 0,
2, 0, 0, 0, 8, 0,
0, 0, 56, 0, 0, 0,
......
......@@ -16,6 +16,7 @@
// float2 PositionScale; // Offset: 24 Size: 8
// int2 TexLocationOffset; // Offset: 32 Size: 8 [unused]
// int2 TexLocationScale; // Offset: 40 Size: 8 [unused]
// uint FirstSlice; // Offset: 48 Size: 4
//
// }
//
......@@ -44,7 +45,7 @@
// LAYER 0 y 1 NONE uint y
//
vs_4_0
dcl_constantbuffer cb0[2], immediateIndexed
dcl_constantbuffer cb0[4], immediateIndexed
dcl_input_sgv v0.x, vertex_id
dcl_output_siv o0.xyzw, position
dcl_output o1.x
......@@ -55,7 +56,7 @@ imul null, r0.xy, cb0[0].wwww, cb0[0].yzyy
udiv r0.z, null, v0.x, r0.x
imad r0.x, -r0.z, r0.x, v0.x
imad r0.y, r0.z, r0.y, cb0[0].x
mov o1.y, r0.z
iadd o1.y, r0.z, cb0[3].x
udiv r0.z, null, r0.x, cb0[0].y
imad r0.x, -r0.z, cb0[0].y, r0.x
utof r1.xy, r0.xzxx
......@@ -68,21 +69,21 @@ ret
const BYTE g_VS_BufferToTexture[] =
{
68, 88, 66, 67, 145, 24,
39, 158, 198, 105, 121, 71,
133, 76, 190, 149, 185, 221,
44, 130, 1, 0, 0, 0,
104, 5, 0, 0, 5, 0,
68, 88, 66, 67, 39, 207,
138, 15, 42, 195, 141, 208,
2, 107, 135, 197, 122, 36,
114, 227, 1, 0, 0, 0,
152, 5, 0, 0, 5, 0,
0, 0, 52, 0, 0, 0,
64, 2, 0, 0, 116, 2,
0, 0, 232, 2, 0, 0,
236, 4, 0, 0, 82, 68,
69, 70, 4, 2, 0, 0,
100, 2, 0, 0, 152, 2,
0, 0, 12, 3, 0, 0,
28, 5, 0, 0, 82, 68,
69, 70, 40, 2, 0, 0,
1, 0, 0, 0, 80, 0,
0, 0, 1, 0, 0, 0,
28, 0, 0, 0, 0, 4,
254, 255, 0, 1, 0, 0,
209, 1, 0, 0, 60, 0,
244, 1, 0, 0, 60, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
......@@ -92,41 +93,45 @@ const BYTE g_VS_BufferToTexture[] =
67, 111, 112, 121, 80, 97,
114, 97, 109, 115, 0, 171,
171, 171, 60, 0, 0, 0,
8, 0, 0, 0, 104, 0,
0, 0, 48, 0, 0, 0,
9, 0, 0, 0, 104, 0,
0, 0, 64, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 40, 1, 0, 0,
0, 0, 64, 1, 0, 0,
0, 0, 0, 0, 4, 0,
0, 0, 2, 0, 0, 0,
60, 1, 0, 0, 0, 0,
0, 0, 76, 1, 0, 0,
84, 1, 0, 0, 0, 0,
0, 0, 100, 1, 0, 0,
4, 0, 0, 0, 4, 0,
0, 0, 2, 0, 0, 0,
60, 1, 0, 0, 0, 0,
0, 0, 89, 1, 0, 0,
84, 1, 0, 0, 0, 0,
0, 0, 113, 1, 0, 0,
8, 0, 0, 0, 4, 0,
0, 0, 2, 0, 0, 0,
60, 1, 0, 0, 0, 0,
0, 0, 99, 1, 0, 0,
84, 1, 0, 0, 0, 0,
0, 0, 123, 1, 0, 0,
12, 0, 0, 0, 4, 0,
0, 0, 2, 0, 0, 0,
60, 1, 0, 0, 0, 0,
0, 0, 112, 1, 0, 0,
84, 1, 0, 0, 0, 0,
0, 0, 136, 1, 0, 0,
16, 0, 0, 0, 8, 0,
0, 0, 2, 0, 0, 0,
128, 1, 0, 0, 0, 0,
0, 0, 144, 1, 0, 0,
152, 1, 0, 0, 0, 0,
0, 0, 168, 1, 0, 0,
24, 0, 0, 0, 8, 0,
0, 0, 2, 0, 0, 0,
128, 1, 0, 0, 0, 0,
0, 0, 158, 1, 0, 0,
152, 1, 0, 0, 0, 0,
0, 0, 182, 1, 0, 0,
32, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0,
176, 1, 0, 0, 0, 0,
0, 0, 192, 1, 0, 0,
200, 1, 0, 0, 0, 0,
0, 0, 216, 1, 0, 0,
40, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0,
176, 1, 0, 0, 0, 0,
200, 1, 0, 0, 0, 0,
0, 0, 233, 1, 0, 0,
48, 0, 0, 0, 4, 0,
0, 0, 2, 0, 0, 0,
84, 1, 0, 0, 0, 0,
0, 0, 70, 105, 114, 115,
116, 80, 105, 120, 101, 108,
79, 102, 102, 115, 101, 116,
......@@ -155,15 +160,17 @@ const BYTE g_VS_BufferToTexture[] =
0, 0, 0, 0, 84, 101,
120, 76, 111, 99, 97, 116,
105, 111, 110, 83, 99, 97,
108, 101, 0, 77, 105, 99,
114, 111, 115, 111, 102, 116,
32, 40, 82, 41, 32, 72,
76, 83, 76, 32, 83, 104,
97, 100, 101, 114, 32, 67,
111, 109, 112, 105, 108, 101,
114, 32, 54, 46, 51, 46,
57, 54, 48, 48, 46, 49,
54, 51, 56, 52, 0, 171,
108, 101, 0, 70, 105, 114,
115, 116, 83, 108, 105, 99,
101, 0, 77, 105, 99, 114,
111, 115, 111, 102, 116, 32,
40, 82, 41, 32, 72, 76,
83, 76, 32, 83, 104, 97,
100, 101, 114, 32, 67, 111,
109, 112, 105, 108, 101, 114,
32, 54, 46, 51, 46, 57,
54, 48, 48, 46, 49, 54,
51, 56, 52, 0, 171, 171,
73, 83, 71, 78, 44, 0,
0, 0, 1, 0, 0, 0,
8, 0, 0, 0, 32, 0,
......@@ -192,11 +199,11 @@ const BYTE g_VS_BufferToTexture[] =
110, 0, 84, 69, 88, 67,
79, 79, 82, 68, 0, 76,
65, 89, 69, 82, 0, 171,
83, 72, 68, 82, 252, 1,
83, 72, 68, 82, 8, 2,
0, 0, 64, 0, 1, 0,
127, 0, 0, 0, 89, 0,
130, 0, 0, 0, 89, 0,
0, 4, 70, 142, 32, 0,
0, 0, 0, 0, 2, 0,
0, 0, 0, 0, 4, 0,
0, 0, 96, 0, 0, 4,
18, 16, 16, 0, 0, 0,
0, 0, 6, 0, 0, 0,
......@@ -238,10 +245,12 @@ const BYTE g_VS_BufferToTexture[] =
0, 0, 26, 0, 16, 0,
0, 0, 0, 0, 10, 128,
32, 0, 0, 0, 0, 0,
0, 0, 0, 0, 54, 0,
0, 5, 34, 32, 16, 0,
0, 0, 0, 0, 30, 0,
0, 8, 34, 32, 16, 0,
1, 0, 0, 0, 42, 0,
16, 0, 0, 0, 0, 0,
10, 128, 32, 0, 0, 0,
0, 0, 3, 0, 0, 0,
78, 0, 0, 9, 66, 0,
16, 0, 0, 0, 0, 0,
0, 208, 0, 0, 10, 0,
......@@ -282,7 +291,7 @@ const BYTE g_VS_BufferToTexture[] =
0, 0, 13, 0, 0, 0,
2, 0, 0, 0, 0, 0,
0, 0, 4, 0, 0, 0,
1, 0, 0, 0, 6, 0,
1, 0, 0, 0, 7, 0,
0, 0, 2, 0, 0, 0,
1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
......@@ -292,7 +301,7 @@ const BYTE g_VS_BufferToTexture[] =
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
2, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment