Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some improvements #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# shex: SHader + HEX
Hex viewer for Linux using Vulkan via GLFW3
Hex viewer for Linux and FreeBSD using Vulkan via GLFW3

This GUI program is written in C++ and requires hardware that supports Vulkan.
It depends on vulkan and glfw3

To build: type inside the shex/ directory:

./mk
make

If you modify the shaders/shader.frag, then you will need xxd to rebuild it.
If you modify the shaders/shader.frag, or shaders/shader.vert then you will need to rebuild it.
Just type:

./shmk
make shaders

and the script will re-generate the frag.h and vert.h. You will need to rebuild
the executable after that with ./mk script mentioned above.
after that shaders/frag.spv and shaders/vert.spv will be regenerated.
There is no need to rebuild an executable after shader changes.

To test: run the executable file with any binary file as parameter

./shex shaders/frag.spv

There is a windows build command 'mkwin', which allows to cross-compile a
windows binary on linux. I'm not sure it's working, but if you want to test
There is a windows build target, which allows to cross-compile a
windows binary on linux or FreeBSD. I'm not sure it's working, but if you want to test
it, type this in the shex/ directory:

./mkwin
make win

You might need to put these files in the same directory as shex.exe:
glfw3.dll
Expand All @@ -34,4 +34,8 @@ libssp-0.dll

in Arch, those files are located in /usr/x86_64-w64-mingw32/bin/

while compiling under FreeBSD install packages glm, glfw, glslang like this:

pkg install glm glfw glslang

Good Luck and Have Fun!
1,506 changes: 0 additions & 1,506 deletions frag.h

This file was deleted.

15 changes: 3 additions & 12 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,17 +881,8 @@ class Application {
}

void createGraphicsPipeline() {
std::vector<uint8_t> vertShaderCode = {
#include "vert.h"
};
std::vector<uint8_t> fragShaderCode = {
#include "frag.h"
};

VkShaderModule vertShaderModule =
createShaderModule(vertShaderCode);
VkShaderModule fragShaderModule =
createShaderModule(fragShaderCode);
VkShaderModule vertShaderModule = createShaderModule(readFile("shaders/vert.spv"));
VkShaderModule fragShaderModule = createShaderModule(readFile("shaders/frag.spv"));

VkPipelineShaderStageCreateInfo vertShaderStageInfo = {};
vertShaderStageInfo.sType =
Expand Down Expand Up @@ -1803,7 +1794,7 @@ class Application {
currentFrame = (currentFrame + 1) % MAX_FRAMES_IN_FLIGHT;
}

VkShaderModule createShaderModule(const std::vector<uint8_t>& code) {
VkShaderModule createShaderModule(const std::vector<char>& code) {
VkShaderModuleCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
createInfo.codeSize = code.size();
Expand Down
18 changes: 18 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
all:
@echo " CXX main.cpp"
@${CXX} -std=c++17 -L/usr/local/lib -o shex -DMOUSEWHEELYDIR=-1 main.cpp -I. -I/usr/local/include -lglfw -lvulkan -DNDEBUG


clean:
@echo " CLEAN"
@rm -f ./shex

win:
@echo " CXX-win main.cpp"
@x86_64-w64-mingw32-g++ -DNDEBUG -D_WIN64 -D_WIN32 -std=c++17 -o shex.exe main.cpp -I. -DMOUSEWHEELYDIR=-1 -static-libgcc -static-libstdc++ -mwindows -lvulkan -lglfw3 -lgdi32 -fstack-protector-all -L/usr/local/lib -I/usr/local/include

shaders:
@echo " MAKE shaders"
@cd shaders && make

.PHONY: all clean win shaders
2 changes: 0 additions & 2 deletions mk

This file was deleted.

4 changes: 0 additions & 4 deletions mkwin

This file was deleted.

5 changes: 5 additions & 0 deletions shaders/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
all:
@echo " SHD shader.vert"
@glslangValidator -V shader.vert > /dev/null
@echo " SHD shader.frag"
@glslangValidator -V shader.frag > /dev/null
11 changes: 0 additions & 11 deletions shaders/mk

This file was deleted.

2 changes: 0 additions & 2 deletions shmk

This file was deleted.

150 changes: 0 additions & 150 deletions vert.h

This file was deleted.