Commit 00424c1b by Ben Clayton

Reintroduce "VkDebug: Update macros to address issues in b/127433389"

36411219 had preprocessor issues on Windows. This should now work on all platforms. I had to change UNIMPLEMENTED() and UNREACHABLE() to always take a format parameter to make this work on MSVC. This doesn't seem like a terrible thing though - especially if we can incorporate the frequency of hit UNIMPLEMENTED()'s to steer our focus. Change-Id: Idc58dbe6caa3fb51e085c3b236904c640091deec Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/27468 Presubmit-Ready: Ben Clayton <bclayton@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent c2bb50b7
...@@ -161,7 +161,7 @@ namespace sw ...@@ -161,7 +161,7 @@ namespace sw
return false; return false;
} }
VkImageSubresourceLayers subresLayers = VkImageSubresourceLayers subresLayers =
{ {
subresourceRange.aspectMask, subresourceRange.aspectMask,
subresourceRange.baseMipLevel, subresourceRange.baseMipLevel,
...@@ -341,14 +341,14 @@ namespace sw ...@@ -341,14 +341,14 @@ namespace sw
case VK_FORMAT_R32_SFLOAT: case VK_FORMAT_R32_SFLOAT:
c.x = *Pointer<Float>(element); c.x = *Pointer<Float>(element);
break; break;
case VK_FORMAT_R16G16B16A16_SFLOAT: case VK_FORMAT_R16G16B16A16_SFLOAT:
c.w = Float(*Pointer<Half>(element + 6)); c.w = Float(*Pointer<Half>(element + 6));
case VK_FORMAT_R16G16B16_SFLOAT: case VK_FORMAT_R16G16B16_SFLOAT:
c.z = Float(*Pointer<Half>(element + 4)); c.z = Float(*Pointer<Half>(element + 4));
case VK_FORMAT_R16G16_SFLOAT: case VK_FORMAT_R16G16_SFLOAT:
c.y = Float(*Pointer<Half>(element + 2)); c.y = Float(*Pointer<Half>(element + 2));
case VK_FORMAT_R16_SFLOAT: case VK_FORMAT_R16_SFLOAT:
c.x = Float(*Pointer<Half>(element)); c.x = Float(*Pointer<Half>(element));
break; break;
case VK_FORMAT_B10G11R11_UFLOAT_PACK32: case VK_FORMAT_B10G11R11_UFLOAT_PACK32:
// 10 (or 11) bit float formats are unsigned formats with a 5 bit exponent and a 5 (or 6) bit mantissa. // 10 (or 11) bit float formats are unsigned formats with a 5 bit exponent and a 5 (or 6) bit mantissa.
...@@ -367,8 +367,8 @@ namespace sw ...@@ -367,8 +367,8 @@ namespace sw
break; break;
case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
// This type contains a common 5 bit exponent (E) and a 9 bit the mantissa for R, G and B. // This type contains a common 5 bit exponent (E) and a 9 bit the mantissa for R, G and B.
c.x = Float(*Pointer<UInt>(element) & UInt(0x000001FF)); // R's mantissa (bits 0-8) c.x = Float(*Pointer<UInt>(element) & UInt(0x000001FF)); // R's mantissa (bits 0-8)
c.y = Float((*Pointer<UInt>(element) & UInt(0x0003FE00)) >> 9); // G's mantissa (bits 9-17) c.y = Float((*Pointer<UInt>(element) & UInt(0x0003FE00)) >> 9); // G's mantissa (bits 9-17)
c.z = Float((*Pointer<UInt>(element) & UInt(0x07FC0000)) >> 18); // B's mantissa (bits 18-26) c.z = Float((*Pointer<UInt>(element) & UInt(0x07FC0000)) >> 18); // B's mantissa (bits 18-26)
c *= Float4( c *= Float4(
// 2^E, using the exponent (bits 27-31) and treating it as an unsigned integer value // 2^E, using the exponent (bits 27-31) and treating it as an unsigned integer value
...@@ -467,10 +467,10 @@ namespace sw ...@@ -467,10 +467,10 @@ namespace sw
case VK_FORMAT_B4G4R4A4_UNORM_PACK16: case VK_FORMAT_B4G4R4A4_UNORM_PACK16:
if(writeRGBA) if(writeRGBA)
{ {
*Pointer<UShort>(element) = UShort(RoundInt(Float(c.w)) & Int(0xF)) | *Pointer<UShort>(element) = UShort(RoundInt(Float(c.w)) & Int(0xF)) |
UShort((RoundInt(Float(c.x)) & Int(0xF)) << 4) | UShort((RoundInt(Float(c.x)) & Int(0xF)) << 4) |
UShort((RoundInt(Float(c.y)) & Int(0xF)) << 8) | UShort((RoundInt(Float(c.y)) & Int(0xF)) << 8) |
UShort((RoundInt(Float(c.z)) & Int(0xF)) << 12); UShort((RoundInt(Float(c.z)) & Int(0xF)) << 12);
} }
else else
{ {
...@@ -480,9 +480,9 @@ namespace sw ...@@ -480,9 +480,9 @@ namespace sw
(writeB ? 0xF000 : 0x0000); (writeB ? 0xF000 : 0x0000);
unsigned short unmask = ~mask; unsigned short unmask = ~mask;
*Pointer<UShort>(element) = (*Pointer<UShort>(element) & UShort(unmask)) | *Pointer<UShort>(element) = (*Pointer<UShort>(element) & UShort(unmask)) |
((UShort(RoundInt(Float(c.w)) & Int(0xF)) | ((UShort(RoundInt(Float(c.w)) & Int(0xF)) |
UShort((RoundInt(Float(c.x)) & Int(0xF)) << 4) | UShort((RoundInt(Float(c.x)) & Int(0xF)) << 4) |
UShort((RoundInt(Float(c.y)) & Int(0xF)) << 8) | UShort((RoundInt(Float(c.y)) & Int(0xF)) << 8) |
UShort((RoundInt(Float(c.z)) & Int(0xF)) << 12)) & UShort(mask)); UShort((RoundInt(Float(c.z)) & Int(0xF)) << 12)) & UShort(mask));
} }
break; break;
...@@ -565,14 +565,14 @@ namespace sw ...@@ -565,14 +565,14 @@ namespace sw
case VK_FORMAT_R32_SFLOAT: case VK_FORMAT_R32_SFLOAT:
if(writeR) { *Pointer<Float>(element) = c.x; } if(writeR) { *Pointer<Float>(element) = c.x; }
break; break;
case VK_FORMAT_R16G16B16A16_SFLOAT: case VK_FORMAT_R16G16B16A16_SFLOAT:
if(writeA) { *Pointer<Half>(element + 6) = Half(c.w); } if(writeA) { *Pointer<Half>(element + 6) = Half(c.w); }
case VK_FORMAT_R16G16B16_SFLOAT: case VK_FORMAT_R16G16B16_SFLOAT:
if(writeB) { *Pointer<Half>(element + 4) = Half(c.z); } if(writeB) { *Pointer<Half>(element + 4) = Half(c.z); }
case VK_FORMAT_R16G16_SFLOAT: case VK_FORMAT_R16G16_SFLOAT:
if(writeG) { *Pointer<Half>(element + 2) = Half(c.y); } if(writeG) { *Pointer<Half>(element + 2) = Half(c.y); }
case VK_FORMAT_R16_SFLOAT: case VK_FORMAT_R16_SFLOAT:
if(writeR) { *Pointer<Half>(element) = Half(c.x); } if(writeR) { *Pointer<Half>(element) = Half(c.x); }
break; break;
case VK_FORMAT_B8G8R8A8_SNORM: case VK_FORMAT_B8G8R8A8_SNORM:
if(writeB) { *Pointer<SByte>(element) = SByte(RoundInt(Float(c.z))); } if(writeB) { *Pointer<SByte>(element) = SByte(RoundInt(Float(c.z))); }
...@@ -1496,7 +1496,7 @@ namespace sw ...@@ -1496,7 +1496,7 @@ namespace sw
if(!blitRoutine) if(!blitRoutine)
{ {
criticalSection.unlock(); criticalSection.unlock();
UNIMPLEMENTED(); UNIMPLEMENTED("blitRoutine");
return nullptr; return nullptr;
} }
...@@ -1518,7 +1518,7 @@ namespace sw ...@@ -1518,7 +1518,7 @@ namespace sw
if((region.srcSubresource.layerCount != region.dstSubresource.layerCount) || if((region.srcSubresource.layerCount != region.dstSubresource.layerCount) ||
(region.srcSubresource.aspectMask != region.dstSubresource.aspectMask)) (region.srcSubresource.aspectMask != region.dstSubresource.aspectMask))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("region");
} }
if(region.dstOffsets[0].x > region.dstOffsets[1].x) if(region.dstOffsets[0].x > region.dstOffsets[1].x)
......
...@@ -279,7 +279,7 @@ namespace sw ...@@ -279,7 +279,7 @@ namespace sw
mainBlockId = Block::ID(it.word(1)); mainBlockId = Block::ID(it.word(1));
break; break;
default: default:
ERR("Unexpected opcode '%s' following OpFunction", OpcodeName(it.opcode()).c_str()); WARN("Unexpected opcode '%s' following OpFunction", OpcodeName(it.opcode()).c_str());
} }
} }
ASSERT(mainBlockId.value() != 0); // Function's OpLabel not found ASSERT(mainBlockId.value() != 0); // Function's OpLabel not found
...@@ -424,7 +424,7 @@ namespace sw ...@@ -424,7 +424,7 @@ namespace sw
break; break;
default: default:
UNIMPLEMENTED(OpcodeName(insn.opcode()).c_str()); UNIMPLEMENTED("%s", OpcodeName(insn.opcode()).c_str());
} }
} }
} }
...@@ -1227,7 +1227,7 @@ namespace sw ...@@ -1227,7 +1227,7 @@ namespace sw
break; break;
default: default:
UNIMPLEMENTED(OpcodeName(insn.opcode()).c_str()); UNIMPLEMENTED("opcode: %s", OpcodeName(insn.opcode()).c_str());
break; break;
} }
} }
......
...@@ -392,14 +392,14 @@ namespace sw ...@@ -392,14 +392,14 @@ namespace sw
Type const &getType(Type::ID id) const Type const &getType(Type::ID id) const
{ {
auto it = types.find(id); auto it = types.find(id);
ASSERT(it != types.end()); ASSERT_MSG(it != types.end(), "Unknown type %d", id.value());
return it->second; return it->second;
} }
Object const &getObject(Object::ID id) const Object const &getObject(Object::ID id) const
{ {
auto it = defs.find(id); auto it = defs.find(id);
ASSERT(it != defs.end()); ASSERT_MSG(it != defs.end(), "Unknown object %d", id.value());
return it->second; return it->second;
} }
......
...@@ -601,7 +601,7 @@ VkResult CommandBuffer::begin(VkCommandBufferUsageFlags flags, const VkCommandBu ...@@ -601,7 +601,7 @@ VkResult CommandBuffer::begin(VkCommandBufferUsageFlags flags, const VkCommandBu
if(pInheritanceInfo) if(pInheritanceInfo)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("pInheritanceInfo");
} }
if(state != INITIAL) if(state != INITIAL)
...@@ -646,7 +646,7 @@ void CommandBuffer::beginRenderPass(VkRenderPass renderPass, VkFramebuffer frame ...@@ -646,7 +646,7 @@ void CommandBuffer::beginRenderPass(VkRenderPass renderPass, VkFramebuffer frame
if(contents != VK_SUBPASS_CONTENTS_INLINE) if(contents != VK_SUBPASS_CONTENTS_INLINE)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("VK_SUBPASS_CONTENTS_INLINE");
} }
addCommand<BeginRenderPass>(renderPass, framebuffer, renderArea, clearValueCount, clearValues); addCommand<BeginRenderPass>(renderPass, framebuffer, renderArea, clearValueCount, clearValues);
...@@ -666,18 +666,18 @@ void CommandBuffer::endRenderPass() ...@@ -666,18 +666,18 @@ void CommandBuffer::endRenderPass()
void CommandBuffer::executeCommands(uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers) void CommandBuffer::executeCommands(uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("executeCommands");
} }
void CommandBuffer::setDeviceMask(uint32_t deviceMask) void CommandBuffer::setDeviceMask(uint32_t deviceMask)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("setDeviceMask");
} }
void CommandBuffer::dispatchBase(uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, void CommandBuffer::dispatchBase(uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ,
uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("dispatchBase");
} }
void CommandBuffer::pipelineBarrier(VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, void CommandBuffer::pipelineBarrier(VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask,
...@@ -698,7 +698,7 @@ void CommandBuffer::bindPipeline(VkPipelineBindPoint pipelineBindPoint, VkPipeli ...@@ -698,7 +698,7 @@ void CommandBuffer::bindPipeline(VkPipelineBindPoint pipelineBindPoint, VkPipeli
addCommand<PipelineBind>(pipelineBindPoint, pipeline); addCommand<PipelineBind>(pipelineBindPoint, pipeline);
break; break;
default: default:
UNIMPLEMENTED(); UNIMPLEMENTED("pipelineBindPoint");
} }
} }
...@@ -713,46 +713,46 @@ void CommandBuffer::bindVertexBuffers(uint32_t firstBinding, uint32_t bindingCou ...@@ -713,46 +713,46 @@ void CommandBuffer::bindVertexBuffers(uint32_t firstBinding, uint32_t bindingCou
void CommandBuffer::beginQuery(VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags) void CommandBuffer::beginQuery(VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("beginQuery");
} }
void CommandBuffer::endQuery(VkQueryPool queryPool, uint32_t query) void CommandBuffer::endQuery(VkQueryPool queryPool, uint32_t query)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("endQuery");
} }
void CommandBuffer::resetQueryPool(VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) void CommandBuffer::resetQueryPool(VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("resetQueryPool");
} }
void CommandBuffer::writeTimestamp(VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query) void CommandBuffer::writeTimestamp(VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("writeTimestamp");
} }
void CommandBuffer::copyQueryPoolResults(VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, void CommandBuffer::copyQueryPoolResults(VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount,
VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags) VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("copyQueryPoolResults");
} }
void CommandBuffer::pushConstants(VkPipelineLayout layout, VkShaderStageFlags stageFlags, void CommandBuffer::pushConstants(VkPipelineLayout layout, VkShaderStageFlags stageFlags,
uint32_t offset, uint32_t size, const void* pValues) uint32_t offset, uint32_t size, const void* pValues)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("pushConstants");
} }
void CommandBuffer::setViewport(uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports) void CommandBuffer::setViewport(uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports)
{ {
// Note: The bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_VIEWPORT dynamic state enabled // Note: The bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_VIEWPORT dynamic state enabled
UNIMPLEMENTED(); UNIMPLEMENTED("setViewport");
} }
void CommandBuffer::setScissor(uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors) void CommandBuffer::setScissor(uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors)
{ {
// Note: The bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_SCISSOR dynamic state enabled // Note: The bound graphics pipeline must have been created with the VK_DYNAMIC_STATE_SCISSOR dynamic state enabled
UNIMPLEMENTED(); UNIMPLEMENTED("setScissor");
} }
void CommandBuffer::setLineWidth(float lineWidth) void CommandBuffer::setLineWidth(float lineWidth)
...@@ -762,7 +762,7 @@ void CommandBuffer::setLineWidth(float lineWidth) ...@@ -762,7 +762,7 @@ void CommandBuffer::setLineWidth(float lineWidth)
// If the wide lines feature is not enabled, lineWidth must be 1.0 // If the wide lines feature is not enabled, lineWidth must be 1.0
ASSERT(lineWidth == 1.0f); ASSERT(lineWidth == 1.0f);
UNIMPLEMENTED(); UNIMPLEMENTED("setLineWidth");
} }
void CommandBuffer::setDepthBias(float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) void CommandBuffer::setDepthBias(float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor)
...@@ -772,7 +772,7 @@ void CommandBuffer::setDepthBias(float depthBiasConstantFactor, float depthBiasC ...@@ -772,7 +772,7 @@ void CommandBuffer::setDepthBias(float depthBiasConstantFactor, float depthBiasC
// If the depth bias clamping feature is not enabled, depthBiasClamp must be 0.0 // If the depth bias clamping feature is not enabled, depthBiasClamp must be 0.0
ASSERT(depthBiasClamp == 0.0f); ASSERT(depthBiasClamp == 0.0f);
UNIMPLEMENTED(); UNIMPLEMENTED("setDepthBias");
} }
void CommandBuffer::setBlendConstants(const float blendConstants[4]) void CommandBuffer::setBlendConstants(const float blendConstants[4])
...@@ -782,7 +782,7 @@ void CommandBuffer::setBlendConstants(const float blendConstants[4]) ...@@ -782,7 +782,7 @@ void CommandBuffer::setBlendConstants(const float blendConstants[4])
// blendConstants is an array of four values specifying the R, G, B, and A components // blendConstants is an array of four values specifying the R, G, B, and A components
// of the blend constant color used in blending, depending on the blend factor. // of the blend constant color used in blending, depending on the blend factor.
UNIMPLEMENTED(); UNIMPLEMENTED("setBlendConstants");
} }
void CommandBuffer::setDepthBounds(float minDepthBounds, float maxDepthBounds) void CommandBuffer::setDepthBounds(float minDepthBounds, float maxDepthBounds)
...@@ -793,7 +793,7 @@ void CommandBuffer::setDepthBounds(float minDepthBounds, float maxDepthBounds) ...@@ -793,7 +793,7 @@ void CommandBuffer::setDepthBounds(float minDepthBounds, float maxDepthBounds)
ASSERT(minDepthBounds >= 0.0f && minDepthBounds <= 1.0f); ASSERT(minDepthBounds >= 0.0f && minDepthBounds <= 1.0f);
ASSERT(maxDepthBounds >= 0.0f && maxDepthBounds <= 1.0f); ASSERT(maxDepthBounds >= 0.0f && maxDepthBounds <= 1.0f);
UNIMPLEMENTED(); UNIMPLEMENTED("setDepthBounds");
} }
void CommandBuffer::setStencilCompareMask(VkStencilFaceFlags faceMask, uint32_t compareMask) void CommandBuffer::setStencilCompareMask(VkStencilFaceFlags faceMask, uint32_t compareMask)
...@@ -803,7 +803,7 @@ void CommandBuffer::setStencilCompareMask(VkStencilFaceFlags faceMask, uint32_t ...@@ -803,7 +803,7 @@ void CommandBuffer::setStencilCompareMask(VkStencilFaceFlags faceMask, uint32_t
// faceMask must not be 0 // faceMask must not be 0
ASSERT(faceMask != 0); ASSERT(faceMask != 0);
UNIMPLEMENTED(); UNIMPLEMENTED("setStencilCompareMask");
} }
void CommandBuffer::setStencilWriteMask(VkStencilFaceFlags faceMask, uint32_t writeMask) void CommandBuffer::setStencilWriteMask(VkStencilFaceFlags faceMask, uint32_t writeMask)
...@@ -813,7 +813,7 @@ void CommandBuffer::setStencilWriteMask(VkStencilFaceFlags faceMask, uint32_t wr ...@@ -813,7 +813,7 @@ void CommandBuffer::setStencilWriteMask(VkStencilFaceFlags faceMask, uint32_t wr
// faceMask must not be 0 // faceMask must not be 0
ASSERT(faceMask != 0); ASSERT(faceMask != 0);
UNIMPLEMENTED(); UNIMPLEMENTED("setStencilWriteMask");
} }
void CommandBuffer::setStencilReference(VkStencilFaceFlags faceMask, uint32_t reference) void CommandBuffer::setStencilReference(VkStencilFaceFlags faceMask, uint32_t reference)
...@@ -823,7 +823,7 @@ void CommandBuffer::setStencilReference(VkStencilFaceFlags faceMask, uint32_t re ...@@ -823,7 +823,7 @@ void CommandBuffer::setStencilReference(VkStencilFaceFlags faceMask, uint32_t re
// faceMask must not be 0 // faceMask must not be 0
ASSERT(faceMask != 0); ASSERT(faceMask != 0);
UNIMPLEMENTED(); UNIMPLEMENTED("setStencilReference");
} }
void CommandBuffer::bindDescriptorSets(VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, void CommandBuffer::bindDescriptorSets(VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout,
...@@ -834,7 +834,7 @@ void CommandBuffer::bindDescriptorSets(VkPipelineBindPoint pipelineBindPoint, Vk ...@@ -834,7 +834,7 @@ void CommandBuffer::bindDescriptorSets(VkPipelineBindPoint pipelineBindPoint, Vk
if(dynamicOffsetCount > 0) if(dynamicOffsetCount > 0)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("bindDescriptorSets");
} }
for(uint32_t i = 0; i < descriptorSetCount; i++) for(uint32_t i = 0; i < descriptorSetCount; i++)
...@@ -855,7 +855,7 @@ void CommandBuffer::dispatch(uint32_t groupCountX, uint32_t groupCountY, uint32_ ...@@ -855,7 +855,7 @@ void CommandBuffer::dispatch(uint32_t groupCountX, uint32_t groupCountY, uint32_
void CommandBuffer::dispatchIndirect(VkBuffer buffer, VkDeviceSize offset) void CommandBuffer::dispatchIndirect(VkBuffer buffer, VkDeviceSize offset)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("dispatchIndirect");
} }
void CommandBuffer::copyBuffer(VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions) void CommandBuffer::copyBuffer(VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions)
...@@ -974,7 +974,7 @@ void CommandBuffer::clearAttachments(uint32_t attachmentCount, const VkClearAtta ...@@ -974,7 +974,7 @@ void CommandBuffer::clearAttachments(uint32_t attachmentCount, const VkClearAtta
void CommandBuffer::resolveImage(VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, void CommandBuffer::resolveImage(VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout,
uint32_t regionCount, const VkImageResolve* pRegions) uint32_t regionCount, const VkImageResolve* pRegions)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("resolveImage");
} }
void CommandBuffer::setEvent(VkEvent event, VkPipelineStageFlags stageMask) void CommandBuffer::setEvent(VkEvent event, VkPipelineStageFlags stageMask)
...@@ -996,7 +996,7 @@ void CommandBuffer::waitEvents(uint32_t eventCount, const VkEvent* pEvents, VkPi ...@@ -996,7 +996,7 @@ void CommandBuffer::waitEvents(uint32_t eventCount, const VkEvent* pEvents, VkPi
uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers,
uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers) uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("waitEvents");
} }
void CommandBuffer::draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) void CommandBuffer::draw(uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance)
...@@ -1011,12 +1011,12 @@ void CommandBuffer::drawIndexed(uint32_t indexCount, uint32_t instanceCount, uin ...@@ -1011,12 +1011,12 @@ void CommandBuffer::drawIndexed(uint32_t indexCount, uint32_t instanceCount, uin
void CommandBuffer::drawIndirect(VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) void CommandBuffer::drawIndirect(VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("drawIndirect");
} }
void CommandBuffer::drawIndexedIndirect(VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) void CommandBuffer::drawIndexedIndirect(VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("drawIndexedIndirect");
} }
void CommandBuffer::submit(CommandBuffer::ExecutionState& executionState) void CommandBuffer::submit(CommandBuffer::ExecutionState& executionState)
......
...@@ -14,25 +14,61 @@ ...@@ -14,25 +14,61 @@
#include "VkDebug.hpp" #include "VkDebug.hpp"
#include <string>
#include <stdarg.h> #include <stdarg.h>
namespace vk namespace vk
{ {
void trace(const char *format, ...)
void tracev(const char *format, va_list args)
{ {
#ifndef SWIFTSHADER_DISABLE_TRACE
if(false) if(false)
{ {
FILE *file = fopen("debug.txt", "a"); FILE *file = fopen(TRACE_OUTPUT_FILE, "a");
if(file) if(file)
{ {
va_list vararg; vfprintf(file, format, args);
va_start(vararg, format);
vfprintf(file, format, vararg);
va_end(vararg);
fclose(file); fclose(file);
} }
} }
#endif
}
void trace(const char *format, ...)
{
va_list vararg;
va_start(vararg, format);
tracev(format, vararg);
va_end(vararg);
}
void warn(const char *format, ...)
{
va_list vararg;
va_start(vararg, format);
tracev(format, vararg);
va_end(vararg);
va_start(vararg, format);
vfprintf(stderr, format, vararg);
va_end(vararg);
} }
void abort(const char *format, ...)
{
va_list vararg;
va_start(vararg, format);
tracev(format, vararg);
va_end(vararg);
va_start(vararg, format);
vfprintf(stderr, format, vararg);
va_end(vararg);
::abort();
}
} }
...@@ -27,77 +27,85 @@ ...@@ -27,77 +27,85 @@
namespace vk namespace vk
{ {
// Outputs text to the debugging log // Outputs text to the debugging log
void trace(const char *format, ...); void trace(const char *format, ...);
inline void trace() {} inline void trace() {}
// Outputs text to the debugging log and prints to stderr.
void warn(const char *format, ...);
inline void warn() {}
// Outputs the message to the debugging log and stderr, and calls abort().
void abort(const char *format, ...);
} }
// A macro to output a trace of a function call and its arguments to the debugging log // A macro to output a trace of a function call and its arguments to the
// debugging log. Disabled if SWIFTSHADER_DISABLE_TRACE is defined.
#if defined(SWIFTSHADER_DISABLE_TRACE) #if defined(SWIFTSHADER_DISABLE_TRACE)
#define TRACE(message, ...) (void(0)) #define TRACE(message, ...) (void(0))
#else #else
#define TRACE(message, ...) vk::trace("trace: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__) #define TRACE(message, ...) vk::trace("%s:%d TRACE: " message "\n", __FILE__, __LINE__, ##__VA_ARGS__)
#endif #endif
// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing. // A macro to print a warning message to the debugging log and stderr to denote
#if defined(SWIFTSHADER_DISABLE_TRACE) // an issue that needs fixing.
#define FIXME(message, ...) (void(0)) #define FIXME(message, ...) vk::warn("%s:%d FIXME: " message "\n", __FILE__, __LINE__, ##__VA_ARGS__);
#else
#define FIXME(message, ...) do {vk::trace("fixme: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); assert(false); abort();} while(false)
#endif
// A macro to output a function call and its arguments to the debugging log, in case of error. // A macro to print a warning message to the debugging log and stderr.
#if defined(SWIFTSHADER_DISABLE_TRACE) #define WARN(message, ...) vk::warn("%s:%d WARNING: " message "\n", __FILE__, __LINE__, ##__VA_ARGS__);
#define ERR(message, ...) (void(0))
// A macro that prints the message to the debugging log and stderr and
// immediately aborts execution of the application.
//
// Note: This will terminate the application regardless of build flags!
// Use with extreme caution!
#undef ABORT
#define ABORT(message, ...) vk::abort("%s:%d ABORT: " message "\n", __FILE__, __LINE__, ##__VA_ARGS__)
// A macro that delegates to:
// ABORT() in debug builds (!NDEBUG || DCHECK_ALWAYS_ON)
// or
// WARN() in release builds (NDEBUG && !DCHECK_ALWAYS_ON)
#undef DABORT
#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
#define DABORT(message, ...) ABORT(message, ##__VA_ARGS__)
#else #else
#define ERR(message, ...) do {vk::trace("err: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); assert(false); abort();} while(false) #define DABORT(message, ...) WARN(message, ##__VA_ARGS__)
#endif #endif
// A macro asserting a condition and outputting failures to the debug log // A macro asserting a condition.
// If the condition fails, the condition and message is passed to DABORT().
#undef ASSERT_MSG
#define ASSERT_MSG(expression, format, ...) do { \
if(!(expression)) { \
DABORT("ASSERT(%s): " format "\n", #expression, ##__VA_ARGS__); \
} } while(0)
// A macro asserting a condition.
// If the condition fails, the condition is passed to DABORT().
#undef ASSERT #undef ASSERT
#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
#define ASSERT(expression) do { \ #define ASSERT(expression) do { \
if(!(expression)) { \ if(!(expression)) { \
ERR("\t! Assert failed in %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \ DABORT("ASSERT(%s)\n", #expression); \
assert(expression); \
abort(); \
} } while(0) } } while(0)
#else
#define ASSERT(expression) (void(0))
#endif
// A macro to indicate unimplemented functionality // A macro to indicate unimplemented functionality.
#undef UNIMPLEMENTED #undef UNIMPLEMENTED
#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) #define UNIMPLEMENTED(format, ...) DABORT("UNIMPLEMENTED: " format, ##__VA_ARGS__)
#define UNIMPLEMENTED(...) do { \
vk::trace("\t! Unimplemented: %s(%d): ", __FUNCTION__, __LINE__); \
vk::trace(__VA_ARGS__); \
vk::trace("\n"); \
assert(false); \
abort(); \
} while(0)
#else
#define UNIMPLEMENTED(...) FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__)
#endif
// A macro for code which is not expected to be reached under valid assumptions // A macro for code which is not expected to be reached under valid assumptions.
#undef UNREACHABLE #undef UNREACHABLE
#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) #define UNREACHABLE(format, ...) DABORT("UNREACHABLE: " format, ##__VA_ARGS__)
#define UNREACHABLE(value) do { \
ERR("\t! Unreachable case reached: %s(%d). %s: %d\n", __FUNCTION__, __LINE__, #value, value); \
assert(false); \
abort(); \
} while(0)
#else
#define UNREACHABLE(value) ERR("\t! Unreachable reached: %s(%d). %s: %d\n", __FUNCTION__, __LINE__, #value, value)
#endif
// A macro asserting a condition and outputting failures to the debug log, or return when in release mode. // A macro asserting a condition and performing a return.
#undef ASSERT_OR_RETURN #undef ASSERT_OR_RETURN
#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
#define ASSERT_OR_RETURN(expression) ASSERT(expression)
#else
#define ASSERT_OR_RETURN(expression) do { \ #define ASSERT_OR_RETURN(expression) do { \
if(!(expression)) { \ if(!(expression)) { \
ASSERT(expression); \
return; \ return; \
} } while(0) } } while(0)
#endif
#endif // VK_DEBUG_H_ #endif // VK_DEBUG_H_
...@@ -204,7 +204,7 @@ const uint8_t* DescriptorSetLayout::GetInputData(const VkWriteDescriptorSet& des ...@@ -204,7 +204,7 @@ const uint8_t* DescriptorSetLayout::GetInputData(const VkWriteDescriptorSet& des
return reinterpret_cast<const uint8_t*>(descriptorWrites.pBufferInfo); return reinterpret_cast<const uint8_t*>(descriptorWrites.pBufferInfo);
break; break;
default: default:
UNIMPLEMENTED(); UNIMPLEMENTED("descriptorType");
return nullptr; return nullptr;
} }
} }
......
...@@ -49,7 +49,7 @@ Device::Device(const Device::CreateInfo* info, void* mem) ...@@ -49,7 +49,7 @@ Device::Device(const Device::CreateInfo* info, void* mem)
if(pCreateInfo->enabledLayerCount) if(pCreateInfo->enabledLayerCount)
{ {
// "The ppEnabledLayerNames and enabledLayerCount members of VkDeviceCreateInfo are deprecated and their values must be ignored by implementations." // "The ppEnabledLayerNames and enabledLayerCount members of VkDeviceCreateInfo are deprecated and their values must be ignored by implementations."
UNIMPLEMENTED(); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here. UNIMPLEMENTED("enabledLayerCount"); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here.
} }
blitter = new sw::Blitter(); blitter = new sw::Blitter();
...@@ -90,12 +90,12 @@ void Device::waitForFences(uint32_t fenceCount, const VkFence* pFences, VkBool32 ...@@ -90,12 +90,12 @@ void Device::waitForFences(uint32_t fenceCount, const VkFence* pFences, VkBool32
// FIXME(b/117835459) : noop // FIXME(b/117835459) : noop
} }
void Device::waitIdle() void Device::waitIdle()
{ {
for(uint32_t i = 0; i < queueCount; i++) for(uint32_t i = 0; i < queueCount; i++)
{ {
queues[i].waitIdle(); queues[i].waitIdle();
} }
} }
void Device::getDescriptorSetLayoutSupport(const VkDescriptorSetLayoutCreateInfo* pCreateInfo, void Device::getDescriptorSetLayoutSupport(const VkDescriptorSetLayoutCreateInfo* pCreateInfo,
......
...@@ -89,7 +89,7 @@ void Image::getSubresourceLayout(const VkImageSubresource* pSubresource, VkSubre ...@@ -89,7 +89,7 @@ void Image::getSubresourceLayout(const VkImageSubresource* pSubresource, VkSubre
(pSubresource->aspectMask == VK_IMAGE_ASPECT_DEPTH_BIT) || (pSubresource->aspectMask == VK_IMAGE_ASPECT_DEPTH_BIT) ||
(pSubresource->aspectMask == VK_IMAGE_ASPECT_STENCIL_BIT))) (pSubresource->aspectMask == VK_IMAGE_ASPECT_STENCIL_BIT)))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("aspectMask");
} }
auto aspect = static_cast<VkImageAspectFlagBits>(pSubresource->aspectMask); auto aspect = static_cast<VkImageAspectFlagBits>(pSubresource->aspectMask);
pLayout->offset = getMemoryOffset(aspect, pSubresource->mipLevel, pSubresource->arrayLayer); pLayout->offset = getMemoryOffset(aspect, pSubresource->mipLevel, pSubresource->arrayLayer);
...@@ -111,7 +111,7 @@ void Image::copyTo(VkImage dstImage, const VkImageCopy& pRegion) ...@@ -111,7 +111,7 @@ void Image::copyTo(VkImage dstImage, const VkImageCopy& pRegion)
(pRegion.srcSubresource.baseArrayLayer != 0) || (pRegion.srcSubresource.baseArrayLayer != 0) ||
(pRegion.srcSubresource.layerCount != 1)) (pRegion.srcSubresource.layerCount != 1))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("srcSubresource");
} }
if(!((pRegion.dstSubresource.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) || if(!((pRegion.dstSubresource.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) ||
...@@ -120,7 +120,7 @@ void Image::copyTo(VkImage dstImage, const VkImageCopy& pRegion) ...@@ -120,7 +120,7 @@ void Image::copyTo(VkImage dstImage, const VkImageCopy& pRegion)
(pRegion.dstSubresource.baseArrayLayer != 0) || (pRegion.dstSubresource.baseArrayLayer != 0) ||
(pRegion.dstSubresource.layerCount != 1)) (pRegion.dstSubresource.layerCount != 1))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("dstSubresource");
} }
VkImageAspectFlagBits srcAspect = static_cast<VkImageAspectFlagBits>(pRegion.srcSubresource.aspectMask); VkImageAspectFlagBits srcAspect = static_cast<VkImageAspectFlagBits>(pRegion.srcSubresource.aspectMask);
...@@ -210,7 +210,7 @@ void Image::copy(VkBuffer buf, const VkBufferImageCopy& region, bool bufferIsSou ...@@ -210,7 +210,7 @@ void Image::copy(VkBuffer buf, const VkBufferImageCopy& region, bool bufferIsSou
(region.imageSubresource.aspectMask == VK_IMAGE_ASPECT_DEPTH_BIT) || (region.imageSubresource.aspectMask == VK_IMAGE_ASPECT_DEPTH_BIT) ||
(region.imageSubresource.aspectMask == VK_IMAGE_ASPECT_STENCIL_BIT))) (region.imageSubresource.aspectMask == VK_IMAGE_ASPECT_STENCIL_BIT)))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("imageSubresource");
} }
VkImageAspectFlagBits aspect = static_cast<VkImageAspectFlagBits>(region.imageSubresource.aspectMask); VkImageAspectFlagBits aspect = static_cast<VkImageAspectFlagBits>(region.imageSubresource.aspectMask);
...@@ -541,7 +541,7 @@ void Image::clear(void* pixelData, VkFormat format, const VkImageSubresourceRang ...@@ -541,7 +541,7 @@ void Image::clear(void* pixelData, VkFormat format, const VkImageSubresourceRang
if((subresourceRange.baseMipLevel != 0) || if((subresourceRange.baseMipLevel != 0) ||
(subresourceRange.levelCount != 1)) (subresourceRange.levelCount != 1))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("subresourceRange");
} }
device->getBlitter()->clear(pixelData, format, this, subresourceRange, &renderArea); device->getBlitter()->clear(pixelData, format, this, subresourceRange, &renderArea);
...@@ -551,7 +551,7 @@ void Image::clear(const VkClearColorValue& color, const VkImageSubresourceRange& ...@@ -551,7 +551,7 @@ void Image::clear(const VkClearColorValue& color, const VkImageSubresourceRange&
{ {
if(!(subresourceRange.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT)) if(!(subresourceRange.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("aspectMask");
} }
device->getBlitter()->clear((void*)color.float32, getClearFormat(), this, subresourceRange); device->getBlitter()->clear((void*)color.float32, getClearFormat(), this, subresourceRange);
...@@ -562,7 +562,7 @@ void Image::clear(const VkClearDepthStencilValue& color, const VkImageSubresourc ...@@ -562,7 +562,7 @@ void Image::clear(const VkClearDepthStencilValue& color, const VkImageSubresourc
if((subresourceRange.aspectMask & ~(VK_IMAGE_ASPECT_DEPTH_BIT | if((subresourceRange.aspectMask & ~(VK_IMAGE_ASPECT_DEPTH_BIT |
VK_IMAGE_ASPECT_STENCIL_BIT)) != 0) VK_IMAGE_ASPECT_STENCIL_BIT)) != 0)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("aspectMask");
} }
if(subresourceRange.aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) if(subresourceRange.aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT)
...@@ -588,7 +588,7 @@ void Image::clear(const VkClearValue& clearValue, const VkRect2D& renderArea, co ...@@ -588,7 +588,7 @@ void Image::clear(const VkClearValue& clearValue, const VkRect2D& renderArea, co
(subresourceRange.baseMipLevel != 0) || (subresourceRange.baseMipLevel != 0) ||
(subresourceRange.levelCount != 1)) (subresourceRange.levelCount != 1))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("subresourceRange");
} }
if(subresourceRange.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT) if(subresourceRange.aspectMask == VK_IMAGE_ASPECT_COLOR_BIT)
......
...@@ -84,12 +84,12 @@ void ImageView::clear(const VkClearValue& clearValue, const VkImageAspectFlags a ...@@ -84,12 +84,12 @@ void ImageView::clear(const VkClearValue& clearValue, const VkImageAspectFlags a
if(!imageTypesMatch(image->getImageType())) if(!imageTypesMatch(image->getImageType()))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("imageTypesMatch");
} }
if(image->getFormat() != format) if(image->getFormat() != format)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("format");
} }
VkImageSubresourceRange sr = subresourceRange; VkImageSubresourceRange sr = subresourceRange;
...@@ -103,12 +103,12 @@ void ImageView::clear(const VkClearValue& clearValue, const VkImageAspectFlags a ...@@ -103,12 +103,12 @@ void ImageView::clear(const VkClearValue& clearValue, const VkImageAspectFlags a
if(!imageTypesMatch(image->getImageType())) if(!imageTypesMatch(image->getImageType()))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("imageTypesMatch");
} }
if(image->getFormat() != format) if(image->getFormat() != format)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("format");
} }
VkImageSubresourceRange sr; VkImageSubresourceRange sr;
......
...@@ -655,7 +655,7 @@ void PhysicalDevice::getImageFormatProperties(VkFormat format, VkImageType type, ...@@ -655,7 +655,7 @@ void PhysicalDevice::getImageFormatProperties(VkFormat format, VkImageType type,
pImageFormatProperties->maxArrayLayers = 1; // no 3D + layers pImageFormatProperties->maxArrayLayers = 1; // no 3D + layers
break; break;
default: default:
UNREACHABLE(type); UNREACHABLE("VkImageType: %d", int(type));
break; break;
} }
......
...@@ -53,7 +53,7 @@ sw::DrawType Convert(VkPrimitiveTopology topology) ...@@ -53,7 +53,7 @@ sw::DrawType Convert(VkPrimitiveTopology topology)
ASSERT(false); ASSERT(false);
break; break;
default: default:
UNIMPLEMENTED(); UNIMPLEMENTED("topology");
} }
return sw::DRAW_TRIANGLELIST; return sw::DRAW_TRIANGLELIST;
...@@ -119,7 +119,7 @@ sw::StreamType getStreamType(VkFormat format) ...@@ -119,7 +119,7 @@ sw::StreamType getStreamType(VkFormat format)
case VK_FORMAT_R32G32B32A32_SFLOAT: case VK_FORMAT_R32G32B32A32_SFLOAT:
return sw::STREAMTYPE_FLOAT; return sw::STREAMTYPE_FLOAT;
default: default:
UNIMPLEMENTED(); UNIMPLEMENTED("format");
} }
return sw::STREAMTYPE_BYTE; return sw::STREAMTYPE_BYTE;
...@@ -179,7 +179,7 @@ uint32_t getNumberOfChannels(VkFormat format) ...@@ -179,7 +179,7 @@ uint32_t getNumberOfChannels(VkFormat format)
case VK_FORMAT_R32G32B32A32_SFLOAT: case VK_FORMAT_R32G32B32A32_SFLOAT:
return 4; return 4;
default: default:
UNIMPLEMENTED(); UNIMPLEMENTED("format");
} }
return 0; return 0;
...@@ -194,19 +194,17 @@ std::vector<uint32_t> preprocessSpirv( ...@@ -194,19 +194,17 @@ std::vector<uint32_t> preprocessSpirv(
spvtools::Optimizer opt{SPV_ENV_VULKAN_1_1}; spvtools::Optimizer opt{SPV_ENV_VULKAN_1_1};
opt.SetMessageConsumer([](spv_message_level_t level, const char*, const spv_position_t& p, const char* m) { opt.SetMessageConsumer([](spv_message_level_t level, const char*, const spv_position_t& p, const char* m) {
const char* category = "";
switch (level) switch (level)
{ {
case SPV_MSG_FATAL: case SPV_MSG_FATAL: category = "FATAL"; break;
case SPV_MSG_INTERNAL_ERROR: case SPV_MSG_INTERNAL_ERROR: category = "INTERNAL_ERROR"; break;
case SPV_MSG_ERROR: case SPV_MSG_ERROR: category = "ERROR"; break;
ERR("%d:%d %s", p.line, p.column, m); case SPV_MSG_WARNING: category = "WARNING"; break;
break; case SPV_MSG_INFO: category = "INFO"; break;
case SPV_MSG_WARNING: case SPV_MSG_DEBUG: category = "DEBUG"; break;
case SPV_MSG_INFO:
case SPV_MSG_DEBUG:
TRACE("%d:%d %s", p.line, p.column, m);
break;
} }
vk::trace("%s: %d:%d %s", category, p.line, p.column, m);
}); });
opt.RegisterPass(spvtools::CreateInlineExhaustivePass()); opt.RegisterPass(spvtools::CreateInlineExhaustivePass());
...@@ -264,13 +262,13 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn ...@@ -264,13 +262,13 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
(pCreateInfo->basePipelineHandle != VK_NULL_HANDLE) || (pCreateInfo->basePipelineHandle != VK_NULL_HANDLE) ||
(pCreateInfo->basePipelineIndex != 0)) (pCreateInfo->basePipelineIndex != 0))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("pCreateInfo settings");
} }
const VkPipelineVertexInputStateCreateInfo* vertexInputState = pCreateInfo->pVertexInputState; const VkPipelineVertexInputStateCreateInfo* vertexInputState = pCreateInfo->pVertexInputState;
if(vertexInputState->flags != 0) if(vertexInputState->flags != 0)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("vertexInputState->flags");
} }
// Context must always have a PipelineLayout set. // Context must always have a PipelineLayout set.
...@@ -285,7 +283,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn ...@@ -285,7 +283,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
bufferStrides[desc.binding] = desc.stride; bufferStrides[desc.binding] = desc.stride;
if(desc.inputRate != VK_VERTEX_INPUT_RATE_VERTEX) if(desc.inputRate != VK_VERTEX_INPUT_RATE_VERTEX)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("vertexInputState->pVertexBindingDescriptions[%d]", i);
} }
} }
...@@ -305,7 +303,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn ...@@ -305,7 +303,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
if((assemblyState->flags != 0) || if((assemblyState->flags != 0) ||
(assemblyState->primitiveRestartEnable != 0)) (assemblyState->primitiveRestartEnable != 0))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("pCreateInfo->pInputAssemblyState settings");
} }
context.drawType = Convert(assemblyState->topology); context.drawType = Convert(assemblyState->topology);
...@@ -317,7 +315,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn ...@@ -317,7 +315,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
(viewportState->viewportCount != 1) || (viewportState->viewportCount != 1) ||
(viewportState->scissorCount != 1)) (viewportState->scissorCount != 1))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("pCreateInfo->pViewportState settings");
} }
scissor = viewportState->pScissors[0]; scissor = viewportState->pScissors[0];
...@@ -329,7 +327,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn ...@@ -329,7 +327,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
(rasterizationState->depthClampEnable != 0) || (rasterizationState->depthClampEnable != 0) ||
(rasterizationState->polygonMode != VK_POLYGON_MODE_FILL)) (rasterizationState->polygonMode != VK_POLYGON_MODE_FILL))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("pCreateInfo->pRasterizationState settings");
} }
context.rasterizerDiscard = rasterizationState->rasterizerDiscardEnable; context.rasterizerDiscard = rasterizationState->rasterizerDiscardEnable;
...@@ -359,7 +357,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn ...@@ -359,7 +357,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
(multisampleState->alphaToCoverageEnable != 0) || (multisampleState->alphaToCoverageEnable != 0) ||
(multisampleState->alphaToOneEnable != 0)) (multisampleState->alphaToOneEnable != 0))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("multisampleState");
} }
} }
else else
...@@ -373,7 +371,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn ...@@ -373,7 +371,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
if((depthStencilState->flags != 0) || if((depthStencilState->flags != 0) ||
(depthStencilState->depthBoundsTestEnable != 0)) (depthStencilState->depthBoundsTestEnable != 0))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("depthStencilState");
} }
context.depthBufferEnable = depthStencilState->depthTestEnable; context.depthBufferEnable = depthStencilState->depthTestEnable;
...@@ -408,7 +406,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn ...@@ -408,7 +406,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
((colorBlendState->logicOpEnable != 0) && ((colorBlendState->logicOpEnable != 0) &&
(colorBlendState->attachmentCount > 1))) (colorBlendState->attachmentCount > 1)))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("colorBlendState");
} }
blendConstants.r = colorBlendState->blendConstants[0]; blendConstants.r = colorBlendState->blendConstants[0];
...@@ -421,7 +419,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn ...@@ -421,7 +419,7 @@ GraphicsPipeline::GraphicsPipeline(const VkGraphicsPipelineCreateInfo* pCreateIn
const VkPipelineColorBlendAttachmentState& attachment = colorBlendState->pAttachments[0]; const VkPipelineColorBlendAttachmentState& attachment = colorBlendState->pAttachments[0];
if(attachment.colorWriteMask != (VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT)) if(attachment.colorWriteMask != (VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT))
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("colorWriteMask");
} }
context.alphaBlendEnable = attachment.blendEnable; context.alphaBlendEnable = attachment.blendEnable;
...@@ -455,7 +453,7 @@ void GraphicsPipeline::compileShaders(const VkAllocationCallbacks* pAllocator, c ...@@ -455,7 +453,7 @@ void GraphicsPipeline::compileShaders(const VkAllocationCallbacks* pAllocator, c
{ {
if (pStage->flags != 0) if (pStage->flags != 0)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("pStage->flags");
} }
auto module = Cast(pStage->module); auto module = Cast(pStage->module);
...@@ -497,7 +495,7 @@ uint32_t GraphicsPipeline::computePrimitiveCount(uint32_t vertexCount) const ...@@ -497,7 +495,7 @@ uint32_t GraphicsPipeline::computePrimitiveCount(uint32_t vertexCount) const
case sw::DRAW_TRIANGLEFAN: case sw::DRAW_TRIANGLEFAN:
return vertexCount - 2; return vertexCount - 2;
default: default:
UNIMPLEMENTED(); UNIMPLEMENTED("drawType");
} }
return 0; return 0;
......
...@@ -27,7 +27,7 @@ namespace vk ...@@ -27,7 +27,7 @@ namespace vk
// pipelineStatistics member of the VkQueryPoolCreateInfo structure." // pipelineStatistics member of the VkQueryPoolCreateInfo structure."
if(pCreateInfo->queryType == VK_QUERY_TYPE_PIPELINE_STATISTICS) if(pCreateInfo->queryType == VK_QUERY_TYPE_PIPELINE_STATISTICS)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("pCreateInfo->queryType");
} }
} }
...@@ -48,7 +48,7 @@ namespace vk ...@@ -48,7 +48,7 @@ namespace vk
char* data = static_cast<char*>(pData); char* data = static_cast<char*>(pData);
for(uint32_t i = 0; i < pQueryCount; i++, data += pStride) for(uint32_t i = 0; i < pQueryCount; i++, data += pStride)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED("queries");
} }
} }
} // namespace vk } // namespace vk
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment