mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Don't allow implicit scalar to vector casts in Vec helpers
* With all default parameters in the constructor `Vec4f foo = 1.0f` would be legal by implicit constructor.
This commit is contained in:
@@ -556,7 +556,7 @@ ResourceId D3D11Replay::RenderOverlay(ResourceId texid, FloatVector clearCol, De
|
||||
|
||||
m_pImmediateContext->RSSetState(rs);
|
||||
|
||||
CheckerboardCBuffer pixelData = {0};
|
||||
CheckerboardCBuffer pixelData = {};
|
||||
|
||||
UINT dummy = 1;
|
||||
D3D11_VIEWPORT views[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE] = {0};
|
||||
@@ -824,7 +824,7 @@ ResourceId D3D11Replay::RenderOverlay(ResourceId texid, FloatVector clearCol, De
|
||||
|
||||
D3D11_VIEWPORT view = m_pImmediateContext->GetCurrentPipelineState()->RS.Viewports[0];
|
||||
|
||||
Vec4f viewport = Vec4f(view.Width, view.Height);
|
||||
Vec4f viewport = Vec4f(view.Width, view.Height, 0.0f, 0.0f);
|
||||
ID3D11Buffer *gsbuf = GetDebugManager()->MakeCBuffer(&viewport.x, sizeof(viewport));
|
||||
|
||||
for(size_t i = 0; i < events.size(); i++)
|
||||
|
||||
@@ -326,7 +326,7 @@ void D3D11Replay::RenderMesh(uint32_t eventId, const rdcarray<MeshFormat> &secon
|
||||
|
||||
pixelData.MeshDisplayFormat = MESHDISPLAY_SOLID;
|
||||
pixelData.MeshColour =
|
||||
Vec4f(cfg.position.meshColor.x, cfg.position.meshColor.y, cfg.position.meshColor.z);
|
||||
Vec4f(cfg.position.meshColor.x, cfg.position.meshColor.y, cfg.position.meshColor.z, 0.0f);
|
||||
GetDebugManager()->FillCBuffer(psCBuf, &pixelData, sizeof(pixelData));
|
||||
m_pImmediateContext->PSSetConstantBuffers(0, 1, &psCBuf);
|
||||
|
||||
|
||||
@@ -1515,7 +1515,7 @@ ResourceId D3D12Replay::RenderOverlay(ResourceId texid, FloatVector clearCol, De
|
||||
|
||||
list->SetGraphicsRootSignature(m_General.CheckerboardRootSig);
|
||||
|
||||
CheckerboardCBuffer pixelData = {0};
|
||||
CheckerboardCBuffer pixelData = {};
|
||||
|
||||
pixelData.BorderWidth = 3;
|
||||
pixelData.CheckerSquareDimension = 16.0f;
|
||||
@@ -1683,7 +1683,7 @@ ResourceId D3D12Replay::RenderOverlay(ResourceId texid, FloatVector clearCol, De
|
||||
Vec4f viewport;
|
||||
|
||||
if(!rs.views.empty())
|
||||
viewport = Vec4f(rs.views[0].Width, rs.views[0].Height);
|
||||
viewport = Vec4f(rs.views[0].Width, rs.views[0].Height, 0.0f, 0.0f);
|
||||
|
||||
D3D12RenderState::SignatureElement viewportElem(eRootCBV, ResourceId(), 0);
|
||||
WrappedID3D12Resource::GetResIDFromAddr(
|
||||
|
||||
@@ -1628,7 +1628,7 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, Debug
|
||||
return ResourceId();
|
||||
}
|
||||
|
||||
*v = Vec4f(rs.Viewports[0].width, rs.Viewports[0].height);
|
||||
*v = Vec4f(rs.Viewports[0].width, rs.Viewports[0].height, 0.0f, 0.0f);
|
||||
drv.glUnmapBuffer(eGL_COPY_WRITE_BUFFER);
|
||||
|
||||
rdcarray<uint32_t> events = passEvents;
|
||||
|
||||
@@ -3327,7 +3327,7 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
|
||||
Vec4f *ubo = (Vec4f *)m_Overlay.m_TriSizeUBO.Map(&viewOffs);
|
||||
if(!ubo)
|
||||
return ResourceId();
|
||||
*ubo = Vec4f(state.views[0].width, state.views[0].height);
|
||||
*ubo = Vec4f(state.views[0].width, state.views[0].height, 0.0f, 0.0f);
|
||||
m_Overlay.m_TriSizeUBO.Unmap();
|
||||
|
||||
uint32_t offsets[2] = {meshOffs, viewOffs};
|
||||
|
||||
+14
-7
@@ -34,11 +34,12 @@
|
||||
|
||||
struct Vec2f
|
||||
{
|
||||
Vec2f(float X = 0.0f, float Y = 0.0f)
|
||||
Vec2f(float X, float Y)
|
||||
{
|
||||
x = X;
|
||||
y = Y;
|
||||
}
|
||||
Vec2f() { x = y = 0.0f; }
|
||||
|
||||
union
|
||||
{
|
||||
@@ -53,7 +54,8 @@ struct Vec2f
|
||||
class Vec3f
|
||||
{
|
||||
public:
|
||||
Vec3f(const float X = 0.0f, const float Y = 0.0f, const float Z = 0.0f) : x(X), y(Y), z(Z) {}
|
||||
Vec3f(const float X, const float Y, const float Z) : x(X), y(Y), z(Z) {}
|
||||
Vec3f() { x = y = z = 0.0f; }
|
||||
inline float Dot(const Vec3f &o) const { return x * o.x + y * o.y + z * o.z; }
|
||||
inline Vec3f Cross(const Vec3f &o) const
|
||||
{
|
||||
@@ -83,13 +85,14 @@ struct FloatVector;
|
||||
|
||||
struct Vec4f
|
||||
{
|
||||
Vec4f(float X = 0.0f, float Y = 0.0f, float Z = 0.0f, float W = 0.0f)
|
||||
Vec4f(float X, float Y, float Z, float W)
|
||||
{
|
||||
x = X;
|
||||
y = Y;
|
||||
z = Z;
|
||||
w = W;
|
||||
}
|
||||
Vec4f() { x = y = z = w = 0.0f; }
|
||||
Vec4f(const FloatVector &v);
|
||||
operator Vec3f() const { return Vec3f(x, y, z); }
|
||||
operator FloatVector() const;
|
||||
@@ -169,11 +172,12 @@ inline Vec4f operator+=(Vec4f &a, const Vec4f &b)
|
||||
|
||||
struct Vec2u
|
||||
{
|
||||
Vec2u(uint32_t X = 0, uint32_t Y = 0)
|
||||
Vec2u(uint32_t X, uint32_t Y)
|
||||
{
|
||||
x = X;
|
||||
y = Y;
|
||||
}
|
||||
Vec2u() { x = y = 0; }
|
||||
union
|
||||
{
|
||||
struct
|
||||
@@ -186,13 +190,14 @@ struct Vec2u
|
||||
|
||||
struct Vec4u
|
||||
{
|
||||
Vec4u(uint32_t X = 0, uint32_t Y = 0, uint32_t Z = 0, uint32_t W = 0)
|
||||
Vec4u(uint32_t X, uint32_t Y, uint32_t Z, uint32_t W)
|
||||
{
|
||||
x = X;
|
||||
y = Y;
|
||||
z = Z;
|
||||
w = W;
|
||||
}
|
||||
Vec4u() { x = y = z = w = 0; }
|
||||
union
|
||||
{
|
||||
struct
|
||||
@@ -205,12 +210,13 @@ struct Vec4u
|
||||
|
||||
struct Vec3u
|
||||
{
|
||||
Vec3u(uint32_t X = 0, uint32_t Y = 0, uint32_t Z = 0)
|
||||
Vec3u(uint32_t X, uint32_t Y, uint32_t Z)
|
||||
{
|
||||
x = X;
|
||||
y = Y;
|
||||
z = Z;
|
||||
}
|
||||
Vec3u() { x = y = z = 0; }
|
||||
union
|
||||
{
|
||||
struct
|
||||
@@ -223,13 +229,14 @@ struct Vec3u
|
||||
|
||||
struct Vec4i
|
||||
{
|
||||
Vec4i(int32_t X = 0, int32_t Y = 0, int32_t Z = 0, int32_t W = 0)
|
||||
Vec4i(int32_t X, int32_t Y, int32_t Z, int32_t W)
|
||||
{
|
||||
x = X;
|
||||
y = Y;
|
||||
z = Z;
|
||||
w = W;
|
||||
}
|
||||
Vec4i() { x = y = z = w = 0; }
|
||||
union
|
||||
{
|
||||
struct
|
||||
|
||||
@@ -1144,7 +1144,7 @@ ResultDetails ReplayController::SaveTexture(const TextureSave &saveData, const r
|
||||
|
||||
if(sd.alpha != AlphaMapping::Discard)
|
||||
{
|
||||
Vec4f col = Vec4f(sd.alphaCol.x, sd.alphaCol.y, sd.alphaCol.z);
|
||||
Vec4f col = Vec4f(sd.alphaCol.x, sd.alphaCol.y, sd.alphaCol.z, 0.0f);
|
||||
if(sd.alpha == AlphaMapping::BlendToCheckerboard)
|
||||
{
|
||||
bool lightSquare = ((x / 64) % 2) == ((y / 64) % 2);
|
||||
|
||||
Reference in New Issue
Block a user