Fix clang/GCC warnings
This commit is contained in:
parent
f30dffa75f
commit
98c90d4faa
|
@ -164,7 +164,6 @@ namespace {
|
||||||
|
|
||||||
const auto& iMaterial = scene.materials.at(iMaterialID);
|
const auto& iMaterial = scene.materials.at(iMaterialID);
|
||||||
const auto& iTechnique = scene.techniques.at(iMaterial.technique);
|
const auto& iTechnique = scene.techniques.at(iMaterial.technique);
|
||||||
const auto& iProgram = scene.programs.at(iTechnique.program);
|
|
||||||
|
|
||||||
auto oVSModule = utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, R"(
|
auto oVSModule = utils::CreateShaderModule(device, nxt::ShaderStage::Vertex, R"(
|
||||||
#version 450
|
#version 450
|
||||||
|
@ -504,7 +503,6 @@ namespace {
|
||||||
uint32_t vertexCount = 0;
|
uint32_t vertexCount = 0;
|
||||||
for (const auto& s : slotSemantics) {
|
for (const auto& s : slotSemantics) {
|
||||||
uint32_t slot = s.first;
|
uint32_t slot = s.first;
|
||||||
const auto& iSemantic = s.second;
|
|
||||||
auto it = iPrim.attributes.find(s.second);
|
auto it = iPrim.attributes.find(s.second);
|
||||||
if (it == iPrim.attributes.end()) {
|
if (it == iPrim.attributes.end()) {
|
||||||
uint32_t zero = 0;
|
uint32_t zero = 0;
|
||||||
|
@ -589,11 +587,11 @@ namespace {
|
||||||
namespace {
|
namespace {
|
||||||
bool buttons[GLFW_MOUSE_BUTTON_LAST + 1] = {0};
|
bool buttons[GLFW_MOUSE_BUTTON_LAST + 1] = {0};
|
||||||
|
|
||||||
void mouseButtonCallback(GLFWwindow *window, int button, int action, int mods) {
|
void mouseButtonCallback(GLFWwindow*, int button, int action, int) {
|
||||||
buttons[button] = (action == GLFW_PRESS);
|
buttons[button] = (action == GLFW_PRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cursorPosCallback(GLFWwindow *window, double mouseX, double mouseY) {
|
void cursorPosCallback(GLFWwindow*, double mouseX, double mouseY) {
|
||||||
static float oldX, oldY;
|
static float oldX, oldY;
|
||||||
float dX = mouseX - oldX;
|
float dX = mouseX - oldX;
|
||||||
float dY = mouseY - oldY;
|
float dY = mouseY - oldY;
|
||||||
|
@ -609,7 +607,7 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void scrollCallback(GLFWwindow *window, double xoffset, double yoffset) {
|
void scrollCallback(GLFWwindow*, double, double yoffset) {
|
||||||
camera.zoom(yoffset * 0.04);
|
camera.zoom(yoffset * 0.04);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,10 +373,10 @@ namespace wire {
|
||||||
ClientBufferUnmap(buffer);
|
ClientBufferUnmap(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientDeviceReference(Device* self) {
|
void ClientDeviceReference(Device*) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientDeviceRelease(Device* self) {
|
void ClientDeviceRelease(Device*) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientDeviceSetErrorCallback(Device* self, nxtDeviceErrorCallback callback, nxtCallbackUserdata userdata) {
|
void ClientDeviceSetErrorCallback(Device* self, nxtDeviceErrorCallback callback, nxtCallbackUserdata userdata) {
|
||||||
|
|
|
@ -69,7 +69,7 @@ namespace backend {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ComputeTextureCopyBufferSize(CommandBufferBuilder* builder, const TextureCopyLocation& location, uint32_t* bufferSize) {
|
bool ComputeTextureCopyBufferSize(CommandBufferBuilder*, const TextureCopyLocation& location, uint32_t* bufferSize) {
|
||||||
// TODO(cwallez@chromium.org): check for overflows
|
// TODO(cwallez@chromium.org): check for overflows
|
||||||
uint32_t pixelSize = TextureFormatPixelSize(location.texture->GetFormat());
|
uint32_t pixelSize = TextureFormatPixelSize(location.texture->GetFormat());
|
||||||
*bufferSize = location.width * location.height * location.depth * pixelSize;
|
*bufferSize = location.width * location.height * location.depth * pixelSize;
|
||||||
|
@ -503,7 +503,7 @@ namespace backend {
|
||||||
|
|
||||||
case Command::SetStencilReference:
|
case Command::SetStencilReference:
|
||||||
{
|
{
|
||||||
SetStencilReferenceCmd* cmd = iterator.NextCommand<SetStencilReferenceCmd>();
|
iterator.NextCommand<SetStencilReferenceCmd>();
|
||||||
if (!state->HaveRenderPass()) {
|
if (!state->HaveRenderPass()) {
|
||||||
HandleError("Can't set stencil reference without an active render pass");
|
HandleError("Can't set stencil reference without an active render pass");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -97,6 +97,10 @@ namespace backend {
|
||||||
return renderPass.Get();
|
return renderPass.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t PipelineBase::GetSubPass() {
|
||||||
|
return subpass;
|
||||||
|
}
|
||||||
|
|
||||||
InputStateBase* PipelineBase::GetInputState() {
|
InputStateBase* PipelineBase::GetInputState() {
|
||||||
return inputState.Get();
|
return inputState.Get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ namespace backend {
|
||||||
|
|
||||||
PipelineLayoutBase* GetLayout();
|
PipelineLayoutBase* GetLayout();
|
||||||
RenderPassBase* GetRenderPass();
|
RenderPassBase* GetRenderPass();
|
||||||
|
uint32_t GetSubPass();
|
||||||
InputStateBase* GetInputState();
|
InputStateBase* GetInputState();
|
||||||
DepthStencilStateBase* GetDepthStencilState();
|
DepthStencilStateBase* GetDepthStencilState();
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace backend {
|
||||||
|
|
||||||
// SamplerBase
|
// SamplerBase
|
||||||
|
|
||||||
SamplerBase::SamplerBase(SamplerBuilder* builder) {
|
SamplerBase::SamplerBase(SamplerBuilder*) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SamplerBuilder
|
// SamplerBuilder
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace metal {
|
||||||
uploader->BufferSubData(mtlBuffer, start * sizeof(uint32_t), count * sizeof(uint32_t), data);
|
uploader->BufferSubData(mtlBuffer, start * sizeof(uint32_t), count * sizeof(uint32_t), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::MapReadAsyncImpl(uint32_t serial, uint32_t start, uint32_t count) {
|
void Buffer::MapReadAsyncImpl(uint32_t serial, uint32_t start, uint32_t) {
|
||||||
MapReadRequestTracker* tracker = ToBackend(GetDevice())->GetMapReadTracker();
|
MapReadRequestTracker* tracker = ToBackend(GetDevice())->GetMapReadTracker();
|
||||||
tracker->Track(this, serial, start);
|
tracker->Track(this, serial, start);
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ namespace metal {
|
||||||
// Nothing to do, Metal StorageModeShared buffers are always mapped.
|
// Nothing to do, Metal StorageModeShared buffers are always mapped.
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::TransitionUsageImpl(nxt::BufferUsageBit currentUsage, nxt::BufferUsageBit targetUsage) {
|
void Buffer::TransitionUsageImpl(nxt::BufferUsageBit, nxt::BufferUsageBit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferView::BufferView(BufferViewBuilder* builder)
|
BufferView::BufferView(BufferViewBuilder* builder)
|
||||||
|
|
|
@ -215,7 +215,7 @@ namespace metal {
|
||||||
// so this-> works as expected. However it is unclear how members are captured, (are they
|
// so this-> works as expected. However it is unclear how members are captured, (are they
|
||||||
// captured using this-> or by value?) so we make a copy of the pendingCommandSerial on the stack.
|
// captured using this-> or by value?) so we make a copy of the pendingCommandSerial on the stack.
|
||||||
Serial pendingSerial = pendingCommandSerial;
|
Serial pendingSerial = pendingCommandSerial;
|
||||||
[pendingCommands addCompletedHandler:^(id<MTLCommandBuffer> commandBuffer) {
|
[pendingCommands addCompletedHandler:^(id<MTLCommandBuffer>) {
|
||||||
this->finishedCommandSerial = pendingSerial;
|
this->finishedCommandSerial = pendingSerial;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace metal {
|
||||||
return mtlTexture;
|
return mtlTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Texture::TransitionUsageImpl(nxt::TextureUsageBit currentUsage, nxt::TextureUsageBit targetUsage) {
|
void Texture::TransitionUsageImpl(nxt::TextureUsageBit, nxt::TextureUsageBit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureView::TextureView(TextureViewBuilder* builder)
|
TextureView::TextureView(TextureViewBuilder* builder)
|
||||||
|
|
|
@ -148,7 +148,7 @@ namespace null {
|
||||||
void Buffer::UnmapImpl() {
|
void Buffer::UnmapImpl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::TransitionUsageImpl(nxt::BufferUsageBit currentUsage, nxt::BufferUsageBit targetUsage) {
|
void Buffer::TransitionUsageImpl(nxt::BufferUsageBit, nxt::BufferUsageBit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CommandBuffer
|
// CommandBuffer
|
||||||
|
@ -216,7 +216,7 @@ namespace null {
|
||||||
Texture::~Texture() {
|
Texture::~Texture() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Texture::TransitionUsageImpl(nxt::TextureUsageBit currentUsage, nxt::TextureUsageBit targetUsage) {
|
void Texture::TransitionUsageImpl(nxt::TextureUsageBit, nxt::TextureUsageBit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ namespace opengl {
|
||||||
|
|
||||||
case Command::CopyTextureToBuffer:
|
case Command::CopyTextureToBuffer:
|
||||||
{
|
{
|
||||||
CopyTextureToBufferCmd* copy = commands.NextCommand<CopyTextureToBufferCmd>();
|
commands.NextCommand<CopyTextureToBufferCmd>();
|
||||||
// TODO(cwallez@chromium.org): implement using a temporary FBO and ReadPixels
|
// TODO(cwallez@chromium.org): implement using a temporary FBO and ReadPixels
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -130,7 +130,7 @@ namespace opengl {
|
||||||
glBufferSubData(GL_ARRAY_BUFFER, start * sizeof(uint32_t), count * sizeof(uint32_t), data);
|
glBufferSubData(GL_ARRAY_BUFFER, start * sizeof(uint32_t), count * sizeof(uint32_t), data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::MapReadAsyncImpl(uint32_t serial, uint32_t start, uint32_t count) {
|
void Buffer::MapReadAsyncImpl(uint32_t, uint32_t, uint32_t) {
|
||||||
// TODO(cwallez@chromium.org): Implement Map Read for the GL backend
|
// TODO(cwallez@chromium.org): Implement Map Read for the GL backend
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ namespace opengl {
|
||||||
// TODO(cwallez@chromium.org): Implement Map Read for the GL backend
|
// TODO(cwallez@chromium.org): Implement Map Read for the GL backend
|
||||||
}
|
}
|
||||||
|
|
||||||
void Buffer::TransitionUsageImpl(nxt::BufferUsageBit currentUsage, nxt::BufferUsageBit targetUsage) {
|
void Buffer::TransitionUsageImpl(nxt::BufferUsageBit, nxt::BufferUsageBit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// BufferView
|
// BufferView
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace opengl {
|
||||||
return GetGLFormatInfo(GetFormat());
|
return GetGLFormatInfo(GetFormat());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Texture::TransitionUsageImpl(nxt::TextureUsageBit currentUsage, nxt::TextureUsageBit targetUsage) {
|
void Texture::TransitionUsageImpl(nxt::TextureUsageBit, nxt::TextureUsageBit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TextureView
|
// TextureView
|
||||||
|
|
|
@ -280,6 +280,10 @@ namespace detail {
|
||||||
return type == MetalBackend;
|
return type == MetalBackend;
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
return type == D3D12Backend;
|
return type == D3D12Backend;
|
||||||
|
#elif __linux__
|
||||||
|
// Temporarily silence a warning while Linux doesn't have a backend that can be tested.
|
||||||
|
(void) type;
|
||||||
|
return false;
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -179,7 +179,7 @@ class InputStateTest : public NXTTest {
|
||||||
uint32_t location;
|
uint32_t location;
|
||||||
nxt::Buffer* buffer;
|
nxt::Buffer* buffer;
|
||||||
};
|
};
|
||||||
void DoTestDraw(const nxt::Pipeline& pipeline, int triangles, int instances, std::vector<DrawVertexBuffer> vertexBuffers) {
|
void DoTestDraw(const nxt::Pipeline& pipeline, unsigned int triangles, unsigned int instances, std::vector<DrawVertexBuffer> vertexBuffers) {
|
||||||
EXPECT_LE(triangles, 4);
|
EXPECT_LE(triangles, 4);
|
||||||
EXPECT_LE(instances, 4);
|
EXPECT_LE(instances, 4);
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ TEST_F(BitSetIteratorTest, EmptySet) {
|
||||||
// causing an unreachable code warning in MSVS
|
// causing an unreachable code warning in MSVS
|
||||||
bool sawBit = false;
|
bool sawBit = false;
|
||||||
for (unsigned long bit : IterateBitSet(mStateBits)) {
|
for (unsigned long bit : IterateBitSet(mStateBits)) {
|
||||||
|
(void) bit;
|
||||||
sawBit = true;
|
sawBit = true;
|
||||||
}
|
}
|
||||||
EXPECT_FALSE(sawBit);
|
EXPECT_FALSE(sawBit);
|
||||||
|
|
|
@ -27,6 +27,7 @@ TEST(SerialQueue, BasicTest) {
|
||||||
|
|
||||||
// Iterating on empty queue 1) works 2) doesn't produce any values
|
// Iterating on empty queue 1) works 2) doesn't produce any values
|
||||||
for (int value : queue.IterateAll()) {
|
for (int value : queue.IterateAll()) {
|
||||||
|
(void) value;
|
||||||
ASSERT_TRUE(false);
|
ASSERT_TRUE(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ TEST(SerialQueue, BasicTest) {
|
||||||
ASSERT_TRUE(queue.Empty());
|
ASSERT_TRUE(queue.Empty());
|
||||||
|
|
||||||
for (int value : queue.IterateAll()) {
|
for (int value : queue.IterateAll()) {
|
||||||
|
(void) value;
|
||||||
ASSERT_TRUE(false);
|
ASSERT_TRUE(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,7 +128,7 @@ class WireTests : public WireTestsBase {
|
||||||
|
|
||||||
// One call gets forwarded correctly.
|
// One call gets forwarded correctly.
|
||||||
TEST_F(WireTests, CallForwarded) {
|
TEST_F(WireTests, CallForwarded) {
|
||||||
nxtCommandBufferBuilder builder = nxtDeviceCreateCommandBufferBuilder(device);
|
nxtDeviceCreateCommandBufferBuilder(device);
|
||||||
|
|
||||||
nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder();
|
nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder();
|
||||||
EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice))
|
EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice))
|
||||||
|
@ -140,7 +140,7 @@ TEST_F(WireTests, CallForwarded) {
|
||||||
// Test that calling methods on a new object works as expected.
|
// Test that calling methods on a new object works as expected.
|
||||||
TEST_F(WireTests, CreateThenCall) {
|
TEST_F(WireTests, CreateThenCall) {
|
||||||
nxtCommandBufferBuilder builder = nxtDeviceCreateCommandBufferBuilder(device);
|
nxtCommandBufferBuilder builder = nxtDeviceCreateCommandBufferBuilder(device);
|
||||||
nxtCommandBuffer cmdBuf = nxtCommandBufferBuilderGetResult(builder);
|
nxtCommandBufferBuilderGetResult(builder);
|
||||||
|
|
||||||
nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder();
|
nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder();
|
||||||
EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice))
|
EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice))
|
||||||
|
@ -350,7 +350,7 @@ TEST_F(WireTests, CallsSkippedAfterBuilderError) {
|
||||||
// These calls will be skipped because of the error
|
// These calls will be skipped because of the error
|
||||||
nxtBufferTransitionUsage(buffer, NXT_BUFFER_USAGE_BIT_UNIFORM);
|
nxtBufferTransitionUsage(buffer, NXT_BUFFER_USAGE_BIT_UNIFORM);
|
||||||
nxtCommandBufferBuilderTransitionBufferUsage(cmdBufBuilder, buffer, NXT_BUFFER_USAGE_BIT_UNIFORM);
|
nxtCommandBufferBuilderTransitionBufferUsage(cmdBufBuilder, buffer, NXT_BUFFER_USAGE_BIT_UNIFORM);
|
||||||
nxtCommandBuffer cmdBuf = nxtCommandBufferBuilderGetResult(cmdBufBuilder);
|
nxtCommandBufferBuilderGetResult(cmdBufBuilder);
|
||||||
|
|
||||||
nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder();
|
nxtCommandBufferBuilder apiCmdBufBuilder = api.GetNewCommandBufferBuilder();
|
||||||
EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice))
|
EXPECT_CALL(api, DeviceCreateCommandBufferBuilder(apiDevice))
|
||||||
|
@ -383,7 +383,7 @@ TEST_F(WireTests, CallsSkippedAfterBuilderError) {
|
||||||
TEST_F(WireTests, SuccessCallbackOnBuilderSuccess) {
|
TEST_F(WireTests, SuccessCallbackOnBuilderSuccess) {
|
||||||
nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device);
|
nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device);
|
||||||
nxtBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 1, 2);
|
nxtBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 1, 2);
|
||||||
nxtBuffer buffer = nxtBufferBuilderGetResult(bufferBuilder);
|
nxtBufferBuilderGetResult(bufferBuilder);
|
||||||
|
|
||||||
nxtBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder();
|
nxtBufferBuilder apiBufferBuilder = api.GetNewBufferBuilder();
|
||||||
EXPECT_CALL(api, DeviceCreateBufferBuilder(apiDevice))
|
EXPECT_CALL(api, DeviceCreateBufferBuilder(apiDevice))
|
||||||
|
@ -420,7 +420,7 @@ TEST_F(WireTests, UnknownBuilderErrorStatusCallback) {
|
||||||
{
|
{
|
||||||
nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device);
|
nxtBufferBuilder bufferBuilder = nxtDeviceCreateBufferBuilder(device);
|
||||||
nxtBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 3, 4);
|
nxtBufferBuilderSetErrorCallback(bufferBuilder, ToMockBuilderErrorCallback, 3, 4);
|
||||||
nxtBuffer buffer = nxtBufferBuilderGetResult(bufferBuilder);
|
nxtBufferBuilderGetResult(bufferBuilder);
|
||||||
|
|
||||||
EXPECT_CALL(*mockBuilderErrorCallback, Call(NXT_BUILDER_ERROR_STATUS_UNKNOWN, _ , 3, 4)).Times(0);
|
EXPECT_CALL(*mockBuilderErrorCallback, Call(NXT_BUILDER_ERROR_STATUS_UNKNOWN, _ , 3, 4)).Times(0);
|
||||||
|
|
||||||
|
@ -485,7 +485,7 @@ TEST_F(WireSetCallbackTests, BuilderErrorCallback) {
|
||||||
FlushClient();
|
FlushClient();
|
||||||
|
|
||||||
// Create an object so that it is a valid case to call the error callback
|
// Create an object so that it is a valid case to call the error callback
|
||||||
nxtBuffer buffer = nxtBufferBuilderGetResult(bufferBuilder);
|
nxtBufferBuilderGetResult(bufferBuilder);
|
||||||
|
|
||||||
nxtBuffer apiBuffer = api.GetNewBuffer();
|
nxtBuffer apiBuffer = api.GetNewBuffer();
|
||||||
EXPECT_CALL(api, BufferBuilderGetResult(apiBufferBuilder))
|
EXPECT_CALL(api, BufferBuilderGetResult(apiBufferBuilder))
|
||||||
|
|
Loading…
Reference in New Issue