mirror of https://github.com/AxioDL/boo.git
Update booTest pipeline for Vulkan
This commit is contained in:
parent
affb4e98d3
commit
b04257c992
|
@ -1307,8 +1307,6 @@ public:
|
|||
TextureFormat format() const {return m_fmt;}
|
||||
};
|
||||
|
||||
static const VkClearValue BlackClear[2] = {{},{}};
|
||||
|
||||
class VulkanTextureR : public ITextureR
|
||||
{
|
||||
friend class VulkanDataFactory;
|
||||
|
@ -1486,8 +1484,8 @@ class VulkanTextureR : public ITextureR
|
|||
m_passBeginInfo.renderArea.offset.y = 0;
|
||||
m_passBeginInfo.renderArea.extent.width = width;
|
||||
m_passBeginInfo.renderArea.extent.height = height;
|
||||
m_passBeginInfo.clearValueCount = 2;
|
||||
m_passBeginInfo.pClearValues = BlackClear;
|
||||
m_passBeginInfo.clearValueCount = 0;
|
||||
m_passBeginInfo.pClearValues = nullptr;
|
||||
}
|
||||
|
||||
VulkanCommandQueue* m_q;
|
||||
|
@ -2294,12 +2292,20 @@ struct VulkanCommandQueue : IGraphicsCommandQueue
|
|||
|
||||
if (render && depth)
|
||||
{
|
||||
clr[0].clearValue.color.uint32[0] = m_clearColor[0] * 255;
|
||||
clr[0].clearValue.color.uint32[1] = m_clearColor[1] * 255;
|
||||
clr[0].clearValue.color.uint32[2] = m_clearColor[2] * 255;
|
||||
clr[0].clearValue.color.uint32[3] = m_clearColor[3] * 255;
|
||||
clr[0].aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
clr[1].aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT;
|
||||
vkCmdClearAttachments(m_cmdBufs[m_fillBuf], 2, clr, 1, &rect);
|
||||
}
|
||||
else if (render)
|
||||
{
|
||||
clr[0].clearValue.color.uint32[0] = m_clearColor[0] * 255;
|
||||
clr[0].clearValue.color.uint32[1] = m_clearColor[1] * 255;
|
||||
clr[0].clearValue.color.uint32[2] = m_clearColor[2] * 255;
|
||||
clr[0].clearValue.color.uint32[3] = m_clearColor[3] * 255;
|
||||
clr[0].aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
vkCmdClearAttachments(m_cmdBufs[m_fillBuf], 1, clr, 1, &rect);
|
||||
}
|
||||
|
@ -3154,7 +3160,8 @@ void VulkanCommandQueue::execute()
|
|||
VulkanContext::Window::SwapChain& otherSc = m_windowCtx->m_swapChains[m_windowCtx->m_activeSwapChain ^ 1];
|
||||
if (otherSc.m_swapChain)
|
||||
{
|
||||
otherSc.destroy(m_ctx->m_dev);
|
||||
VulkanContext::Window::SwapChain& thisSc = m_windowCtx->m_swapChains[m_windowCtx->m_activeSwapChain];
|
||||
thisSc.destroy(m_ctx->m_dev);
|
||||
m_windowCtx->m_activeSwapChain ^= 1;
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <math.h>
|
||||
#include <boo/boo.hpp>
|
||||
#include <boo/graphicsdev/GL.hpp>
|
||||
#include <boo/graphicsdev/Vulkan.hpp>
|
||||
#include <boo/graphicsdev/D3D.hpp>
|
||||
#include <boo/graphicsdev/Metal.hpp>
|
||||
#include <thread>
|
||||
|
@ -275,7 +276,8 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
|
||||
/* Make shader pipeline */
|
||||
IShaderPipeline* pipeline = nullptr;
|
||||
if (ctx.platform() == IGraphicsDataFactory::Platform::OGL)
|
||||
auto plat = ctx.platform();
|
||||
if (plat == IGraphicsDataFactory::Platform::OGL)
|
||||
{
|
||||
GLDataFactory::Context& glF = dynamic_cast<GLDataFactory::Context&>(ctx);
|
||||
|
||||
|
@ -306,6 +308,38 @@ struct TestApplicationCallback : IApplicationCallback
|
|||
BlendFactor::One, BlendFactor::Zero,
|
||||
Primitive::TriStrips, true, true, false);
|
||||
}
|
||||
#if BOO_HAS_VULKAN
|
||||
else if (plat == IGraphicsDataFactory::Platform::Vulkan)
|
||||
{
|
||||
VulkanDataFactory::Context& vkF = dynamic_cast<VulkanDataFactory::Context&>(ctx);
|
||||
|
||||
static const char* VS =
|
||||
"#version 330\n"
|
||||
"layout(location=0) in vec3 in_pos;\n"
|
||||
"layout(location=1) in vec2 in_uv;\n"
|
||||
"out vec4 out_uv;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = vec4(in_pos, 1.0);\n"
|
||||
" out_uv.xy = in_uv;\n"
|
||||
"}\n";
|
||||
|
||||
static const char* FS =
|
||||
"#version 330\n"
|
||||
BOO_GLSL_BINDING_HEAD
|
||||
"precision highp float;\n"
|
||||
"TBINDING0 uniform sampler2D texs[1];\n"
|
||||
"layout(location=0) out vec4 out_frag;\n"
|
||||
"in vec4 out_uv;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" out_frag = texture(texs[0], out_uv.xy);\n"
|
||||
"}\n";
|
||||
|
||||
pipeline = vkF.newShaderPipeline(VS, FS, vfmt, BlendFactor::One, BlendFactor::Zero,
|
||||
Primitive::TriStrips, false, false, false);
|
||||
}
|
||||
#endif
|
||||
#if _WIN32
|
||||
else if (ctx.platform() == IGraphicsDataFactory::Platform::D3D12 ||
|
||||
ctx.platform() == IGraphicsDataFactory::Platform::D3D11)
|
||||
|
|
Loading…
Reference in New Issue