GithubHelp home page GithubHelp logo

vulkan-sdk's Introduction

Vulkan SDK for Android

Vulkan SDK banner


This project is not supported. For the latest tutorials and samples please go to:


Introduction

The Vulkan Software Development Kit is a collection of resources to help you build Vulkan applications for a platform with a Mali GPU and an ARM processor. You can use it for creating new applications, training, and exploration of implementation possibilities.

Setting up development environment

Minimum NDK requirements

Minimum android-ndk-r12 is required. The NDK can be downloaded from Android Studio 2.2 or later. It is recommended to use the NDK provided in Android Studio.

OS requirements

The Vulkan SDK has been tested to build on Linux (Android Studio) and Windows (Android Studio). Partial support for running on Linux desktop is also included.

Android requirements

Not all Android devices support Vulkan. To make sure your Android device has the Vulkan API supported download the Hardware CapsViewer for Vulkan app to verify your device's status.

License

The software is provided under an MIT license. Contributions to this project are accepted under the same license.

Trademarks

Vulkan is a registered trademark of the Khronos Group Inc.

Building

Check out submodules

This repo uses GLM and STB as submodules, before building, make sure you pull those in.

git submodule init
git submodule update

Build and run samples from Android Studio

  • Open Android Studio 3.4 or newer
  • Open an existing Android Studio project
  • Import a sample project
  • You might be prompted to update or install the Gradle wrapper. Do so if asked.
  • You might be prompted to download and/or update Android SDK tools if Android Studio has not downloaded these before.
  • Under Tools -> Android -> SDK manager, install cmake, lldb and NDK components if these are not installed already.
  • In the top menu, run Build -> Make Project.
  • In the bottom of the screen, the Messages tab should display a build log which shows that libnative.so has been built and that build was successful.
  • Run the app on the device by pressing the Play button on the top toolbar.
  • To debug the code, Run -> Debug app. In the project view, you will find app/cpp/native/hellotriangle.cpp or similar. You can set breakpoints and step through the code.

Build samples for desktop Linux

mkdir build
cd build
cmake ..
make -j8

will build samples with a PNG backend. Running the binary on desktop should dump out PNG images. This is useful when developing samples and for creating screenshots.

X11 or Wayland backends can be used instead on Linux by passing in extra parameters to cmake:

cmake .. -DPLATFORM=wayland   # or xcb for X11

Documentation

For online tutorials, documentation and explanation of the samples, see Vulkan SDK documentation.

To build the same documentation for yourself for offline use, build Doxygen documentation with ./build_documentation.sh. This requires Doxygen to be installed on your machine.

Adding new samples

The build system for samples is designed to be as general as possible. To create a new sample based on hellotriangle:

cd samples
$EDITOR CMakeLists.txt             # add_subdirectory(newsample)
mkdir newsample
cp -r hellotriangle/{CMakeLists.txt,app,build.gradle,settings.gradle} newsample/
$EDITOR CMakeLists.txt             # Edit add_sample
$EDITOR app/AndroidManifest.xml    # Edit manifest:package
$EDITOR app/res/values/strings.xml # Edit resources:string

Source files go in newsample/, GLSL source files go in newsample/shaders and general assets (if needed) go in newsample/assets.

Samples must implement the VulkanApplication interface as well as implementing MaliSDK::create_application().

#include "framework/application.hpp"
#include "framework/context.hpp"
#include "framework/common.hpp"
#include "framework/assets.hpp"
#include "platform/platform.hpp"

class MyVulkanApplication : public VulkanApplication
{
    // ...
};

VulkanApplication* MaliSDK::create_application()
{
    return new MyVulkanApplication();
}

vulkan-sdk's People

Contributors

attilioprovenzano-arm avatar cforfang avatar christianf-arm avatar hanskristian-work avatar joseemilio-arm avatar josmil1 avatar wasimabbas-arm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vulkan-sdk's Issues

I hava a problem about barrier scope. Can you help me?

/////////// A set of commands
vkCmd..(…)

vkCmd.. (…)
////////////

///////Barrier1
vkCmdPipelineBarrier (…)
///////

///////// B set of commands
vkCmd…(…)

vkQueueSubmit(…)
vkQueuePresentKHR(..)
//////////

/////////Barrier2
vkCmdPipelineBarrier (…)
////////

//////C set of commands
vkCmd…(…)

vkQueueSubmit(…)
vkQueuePresentKHR(..)
//////

I use one queue to submit commands.

I want to know:

Do the "Barrier1" act on "B set of commands" and "Barrier2" and "C set of commands"?

Thanks you!

Tell people to verify capabilities of phone

I personally have run into trying to use the Vulkan SDK with my Galaxy S6 with the Mali-T760 GPU to find that it was not Vulkan supported.

I think giving people a link to the Hardware CapsViewer for Vulkan app will save many people hours of headaches from finding out they can't even run the SDK on their android device. All these Vulkan pages neglect to remind people that not all phones work with it.

Incorrect external dependency in hellotriangle sample

This code:
https://github.com/ARM-software/vulkan-sdk/blob/master/samples/hellotriangle/hellotriangle.cpp#L211-L226

Has misleading comments and incorrect dstAccessMask. As per offline discussion with @Tobski, we don't need a write-after-read barrier here - the semaphore establishes that - but we need a write-after-write dependency to make sure that the writes to color attachment don't get reordered with the (implied) write operations from the image layout transition. This requires dstAccessMask to be COLOR_ATTACHMENT_OPTIMAL.

We haven't discussed this so I'm less sure about this but it looks like this also needs an external dependency at the end of the pass (so 0 -> EXTERNAL) to establish a read-after-write barrier to make sure that (implied) read operations from the image layout transition wait until the color attachment writes complete.

One day validation layers will check for things like this.

when I make, some mistake happend

root@linaro-alip:~/jack_vulkan/vulkan-sdk/build# make
[ 3%] Built target vulkan-stub
[ 8%] Built target platform-png
[ 11%] Built target platform-asset-manager
[ 14%] Built target platform
[ 25%] Built target framework
[ 30%] Built target vulkan-sdk
[ 33%] Built target platform-wsi
[ 35%] Generating assets/shaders/triangle.frag.spv
/bin/sh: GLSLC-NOTFOUND: command not found
samples/hellotriangle/CMakeFiles/hellotriangle.dir/build.make:67: recipe for target 'samples/hellotriangle/assets/shaders/triangle.frag.spv' failed
make[2]: *** [samples/hellotriangle/assets/shaders/triangle.frag.spv] Error 127
CMakeFiles/Makefile2:470: recipe for target 'samples/hellotriangle/CMakeFiles/hellotriangle.dir/all' failed
make[1]: *** [samples/hellotriangle/CMakeFiles/hellotriangle.dir/all] Error 2
Makefile:94: recipe for target 'all' failed
make: *** [all] Error 2

this error is always exist, my platform is ARM 3399, on Ubuntu
I need some help

the issue of imageMemoryBarrier that is in multithreading.cpp

In multithreading.cpp. The the method of "createTextureFromAsset" .

imageMemoryBarrier(cmd, image, 0, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_IMAGE_LAYOUT_UNDEFINED,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);

the srcstage is VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
the dststage is VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT
it seem like this is a bug.

is it a bug in multipass.cpp?

// These cubes do not intersect with the camera.
static const vec4 lightPositions[] = {
	vec4(-20.0f, 20.0f, -30.0f, 25.0f), vec4(-20.0f, -20.0f, -30.0f, 20.0f), vec4(+20.0f, +20.0f, -15.0f, 12.0f),
	vec4(+20.0f, -20.0f, -15.0f, 12.0f),
};

I use codes to test, the code is:

bool checkPostInCamera(const mat4& vpMat, const vec4& pos) { std::vector vertices = { // Front face vec4(-1.0f, -1.0f, +1.0f, 1.0f), vec4(+1.0f, -1.0f, +1.0f, 1.0f), vec4(-1.0f, +1.0f, +1.0f, 1.0f), vec4(+1.0f, +1.0f, +1.0f, 1.0f),
            // Back face
            vec4(+1.0f, -1.0f, -1.0f, 1.0f),
            vec4(-1.0f, -1.0f, -1.0f, 1.0f),
            vec4(+1.0f, +1.0f, -1.0f, 1.0f),
            vec4(-1.0f, +1.0f, -1.0f, 1.0f)
    };

    for(int i =0; i < vertices.size(); ++i)
    {

        vec4 v = vec4(vertices[i].xyz() * pos.w, 1.0) + vec4(pos.xyz(), 0.0f);


        vec4 ndcPos = vpMat  * v;
        float xPos = ndcPos.x;
        float yPos = ndcPos.y;
        float zPos =  ndcPos.z;
        float wPos =  ndcPos.w;
        ndcPos = ndcPos / ndcPos.w;

        xPos = ndcPos.x;
        yPos = ndcPos.y;
        zPos =  ndcPos.z;
        wPos =  ndcPos.w;

        if (fabs(ndcPos.x) < 1.0f && fabs(ndcPos.y) < 1.0f  && fabs(ndcPos.z) < 1.0f)
        {
            return true;
        }
    }

    return false;
}

and the use case is:
auto result = checkPostInCamera(mvp[1], lightPositions[0]);

It is intersect with the camera!

anything isn't declare

Hello,

Anythink isn't declare in your make command line :

image

Thank you in advance to repair your error,

Regards.

Azaretdodo.

The promble of the uniform buffer in in the sample that is named "multipass"

The initialization of the uniform buffer is :
A:
uboAlignment = std::max(size_t(pContext->getPlatform().getGpuProperties().limits.minUniformBufferOffsetAlignment),
sizeof(mat4));
uniformBuffer = createBuffer(nullptr, backbuffers.size() * uboAlignment, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT);
VK_CHECK(vkMapMemory(device, uniformBuffer.memory, 0, VK_WHOLE_SIZE, 0, reinterpret_cast<void **>(&uboData)));

The VkDescriptorBufferInfo is :

B:
VkDescriptorBufferInfo uboInfo = { uniformBuffer.buffer, 0, sizeof(mat4) }.

The above codes is in the sample that is named "multipass".

About the B. Why not " VkDescriptorBufferInfo uboInfo = { uniformBuffer.buffer, 0, backbuffers.size() * uboAlignment }." or " VkDescriptorBufferInfo uboInfo = { uniformBuffer.buffer, 0, VK_WHOLE_SIZE }."

VkDescriptorBufferInfo uboInfo = { uniformBuffer.buffer, 0, sizeof(mat4) }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.