Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class Format {
Format(const Format&);
~Format();

Format& operator=(const Format&) = default;

void SetFormatType(FormatType type) { type_ = type; }
FormatType GetFormatType() const { return type_; }

Expand Down
7 changes: 4 additions & 3 deletions src/vulkan/frame_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ Result FrameBuffer::Initialize(
if (depth_format != VK_FORMAT_UNDEFINED) {
depth_image_ = MakeUnique<Image>(
device_, depth_format,
VkFormatHasStencilComponent(depth_format)
? VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT
: VK_IMAGE_ASPECT_DEPTH_BIT,
static_cast<VkImageAspectFlags>(
VkFormatHasStencilComponent(depth_format)
? VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT
: VK_IMAGE_ASPECT_DEPTH_BIT),
width_, height_, depth_, properties);
Result r =
depth_image_->Initialize(VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
Expand Down
24 changes: 4 additions & 20 deletions src/vulkan/graphics_pipeline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,6 @@ const VkAttachmentDescription kDefaultAttachmentDesc = {
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, /* finalLayout */
};

const VkPipelineRasterizationStateCreateInfo kDefaultRasterizationInfo = {
VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, /* sType */
nullptr, /* pNext */
0, /* flags */
VK_FALSE, /* depthClampEnable */
VK_FALSE, /* rasterizerDiscardEnable */
VK_POLYGON_MODE_FILL, /* polygonMode */
VK_CULL_MODE_NONE, /* cullMode */
VK_FRONT_FACE_CLOCKWISE, /* frontFace */
VK_FALSE, /* depthBiasEnable */
0, /* depthBiasConstantFactor */
0, /* depthBiasClamp */
0, /* depthBiasSlopeFactor */
1.0f, /* lineWidth */
};

const VkSampleMask kSampleMask = ~0U;

VkPrimitiveTopology ToVkTopology(Topology topology) {
Expand Down Expand Up @@ -966,10 +950,10 @@ Result GraphicsPipeline::Draw(const DrawArraysCommand* command,
// becomes the vertex offset and firstIndex will always be zero."
device_->GetPtrs()->vkCmdDrawIndexed(
command_->GetCommandBuffer(),
command->GetVertexCount(), /* indexCount */
instance_count, /* instanceCount */
0, /* firstIndex */
command->GetFirstVertexIndex(), /* vertexOffset */
command->GetVertexCount(), /* indexCount */
instance_count, /* instanceCount */
0, /* firstIndex */
static_cast<int32_t>(command->GetFirstVertexIndex()), /* vertexOffset */
0 /* firstInstance */);
} else {
device_->GetPtrs()->vkCmdDraw(command_->GetCommandBuffer(),
Expand Down
30 changes: 15 additions & 15 deletions src/vulkan/vertex_buffer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class VertexBufferTest : public testing::Test {
vertex_buffer_ = MakeUnique<VertexBuffer>(nullptr);

std::unique_ptr<Buffer> buffer =
MakeUnique<BufferForTest>(nullptr, 0, kMemoryProperties);
MakeUnique<BufferForTest>(nullptr, 0U, kMemoryProperties);
buffer_memory_ = buffer->HostAccessibleMemoryPtr();
vertex_buffer_->SetBufferForTest(std::move(buffer));
}
Expand Down Expand Up @@ -179,9 +179,9 @@ TEST_F(VertexBufferTest, R64G64B64A64_UINT) {

TEST_F(VertexBufferTest, R8G8B8A8_SNORM) {
std::vector<Value> values(4);
values[0].SetIntValue(-55);
values[0].SetIntValue(static_cast<uint64_t>(-55));
values[1].SetIntValue(3);
values[2].SetIntValue(-128);
values[2].SetIntValue(static_cast<uint64_t>(-128));
values[3].SetIntValue(127);

Format format;
Expand All @@ -201,9 +201,9 @@ TEST_F(VertexBufferTest, R8G8B8A8_SNORM) {

TEST_F(VertexBufferTest, R16G16B16A16_SNORM) {
std::vector<Value> values(4);
values[0].SetIntValue(-55);
values[0].SetIntValue(static_cast<uint64_t>(-55));
values[1].SetIntValue(3);
values[2].SetIntValue(-27);
values[2].SetIntValue(static_cast<uint64_t>(-27));
values[3].SetIntValue(255);

Format format;
Expand All @@ -223,9 +223,9 @@ TEST_F(VertexBufferTest, R16G16B16A16_SNORM) {

TEST_F(VertexBufferTest, R32G32B32A32_SINT) {
std::vector<Value> values(4);
values[0].SetIntValue(-55);
values[0].SetIntValue(static_cast<uint64_t>(-55));
values[1].SetIntValue(3);
values[2].SetIntValue(-27);
values[2].SetIntValue(static_cast<uint64_t>(-27));
values[3].SetIntValue(255);

Format format;
Expand All @@ -245,9 +245,9 @@ TEST_F(VertexBufferTest, R32G32B32A32_SINT) {

TEST_F(VertexBufferTest, R64G64B64A64_SINT) {
std::vector<Value> values(4);
values[0].SetIntValue(-55);
values[0].SetIntValue(static_cast<uint64_t>(-55));
values[1].SetIntValue(3);
values[2].SetIntValue(-27);
values[2].SetIntValue(static_cast<uint64_t>(-27));
values[3].SetIntValue(255);

Format format;
Expand Down Expand Up @@ -366,9 +366,9 @@ TEST_F(VertexBufferTest, R11G16B10_SFLOAT) {

TEST_F(VertexBufferTest, R32G32B32_SFLOAT) {
std::vector<Value> values(3);
values[0].SetDoubleValue(-6.0f);
values[1].SetDoubleValue(14.0f);
values[2].SetDoubleValue(0.1171875f);
values[0].SetDoubleValue(-6.0);
values[1].SetDoubleValue(14.0);
values[2].SetDoubleValue(0.1171875);

Format format;
format.SetFormatType(FormatType::kR32G32B32A32_SFLOAT);
Expand All @@ -385,9 +385,9 @@ TEST_F(VertexBufferTest, R32G32B32_SFLOAT) {

TEST_F(VertexBufferTest, R64G64B64_SFLOAT) {
std::vector<Value> values(3);
values[0].SetDoubleValue(-6.0f);
values[1].SetDoubleValue(14.0f);
values[2].SetDoubleValue(0.1171875f);
values[0].SetDoubleValue(-6.0);
values[1].SetDoubleValue(14.0);
values[2].SetDoubleValue(0.1171875);

Format format;
format.SetFormatType(FormatType::kR64G64B64A64_SFLOAT);
Expand Down