question stringlengths 11 28.2k | answer stringlengths 26 27.7k | tag stringclasses 130
values | question_id int64 935 78.4M | score int64 10 5.49k |
|---|---|---|---|---|
Are there any tools for windows like that *nix world has? I am looking for something like Chef or Puppet.
I have found cfEngine but it still looks very *nix centric. Ideally it would be open source, and command line driven.
The idea is to put together an automated infrastructure with windows based servers. Our current... | Chef is supported on Windows by Opscode. While we don't run Windows for any of our infrastructure, we do have developers who are continually improving our Windows support. We also get community contributions, and most of the early phase Windows functionality for Chef was contributed by the community.
Important: Opscode... | CFEngine | 4,910,034 | 70 |
I'm in the process of evaluating if and how a CF .NET enterprise application can be ported to run on Android devices. The application on Windows Mobile phones are run in kiosk mode where the application autostart in fullscreen-mode after booting and with the users unable to accidentally or willingly access any other pa... | You can autostart applications on boot by listening to the android.intent.action.BOOT_COMPLETED intent in a BroadcastReceiver and start your Activity from there. In the Activity you can register yourself as the new default homescreen[1] and handle the keys.
I think there are some instances that you can't handle withou... | kiosk | 2,068,084 | 121 |
I need to disable Home and other system buttons in my Android application.
Example: MX Player (see at Google Play) - you can press "lock" icon at player screen and it locks all hardware and software system buttons.
It works fine WITHOUT ROOTING.
I tested it on some devices with different Android versions. I tried to ... | First of, please think long and hard if you really want to disable the Home button or any other button for that matter (e.g. the Back button), this is not something that should be done (at least most of the times, this is a bad design). I can speak only for myself, but if I downloaded an app that doesn't let me do some... | kiosk | 17,549,478 | 82 |
We are using Chrome in kiosk mode and accidentally users are causing the application to zoom with the recent addition of pinch zoom support.
They then think they've broken it and simply walk away leaving the application (and subsequently a 55" touch screen) in a broken state.
Now the only thing to work has been stopp... | We've had a similar problem, it manifests as the browser zooming but javascript receiving no touch event (or sometimes just a single point before zooming starts).
We've found these possible (but possibly not long-term) solutions:
1. Disable the pinch / swipe features when using kiosk mode
If these command-line settings... | kiosk | 22,999,829 | 53 |
I am implementing a kiosk mode application and i have successfully made the application full-screen without status bar appearance post 4.3 but unable to hide status bar in 4.3 and 4.4 as status-bar appears when we swipe down at the top of the screen.
I have tried to make it full screen by
speciflying the full screen t... | We could not prevent the status appearing in full screen mode in kitkat devices, so made a hack which still suits the requirement ie block the status bar from expanding.
For that to work, the app was not made full screen. We put a overlay over status bar and consumed all input events. It prevented the status from expan... | kiosk | 25,284,233 | 31 |
I am developing a kiosk and now in admin side. In order to go to the Admin, the user needs to tap the screen 5 times just in 3 seconds or else, nothing will happen.
| Please read the comments in the code, it is quite straightforward
import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
public class MainActivity extends Activity {
private int tapCount = 0;
private long tapCounterStartMillis = 0;
//detect any touch event in the screen (instead ... | kiosk | 21,104,263 | 26 |
We are looking to print to a POS printer connected where apache is running. Due to design of the application, and deployment, printing should be done from Server (it should detect the order and send to different printers and different formats of printing...bill, kitchen orders, and so on...). For this reason and others... | Author of escpos-php here.
If your printers do support ESC/POS (most thermal receipt printers seem to use some sub-set of it), then I think the driver will accommodate your use case: USB or network printing, logo, some formatting. Some of these are quite recent additions.
USB printing
escpos-php prints to a file pointe... | kiosk | 25,973,046 | 24 |
I am modifying the AOSP source code because my app needs to run in a kiosk environment.
I want Android to boot directly into the app. I've excluded launcher2 from generic_no_telephony.mk, and added the app there. Now Android prompts me all the time to choose default launcher.
The two choices that are available on the p... | Instead of modifying the AOSP make files (which is annoying because then you need to track your changes) it is easier to add a LOCAL_OVERRIDES_PACKAGES line to your app's make file.
For instance:
LOCAL_OVERRIDES_PACKAGES := Launcher2 Launcher3
added to your Android.mk file will ensure that those packages are not added... | kiosk | 22,911,156 | 17 |
So, I need to build a kiosk type of application for use in an internet cafe. The app needs to load and display some options of things to do. One option is to launch IE to surf. Another option is to play a game.
I've been reading that what I probably want to do is replace the windows shell and have it run my app wh... | You should check out Microsoft Steady State
It has plenty features and are free to use.
Windows SteadyState Features
Whether you manage computers in a school computer lab or an Internet cafe, a library, or even in your home, Windows SteadyState helps make it easy for you to keep your computers running the way you want... | kiosk | 3,581,059 | 14 |
I have a kiosk mode application which hides all traces of the System UI (Notification bar and navigation buttons). On versions of Android pre-Lollipop the following works fine (as root):
service call activity 42 s16 com.android.systemui
In Lollipop however, this makes the screen completely black as well as hiding the ... | If the device is rooted you could disable the systemui pm disable-user com.android.systemui and then the device-owner method works fine.
This method should not be used if the device runs other apps, because if your app crashes the systemui might be disabled and the user can't interact with the device.
<?xml version='1... | kiosk | 27,942,053 | 14 |
How can I programmatically enable/disable an android screen reader service such as TalkBack?
I am developing a kiosk type application that will be installed on an Android device that will be loaned to visitors while they visit a particular museum. (We are still in the process of determining what device we will use.) T... | Only system apps can enable/disable accessibility service programatically.
System apps can directly write in settings secure db to start accessibility service.
Settings.Secure.putString(getContentResolver(),Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES, "com.packagename/com.packagename.componentname");
Following perm... | kiosk | 38,360,198 | 14 |
I have chrome opening in kiosk mode - I added the --kiosk flag to the chrome shortcut which works as expected.
The kiosk allows browsing of our intranet and the internet. I realise I can use javascript to redirect pages on our intranet, but what about the internet? We don't want people fpr example browsing to YouTube ... | I managed to find an answer to this question on another site.
Ended up using a chrome extension called Idle Reset.
Hopefully it helps somebody else.
| kiosk | 33,284,153 | 12 |
I wish to set up what is usually called a Kiosk, running Firefox locked down to our own specific home page (and links from there). The base operating system is CentOs 5 (i.e. just like RedHat Enterprise 5).
Ideally I want Firefox to start full screen (and I have installed the full-fullscreen addon to help with this), a... | You have 2 options.
You install a kiosk plug-in, that allows you to start firefox automatically in full screen mode (amongst other things). One example would be R-kiosk
Or you skip firefox and create a xul application that does what you want. You can find a sample application here. And you can find full screen code (n... | kiosk | 9,586,290 | 11 |
What exactly does kiosk: true in the BrowserWindow config of a new ElectronJS window do?
The documentation just states that the parameter indicates, that the window is in 'kiosk' mode. I was unable to find information on what this means.
| Basically, Kiosk mode is a Windows operating system (OS) feature that only allows one application to run. Kiosk mode is a common way to lock down a Windows device when that device is used for a specific task or used in a public setting.
So in electron kiosk mode, we'd have the ability to lock down our application to a ... | kiosk | 70,456,451 | 11 |
I have a homemade Sinatra application for which I intend to use Heroku to host it.
I use foreman and shotgun in development, with the following Procfile:
web: shotgun config.ru -s thin -o 0.0.0.0 -p $PORT -E $RACK_ENV
It works great with both development and production. But the thing is, I don't want to use shotgun in... | Use multiple Procfiles and specify -f or --procfile running option to select one:
In dev (Procfile.dev contains your shotgun web process):
foreman start -f Procfile.dev
In production, foreman start will pick up the normal Procfile.
Alternatively, you could create a bin directory in your app with a script to start the ... | Foreman | 11,592,798 | 78 |
When I run foreman I get the following:
> foreman start
16:47:56 web.1 | started with pid 27122
Only if I stop it (via ctrl-c) it shows me what is missing:
^CSIGINT received
16:49:26 system | sending SIGTERM to all processes
16:49:26 web.1 | => Booting Thin
16:49:26 web.1 | => Rails 3.0.0 application ... | I’ve been able to resolve this issue by 2 different ways:
From https://github.com/ddollar/foreman/wiki/Missing-Output:
If you are not seeing any output from your program, there is a likely
chance that it is buffering stdout. Ruby buffers stdout by default. To
disable this behavior, add this code as early as possi... | Foreman | 8,717,198 | 55 |
Can you comment out lines in a .env file read by foreman?
| FWIW, '#' appears to work as a comment character.
It at least has the effect of removing unwanted environment declarations. It might be declaring others starting with a #, but... it still works.
EG
DATABASE_URL=postgres://mgregory:@localhost/mgregory
#DATABASE_URL=mysql://root:secret@localhost:3306/cm_central
resul... | Foreman | 26,713,508 | 50 |
I want to be able to set environment variables in my Django app for tests to be able to run. For instance, my views rely on several API keys.
There are ways to override settings during testing, but I don't want them defined in settings.py as that is a security issue.
I've tried in my setup function to set these enviro... | The test.support.EnvironmentVarGuard is an internal API that might be changed from version to version with breaking (backward incompatible) changes. In fact, the entire test package is internal use only. It was explicitly stated on the test package documentation page that it's for internal testing of core libraries and... | Foreman | 31,195,183 | 46 |
I have been attempting to complete this tutorial, but have run into a problem with the foreman start line. I am using a windows 7, 64 bit machine and am attempting to do this in the git bash terminal provided by the Heroku Toolbelt.
When I enter foreman start I receive:
sh.exe": /c/Program Files (x86)/Heroku/ruby-1.9.... | I had this problem. I fixed it by uninstalling version 0.62 of the foreman gem and installing 0.61.
gem uninstall foreman
gem install foreman -v 0.61
| Foreman | 15,399,637 | 41 |
I think this is a little, easy question!
I'm using .env file to keep all my environment variables, and i'm using foreman.
Unfortunately, these environment variables are not being loaded when running rails console rails c so, i'm now loading them manually after running the console, which is not the best way.
I'd like to... | About a year ago, the "run" command was added to foreman
ref: https://github.com/ddollar/foreman/pull/121
You can use it as follow:
foreman run rails console
or
foreman run rake db:migrate
| Foreman | 15,370,814 | 34 |
I have this simple Procfile
web: myapp
myapp is in the path, but the processes home directory should be ./directory/. How can I specify in the Procfile where the process is to be started?
https://github.com/ddollar/foreman/pull/101 doesn't help because it assumes, that this working directory should be the same for eve... | The shell is the answer. It's as simple as
web: sh -c 'cd ./directory/ && exec appname'
| Foreman | 13,284,310 | 27 |
I installed redis this afternoon and it caused a few errors, so I uninstalled it but this error is persisting when I launch the app with foreman start. Any ideas on a fix?
foreman start
22:46:26 web.1 | started with pid 1727
22:46:26 web.1 | 2013-05-25 22:46:26 [1727] [INFO] Starting gunicorn 0.17.4
22:46:26 web.1 ... | Just type
sudo fuser -k 5000/tcp
.This will kill all process associated with port 5000
| Foreman | 16,756,624 | 22 |
A web app I am writing in JavaScript using node.js. I use Foreman, but I don't want to manually restart the server every time I change my code. Can I tell Foreman to reload the entire web app before handling an HTTP request (i.e. restart the node process)?
| Here's an adjusted version of Pendlepants solution. Foreman looks for an .env file to read environment variables. Rather than adding a wrapper, you can just have Foreman switch what command it uses to start things up:
In .env:
WEB=node app.js
In dev.env:
WEB=supervisor app.js
In your Procfile:
web: $WEB
By default, ... | Foreman | 9,131,496 | 21 |
I am trying to export my application to another process management format/system (specifically, upstart). In doing so, I have come across a number of roadblocks, mostly due to lacking documentation.
As a non-root user, I ran the following command (as shown here):
-bash> foreman export upstart /etc/init
ERROR: Could not... | app is default for both the name of the app and the name of the user the application should be run as when the corresponding options (--app and --user) are not used. See the foreman man page for the available options, but note that at the time of this writing the official synopsis did not include [options]:
foreman exp... | Foreman | 12,990,842 | 19 |
I'm following the heroku tutorial for Heroku/Facebook integration (but I suspect this issue has nothing to do with facebook integration) and I got stuck on the stage where I was supposed to start foreman (I've installed the Heroku installbelt for windows, which includes foreman):
> foreman start
gives:
C:/RailsInstall... | Although this question doesn't seem to be of interest to anyone here (5 views in ~2 hours, 0 answers, 0 comments...), I have found the solution and ready to share it with anyone that will encounter it:
Install the latest ruby from rubyinstaller.org (1.9.3-p194) - Sometimes there is a collision installs of the same ver... | Foreman | 11,434,287 | 18 |
I simply followed the getting started with nodejs tutorial from Heroku.
https://devcenter.heroku.com/articles/getting-started-with-nodejs#declare-process-types-with-procfile
But I get an error at the part "declare process types with procfile"
My problem is that my cmd (using windows 7) didn't find the command "foreman"... | I had the same problem on Windows7 64-bit, using git's bash. Here's what I did:
uninstall the toolbelt, Ruby, and Git using Control Panel's "Program and Features"
reinstall the toolbelt to C:\Heroku (see known issue for more info)
add C:\Program Files (x86)\git\bin;C:\Heroku\ruby-1.9.2\bin to the system PATH variable... | Foreman | 19,078,939 | 18 |
I am trying to use foreman to start my rails app. Unfortunately I have difficulties connecting my IDE for debugging.
I read here about using
Debugger.wait_connection = true
Debugger.start_remote
to start a remote debugging session, but that does not really work out.
Question:
Is there a way to debug a rails (3.2) app... | If you use several workers with full rails environment you could use the following initializer:
# Enabled debugger with foreman, see https://github.com/ddollar/foreman/issues/58
if Rails.env.development?
require 'debugger'
Debugger.wait_connection = true
def find_available_port
server = TCPServer.new(nil, 0)... | Foreman | 9,558,576 | 17 |
I am trying to deploy an Heroku app.
I must be doing something wrong with the Procfile. When I run foreman check I get this error.
ERROR: no processes defined
I get pretty much the same thing when deploying on Heroku
-----> Building runtime environment
-----> Discovering process types
! Push failed: cannot pars... | Just encounter "Push failed: cannot parse Procfile." on Windows.
I can conclude that
It IS "Windows-file format" problem, NOT the context of file itself.
make sure to create a clean file, maybe use Notepad++ or other advanced editor to check the file type.
| Foreman | 19,846,342 | 17 |
We have rails app that is running some foreman processes with bundle exec foreman start, and have googled a lot of different things, and found that the common suggestion is to set up another background process handler, and export the processes there. So essentially let someone else do foreman's job of managing the pro... | Used monit to control stop and start of foreman processes.
| Foreman | 18,925,483 | 16 |
I have the following Procfile:
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
redis: bundle exec redis-server /usr/local/etc/redis.conf
worker: bundle exec sidekiq
Running $ foreman start starts up Unicorn, Redis and Sidekiq, but how should i stop them again?
Killing Foreman leaves all three up. I can see th... | To kill them all with a one-liner:
$ kill $(ps aux | grep -E 'redis|sidekiq|unicorn' | grep -v grep | awk '{print $2}')
| Foreman | 20,190,152 | 14 |
I know for a fact that Flask, in debug mode, will detect changes to .py source code files and will reload them when new requests come in.
I used to see this in my app all the time. Change a little text in an @app.route decoration section in my views.py file, and I could see the changes in the browser upon refresh.
But... | The issue here, as stated in other answers, is that it looks like you moved from python run.py to foreman start, or you changed your Procfile from
# Procfile
web: python run.py
to
# Procfile
web: gunicorn --log-level=DEBUG run:app
When you run foreman start, it simply runs the commands that you've specified in the Pr... | Foreman | 23,400,599 | 14 |
I am having trouble getting my dynos to run multiple delayed job worker processes.
My Procfile looks like this:
worker: bundle exec script/delayed_job -n 3 start
and my delayed_job script is the default provided by the gem:
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config',... | You can use foreman to start multiple processes on the same dyno.
First, add foreman to your Gemfile.
Then add a worker line to your Procfile:
worker: bundle exec foreman start -f Procfile.workers
Create a new file called Procfile.workers which contains:
dj_worker: bundle exec rake jobs:work
dj_worker: bundle exec r... | Foreman | 24,792,399 | 12 |
binding.pry not works(console input not available) if i start the server with bin/dev command. It only works with bin/rails s command.
I understand it has something to do with foreman and Procfile.dev, but I don't know how.
Is this a bug or is it supposed to be like this?
| With bin/dev, the Procfile.dev file is run with foreman. The pry issue is caused by the CSS and JS watchers:these just listen to changes in your CSS and JS files.
What you can do is remove the web: unset PORT && bin/rails server command from your Procfile, so it will only have the CSS and JS watchers and look like this... | Foreman | 72,532,475 | 12 |
I want the foreman gem to use the PORT value provided in the my development env file instead of using its own values. My files setup is shown below:
A bash script to start foreman:
foreman start -e development.env
The development.env file content:
PORT=3000
The Procfile content
web: bundle exec rails server thin -p $P... | I know this is an old post but it took me a while to figure out so might as well add a note here.
Foreman increments the PORT based on where your define the service in the Procfile.
Say our PORT environment variable is set to 3000.
In our first Procfile example Puma will run on PORT 3000:
web: bundle exec puma -q -p $P... | Foreman | 9,804,184 | 11 |
I have the following Rake task:
namespace :foreman do
task :dev do
`foreman start -f Procfile.dev`
end
end
desc "Run Foreman using Procfile.dev"
task :foreman => 'foreman:dev'
The forman command works fine from the shell, however when I run rake foreman I get the following error:
/Users/me/.gem/ruby/2.0.0/gem... | If you must make it work via rake, try changing the shell-out via backtick to use a hard-coded path to the system-wide foreman binary
`/global/path/to/foreman start -f Procfile.dev`
You just need to use 'which' or 'locate' or a similar tool to determine the path that works outside your bundler context. If you are usin... | Foreman | 27,189,450 | 11 |
Is there a way to download and install heroku toolbelt components individually, or at least without the bundled git? Heroku Toolbelt comes with git bundled in. Last time I downloaded it and installed it, it overwrote my existing git installation. Heroku Toolbelt bundles an older version of git and I require at least 1.... | It's just Foreman, Git, and the Heroku CLI client.
If you already have Git and Foreman, you can just install the CLI from the command line,
wget -qO- https://toolbelt.heroku.com/install.sh | sh
The Windows installer offers the same options.
| Foreman | 12,322,473 | 10 |
we are trying to install couple of python packages without internet.
For ex : python-keystoneclient
For that we have the packages downloaded from https://pypi.python.org/pypi/python-keystoneclient/1.7.1 and kept it in server.
However, while installing tar.gz and .whl packages , the installation is looking for dependen... | This is how I handle this case:
On the machine where I have access to Internet:
mkdir keystone-deps
pip download python-keystoneclient -d "/home/aviuser/keystone-deps"
tar cvfz keystone-deps.tgz keystone-deps
Then move the tar file to the destination machine that does not have Internet access and perform the following... | OpenStack | 36,725,843 | 98 |
Are there any differences in images of Docker and Virtual Machine?
Except the image formats, I couldn't find any info on this anywhere.
Please comment out on the things like image size, instance creation time, capture time, etc.
Thanks!
| These are some differences between a docker and a VM image which I could list out:
1. Snapshot process is faster in Docker than VMs
We generally start with a base image, and then make our changes, and commit those changes using docker, and it creates an image. This image contains only the differences from the base. Whe... | OpenStack | 29,096,967 | 28 |
I'm really trying to understand the under the hood of keystone regarding the relationships among endpoints, regions, tenants, services, users and roles.
I've tried to find the related documents but sadly, failed.
Could anybody give any pointers or explanations?
| Keystone is the identity management service for OpenStack.
Essentially it's role is to grant tokens to users be they people, services, or anything at all.
If you make an API query anywhere in OpenStack, keystone's API is how it is discovered if you are allowed to make that API query.
Let's work our way up from the grou... | OpenStack | 19,004,503 | 20 |
I had to install OpenStack using devstack infrastructure for experiements with open vSwitch, and found this in the logs:
/usr/lib/python2.7/site-packages/setuptools/dist.py:298: UserWarning: The version specified ('2014.2.2.dev5.gb329598') is an invalid version, this may not work as expected with newer versions of setu... | Each Python package can specify its own version. Among other things, PEP440 says that a version specification should be stored in the __version__ attribute of the module, that it should be a string, and that should consist of major version number, minor version number and build number separated by dots (e.g. '2.7.8') ... | OpenStack | 27,493,792 | 20 |
I'm having a problem with Python generators while working with the Openstack Swift client library.
The problem at hand is that I am trying to retrieve a large string of data from a specific url (about 7MB), chunk the string into smaller bits, and send a generator class back, with each iteration holding a chunked bit of... | In your get_object method, you're assigning the return value of _object_body() to the contents variable. However, that variable is also the one that holds your actual data, and it's used early on in _object_body.
The problem is that _object_body is a generator function (it uses yield). Therefore, when you call it, it p... | OpenStack | 20,429,971 | 19 |
I am searching for options that enable dynamic cloud-based NVIDIA GPU virtualization similar to the way AWS assigns GPUs for Cluster GPU Instances.
My project is working on standing up an internal cloud. One requirement is the ability to allocate GPUs to virtual-machines/instances for server-side CUDA processing.
USC a... |
"dynamic cloud-based NVIDIA GPU virtualization similar to the way AWS assigns GPUs for Cluster GPU Instances."
AWS does not really allocate GPUs dynamically: Each GPU Cluster Compute has 2 fixed GPUs. All other servers (including the regular Cluster Compute) don't have any GPUs. I.e. they don't have an API where you ... | OpenStack | 14,505,941 | 15 |
Does devstack completely install openstack? I read somewhere that devStack is not and has never been intended to be a general OpenStack installer. So what does devstack actually install? Is there any other scripted method available to completely install openstack(grizzly release) or I need to follow the manual installa... | devstack does completely install from git openstack.
for lesser values of completely anyways. devstack is the version of openstack used in jenkins gate testing by developers committing code to the openstack project.
devstack as the name suggests is specifically for developing for openstack. as such it's existence i... | OpenStack | 21,729,860 | 14 |
My question is similar to this git hub post:
https://github.com/hashicorp/terraform/issues/745
It is also related to another stack exchange post of mine:
Terraform stalls while trying to get IP addresses of multiple instances?
I am trying to bootstrap several servers and there are several commands I need to run on my i... | The solution is to create a resource "null_resource" "nameYouWant" { } and then run your commands inside that. They will run after the initial resources are created:
resource "aws_instance" "consul" {
count = 3
ami = "ami-ce5a9fa3"
instance_type = "t2.micro"
key_name = "ansible_aws"
tags {
Name = "consul... | OpenStack | 37,865,979 | 12 |
I have no experience in openstack and would appreciate anyone who can help and guide me with this issue. I'm installing openstack in virtual environment (Ubuntu 12.04) and this came out:
git clone git//git.openstack.org/openstack/requirements.git/opt/stack/reqiurements
Cloning into '/opt/stack/requirements'... fata... | I had the same problem, the git protocol is blocked in my testing environment.
The solution is to modify the sourcerc file in the devstack installation folder to use https instead of git. You have to look for that line and change it. This file is also known as the local.conf file.
Default setting in sourcerc file:
GIT... | OpenStack | 20,390,267 | 11 |
I am looking into the python shade module in order to automate some tasks using our OpenStack installation.
This page instructs:
Create a configuration file to store your user name, password, project_name in ~/.config/openstack/clouds.yml.
I had a close look; but I couldn't find any information how to provide creden... | I am not a python expert, but after some searching how "other" openclient modules do it; maybe the following could work (example code from your link; just a bit of enhancement):
from shade import *
auth_data = {
# URL to the Keystone API endpoint.
'auth_url': 'url',
# User credentials.
'user_domain_name': ...
}
to ... | OpenStack | 42,222,387 | 11 |
I am dealing with creating AWS API Gateway. I am trying to create CloudWatch Log group and name it API-Gateway-Execution-Logs_${restApiId}/${stageName}. I have no problem in Rest API creation.
My issue is in converting restApi.id which is of type pulumi.Outout to string.
I have tried these 2 versions which are proposed... | @Cameron answered the naming question, I want to answer your question in the title.
It's not possible to convert an Output<string> to string, or any Output<T> to T.
Output<T> is a container for a future value T which may not be resolved even after the program execution is over. Maybe, your restApiId is generated by AWS... | Pulumi | 62,561,660 | 18 |
I don't see any options in the documentation on how to delete imported resources from my stack. If I try to remove the resource's reference from my code I get the following error when running pulumi up:
error: Preview failed: refusing to delete protected resource 'urn:pulumi:dev::my-cloud-infrastructure::aws:iam/instan... | As answered in the Pulumi Slack community channel, one can use the command:
pulumi state delete <urn>
This will remove the reference from your state file but not from aws.
Also, if the resource is protected you'll first have to unprotect it or run the above command with the flag --force.
| Pulumi | 66,162,196 | 16 |
I'm building a macOS app via Xcode. Every time I build, I get the log output:
Metal API Validation Enabled
To my knowledge my app is not using any Metal features. I'm not using hardware-accelerated 3D graphics or shaders or video game features or anything like that.
Why is Xcode printing Metal API log output?
Is Meta... | Toggle Metal API Validation via your Xcode Scheme:
Scheme > Edit Scheme... > Run > Diagnostics > Metal API Validation.
It's a checkbox, so the possible options are Enabled or Disabled.
Disabling sets the key enableGPUValidationMode = 1 in your .xcscheme file.
After disabling, Xcode no longer logs the "Metal API Valid... | Metal³ | 60,645,401 | 40 |
Task
I would like to capture a real-world texture and apply it to a reconstructed mesh produced with a help of LiDAR scanner. I suppose that Projection-View-Model matrices should be used for that. A texture must be made from fixed Point-of-View, for example, from center of a room. However, it would be an ideal solution... | Object Reconstruction
10 October 2023, Apple released iOS Reality Composer 1.6 app that is capable of capturing a real world model's mesh with texture in realtime using the LiDAR scanning process. But at the moment there's still no native programmatic API for that (but we are all looking forward to it).
Also, there's a... | Metal³ | 63,793,918 | 32 |
I want to set a MTLTexture object as the environment map of a scene, as it seems to be possible according to the documentation. I can set the environment map to be a UIImage with the following code:
let roomImage = UIImage(named: "room")
scene.lightingEnvironment.contents = roomImage
This works and I see the reflectio... | Lighting SCN Environment with an MTK texture
Using Xcode 13.3.1 on macOS 12.3.1 for iOS 15.4 app.
The trick is, the environment lighting requires a cube texture, not a flat image.
Create 6 square images for MetalKit cube texture
in Xcode Assets folder create Cube Texture Set
place textures to their correspondin... | Metal³ | 47,739,214 | 31 |
I'm creating a MTLTexture from CVImageBuffers (from camera and players) using CVMetalTextureCacheCreateTextureFromImage to get a CVMetalTexture and then CVMetalTextureGetTexture to get the MTLTexture.
The problem I'm seeing is that when I later render the texture using Metal, I occasionally see video frames rendered ou... | I recently ran into this exact same issue. The problem is that the MTLTexture is not valid unless it's owning CVMetalTextureRef is still alive. You must keep a reference to the CVMetalTextureRef the entire time you're using the MTLTexture (all the way until the end of the current rendering cycle).
| Metal³ | 43,550,769 | 21 |
I try to check out the new Samples from the new Metal API for iOS.
When i download the code an open it in the XCode 6 Beta I'm getting the following error message:
QuartzCore/CAMetalLayer.h file not found
Do i need to add some other files or am I missing something else?
The Metal API should be available in OSX 10.9.3.... | Reason behind this error is it only works in device having A7+ chip, simulator will not work for this.
| Metal³ | 24,145,101 | 20 |
What is the most efficient way to capture frames from a MTKView? If possible, I would like to save a .mov file from the frames in realtime. Is it possible to render into an AVPlayer frame or something?
It is currently drawing with this code (based on @warrenm PerformanceShaders project):
func draw(in view: MTKView) {
... | Here's a small class that performs the essential functions of writing out a movie file that captures the contents of a Metal view:
class MetalVideoRecorder {
var isRecording = false
var recordingStartTime = TimeInterval(0)
private var assetWriter: AVAssetWriter
private var assetWriterVideoInput: AVAsse... | Metal³ | 43,838,089 | 20 |
I've been learning Metal for iOS / OSX, and I began by following a Ray Wenderlich tutorial. This tutorial works fine but it makes no mention of MTLVertexAttributeDescriptors.
Now that I'm developing my own app, I'm getting weird glitches and I'm wondering if the fact that I don't use MTLVertexAttributeDescriptors may ... | There are, of course, multiple ways of doing things. The vertex descriptor is only used for one of them.
For example, a vertex function might be declared like this:
vertex MyVertexOut vertex_func(device const float3 *positions [[buffer(0)]],
device const float2 *texCoords [[buffer(1)]],
... | Metal³ | 47,044,663 | 20 |
I am trying to create a framework that works with METAL Api (iOS). I am pretty new to this platform and I would like to know how to build the framework to work with .metal files (I am building a static lib, not dynamic). Should they be a part of the .a file, or as a resource files in the framework bundle? Or is there a... | There are many ways to provide Metal shaders with a static library, all with different tradeoffs. I'll try to enumerate them here.
1) Transform your .metal files into static strings that are baked into your static library.
This is probably the worst option. The idea is that you preprocess your Metal shader code into st... | Metal³ | 46,742,403 | 19 |
I have an image that I generate programmatically and I want to send this image as a texture to a compute shader. The way I generate this image is that I calculate each of the RGBA components as UInt8 values, and combine them into a UInt32 and store it in the buffer of the image. I do this with the following piece of co... | There's a bit more magic at play than you seem to be familiar with, so I'll try to elucidate.
First of all, by design, there is a loose connection between the storage format of textures in Metal and the type you get when you read/sample. You can have a texture in .bgra8Unorm format that, when sampled through a texture ... | Metal³ | 47,738,441 | 18 |
import UIKit
import Metal
import QuartzCore
class ViewController: UIViewController {
var device: MTLDevice! = nil
var metalLayer: CAMetalLayer! = nil
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
device = MTLCreateSystemDefaultD... | UPDATE:
Simulator support is coming this year (2019)
Pre Xcode 11/iOS 13:
Metal code doesn't compile on the Simulator. Try compiling for a device.
| Metal³ | 32,917,630 | 17 |
I tried using Metal in a simple app but when I call the device.newDefaultLibrary() function then I get an error in runtime:
/BuildRoot/Library/Caches/com.apple.xbs/Sources/Metal/Metal-56.7/Framework/MTLLibrary.mm:1842: failed assertion `Metal default library not found'
Has anyone any idea what cloud be the problem? I... | The default library is only included in your app when you have at least one .metal file in your app target's Compile Sources build phase. I assume you've followed the steps of the tutorial where you created the Metal shader source file and added the vertex and fragment functions, so you simply need to use the + icon in... | Metal³ | 36,204,360 | 16 |
I'm doing realtime video processing on iOS at 120 fps and want to first preprocess image on GPU (downsample, convert color, etc. that are not fast enough on CPU) and later postprocess frame on CPU using OpenCV.
What's the fastest way to share camera feed between GPU and CPU using Metal?
In other words the pipe would lo... | The fastest way to do this is to use a MTLTexture backed by a MTLBuffer; it is a special kind of MTLTexture that shares memory with a MTLBuffer. However, your C processing (openCV) will be running a frame or two behind, this is unavoidable as you need to submit the commands to the GPU (encoding) and the GPU needs to re... | Metal³ | 37,639,271 | 16 |
When working with Metal, I find there's a bewildering number of types and it's not always clear to me which type I should be using in which context.
In Apple's Metal Shading Language Specification, there's a pretty clear table of which types are supported within a Metal shader file. However, there's plenty of sample c... | The types with vector_ and matrix_ prefixes have been deprecated in favor of those with the simd_ prefix, so the general guidance (using float4 as an example) would be:
In C code, use the simd_float4 type. (You have to include the prefix unless you provide your own typedef, since C doesn't have namespaces.)
Same for O... | Metal³ | 51,790,490 | 16 |
On 18th May 2022, PyTorch announced support for GPU-accelerated PyTorch training on Mac.
I followed the following process to set up PyTorch on my Macbook Air M1 (using miniconda).
conda create -n torch-nightly python=3.8
$ conda activate torch-nightly
$ pip install --pre torch torchvision torchaudio --extra-index-ur... | This is what I used:
if torch.backends.mps.is_available():
mps_device = torch.device("mps")
G.to(mps_device)
D.to(mps_device)
Similarly for all tensors that I want to move to M1 GPU, I used:
tensor_ = tensor_(mps_device)
Some operations are ot yet implemented using MPS, and we might need to set a few envi... | Metal³ | 72,416,726 | 15 |
I'd like to build a dissolve in effect for a Scenekit game. I've been looking into shader modifiers since they seem to be the most light weight and haven't had any luck in replicating this effect:
Is it possible to use shader modifiers to create this effect?
How would you go about implementing one?
| You can get pretty close to the intended effect with a fragment shader modifier. The basic approach is as follows:
Sample from a noise texture
If the noise sample is below a certain threshold (which I call "revealage"), discard it, making it fully transparent
Otherwise, if the fragment is close to the edge, replace it... | Metal³ | 54,562,128 | 14 |
I'm having trouble rendering semitransparent sprites in Metal. I have read this question, and this question, and this one, and this thread on Apple's forums, and several more, but can't quite get it to work, so please read on before marking this question as a duplicate.
My reference texture has four rows and four colum... | Well, it turns out the problem was indeed in the texture loading stage, but not in any piece of code that I could possibly tweak (at least not if sticking to MTKTextureLoader).
It seems that I needed to introduce some changes to the Attributes Inspector of my asset catalog in Xcode (But at least now I get to tag my or... | Metal³ | 55,604,226 | 14 |
In Metal what coordinate system to use inside shader (in and out)? And when we render to texture is it the same? With the z buffer also? Are there any inconsistencies? Finally what are the difference between Metal, OpenGL and DirectX ?
| Metal Coordinate Systems
Metal defines several standard coordinate systems to represent transformed graphics data at
different stages along the rendering pipeline.
1) NDC (Normalized Device Coordinate): this coordinates is used by developers to construct their geometries and transform the geometries in vertex shader v... | Metal³ | 58,702,023 | 14 |
It has been a while since I have used XCode, but since Apple revieled XCode 6 and the new Metal API I had to check it out.
They have released examples, e.g. a converted version of their Basic3D example. I am having problems making them compile and run, though. I had to add paths the Quatz and Metal frameworks for compi... | According to a staff on Apple dev forums, Metal does not run in the simulator.
See: https://devforums.apple.com/message/971605#971605
If you look at other samples/app templates there is no need to explicitly link any framework, indeed everything runs out of the box.
| Metal³ | 24,046,125 | 13 |
Usually, I use the below code to identify the iOS version of the device.
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0)
In a similar way, I'm trying to find Metal support for the device. Metal is supported for Apple devices with the A7 (or better) GPU and iOS 8.0.
This is the way I expect my code to w... | It's good that you're looking for something specific to Metal — generally, iOS version checks and hardware name checks are fragile, because they rely on your app knowing all of the OS versions and devices that could ever run it. If Apple were to go back and release an iOS 7.x version that added Metal support (okay, see... | Metal³ | 29,790,663 | 13 |
I have a MTLTexture containing 16bit unsigned integers (MTLPixelFormatR16Uint). The values range from about 7000 to 20000, with 0 being used as a 'nodata' value, which is why it is skipped in the code below. I'd like to find the minimum and maximum values so I can rescale these values between 0-255. Ultimately I'll be ... | The Metal Shading Language has atomic compare-and-swap functions you can use to compare the existing value at a memory location with a value, and replace the value at that location if they don't compare equal. With these, you can create a set of atomic compare-and-replace-if-[greater|less]-than operations:
static void ... | Metal³ | 36,663,645 | 13 |
In Metal what is the difference between a packed_float4 and a float4?
| This information is from here
float4 has an alignment of 16 bytes. This means that the memory address of such a type (e.g. 0x12345670) will be divisible by 16 (aka the last hexadecimal digit is 0).
packed_float4 on the other hand has an alignment of 4 bytes. Last digit of the address will be 0, 4, 8 or c
This does matt... | Metal³ | 38,773,807 | 13 |
Is it possible to import or include metal file into another metal file? Say I have a metal file with all the math functions and I will only include or import it if it is needed in my metal project. Is it possible?
I tried:
#include "sdf.metal"
and I got error:
metallib: Multiply defined symbols _Z4vmaxDv2_f
Comman... | Your setup is incorrect (EDIT: And so was my setup in my other answer and the previous version of this answer.)
You can use a header just like in C++ (Metal is based on C++11, after all...). All you need one is more file, I'll call it SDF.h. The file includes function prototype declarations without a namespace declar... | Metal³ | 39,283,565 | 13 |
I got this passthrough vertex shader I used from Apple's sample code:
vertex VertexIO vertexPassThrough(device packed_float4 *pPosition [[ buffer(0) ]],
device packed_float2 *pTexCoords [[ buffer(1) ]],
uint vid [[ vertex_id ]]... | You need to ensure the shader can only read from those buffers, so you need to change the declaration to const device:
vertex VertexIO vertexPassThrough(const device packed_float4 *pPosition [[ buffer(0) ]],
const device packed_float2 *pTexCoords [[ buffer(1) ]],
... | Metal³ | 57,692,571 | 13 |
I want to pass a float to my metal shader. I cannot figure out how.
Here is my shader:
vertex float4 model_vertex(unsigned int iid[[instance_id]]
constant float angle) {
float number = float(iid) / 64.0;
return float4(number * sin(angle), number * cos(angle), 0.0, 1.0);
}
Now I want ... | Also in 10.11+ and iOS 9+ you can use:
public func setVertexBytes(bytes: UnsafePointer<Void>, length: Int, atIndex index: Int)
Which is documented to be better than creating a MTLBuffer if you're only using the buffer once (and your data is less than 4K long).
| Metal³ | 26,298,840 | 12 |
This is an absolute beginner question.
Background: I’m not really a game developer, but I’m trying to learn the basics of low-level 3D programming, because it’s a fun and interesting topic. I’ve picked Apple’s Metal as the graphics framework. I know about SceneKit and other higher level frameworks, but I’m intentionall... | There is no one recommended way. When you're working at such a low level as Metal, there are many possibilities, and the one you pick depends heavily on the situation and what performance characteristics you want/need to optimize for. If you're just playing around with intro projects, most of these decisions are irrele... | Metal³ | 34,485,259 | 12 |
I am trying to compute sum of large array in parallel with metal swift.
Is there a god way to do it?
My plane was that I divide my array to sub arrays, compute sum of one sub arrays in parallel and then when parallel computation is finished compute sum of sub sums.
for example if I have
array = [a0,....an]
I divid... | I took the time to create a fully working example of this problem with Metal. The explanation is in the comments:
let count = 10_000_000
let elementsPerSum = 10_000
// Data type, has to be the same as in the shader
typealias DataType = CInt
let device = MTLCreateSystemDefaultDevice()!
let library = self.library(devic... | Metal³ | 38,164,634 | 12 |
I have a Metal texture, I want to access its data from Swift by making it a float4 array (so that I can access each pixel 4 color components).
I discovered this method of MTLTexture :
getBytes(UnsafeMutableRawPointer, bytesPerRow: Int, bytesPerImage: Int, from: MTLRegion, mipmapLevel: Int, slice: Int)
I don't know... | First, let's assume you have a UnsafeRawPointer and a length:
let ptr: UnsafeRawPointer = ...
let length: Int = ...
Now you want to convert that to an [float4]. First, you can convert your UnsafeRawPointer to a typed pointer by binding it to a type:
let float4Ptr = ptr.bindMemory(to: float4.self, capacity: length)
No... | Metal³ | 41,574,498 | 12 |
Whenever I build a project that includes a metal shader to an x86_64 target (iOS simulator), I get a dependency analysis warning:
warning: no rule to process file '[File Path]/Shaders.metal' of type sourcecode.metal for architecture x86_64
I know this isn't a huge issue but I like to keep my projects free from warnings... | You can resolve this by precompiling your .metal file into a Metal library during the build step, and removing the .metal source code from your app target.
Remove .metal file from target
Select your .metal file in the project navigator, and uncheck the target that is giving you the warning.
Metal library compile script... | Metal³ | 46,254,475 | 12 |
I am going through the Metal iOS Swift example trying to understand the triple buffering practice they suggest. This is shown inside of the demo for the uniform animations.
As I understand it aligned memory simply starts at a specefic increment that is a multiple of some byte amount that the device really likes. My con... | Let's talk first about why you'd want aligned buffers, then we can talk about the bitwise arithmetic.
Our goal is to allocate a Metal buffer that can store three (triple-buffered) copies of our uniforms (so that we can write to one part of the buffer while the GPU reads from another). In order to read from each of thes... | Metal³ | 46,431,114 | 12 |
I have a Metal fragment shader that returns some transparent colors with an alpha channel and I'd like to reveal a UIView under the MTKView, but they only background result I get is black and "error noise".
MTLRenderPipelineDescriptor:
pipelineStateDescriptor.isAlphaToCoverageEnabled = true
pipelineStateDescriptor.colo... | If a UIView may have transparent content or otherwise fail to fill itself with opaque drawing, then it should set its opaque (isOpaque) property to false so that it will be properly composited with whatever is behind it. Since, MTKView is a subclass of UIView, this applies to it as well.
| Metal³ | 47,643,974 | 12 |
What I am Trying to Do
I am trying to show filters on a camera feed by using a Metal view: MTKView. I am closely following the method of Apple's sample code - Enhancing Live Video by Leveraging TrueDepth Camera Data (link).
What I Have So Far
Following code works great (mainly interpreted from above-mentioned sample c... |
There are a few things you can do to improve the performance:
Render into the view’s drawable directly instead of rendering into a texture and then rendering again to render that texture into the view.
Use the newish CIRenderDestination API to defer the actual texture retrieval to the moment the view is actually rend... | Metal³ | 55,769,612 | 12 |
I'm an Objective-C / Swift software developer (in training) currently with an application in the App Store. But I have recently really been interested in Metal, Apple's new alternative to OpenGL. But I'm not exactly sure how to begin... Apple's documentation is handy, but only if you really know what you are doing in t... | Metal is a newer graphics API. So if you are new to graphics and 3D game programming you may want to start with OpenGL- specifically since there are many textbooks out there that teaches you fundamentals of graphics using OpenGL. As for a web page on OpenGL, one of my favorite ones is songho. Books on OpenGL ES2.0 and ... | Metal³ | 28,229,199 | 11 |
I am trying to let a neural net run on metal.
The basic idea is that of data duplication. Each gpu thread runs one version of the net for random data points.
I have written other shaders that work fine.
I also tried my code in a c++ command line app. No errors there.
There is also no compile error.
I used the apple d... | The real problem:
It is a memory issue!
To all the people saying that it was a memory issue, you were right!
Here is some pseudo code to illustrate it. Sorry that it is in "Swift" but easier to read. Metal Shaders have a funky way of coming to life. They are first initialised without values to get the memory. It was th... | Metal³ | 32,193,726 | 11 |
I'm seeing very inconsistent frame rates in the SceneKit starter project. Sometimes it runs constantly at 60 fps (12ms rendering, 6ms metal flush), and sometimes it runs constantly at 40 fps (20ms rendering, 6ms metal flush), no more, no less.
The frame rate changes randomly when I reopen the app, and will stay at th... | Unfortunately it looks like SceneKit (and SpriteKit) are in evolutionary stages of development, at the expense of those using them.
This problem is definitely on all devices, and the following frameworks, that I know of:
SceneKit
SpriteKit
Metal
Even using OpenGL instead of Metal in the game frameworks the problem st... | Metal³ | 32,821,033 | 11 |
Can I debug my metal-shading-language code using console output (like print in Swift)?
If yes, how?
If no, are there any other ways to output variables from my .metal file? (Maybe by passing data from the .metal file to my .swift file using the commandEncoder-buffer?)
I have unsuccessfully tried to pass a reference to... | Here's a working solution in case somebody needs it:
let device = MTLCreateSystemDefaultDevice()!
let commandQueue = device.newCommandQueue()
let defaultLibrary = device.newDefaultLibrary()!
let commandBuffer = commandQueue.commandBuffer()
let computeCommandEncoder = commandBuffer.computeCommandEncoder()
let program =... | Metal³ | 35,985,353 | 11 |
I'm looking for just a working Metal shader that works in SceneKit with SCNProgram.
Can someone show me the correct method declarations/how to hook this up?
let program = SCNProgram()
program.vertexFunctionName = "myVertex"
program.fragmentFunctionName = "myFragment"
material.program = program
and then the shader
//My... | I clipped out all the 'unnecessary' stuff, this is about as basic as it gets and pretty much what my first Metal shader was.
Next I'd start looking into wiring up the other vertex attributes (colour, normals), and maybe do some basic lighting calculations.
#include <metal_stdlib>
using namespace metal;
#include <SceneK... | Metal³ | 37,697,939 | 11 |
When trying to use Metal to rapidly draw pixel buffers to the screen from memory, we create MTLBuffer objects using MTLDevice.makeBuffer(bytesNoCopy:..) to allow the GPU to directly read the pixels from memory without having to copy it. Shared memory is really a must-have for achieving good pixel transfer performance.
... | I have submitted an Apple TSI (Technical Support Incident) for this question, and the answer is basically yes, it is safe. Here is the exact response in case anyone is interested:
After discussing your approach with engineering we concluded that it
was valid and safe. Some noteworthy quotes:
“The framework shouldn’... | Metal³ | 39,951,878 | 11 |
I'm recording the screen from my iPhone device to my Mac. As a preview layer, I am collecting sample buffers directly from an AVCaptureVideoDataOutput, from which I'm creating textures and rendering them with Metal. The problem I'm having is that code that worked in macOS prior to 10.13 stopped working after updating t... | I've come across the same issue, the problem was not asking for Metal compatibility when configuring the AVCaptureVideoDataOutput. I guess the system started to check this in macOS 10.13, possibly to apply some optimization when not requested.
The solution was to add the kCVPixelBufferMetalCompatibilityKey to the video... | Metal³ | 46,549,906 | 11 |
If you're using iOS Metal, and you have custom programmatic object models, and (like me) your models stopped working with the advent of Metal2 and iOS 11, then you've probably started looking into how to programmatically generate an MDLMesh.
Apple documentation says, "Typically, you obtain meshes by traversing the obje... | There are plenty of examples creating an MDLMesh using one of the factory parametric methods for e.g., a cube:
[MDLMesh newBoxWithDimensions:...
Using the most simple of these, for a "plane" (a rectangle), I generated a 1x1 rect with the minimum number of vertices:
MDLMesh *mdlMesh = [MDLMesh newPlaneWithDimensions:(v... | Metal³ | 46,804,603 | 11 |
Given the iPhone 6 Plus is downscaling from 1242x2208 to 1080x1920, and UIKit is doing that, are there other ways of drawing to the screen that permit absolute (pixel perfect) drawing without downscaling?
I imagine, but am not sure, that OpenGL and Metal can draw pixel perfect graphics on iPhone 6 Plus, but don't know ... | For UIKit the non-integral scale factor doesn't usually matter. For OpenGL or Metal, use the new UIScreen nativeScale property to optimally determine the size of your framebuffer or drawable.
| Metal³ | 25,839,514 | 10 |
I'm interested in moving away from Xcode and manually compiling Metal shaders in a project for a mixed-language application.
I have no idea how to do this, though. Xcode hides the details of shader compilation and subsequent loading into the application at runtime (you just call device.newDefaultLibrary()). Is this eve... | Generally, you have three ways to load a shader library in Metal:
Use runtime shader compilation from shader source code via the MTLDevice newLibraryWithSource:options:error: or newLibraryWithSource:options:completionHandler: methods. Although purists may shy away from runtime compilation, this option has minimal prac... | Metal³ | 32,298,719 | 10 |
I'm currently trying to draw a graphic that will be animated using Metal in Swift. I have successfully drawn a single frame of my graphic. The graphic is simple, as you can see from this image. What I can't figure out is how to multisample the drawing. There seems to be few references on Metal in general, especially in... | This is substantially simpler with MTKView (just set sampleCount to your desired number of MSAA samples on the view and the pipeline descriptor), but here are the steps for rolling your own.
When creating a render pipeline state, set the sampleCount of your render pipeline state descriptor to your multisample count.
A... | Metal³ | 36,227,209 | 10 |
What's the correct way to generate a MTLTexture backed by a CVPixelBuffer?
I have the following code, but it seems to leak:
func PixelBufferToMTLTexture(pixelBuffer:CVPixelBuffer) -> MTLTexture
{
var texture:MTLTexture!
let width = CVPixelBufferGetWidth(pixelBuffer)
let height = CVPixelBufferGetHeight(pixe... | Ah, I was missing: textureRef?.release()
| Metal³ | 37,445,052 | 10 |
I am new to MetalKit and trying to convert this tutorial from playground back to OSX app:
import MetalKit
public class MetalView: MTKView {
var queue: MTLCommandQueue! = nil
var cps: MTLComputePipelineState! = nil
required public init(coder: NSCoder) {
super.init(coder: coder)
device ... | If you want to write to a drawable's texture from a compute function, you'll need to tell the MTKView that it should configure its layer not to be framebuffer-only:
metalView.framebufferOnly = false
With this value set to false, your drawable will give you a texture with the shaderWrite usage flag set, which is requir... | Metal³ | 39,206,935 | 10 |
With every Implementation of Metal based ImageView I'm facing the same problem
let targetTexture = currentDrawable?.texture else{ return }
Value of type 'MTLDrawable' has no member 'texture'
Seems like apple has changed some metal api
here is the full function I'm tryong to use:
func renderImage()
{
guard let
... | I had the same problem after performing a system and xcode update. Turns out during the update process, xcode switched the build target to the simulator. Once I switched the target back to the device it all compiled again.
| Metal³ | 41,916,306 | 10 |
I'm using a MTKView to draw Metal content. It's configured as follows:
mtkView = MTKView(frame: self.view.frame, device: device)
mtkView.colorPixelFormat = .bgra8Unorm
mtkView.delegate = self
mtkView.sampleCount = 4
mtkView.isPaused = true
mtkView.enableSetNeedsDisplay = true
setFrameSize is overriden to trigger a red... | In my usage of Metal and MTKView, I tried various combinations of presentsWithTransaction and waitUntilScheduled without success. I still experienced occasional frames of stretched content in between frames of properly rendered content during live resize.
Finally, I dropped MTKView altogether and made my own NSView sub... | Metal³ | 45,375,548 | 10 |
In Metal shading language, what is the exact difference between read and sample function to access texture pixels, and which one should be used when?
| A few differences:
You can sample outside the bounds of the texture. But you should not read outside the texture.
Sampling can use normalized coordinates (between 0 and 1). Reading always uses pixel coordinates.
Samplers can interpolate between pixel values (for example if you're sampling in between two pixels). Read... | Metal³ | 49,820,430 | 10 |
I'm trying to implement voxel cone tracing in Metal. One of the steps in the algorithm is to voxelize the geometry using a geometry shader. Metal does not have geometry shaders so I was looking into emulating them using a compute shader. I pass in my vertex buffer into the compute shader, do what a geometry shader woul... | Here's a very speculative possibility depending on exactly what your geometry shader needs to do.
I'm thinking you can do it sort of "backwards" with just a vertex shader and no separate compute shader, at the cost of redundant work on the GPU. You would do a draw as if you had a buffer of all of the output vertices of... | Metal³ | 50,557,224 | 10 |
I'm trying to get multisampling working with MTKView. I have an MTKView with a delegate. I set the view's sampleCount property to 4. I create a pipeline state descriptor with the rasterSampleCount set to 4, and use that to make a render pipeline state that I use when rendering.
In the delegate's draw(in:) method, I cre... | What's the initial configuration of renderPassDescriptor (as returned from metalView.currentRenderPassDescriptor?
I believe you want the color attachment's texture set to metalView.multisampleColorTexture and its resolveTexture set to metalView.currentDrawable.texture. That is, it should do the primary, multi-sampled r... | Metal³ | 52,846,343 | 10 |
I'm experimenting with SwiftUI and Metal. I've got 2 windows, one with various lists and controls and the other a Metal window.
I had the slider data updating the Metal window but when I moved the slider the FPS dropped from 60 to around 25. I removed all links between the views and moving the sliders still drops th... | As 0xBFE1A8 said SwiftUI was blocking the main thread. I moved the draw function into a callback setup using CVDisplayLink .global(qos: .userInteractive). This stops the rendering slowing down when the sliders are moved.
| Metal³ | 59,212,294 | 10 |
Recently I'm looking at Ansible and want to use it in projects. And also there's another tool Rundeck can be used to do all kinds of Operations works. I have experience with neither tool and this is my current understanding about them:
Similar points
Both tools are agent-less and use SSH to execute commands on remote ... | TL;DR - given your environment of Jenkins for CI/CD I'd recommend using just Ansible.
You've spotted that there is sizeable cross-over between Ansible & Rundeck, so it's probably best to concentrate on where each product focuses, it's style and use.
Focus
I believe Rundeck's focus is in enabling sysadmins to build a (w... | Rundeck | 31,152,102 | 48 |
I have a script I want to be available globally. I've started it with the standard hashbang:
#! /usr/bin/env python
And linked it into the bin directory of my virtualenv:
~/environments/project/env/bin/myscript
And added that directory to my path. When I run the command:
myscript
I get an import error with one of th... | Putting the script into the bin of your virtualenv, and then adding that bin location to your global PATH will not automatically source your virtualenv. You do need to source it first to make it active.
All that your system knows is to check that extra path for the executable and run it. There isn't anything in that s... | Rundeck | 11,963,019 | 47 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.