diff --git a/util/test/demos/CMakeLists.txt b/util/test/demos/CMakeLists.txt
index fd2fd4c8a..669507274 100644
--- a/util/test/demos/CMakeLists.txt
+++ b/util/test/demos/CMakeLists.txt
@@ -18,6 +18,7 @@ set(VULKAN_SRC
vk/vk_indirect.cpp
vk/vk_int8_ibuffer.cpp
vk/vk_khr_buffer_address.cpp
+ vk/vk_large_buffer.cpp
vk/vk_line_raster.cpp
vk/vk_mesh_zoo.cpp
vk/vk_misaligned_dirty.cpp
@@ -52,6 +53,7 @@ set(OPENGL_SRC
gl/gl_empty_capture.cpp
gl/gl_entry_points.cpp
gl/gl_large_bcn_arrays.cpp
+ gl/gl_large_buffer.cpp
gl/gl_marker_test.cpp
gl/gl_map_overrun.cpp
gl/gl_mesh_zoo.cpp
diff --git a/util/test/demos/d3d11/d3d11_large_buffer.cpp b/util/test/demos/d3d11/d3d11_large_buffer.cpp
new file mode 100644
index 000000000..c6534eacd
--- /dev/null
+++ b/util/test/demos/d3d11/d3d11_large_buffer.cpp
@@ -0,0 +1,92 @@
+/******************************************************************************
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019-2020 Baldur Karlsson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ ******************************************************************************/
+
+#include "d3d11_test.h"
+
+RD_TEST(D3D11_Large_Buffer, D3D11GraphicsTest)
+{
+ static constexpr const char *Description =
+ "Draws a triangle over the span of a very large buffer to ensure readbacks work correctly.";
+
+ int main()
+ {
+ // initialise, create window, create device, etc
+ if(!Init())
+ return 3;
+
+ ID3DBlobPtr vsblob = Compile(D3DDefaultVertex, "main", "vs_4_0");
+ ID3DBlobPtr psblob = Compile(D3DDefaultPixel, "main", "ps_4_0");
+
+ CreateDefaultInputLayout(vsblob);
+
+ ID3D11VertexShaderPtr vs = CreateVS(vsblob);
+ ID3D11PixelShaderPtr ps = CreatePS(psblob);
+
+ uint32_t indices[3] = {0, 1000000, 2345678};
+
+ ID3D11BufferPtr ib = MakeBuffer().Index().Data(indices);
+
+ ID3D11BufferPtr vb = MakeBuffer().Vertex().Size(128 * 1024 * 1024).Mappable();
+
+ D3D11_MAPPED_SUBRESOURCE mapped = Map(vb, 0, D3D11_MAP_WRITE_DISCARD);
+
+ DefaultA2V *verts = (DefaultA2V *)mapped.pData;
+
+ verts[indices[0]] = DefaultTri[0];
+ verts[indices[1]] = DefaultTri[1];
+ verts[indices[2]] = DefaultTri[2];
+
+ ctx->Unmap(vb, 0);
+
+ // make a simple texture so that the structured data includes texture initial states
+ ID3D11Texture2DPtr fltTex = MakeTexture(DXGI_FORMAT_R32G32B32A32_FLOAT, 4, 4).RTV();
+ ID3D11RenderTargetViewPtr fltRT = MakeRTV(fltTex);
+
+ while(Running())
+ {
+ ClearRenderTargetView(bbRTV, {0.2f, 0.2f, 0.2f, 1.0f});
+ ClearRenderTargetView(fltRT, {0.2f, 0.2f, 0.2f, 1.0f});
+
+ IASetVertexBuffer(vb, sizeof(DefaultA2V), 0);
+ ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+ ctx->IASetInputLayout(defaultLayout);
+ ctx->IASetIndexBuffer(ib, DXGI_FORMAT_R32_UINT, 0);
+
+ ctx->VSSetShader(vs, NULL, 0);
+ ctx->PSSetShader(ps, NULL, 0);
+
+ RSSetViewport({0.0f, 0.0f, (float)screenWidth, (float)screenHeight, 0.0f, 1.0f});
+
+ ctx->OMSetRenderTargets(1, &bbRTV.GetInterfacePtr(), NULL);
+
+ ctx->DrawIndexed(3, 0, 0);
+
+ Present();
+ }
+
+ return 0;
+ }
+};
+
+REGISTER_TEST();
diff --git a/util/test/demos/d3d12/d3d12_large_buffer.cpp b/util/test/demos/d3d12/d3d12_large_buffer.cpp
new file mode 100644
index 000000000..25573ec32
--- /dev/null
+++ b/util/test/demos/d3d12/d3d12_large_buffer.cpp
@@ -0,0 +1,112 @@
+/******************************************************************************
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019-2020 Baldur Karlsson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ ******************************************************************************/
+
+#include "d3d12_test.h"
+
+RD_TEST(D3D12_Large_Buffer, D3D12GraphicsTest)
+{
+ static constexpr const char *Description =
+ "Draws a triangle over the span of a very large buffer to ensure readbacks work correctly.";
+
+ int main()
+ {
+ // initialise, create window, create device, etc
+ if(!Init())
+ return 3;
+
+ ID3DBlobPtr vsblob = Compile(D3DDefaultVertex, "main", "vs_4_0");
+ ID3DBlobPtr psblob = Compile(D3DDefaultPixel, "main", "ps_4_0");
+
+ uint32_t indices[3] = {0, 1000000, 2345678};
+
+ ID3D12ResourcePtr ib = MakeBuffer().Data(indices);
+
+ ID3D12ResourcePtr vb = MakeBuffer().Size(128 * 1024 * 1024).Upload();
+
+ D3D12_RANGE range = {0, 0};
+
+ byte *ptr = NULL;
+ CHECK_HR(vb->Map(0, &range, (void **)&ptr));
+
+ DefaultA2V *verts = (DefaultA2V *)ptr;
+
+ verts[indices[0]] = DefaultTri[0];
+ verts[indices[1]] = DefaultTri[1];
+ verts[indices[2]] = DefaultTri[2];
+
+ range.End = vb->GetDesc().Width;
+
+ vb->Unmap(0, &range);
+
+ ID3D12RootSignaturePtr sig = MakeSig({});
+
+ ID3D12PipelineStatePtr pso = MakePSO().RootSig(sig).InputLayout().VS(vsblob).PS(psblob);
+
+ ID3D12ResourcePtr rtvtex = MakeTexture(DXGI_FORMAT_R32G32B32A32_FLOAT, 4, 4)
+ .RTV()
+ .InitialState(D3D12_RESOURCE_STATE_RENDER_TARGET);
+
+ while(Running())
+ {
+ ID3D12GraphicsCommandListPtr cmd = GetCommandBuffer();
+
+ Reset(cmd);
+
+ ID3D12ResourcePtr bb = StartUsingBackbuffer(cmd, D3D12_RESOURCE_STATE_RENDER_TARGET);
+
+ D3D12_CPU_DESCRIPTOR_HANDLE rtv =
+ MakeRTV(bb).Format(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB).CreateCPU(0);
+
+ ClearRenderTargetView(cmd, rtv, {0.2f, 0.2f, 0.2f, 1.0f});
+
+ ClearRenderTargetView(cmd, MakeRTV(rtvtex).CreateCPU(1), {0.2f, 0.2f, 0.2f, 1.0f});
+
+ cmd->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+
+ IASetVertexBuffer(cmd, vb, sizeof(DefaultA2V), 0);
+ IASetIndexBuffer(cmd, ib, DXGI_FORMAT_R32_UINT, 0);
+ cmd->SetPipelineState(pso);
+ cmd->SetGraphicsRootSignature(sig);
+
+ RSSetViewport(cmd, {0.0f, 0.0f, (float)screenWidth, (float)screenHeight, 0.0f, 1.0f});
+ RSSetScissorRect(cmd, {0, 0, screenWidth, screenHeight});
+
+ OMSetRenderTargets(cmd, {rtv}, {});
+
+ cmd->DrawIndexedInstanced(3, 1, 0, 0, 0);
+
+ FinishUsingBackbuffer(cmd, D3D12_RESOURCE_STATE_RENDER_TARGET);
+
+ cmd->Close();
+
+ Submit({cmd});
+
+ Present();
+ }
+
+ return 0;
+ }
+};
+
+REGISTER_TEST();
diff --git a/util/test/demos/d3d12/d3d12_test.cpp b/util/test/demos/d3d12/d3d12_test.cpp
index 4f18cd735..e0ec027e8 100644
--- a/util/test/demos/d3d12/d3d12_test.cpp
+++ b/util/test/demos/d3d12/d3d12_test.cpp
@@ -838,6 +838,16 @@ void D3D12GraphicsTest::IASetVertexBuffer(ID3D12GraphicsCommandListPtr cmd, ID3D
cmd->IASetVertexBuffers(0, 1, &view);
}
+void D3D12GraphicsTest::IASetIndexBuffer(ID3D12GraphicsCommandListPtr cmd, ID3D12ResourcePtr ib,
+ DXGI_FORMAT fmt, UINT offset)
+{
+ D3D12_INDEX_BUFFER_VIEW view;
+ view.BufferLocation = ib->GetGPUVirtualAddress() + offset;
+ view.Format = fmt;
+ view.SizeInBytes = UINT(ib->GetDesc().Width - offset);
+ cmd->IASetIndexBuffer(&view);
+}
+
void D3D12GraphicsTest::ClearRenderTargetView(ID3D12GraphicsCommandListPtr cmd,
ID3D12ResourcePtr rt, Vec4f col)
{
diff --git a/util/test/demos/d3d12/d3d12_test.h b/util/test/demos/d3d12/d3d12_test.h
index c37496084..ef953385a 100644
--- a/util/test/demos/d3d12/d3d12_test.h
+++ b/util/test/demos/d3d12/d3d12_test.h
@@ -153,6 +153,8 @@ struct D3D12GraphicsTest : public GraphicsTest
void IASetVertexBuffer(ID3D12GraphicsCommandListPtr cmd, ID3D12ResourcePtr vb, UINT stride,
UINT offset);
+ void IASetIndexBuffer(ID3D12GraphicsCommandListPtr cmd, ID3D12ResourcePtr ib, DXGI_FORMAT fmt,
+ UINT offset);
void ClearRenderTargetView(ID3D12GraphicsCommandListPtr cmd, D3D12_CPU_DESCRIPTOR_HANDLE rt,
Vec4f col);
diff --git a/util/test/demos/demos.vcxproj b/util/test/demos/demos.vcxproj
index 49ca0fe09..5c98acc42 100644
--- a/util/test/demos/demos.vcxproj
+++ b/util/test/demos/demos.vcxproj
@@ -133,6 +133,7 @@
+
@@ -167,6 +168,7 @@
+
@@ -205,6 +207,7 @@
+
@@ -244,6 +247,7 @@
+
diff --git a/util/test/demos/demos.vcxproj.filters b/util/test/demos/demos.vcxproj.filters
index cfab4031b..7db4a1c7c 100644
--- a/util/test/demos/demos.vcxproj.filters
+++ b/util/test/demos/demos.vcxproj.filters
@@ -457,6 +457,18 @@
D3D11\demos
+
+ OpenGL\demos
+
+
+ Vulkan\demos
+
+
+ D3D12\demos
+
+
+ D3D11\demos
+
diff --git a/util/test/demos/gl/gl_large_buffer.cpp b/util/test/demos/gl/gl_large_buffer.cpp
new file mode 100644
index 000000000..cf1dab346
--- /dev/null
+++ b/util/test/demos/gl/gl_large_buffer.cpp
@@ -0,0 +1,89 @@
+/******************************************************************************
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019-2020 Baldur Karlsson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ ******************************************************************************/
+
+#include "gl_test.h"
+
+RD_TEST(GL_Large_Buffer, OpenGLGraphicsTest)
+{
+ static constexpr const char *Description =
+ "Draws a triangle over the span of a very large buffer to ensure readbacks work correctly.";
+
+ int main()
+ {
+ // initialise, create window, create context, etc
+ if(!Init())
+ return 3;
+
+ GLuint vao = MakeVAO();
+ glBindVertexArray(vao);
+
+ uint32_t indices[3] = {0, 1000000, 2345678};
+
+ GLuint ib = MakeBuffer();
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ib);
+ glBufferStorage(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, 0);
+
+ GLuint vb = MakeBuffer();
+ glBindBuffer(GL_ARRAY_BUFFER, vb);
+ glBufferStorage(GL_ARRAY_BUFFER, 128 * 1024 * 1024, 0, GL_DYNAMIC_STORAGE_BIT);
+
+ glBufferSubData(GL_ARRAY_BUFFER, indices[0] * sizeof(DefaultA2V), sizeof(DefaultA2V),
+ &DefaultTri[0]);
+ glBufferSubData(GL_ARRAY_BUFFER, indices[1] * sizeof(DefaultA2V), sizeof(DefaultA2V),
+ &DefaultTri[1]);
+ glBufferSubData(GL_ARRAY_BUFFER, indices[2] * sizeof(DefaultA2V), sizeof(DefaultA2V),
+ &DefaultTri[2]);
+
+ ConfigureDefaultVAO();
+
+ GLuint program = MakeProgram(GLDefaultVertex, GLDefaultPixel);
+
+ // make a simple texture so that the structured data includes texture initial states
+ GLuint tex = MakeTexture();
+ glBindTexture(GL_TEXTURE_2D, tex);
+ glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA32F, 4, 4);
+
+ while(Running())
+ {
+ float col[] = {0.2f, 0.2f, 0.2f, 1.0f};
+ glClearBufferfv(GL_COLOR, 0, col);
+
+ glClearTexImage(tex, 0, GL_RGBA, GL_FLOAT, col);
+
+ glBindVertexArray(vao);
+
+ glUseProgram(program);
+
+ glViewport(0, 0, GLsizei(screenWidth), GLsizei(screenHeight));
+
+ glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, NULL);
+
+ Present();
+ }
+
+ return 0;
+ }
+};
+
+REGISTER_TEST();
diff --git a/util/test/demos/vk/vk_large_buffer.cpp b/util/test/demos/vk/vk_large_buffer.cpp
new file mode 100644
index 000000000..105208efd
--- /dev/null
+++ b/util/test/demos/vk/vk_large_buffer.cpp
@@ -0,0 +1,180 @@
+/******************************************************************************
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019-2020 Baldur Karlsson
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ ******************************************************************************/
+
+#include "vk_test.h"
+
+RD_TEST(VK_Large_Buffer, VulkanGraphicsTest)
+{
+ static constexpr const char *Description =
+ "Draws a triangle over the span of a very large buffer to ensure readbacks work correctly.";
+
+ std::string common = R"EOSHADER(
+
+#version 420 core
+
+struct v2f
+{
+ vec4 pos;
+ vec4 col;
+ vec4 uv;
+};
+
+)EOSHADER";
+
+ const std::string vertex = R"EOSHADER(
+
+layout(location = 0) in vec3 Position;
+layout(location = 1) in vec4 Color;
+layout(location = 2) in vec2 UV;
+
+layout(location = 0) out v2f vertOut;
+
+void main()
+{
+ vertOut.pos = vec4(Position.xyz*vec3(1,-1,1), 1);
+ gl_Position = vertOut.pos;
+ vertOut.col = Color;
+ vertOut.uv = vec4(UV.xy, 0, 1);
+}
+
+)EOSHADER";
+
+ const std::string pixel = R"EOSHADER(
+
+layout(location = 0) in v2f vertIn;
+
+layout(location = 0, index = 0) out vec4 Color;
+
+void main()
+{
+ Color = vertIn.col;
+}
+
+)EOSHADER";
+
+ int main()
+ {
+ // initialise, create window, create context, etc
+ if(!Init())
+ return 3;
+
+ VkPipelineLayout layout = createPipelineLayout(vkh::PipelineLayoutCreateInfo());
+
+ vkh::GraphicsPipelineCreateInfo pipeCreateInfo;
+
+ pipeCreateInfo.layout = layout;
+ pipeCreateInfo.renderPass = mainWindow->rp;
+
+ pipeCreateInfo.vertexInputState.vertexBindingDescriptions = {vkh::vertexBind(0, DefaultA2V)};
+ pipeCreateInfo.vertexInputState.vertexAttributeDescriptions = {
+ vkh::vertexAttr(0, 0, DefaultA2V, pos), vkh::vertexAttr(1, 0, DefaultA2V, col),
+ vkh::vertexAttr(2, 0, DefaultA2V, uv),
+ };
+
+ pipeCreateInfo.stages = {
+ CompileShaderModule(common + vertex, ShaderLang::glsl, ShaderStage::vert, "main"),
+ CompileShaderModule(common + pixel, ShaderLang::glsl, ShaderStage::frag, "main"),
+ };
+
+ VkPipeline pipe = createGraphicsPipeline(pipeCreateInfo);
+
+ uint32_t indices[3] = {0, 1000000, 2345678};
+
+ AllocatedBuffer ib(this,
+ vkh::BufferCreateInfo(sizeof(indices), VK_BUFFER_USAGE_INDEX_BUFFER_BIT |
+ VK_BUFFER_USAGE_TRANSFER_DST_BIT),
+ VmaAllocationCreateInfo({0, VMA_MEMORY_USAGE_CPU_TO_GPU}));
+
+ ib.upload(indices);
+
+ AllocatedBuffer vb(
+ this, vkh::BufferCreateInfo(128 * 1024 * 1024, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT |
+ VK_BUFFER_USAGE_TRANSFER_DST_BIT),
+ VmaAllocationCreateInfo({0, VMA_MEMORY_USAGE_CPU_TO_GPU}));
+
+ byte *ptr = vb.map();
+ if(ptr)
+ {
+ DefaultA2V *verts = (DefaultA2V *)ptr;
+
+ verts[indices[0]] = DefaultTri[0];
+ verts[indices[1]] = DefaultTri[1];
+ verts[indices[2]] = DefaultTri[2];
+ }
+ vb.unmap();
+
+ AllocatedImage offimg(this, vkh::ImageCreateInfo(4, 4, 0, VK_FORMAT_R32G32B32A32_SFLOAT,
+ VK_IMAGE_USAGE_TRANSFER_DST_BIT),
+ VmaAllocationCreateInfo({0, VMA_MEMORY_USAGE_GPU_ONLY}));
+
+ while(Running())
+ {
+ VkCommandBuffer cmd = GetCommandBuffer();
+
+ vkBeginCommandBuffer(cmd, vkh::CommandBufferBeginInfo());
+
+ VkImage swapimg =
+ StartUsingBackbuffer(cmd, VK_ACCESS_TRANSFER_WRITE_BIT, VK_IMAGE_LAYOUT_GENERAL);
+
+ vkCmdClearColorImage(cmd, swapimg, VK_IMAGE_LAYOUT_GENERAL,
+ vkh::ClearColorValue(0.2f, 0.2f, 0.2f, 1.0f), 1,
+ vkh::ImageSubresourceRange());
+
+ vkh::cmdPipelineBarrier(
+ cmd, {
+ vkh::ImageMemoryBarrier(0, VK_ACCESS_TRANSFER_WRITE_BIT, VK_IMAGE_LAYOUT_UNDEFINED,
+ VK_IMAGE_LAYOUT_GENERAL, offimg.image),
+ });
+
+ vkCmdClearColorImage(cmd, offimg.image, VK_IMAGE_LAYOUT_GENERAL,
+ vkh::ClearColorValue(0.2f, 0.2f, 0.2f, 1.0f), 1,
+ vkh::ImageSubresourceRange());
+
+ vkCmdBeginRenderPass(
+ cmd, vkh::RenderPassBeginInfo(mainWindow->rp, mainWindow->GetFB(), mainWindow->scissor),
+ VK_SUBPASS_CONTENTS_INLINE);
+
+ vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, pipe);
+ vkCmdSetViewport(cmd, 0, 1, &mainWindow->viewport);
+ vkCmdSetScissor(cmd, 0, 1, &mainWindow->scissor);
+ vkh::cmdBindVertexBuffers(cmd, 0, {vb.buffer}, {0});
+ vkCmdBindIndexBuffer(cmd, ib.buffer, 0, VK_INDEX_TYPE_UINT32);
+ vkCmdDrawIndexed(cmd, 3, 1, 0, 0, 0);
+
+ vkCmdEndRenderPass(cmd);
+
+ FinishUsingBackbuffer(cmd, VK_ACCESS_TRANSFER_WRITE_BIT, VK_IMAGE_LAYOUT_GENERAL);
+
+ vkEndCommandBuffer(cmd);
+
+ Submit(0, 1, {cmd});
+
+ Present();
+ }
+
+ return 0;
+ }
+};
+
+REGISTER_TEST();
diff --git a/util/test/rdtest/util.py b/util/test/rdtest/util.py
index c69750404..8691b2eee 100644
--- a/util/test/rdtest/util.py
+++ b/util/test/rdtest/util.py
@@ -279,11 +279,11 @@ def value_compare_diff(ref, data, eps=FLT_EPSILON):
elif type(ref) == list or type(ref) == tuple:
# tuples and lists can be treated interchangeably
if type(data) != list and type(data) != tuple:
- return False
+ return False, 0.0
# Lists are equal if they have the same length and all members have value_compare(i, j) == True
if len(ref) != len(data):
- return False
+ return False, 0.0
ret = (True, 0.0)
diff --git a/util/test/tests/D3D11/D3D11_Large_Buffer.py b/util/test/tests/D3D11/D3D11_Large_Buffer.py
new file mode 100644
index 000000000..61c2aee3b
--- /dev/null
+++ b/util/test/tests/D3D11/D3D11_Large_Buffer.py
@@ -0,0 +1,65 @@
+import renderdoc as rd
+import rdtest
+
+
+class D3D11_Large_Buffer(rdtest.TestCase):
+ demos_test_name = 'D3D11_Large_Buffer'
+
+ def check_capture(self):
+ draw = self.find_draw("Draw")
+
+ self.controller.SetFrameEvent(draw.eventId, False)
+
+ vsin_ref = {
+ 0: {
+ 'vtx': 0,
+ 'idx': 0,
+ 'POSITION': [-0.5, -0.5, 0.0],
+ 'COLOR': [0.0, 1.0, 0.0, 1.0],
+ 'TEXCOORD': [0.0, 0.0],
+ },
+ 1: {
+ 'vtx': 1,
+ 'idx': 1000000,
+ 'POSITION': [0.0, 0.5, 0.0],
+ 'COLOR': [0.0, 1.0, 0.0, 1.0],
+ 'TEXCOORD': [0.0, 1.0],
+ },
+ 2: {
+ 'vtx': 2,
+ 'idx': 2345678,
+ 'POSITION': [0.5, -0.5, 0.0],
+ 'COLOR': [0.0, 1.0, 0.0, 1.0],
+ 'TEXCOORD': [1.0, 0.0],
+ },
+ }
+
+ self.check_mesh_data(vsin_ref, self.get_vsin(draw))
+
+ postvs_data = self.get_postvs(rd.MeshDataStage.VSOut, 0, draw.numIndices)
+
+ postvs_ref = {
+ 0: {
+ 'vtx': 0,
+ 'idx': 0,
+ 'SV_POSITION': [-0.5, -0.5, 0.0, 1.0],
+ 'COLOR': [0.0, 1.0, 0.0, 1.0],
+ 'TEXCOORD': [0.0, 0.0],
+ },
+ 1: {
+ 'vtx': 1,
+ 'idx': 1,
+ 'SV_POSITION': [0.0, 0.5, 0.0, 1.0],
+ 'COLOR': [0.0, 1.0, 0.0, 1.0],
+ 'TEXCOORD': [0.0, 1.0],
+ },
+ 2: {
+ 'vtx': 2,
+ 'idx': 2,
+ 'SV_POSITION': [0.5, -0.5, 0.0, 1.0],
+ 'COLOR': [0.0, 1.0, 0.0, 1.0],
+ 'TEXCOORD': [1.0, 0.0],
+ },
+ }
+
+ self.check_mesh_data(postvs_ref, postvs_data)
diff --git a/util/test/tests/D3D12/D3D12_Large_Buffer.py b/util/test/tests/D3D12/D3D12_Large_Buffer.py
new file mode 100644
index 000000000..23d063933
--- /dev/null
+++ b/util/test/tests/D3D12/D3D12_Large_Buffer.py
@@ -0,0 +1,66 @@
+import renderdoc as rd
+import rdtest
+
+
+class D3D12_Large_Buffer(rdtest.TestCase):
+ demos_test_name = 'D3D12_Large_Buffer'
+
+ def check_capture(self):
+ draw = self.find_draw("Draw")
+
+ self.controller.SetFrameEvent(draw.eventId, False)
+
+ vsin_ref = {
+ 0: {
+ 'vtx': 0,
+ 'idx': 0,
+ 'POSITION': [-0.5, -0.5, 0.0],
+ 'COLOR': [0.0, 1.0, 0.0, 1.0],
+ 'TEXCOORD': [0.0, 0.0],
+ },
+ 1: {
+ 'vtx': 1,
+ 'idx': 1000000,
+ 'POSITION': [0.0, 0.5, 0.0],
+ 'COLOR': [0.0, 1.0, 0.0, 1.0],
+ 'TEXCOORD': [0.0, 1.0],
+ },
+ 2: {
+ 'vtx': 2,
+ 'idx': 2345678,
+ 'POSITION': [0.5, -0.5, 0.0],
+ 'COLOR': [0.0, 1.0, 0.0, 1.0],
+ 'TEXCOORD': [1.0, 0.0],
+ },
+ }
+
+ self.check_mesh_data(vsin_ref, self.get_vsin(draw))
+
+ postvs_data = self.get_postvs(rd.MeshDataStage.VSOut, 0, draw.numIndices)
+
+ postvs_ref = {
+ 0: {
+ 'vtx': 0,
+ 'idx': 0,
+ 'SV_POSITION': [-0.5, -0.5, 0.0, 1.0],
+ 'COLOR': [0.0, 1.0, 0.0, 1.0],
+ 'TEXCOORD': [0.0, 0.0],
+ },
+ 1: {
+ 'vtx': 1,
+ 'idx': 1,
+ 'SV_POSITION': [0.0, 0.5, 0.0, 1.0],
+ 'COLOR': [0.0, 1.0, 0.0, 1.0],
+ 'TEXCOORD': [0.0, 1.0],
+ },
+ 2: {
+ 'vtx': 2,
+ 'idx': 2,
+ 'SV_POSITION': [0.5, -0.5, 0.0, 1.0],
+ 'COLOR': [0.0, 1.0, 0.0, 1.0],
+ 'TEXCOORD': [1.0, 0.0],
+ },
+ }
+
+ self.check_mesh_data(postvs_ref, postvs_data)
+
diff --git a/util/test/tests/GL/GL_Large_Buffer.py b/util/test/tests/GL/GL_Large_Buffer.py
new file mode 100644
index 000000000..df87fc092
--- /dev/null
+++ b/util/test/tests/GL/GL_Large_Buffer.py
@@ -0,0 +1,69 @@
+import renderdoc as rd
+import rdtest
+
+
+class GL_Large_Buffer(rdtest.TestCase):
+ demos_test_name = 'GL_Large_Buffer'
+
+ def check_capture(self):
+ draw = self.find_draw("Draw")
+
+ self.controller.SetFrameEvent(draw.eventId, False)
+
+ vsin_ref = {
+ 0: {
+ 'vtx': 0,
+ 'idx': 0,
+ 'Position': [-0.5, -0.5, 0.0],
+ 'Color': [0.0, 1.0, 0.0, 1.0],
+ # GL may eliminate UV as unused
+ #'UV': [0.0, 0.0],
+ },
+ 1: {
+ 'vtx': 1,
+ 'idx': 1000000,
+ 'Position': [0.0, 0.5, 0.0],
+ 'Color': [0.0, 1.0, 0.0, 1.0],
+ #'UV': [0.0, 1.0],
+ },
+ 2: {
+ 'vtx': 2,
+ 'idx': 2345678,
+ 'Position': [0.5, -0.5, 0.0],
+ 'Color': [0.0, 1.0, 0.0, 1.0],
+ #'UV': [1.0, 0.0],
+ },
+ }
+
+ self.check_mesh_data(vsin_ref, self.get_vsin(draw))
+
+ postvs_data = self.get_postvs(rd.MeshDataStage.VSOut, 0, draw.numIndices)
+
+ postvs_ref = {
+ 0: {
+ 'vtx': 0,
+ 'idx': 0,
+ 'gl_Position': [-0.5, -0.5, 0.0, 1.0],
+ 'v2f_block.pos': [-0.5, -0.5, 0.0, 1.0],
+ 'v2f_block.col': [0.0, 1.0, 0.0, 1.0],
+ 'v2f_block.uv': [0.0, 0.0, 0.0, 1.0],
+ },
+ 1: {
+ 'vtx': 1,
+ 'idx': 1,
+ 'gl_Position': [0.0, 0.5, 0.0, 1.0],
+ 'v2f_block.pos': [0.0, 0.5, 0.0, 1.0],
+ 'v2f_block.col': [0.0, 1.0, 0.0, 1.0],
+ 'v2f_block.uv': [0.0, 1.0, 0.0, 1.0],
+ },
+ 2: {
+ 'vtx': 2,
+ 'idx': 2,
+ 'gl_Position': [0.5, -0.5, 0.0, 1.0],
+ 'v2f_block.pos': [0.5, -0.5, 0.0, 1.0],
+ 'v2f_block.col': [0.0, 1.0, 0.0, 1.0],
+ 'v2f_block.uv': [1.0, 0.0, 0.0, 1.0],
+ },
+ }
+
+ self.check_mesh_data(postvs_ref, postvs_data)
diff --git a/util/test/tests/Vulkan/VK_Large_Buffer.py b/util/test/tests/Vulkan/VK_Large_Buffer.py
new file mode 100644
index 000000000..a4b8e654f
--- /dev/null
+++ b/util/test/tests/Vulkan/VK_Large_Buffer.py
@@ -0,0 +1,68 @@
+import renderdoc as rd
+import rdtest
+
+
+class VK_Large_Buffer(rdtest.TestCase):
+ demos_test_name = 'VK_Large_Buffer'
+
+ def check_capture(self):
+ draw = self.find_draw("Draw")
+
+ self.controller.SetFrameEvent(draw.eventId, False)
+
+ vsin_ref = {
+ 0: {
+ 'vtx': 0,
+ 'idx': 0,
+ 'Position': [-0.5, -0.5, 0.0],
+ 'Color': [0.0, 1.0, 0.0, 1.0],
+ 'UV': [0.0, 0.0],
+ },
+ 1: {
+ 'vtx': 1,
+ 'idx': 1000000,
+ 'Position': [0.0, 0.5, 0.0],
+ 'Color': [0.0, 1.0, 0.0, 1.0],
+ 'UV': [0.0, 1.0],
+ },
+ 2: {
+ 'vtx': 2,
+ 'idx': 2345678,
+ 'Position': [0.5, -0.5, 0.0],
+ 'Color': [0.0, 1.0, 0.0, 1.0],
+ 'UV': [1.0, 0.0],
+ },
+ }
+
+ self.check_mesh_data(vsin_ref, self.get_vsin(draw))
+
+ postvs_data = self.get_postvs(rd.MeshDataStage.VSOut, 0, draw.numIndices)
+
+ postvs_ref = {
+ 0: {
+ 'vtx': 0,
+ 'idx': 0,
+ 'gl_PerVertex.gl_Position': [-0.5, 0.5, 0.0, 1.0],
+ 'vertOut.pos': [-0.5, 0.5, 0.0, 1.0],
+ 'vertOut.col': [0.0, 1.0, 0.0, 1.0],
+ 'vertOut.uv': [0.0, 0.0, 0.0, 1.0],
+ },
+ 1: {
+ 'vtx': 1,
+ 'idx': 1,
+ 'gl_PerVertex.gl_Position': [0.0, -0.5, 0.0, 1.0],
+ 'vertOut.pos': [0.0, -0.5, 0.0, 1.0],
+ 'vertOut.col': [0.0, 1.0, 0.0, 1.0],
+ 'vertOut.uv': [0.0, 1.0, 0.0, 1.0],
+ },
+ 2: {
+ 'vtx': 2,
+ 'idx': 2,
+ 'gl_PerVertex.gl_Position': [0.5, 0.5, 0.0, 1.0],
+ 'vertOut.pos': [0.5, 0.5, 0.0, 1.0],
+ 'vertOut.col': [0.0, 1.0, 0.0, 1.0],
+ 'vertOut.uv': [1.0, 0.0, 0.0, 1.0],
+ },
+ }
+
+ self.check_mesh_data(postvs_ref, postvs_data)