GithubHelp home page GithubHelp logo

turol / smaademo Goto Github PK

View Code? Open in Web Editor NEW
70.0 8.0 3.0 89.37 MB

Subpixel Morphological AntiAliasing OpenGL/Vulkan demo

License: MIT License

C 14.03% Makefile 0.36% Shell 0.17% C++ 54.84% HTML 19.36% Python 0.62% Gnuplot 0.01% CSS 0.13% CMake 0.52% GLSL 8.21% JavaScript 1.16% Lua 0.18% Emacs Lisp 0.01% Objective-C 0.02% Yacc 0.22% Objective-C++ 0.13% Batchfile 0.02% Roff 0.01% M4 0.01% Assembly 0.01%
opengl vulkan antialiasing smaa

smaademo's Introduction

	SMAA Demo

This is a small program demonstrating the use of the Subpixel Morphological Antialiasing implementation from https://github.com/iryoku/smaa/.

Building
========

Linux: Go to /binaries and type make. To change build settings copy example.mk to local.mk in the same directory. You only need to include changed lines in local.mk. The build defaults to Vulkan renderer, to use OpenGL set "RENDERER:=opengl" in local.mk.

Windows: There is a Visual Studio 2015 solution in /windows/SMAADemo.sln. You will need cmake, Python3, SDL2 and Vulkan SDK. You also need to build the following libraries from the included sources under /foreign:
SPIRV-Tools.lib
SPIRV-Tools-comp.lib
SPIRV-Tools-opt.lib
spirv-cross-core.lib
spirv-cross-glsl.lib

You can use the included windows/build-foreign.bat file to automatically build the required libraries with cmake.


Usage
=====

Command line options:
"--debug"            - Enable renderer debugging.
"--trace"            - Enable renderer tracing.
"--nocache"          - Don't load shaders from cache.
"-f", "--fullscreen" - Start in fullscreen mode.
"novsync"            - Disable vsync.
"--width <value>"    - Specify window width.
"--height <value>"   - Specify window height.
"<file path> ..."    - Load specified image(s).

Key commands:
A - Toggle antialiasing on/off
C - Re-color cubes
D - Cycle through debug visualizations. Hold SHIFT to cycle in opposite direction.
F - Toggle fullscreen
H - Print help
M - Change antialiasing method (SMAA/FXAA)
Q - Cycle through AA quality levels. Hold SHIFT to cycle in opposite direction.
V - Toggle vsync
LEFT/RIGHT ARROW - Cycle through scenes
SPACE - Toggle camera rotation
ESC - Quit


Third-party software
====================

GLEW (http://glew.sourceforge.net)
GLM (OpenGL Mathematics) (http://glm.g-truc.net/0.9.8)
glslang (https://github.com/KhronosGroup/glslang)
Dear ImGui (https://github.com/ocornut/imgui)
PCG-Random (http://www.pcg-random.org)
SPIRV-Cross (https://github.com/KhronosGroup/SPIRV-Cross)
SPIRV-Headers (https://github.com/KhronosGroup/SPIRV-Headers)
SPIRV-Tools (https://github.com/KhronosGroup/SPIRV-Tools)
stb_image (https://github.com/nothings/stb/)
TCLAP (http://tclap.sourceforge.net)
Vulkan Memory Allocator (https://gpuopen.com/gaming-product/vulkan-memory-allocator/)


Authors
=======

Turo Lamminen [email protected]
Tuomas Närväinen [email protected]


Copyright and License
=====================

Copyright (c) 2015-2024 Alternative Games Ltd / Turo Lamminen

This code is licensed under the MIT license (see license.txt).

Third-party code under foreign/ is licensed according to their respective licenses.

smaademo's People

Contributors

tuomasn avatar turol 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smaademo's Issues

throwing an instance of 'vk::LayerNotPresentError'

Hi, when I run the command "./smaaDemo-bin --debug -f --width 500 --height 500 patch_15104.png", I got the following issues:
"terminate called after throwing an instance of 'vk::LayerNotPresentError'
what(): vk::createInstance: ErrorLayerNotPresent
Aborted (core dumped)
"
I have successfully make the program, So, can anybody tell me what's wrong with this, and how to resolve it.

Boost Version

Using boost on Ubuntu 16.04 I can't build this package. Compilation errors are coming from boost, and I'm certain there's a version mismatch.

Which version of boost should this project be built against?

Thanks!

Shader fails to compile on current radeon/mesa git

When I try to execute the program (after removing the icf from LDFLAGS), the program crashes:

$ ./binaries/smaaDemo-bin
Number of displays detected: 1
Number of display modes for display 0 : 22
Display mode 0 : width 1920, height 1080, BPP 24
Display mode 1 : width 1680, height 1050, BPP 24
Display mode 2 : width 1600, height 1200, BPP 24
Display mode 3 : width 1440, height 900, BPP 24
Display mode 4 : width 1400, height 1050, BPP 24
Display mode 5 : width 1280, height 1024, BPP 24
Display mode 6 : width 1280, height 1024, BPP 24
Display mode 7 : width 1280, height 960, BPP 24
Display mode 8 : width 1152, height 864, BPP 24
Display mode 9 : width 1024, height 768, BPP 24
Display mode 10 : width 1024, height 768, BPP 24
Display mode 11 : width 1024, height 768, BPP 24
Display mode 12 : width 832, height 624, BPP 24
Display mode 13 : width 800, height 600, BPP 24
Display mode 14 : width 800, height 600, BPP 24
Display mode 15 : width 800, height 600, BPP 24
Display mode 16 : width 800, height 600, BPP 24
Display mode 17 : width 720, height 400, BPP 24
Display mode 18 : width 640, height 480, BPP 24
Display mode 19 : width 640, height 480, BPP 24
Display mode 20 : width 640, height 480, BPP 24
Display mode 21 : width 640, height 480, BPP 24
VSync is on
ARB_direct_state_access found
Vertex array objects enabled
Sampler objects enabled
GL vendor: "X.Org"
GL renderer: "Gallium 0.4 on AMD BARTS (DRM 2.43.0, LLVM 3.7.0)"
GL version: "3.3 (Core Profile) Mesa 11.2.0-devel (git-57fc0dd)"
GLSL version: "3.30"
shader "fxaa.frag" info log:
0:897(16): error: no matching function for call to `textureGather(sampler2D, vec2, int)'; candidates are:
0:898(16): error: no matching function for call to `textureGatherOffset(sampler2D, vec2, ivec2, int)'; candidates are:

info log end
caught std::exception "shader compile failed"
terminate called after throwing an instance of 'std::runtime_error'
  what():  shader compile failed
Aborted

According to https://www.opengl.org/sdk/docs/man/html/textureGatherOffset.xhtml the function is only available on GLSL 4 and above.

According to http://mesamatrix.net/, my card (using r600) should support GL_ARB_texture_gather. Why doesn't it compile?
I assume there is a missing pushLine("#extension GL_ARB_texture_gather : enable"); somewhere.

As a fallback, could you disable FXAA on GLSL version < 4? The SMAA demo should run nevertheless.

ld: unrecognized option '--icf=all' in Linux

$ make
g++ -g -Wl,-rpath,. -Wl,-rpath,/usr/local/lib:./lib32 -Wl,--gc-sections,--icf=all  -o smaaDemo-bin demo/smaaDemo.o foreign/glew/src/glew.o     -L/usr/lib64 -lSDL2 -lpthread -lGL
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld: unrecognized option '--icf=all'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
../module.mk:181: recipe for target 'smaaDemo-bin' failed
make: *** [smaaDemo-bin] Error 1

As far as I know, there is no icf option for either clang or gcc.

Window start up like one second and shut down immediately

I use VS2017 community 64bits to compile the Debug version OpenGL and Vulkan.
Both start then shut down immediately, and I don't know why since it already show no more error.
Have you encounter this before? What did I do wrong.

Boost downloaded and built it as 64 bits. Include and library.
Vulkan SDK installed. Include and library.
SDL2 dev kit downloaded. Include and library.
SPIRV-Cross and SPIRV-Tools both cmake 64 bits and built successfully.

IMGUI and background issue

I am sorry, I have two question left.
(1).
I did successfully run your program.
But once I click the TAA enable button it would cause exception. (with SMAA)
It point to /renderer/redererinternal.h line 81 : handle.handle != 0
However, I press 'T' button instead, it would be fine and work.
Is IMGUI bugged? or I did something wrong again :P

(2).
If I background the window, it call abort() and the program shut down.
I saw it abort() is define as UNREACHABLE()
So this is intend to doing so?

Thank you for answered me yesterday.
Once all the execute issue is cleared, I will look into your code.
Your code is clean and a good learning source, thank you again!

16RGBA format

How would one go about extending the format to RGBA16? Are there any problems other than add Format enums?

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.