ld: finish librashader_ld
This commit is contained in:
parent
f0e4546e57
commit
da4f61fcc4
163
.clang-format
163
.clang-format
|
@ -1,192 +1,95 @@
|
|||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
# BasedOnStyle: Google
|
||||
AccessModifierOffset: -1
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignArrayOfStructures: None
|
||||
AlignConsecutiveMacros: None
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignConsecutiveBitFields: None
|
||||
AlignConsecutiveDeclarations: None
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlinesLeft: true
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortEnumsOnASingleLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
AttributeMacros:
|
||||
- __capability
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: Never
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeConceptDeclarations: true
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
QualifierAlignment: Leave
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DeriveLineEnding: true
|
||||
DerivePointerAlignment: false
|
||||
DerivePointerAlignment: true
|
||||
DisableFormat: false
|
||||
EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
PackConstructorInitializers: BinPack
|
||||
BasedOnStyle: ''
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IfMacros:
|
||||
- KJ_IF_MAYBE
|
||||
IncludeBlocks: Preserve
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '.*'
|
||||
- Regex: '^<.*\.h>'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseLabels: false
|
||||
IndentCaseBlocks: false
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentExternBlock: AfterExternBlock
|
||||
IndentRequires: false
|
||||
IndentWidth: 2
|
||||
- Regex: '^<.*'
|
||||
Priority: 2
|
||||
- Regex: '.*'
|
||||
Priority: 3
|
||||
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||
IndentCaseLabels: true
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertTrailingCommas: None
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
LambdaBodyIndentation: Signature
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCBlockIndentWidth: 4
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
ObjCSpaceBeforeProtocolList: false
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakOpenParenthesis: 0
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PenaltyIndentedWhitespace: 0
|
||||
PointerAlignment: Right
|
||||
PPIndentWidth: -1
|
||||
ReferenceAlignment: Pointer
|
||||
PenaltyReturnTypeOnItsOwnLine: 200
|
||||
PointerAlignment: Left
|
||||
ReflowComments: true
|
||||
RemoveBracesLLVM: false
|
||||
SeparateDefinitionBlocks: Leave
|
||||
ShortNamespaceLines: 1
|
||||
SortIncludes: CaseSensitive
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: true
|
||||
SortIncludes: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeParensOptions:
|
||||
AfterControlStatements: true
|
||||
AfterForeachMacros: true
|
||||
AfterFunctionDefinitionName: false
|
||||
AfterFunctionDeclarationName: false
|
||||
AfterIfMacros: true
|
||||
AfterOverloadedOperator: false
|
||||
BeforeNonEmptyParentheses: false
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: Never
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesBeforeTrailingComments: 4
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 1
|
||||
Maximum: -1
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
SpaceBeforeSquareBrackets: false
|
||||
BitFieldColonSpacing: Both
|
||||
Standard: Latest
|
||||
StatementAttributeLikeMacros:
|
||||
- Q_EMIT
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
Standard: Auto
|
||||
TabWidth: 8
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros:
|
||||
- STRINGIZE
|
||||
- PP_STRINGIZE
|
||||
- BOOST_PP_STRINGIZE
|
||||
- NS_SWIFT_NAME
|
||||
- CF_SWIFT_NAME
|
||||
...
|
||||
|
||||
|
|
|
@ -1,3 +1,28 @@
|
|||
/*
|
||||
librashader.h
|
||||
SPDX-License-Identifier: MIT
|
||||
This file is part of the librashader C headers.
|
||||
|
||||
Copyright 2022 chyyran
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __LIBRASHADER_H__
|
||||
#define __LIBRASHADER_H__
|
||||
|
||||
|
|
|
@ -1,3 +1,28 @@
|
|||
/*
|
||||
librashader_ld.h
|
||||
SPDX-License-Identifier: MIT
|
||||
This file is part of the librashader C headers.
|
||||
|
||||
Copyright 2022 chyyran
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __LIBRASHADER_LD_H__
|
||||
#define __LIBRASHADER_LD_H__
|
||||
#pragma once
|
||||
|
@ -5,14 +30,116 @@
|
|||
#define LIBRA_RUNTIME_D3D11
|
||||
#define LIBRA_RUNTIME_VULKAN
|
||||
|
||||
#include "librashader.h"
|
||||
#define _WIN32
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <libloaderapi.h>
|
||||
#elif defined(__linux__)
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
#include "librashader.h"
|
||||
|
||||
LIBRA_ERRNO __librashader__noop_error_errno(libra_error_t error) {
|
||||
return LIBRA_ERRNO_UNKNOWN_ERROR;
|
||||
}
|
||||
|
||||
int32_t __librashader__noop_error_print(libra_error_t error) { return 1; }
|
||||
|
||||
int32_t __librashader__noop_error_free(libra_error_t *error) { return 1; }
|
||||
|
||||
int32_t __librashader__noop_error_write(libra_error_t error, char **out) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t __librashader__noop_error_free_string(char **out) { return 1; }
|
||||
|
||||
libra_error_t __librashader__noop_preset_create(const char *filename,
|
||||
libra_shader_preset_t *out) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_preset_free(libra_shader_preset_t *preset) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_preset_set_param(
|
||||
libra_shader_preset_t *preset, const char *name, float value) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_preset_get_param(
|
||||
libra_shader_preset_t *preset, const char *name, float *value) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_preset_print(libra_shader_preset_t *preset) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_preset_get_runtime_param_names(
|
||||
libra_shader_preset_t *preset, const char **value) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_gl_init_context(libra_gl_loader_t loader) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_gl_filter_chain_create(
|
||||
libra_shader_preset_t *preset, const struct filter_chain_gl_opt_t *options,
|
||||
libra_gl_filter_chain_t *out) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_gl_filter_chain_frame(
|
||||
libra_gl_filter_chain_t *chain, size_t frame_count,
|
||||
struct libra_source_image_gl_t image, struct libra_viewport_t viewport,
|
||||
struct libra_draw_framebuffer_gl_t out, const float *mvp,
|
||||
const struct frame_gl_opt_t *opt) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_gl_filter_chain_free(
|
||||
libra_gl_filter_chain_t *chain) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_d3d11_filter_chain_create(
|
||||
libra_shader_preset_t *preset,
|
||||
const struct filter_chain_d3d11_opt_t *options, const ID3D11Device *device,
|
||||
libra_d3d11_filter_chain_t *out) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_d3d11_filter_chain_frame(
|
||||
libra_d3d11_filter_chain_t *chain, size_t frame_count,
|
||||
struct libra_source_image_d3d11_t image, struct libra_viewport_t viewport,
|
||||
const ID3D11RenderTargetView *out, const float *mvp,
|
||||
const struct frame_vk_opt_t *opt) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_d3d11_filter_chain_free(
|
||||
libra_d3d11_filter_chain_t *chain) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_vk_filter_chain_create(
|
||||
struct libra_device_vk_t vulkan, libra_shader_preset_t *preset,
|
||||
const struct filter_chain_vk_opt_t *options, libra_vk_filter_chain_t *out) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_vk_filter_chain_frame(
|
||||
libra_vk_filter_chain_t *chain, VkCommandBuffer command_buffer,
|
||||
size_t frame_count, struct libra_image_vk_t image,
|
||||
struct libra_viewport_t viewport, struct libra_image_vk_t out,
|
||||
const float *mvp, const struct FrameOptionsVulkan *opt) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
libra_error_t __librashader__noop_vk_filter_chain_free(
|
||||
libra_vk_filter_chain_t *chain) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
typedef struct libra_instance_t {
|
||||
PFN_libra_preset_create preset_create;
|
||||
|
@ -42,7 +169,132 @@ typedef struct libra_instance_t {
|
|||
PFN_libra_vk_filter_chain_free vk_filter_chain_free;
|
||||
} libra_instance_t;
|
||||
|
||||
libra_instance_t librashader_load_instance(const char *filename) {
|
||||
libra_instance_t __librashader_make_null_instance() {
|
||||
return libra_instance_t{
|
||||
.preset_create = __librashader__noop_preset_create,
|
||||
.preset_free = __librashader__noop_preset_free,
|
||||
.preset_set_param = __librashader__noop_preset_set_param,
|
||||
.preset_get_param = __librashader__noop_preset_get_param,
|
||||
.preset_print = __librashader__noop_preset_print,
|
||||
.preset_get_runtime_param_names =
|
||||
__librashader__noop_preset_get_runtime_param_names,
|
||||
|
||||
.error_errno = __librashader__noop_error_errno,
|
||||
.error_print = __librashader__noop_error_print,
|
||||
.error_free = __librashader__noop_error_free,
|
||||
.error_write = __librashader__noop_error_write,
|
||||
.error_free_string = __librashader__noop_error_free_string,
|
||||
|
||||
.gl_init_context = __librashader__noop_gl_init_context,
|
||||
.gl_filter_chain_create = __librashader__noop_gl_filter_chain_create,
|
||||
.gl_filter_chain_frame = __librashader__noop_gl_filter_chain_frame,
|
||||
.gl_filter_chain_free = __librashader__noop_gl_filter_chain_free,
|
||||
|
||||
.d3d11_filter_chain_create =
|
||||
__librashader__noop_d3d11_filter_chain_create,
|
||||
.d3d11_filter_chain_frame =
|
||||
__librashader__noop_d3d11_filter_chain_frame,
|
||||
.d3d11_filter_chain_free = __librashader__noop_d3d11_filter_chain_free,
|
||||
|
||||
.vk_filter_chain_create = __librashader__noop_vk_filter_chain_create,
|
||||
.vk_filter_chain_frame = __librashader__noop_vk_filter_chain_frame,
|
||||
.vk_filter_chain_free = __librashader__noop_vk_filter_chain_free,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define _LIBRASHADER_ASSIGN_FARPROC(HMOD, INSTANCE, NAME) \
|
||||
{ \
|
||||
FARPROC address = GetProcAddress(HMOD, "libra_" #NAME); \
|
||||
if (address != NULL) { \
|
||||
(INSTANCE).NAME = (PFN_libra_##NAME)address; \
|
||||
} \
|
||||
}
|
||||
|
||||
libra_instance_t librashader_load_instance() {
|
||||
HMODULE librashader = LoadLibraryW(L"librashader.dll");
|
||||
libra_instance_t instance = __librashader_make_null_instance();
|
||||
if (librashader == 0) {
|
||||
return instance;
|
||||
}
|
||||
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, preset_create);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, preset_free);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, preset_set_param);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, preset_get_param);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, preset_print);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, preset_get_runtime_param_names);
|
||||
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, error_errno);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, error_print);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, error_free);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, error_write);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, error_free_string);
|
||||
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, gl_init_context);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, gl_filter_chain_create);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, gl_filter_chain_frame);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, gl_filter_chain_free);
|
||||
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, d3d11_filter_chain_create);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, d3d11_filter_chain_frame);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, d3d11_filter_chain_free);
|
||||
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, vk_filter_chain_create);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, vk_filter_chain_frame);
|
||||
_LIBRASHADER_ASSIGN_FARPROC(librashader, instance, vk_filter_chain_free);
|
||||
|
||||
return instance;
|
||||
}
|
||||
#elif defined(__linux__)
|
||||
#define _LIBRASHADER_ASSIGN_DLSYM(HMOD, INSTANCE, NAME) \
|
||||
{ \
|
||||
void* address = dlsym(HMOD, "libra_" #NAME); \
|
||||
if (address != NULL) { \
|
||||
(INSTANCE).NAME = (PFN_libra_##NAME)address; \
|
||||
} \
|
||||
}
|
||||
|
||||
libra_instance_t librashader_load_instance() {
|
||||
void* librashader = dlopen(L"librashader.so", RTLD_LAZY);
|
||||
libra_instance_t instance = __librashader_make_null_instance();
|
||||
if (librashader == NULL) {
|
||||
return instance;
|
||||
}
|
||||
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, preset_create);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, preset_free);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, preset_set_param);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, preset_get_param);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, preset_print);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, preset_get_runtime_param_names);
|
||||
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, error_errno);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, error_print);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, error_free);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, error_write);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, error_free_string);
|
||||
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, gl_init_context);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, gl_filter_chain_create);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, gl_filter_chain_frame);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, gl_filter_chain_free);
|
||||
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, d3d11_filter_chain_create);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, d3d11_filter_chain_frame);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, d3d11_filter_chain_free);
|
||||
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, vk_filter_chain_create);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, vk_filter_chain_frame);
|
||||
_LIBRASHADER_ASSIGN_DLSYM(librashader, instance, vk_filter_chain_free);
|
||||
|
||||
return instance;
|
||||
}
|
||||
#else
|
||||
libra_instance_t librashader_load_instance() {
|
||||
return __librashader_make_null_instance();
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -6,8 +6,6 @@ usize_is_size_t = true
|
|||
documentation_style = "c++"
|
||||
after_includes = "#if defined(_WIN32) && defined(LIBRA_RUNTIME_D3D11)\n#include <d3d11.h>\n#else\ntypedef void ID3D11Device;typedef void ID3D11RenderTargetView;typedef void ID3D1ShaderResourceView;\n#endif\n#if defined(LIBRA_RUNTIME_VULKAN)\n#include <vulkan\\vulkan.h>\n#endif"
|
||||
|
||||
|
||||
|
||||
[defines]
|
||||
"feature = runtime-opengl" = "LIBRA_RUNTIME_OPENGL"
|
||||
"feature = runtime-d3d11" = "LIBRA_RUNTIME_D3D11"
|
||||
|
@ -59,7 +57,7 @@ include = [
|
|||
"PFN_libra_d3d11_filter_chain_frame",
|
||||
"PFN_libra_d3d11_filter_chain_free",
|
||||
|
||||
# d3d11
|
||||
# vulkan
|
||||
"PFN_libra_vk_filter_chain_create",
|
||||
"PFN_libra_vk_filter_chain_frame",
|
||||
"PFN_libra_vk_filter_chain_free",
|
||||
|
|
|
@ -4,21 +4,14 @@
|
|||
#include <iostream>
|
||||
#include <filesystem>
|
||||
|
||||
#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
|
||||
VK_DEFINE_HANDLE(VkInstance)
|
||||
typedef void (*PFN_vkVoidFunction)(void);
|
||||
typedef PFN_vkVoidFunction(*PFN_vkGetInstanceProcAddr)(VkInstance instance, const char* pName);
|
||||
|
||||
|
||||
#define LIBRA_RUNTIME_OPENGL
|
||||
#define LIBRA_RUNTIME_VULKAN
|
||||
|
||||
#include "../../../../include/librashader.h"
|
||||
#include "../../../../include/librashader_ld.h"
|
||||
int main()
|
||||
{
|
||||
std::cout << "Hello World!\n";
|
||||
std::cout << std::filesystem::current_path() << std::endl;
|
||||
libra_shader_preset_t preset;
|
||||
auto instance = librashader_load_instance();
|
||||
|
||||
/*libra_shader_preset_t preset;
|
||||
auto error = libra_preset_create("../../../slang-shaders/border/gameboy-player/gameboy-player-crt-royale.slangp", &preset);
|
||||
if (error != NULL) {
|
||||
std::cout << "error happened\n";
|
||||
|
@ -27,9 +20,6 @@ int main()
|
|||
|
||||
libra_gl_filter_chain_t chain;
|
||||
|
||||
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
|
||||
libra_PFN_vkGetInstanceProcAddr entry = reinterpret_cast<libra_PFN_vkGetInstanceProcAddr>(GetInstanceProcAddr);
|
||||
|
||||
error = libra_gl_filter_chain_create(NULL, NULL, &chain);
|
||||
if (error != NULL) {
|
||||
libra_error_print(error);
|
||||
|
@ -38,7 +28,7 @@ int main()
|
|||
printf("%s", error_str);
|
||||
libra_error_free_string(&error_str);
|
||||
printf("%s", error_str);
|
||||
}
|
||||
}*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -142,16 +142,11 @@
|
|||
<ClCompile Include="librashader-capi-tests.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\..\librashader-capi\librashader.h" />
|
||||
<ClInclude Include="..\..\..\..\include\librashader.h" />
|
||||
<ClInclude Include="..\..\..\..\include\librashader_ld.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Library Include="..\..\..\..\target\debug\librashader_capi.dll.lib" />
|
||||
<Library Include="..\..\..\..\target\debug\librashader_capi.lib" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\..\target\debug\librashader_capi.dll">
|
||||
<DeploymentContent>true</DeploymentContent>
|
||||
</None>
|
||||
<Library Include="..\..\..\..\target\debug\librashader.dll.lib" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
|
Loading…
Reference in a new issue