mirror of https://github.com/AxioDL/boo.git
depth range part of setViewport now
This commit is contained in:
parent
23f49fcc19
commit
4cec163804
|
@ -18,7 +18,7 @@ struct IGraphicsCommandQueue
|
|||
|
||||
virtual void setShaderDataBinding(IShaderDataBinding* binding)=0;
|
||||
virtual void setRenderTarget(ITextureR* target)=0;
|
||||
virtual void setViewport(const SWindowRect& rect)=0;
|
||||
virtual void setViewport(const SWindowRect& rect, float znear=0.f, float zfar=1.f)=0;
|
||||
virtual void setScissor(const SWindowRect& rect)=0;
|
||||
|
||||
virtual void resizeRenderTexture(ITextureR* tex, size_t width, size_t height)=0;
|
||||
|
|
|
@ -784,7 +784,11 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
const IShaderDataBinding* binding;
|
||||
const ITextureR* target;
|
||||
const ITextureR* source;
|
||||
SWindowRect rect;
|
||||
struct
|
||||
{
|
||||
SWindowRect rect;
|
||||
float znear, zfar;
|
||||
};
|
||||
float rgba[4];
|
||||
GLbitfield flags;
|
||||
struct
|
||||
|
@ -983,6 +987,7 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
case Command::Op::SetViewport:
|
||||
glViewport(cmd.rect.location[0], cmd.rect.location[1],
|
||||
cmd.rect.size[0], cmd.rect.size[1]);
|
||||
glDepthRange(cmd.znear, cmd.zfar);
|
||||
break;
|
||||
case Command::Op::SetScissor:
|
||||
if (cmd.rect.size[0] == 0 && cmd.rect.size[1] == 0)
|
||||
|
@ -1093,11 +1098,13 @@ struct GLCommandQueue : IGraphicsCommandQueue
|
|||
cmds.back().target = target;
|
||||
}
|
||||
|
||||
void setViewport(const SWindowRect& rect)
|
||||
void setViewport(const SWindowRect& rect, float znear, float zfar)
|
||||
{
|
||||
std::vector<Command>& cmds = m_cmdBufs[m_fillBuf];
|
||||
cmds.emplace_back(Command::Op::SetViewport);
|
||||
cmds.back().rect = rect;
|
||||
cmds.back().znear = znear;
|
||||
cmds.back().zfar = zfar;
|
||||
}
|
||||
|
||||
void setScissor(const SWindowRect& rect)
|
||||
|
|
|
@ -2393,12 +2393,12 @@ struct VulkanCommandQueue : IGraphicsCommandQueue
|
|||
m_boundTarget = ctarget;
|
||||
}
|
||||
|
||||
void setViewport(const SWindowRect& rect)
|
||||
void setViewport(const SWindowRect& rect, float znear, float zfar)
|
||||
{
|
||||
if (m_boundTarget)
|
||||
{
|
||||
VkViewport vp = {float(rect.location[0]), float(m_boundTarget->m_height - rect.location[1]),
|
||||
float(rect.size[0]), float(rect.size[1]), 0.0f, 1.0f};
|
||||
VkViewport vp = {float(rect.location[0]), float(m_boundTarget->m_height - rect.location[1] - rect.size[1]),
|
||||
float(rect.size[0]), float(rect.size[1]), znear, zfar};
|
||||
vkCmdSetViewport(m_cmdBufs[m_fillBuf], 0, 1, &vp);
|
||||
}
|
||||
}
|
||||
|
@ -2409,7 +2409,7 @@ struct VulkanCommandQueue : IGraphicsCommandQueue
|
|||
{
|
||||
VkRect2D vkrect =
|
||||
{
|
||||
{int32_t(rect.location[0]), int32_t(m_boundTarget->m_height) - int32_t(rect.location[1])},
|
||||
{int32_t(rect.location[0]), int32_t(m_boundTarget->m_height - rect.location[1] - rect.size[1])},
|
||||
{uint32_t(rect.size[0]), uint32_t(rect.size[1])}
|
||||
};
|
||||
vkCmdSetScissor(m_cmdBufs[m_fillBuf], 0, 1, &vkrect);
|
||||
|
|
Loading…
Reference in New Issue