daily update on 20240213 by nitload youmu. 逐步弃用GLFW,正在使用wgl重写glfw底层,相关实现转移到C#实现,SSC彻底变成线性代数计算器。

This commit is contained in:
Nitload
2024-02-13 23:42:22 +08:00
parent 8391569482
commit a2241a5a58
307 changed files with 16701 additions and 10296 deletions
+17 -15
View File
@@ -30,18 +30,19 @@ SSCAPI void _cdecl initGL(int majorVersion, int minorVersion)
SSCAPI unsigned int loadShaderCode(char* const shaderCode, GLint shadertype)
SSCAPI unsigned int loadShaderCode(GladGLContext* context, char* const shaderCode, GLint shadertype)
{
if (currentContext != NULL)
{
unsigned int shader = currentContext->CreateShader(shadertype);
currentContext->ShaderSource(shader, 1, &shaderCode, NULL);
currentContext->CompileShader(shader);
unsigned int shader = context->CreateShader(shadertype);
context->ShaderSource(shader, 1, &shaderCode, NULL);
context->CompileShader(shader);
int success;
currentContext->GetShaderiv(shader, GL_COMPILE_STATUS, &success);
context->GetShaderiv(shader, GL_COMPILE_STATUS, &success);
if (!success)
{
currentContext->GetShaderInfoLog(shader, 512, NULL, infolog);
context->GetShaderInfoLog(shader, 512, NULL, infolog);
infolog[511] = '\0';
return 0;
}
else
@@ -55,15 +56,15 @@ SSCAPI unsigned int loadShaderCode(char* const shaderCode, GLint shadertype)
}
}
SSCAPI unsigned int linkShaderProgram(GLuint shaderProgram)
SSCAPI unsigned int linkShaderProgram(GladGLContext* context, GLuint shaderProgram)
{
currentContext->LinkProgram(shaderProgram);
context->LinkProgram(shaderProgram);
int success;
currentContext->GetProgramiv(shaderProgram, GL_LINK_STATUS, &success);
context->GetProgramiv(shaderProgram, GL_LINK_STATUS, &success);
if (!success)
{
currentContext->GetProgramInfoLog(shaderProgram, 512, NULL, infolog);
context->GetProgramInfoLog(shaderProgram, 512, NULL, infolog);
return 0;
}
else
@@ -82,15 +83,16 @@ SSCAPI void SSCDECL loadImageData(char* location, Image* out, imageLoader loader
out->pixelPtr = loader(location, &(out->width), &(out->height), &(out->channel), 0);
}
SSCAPI void SSCDECL unloadImageData(Image* out)
{
free(out->pixelPtr);
}
char* _cdecl readLog()
{
infolog[511] = '\0';
return &infolog;
}
SSCAPI void SSCDECL setCurrentGLContext(GLFWwindow* window, GladGLContext* contextPtr)
{
glfwMakeContextCurrent(window);
currentContext = contextPtr;
}
@@ -33,6 +33,14 @@
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Toollist|Win32">
<Configuration>Toollist</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Toollist|x64">
<Configuration>Toollist</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
@@ -55,6 +63,12 @@
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Toollist|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RealDebug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
@@ -82,6 +96,13 @@
<CharacterSet>Unicode</CharacterSet>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Toollist|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RealDebug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
@@ -108,6 +129,9 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Benchmark|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Toollist|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='RealDebug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
@@ -120,6 +144,9 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Benchmark|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Toollist|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='RealDebug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
@@ -139,6 +166,12 @@
<OutDir>$(SolutionDir)</OutDir>
<LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(ProjectDir)lib</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Toollist|x64'">
<TargetName>StgSharpC</TargetName>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)include</IncludePath>
<OutDir>$(SolutionDir)</OutDir>
<LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(ProjectDir)lib</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RealDebug|x64'">
<TargetName>StgSharpC</TargetName>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)include</IncludePath>
@@ -151,6 +184,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Benchmark|Win32'">
<TargetName>StgSharpGraphic</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Toollist|Win32'">
<TargetName>StgSharpGraphic</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RealDebug|Win32'">
<TargetName>StgSharpGraphic</TargetName>
</PropertyGroup>
@@ -189,6 +225,19 @@
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Toollist|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;STGSHARPGRAPHIC_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='RealDebug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
@@ -261,6 +310,27 @@
<ShowProgress>LinkVerbose</ShowProgress>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Toollist|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>GLFW_BUILD_DLL;_DEBUG;STGSHARPGRAPHIC_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<CompileAs>CompileAsC</CompileAs>
<ShowIncludes>true</ShowIncludes>
<AssemblerOutput>All</AssemblerOutput>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>$(ProjectDir)lib</AdditionalLibraryDirectories>
<AdditionalDependencies>OpenGL32.lib;glfw3.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>LinkVerbose</ShowProgress>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='RealDebug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
+393
View File
@@ -0,0 +1,393 @@
#include <Windows.h>
#include <GL/gl.h>
#include <tchar.h>
#include <iostream>
#define SIMPLE_DEMO 0
#if defined SIMPLE_DEMO && SIMPLE_DEMO ==1
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// Create a window
const char* className = "OpenGLWindowClass";
const char* windowTitle = "OpenGL Window";
const int windowWidth = 800;
const int windowHeight = 600;
WNDCLASSEX wc = {};
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = WindowProc;
wc.hInstance = hInstance;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.lpszClassName = _T("OpenGLWindowClass");
if (!RegisterClassEx(&wc))
{
MessageBox(NULL, _T("Failed to register window class"), _T("Error"), MB_OK | MB_ICONERROR);
return -1;
}
HWND hwnd = CreateWindowEx(
0, //窗口扩展风格
_T("OpenGLWindowClass"), //指向注册类名的指针
_T("OpenGL Window"), //指向窗口名称的指针
WS_OVERLAPPEDWINDOW, //窗口风格
CW_USEDEFAULT, //窗口水平位置
CW_USEDEFAULT, //窗口垂直位置
windowWidth, //窗口宽度
windowHeight, //窗口深度
NULL, //父窗口的句柄
NULL, //菜单的句柄或是子窗口的标识符
hInstance, //应用程序实例的句柄
NULL //指向窗口的创建数据
);
if (!hwnd)
{
MessageBox(NULL, _T("Failed to create window"), _T("Error"), MB_OK | MB_ICONERROR);
return -1;
}
else
{
UpdateWindow(hwnd);
ShowWindow(hwnd, SW_SHOW);
}
HDC hdc = GetDC(hwnd);
// Set pixel format
PIXELFORMATDESCRIPTOR pfd = {};
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 32;
pfd.cDepthBits = 24;
pfd.cStencilBits = 8;
pfd.iLayerType = PFD_MAIN_PLANE;
int pixelFormat = ChoosePixelFormat(hdc, &pfd);
if (!SetPixelFormat(hdc, pixelFormat, &pfd))
{
MessageBox(NULL, _T("Failed to set pixel format"), _T("Error"), MB_OK | MB_ICONERROR);
return -1;
}
// Create and activate OpenGL context
HGLRC hglrc = wglCreateContext(hdc);
if (!wglMakeCurrent(hdc, hglrc))
{
MessageBox(NULL, _T("Failed to make OpenGL context current"), _T("Error"), MB_OK | MB_ICONERROR);
return -1;
}
MessageBoxA(0, (char*)glGetString(GL_VERSION), "OPENGL VERSION", 0);
// Now you have an active OpenGL context
// Main message loop
MSG msg = {};
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// Clean up and exit
wglMakeCurrent(NULL, NULL);
wglDeleteContext(hglrc);
ReleaseDC(hwnd, hdc);
DestroyWindow(hwnd);
return 0;
}
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_CLOSE:
PostQuitMessage(0);
return 0;
case WM_DESTROY:
return 0;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
#else
// Sample code showing how to create a modern OpenGL window and rendering context on Win32.
#include <stdbool.h>
typedef HGLRC WINAPI wglCreateContextAttribsARB_type(HDC hdc, HGLRC hShareContext, const int* attribList);
wglCreateContextAttribsARB_type* wglCreateContextAttribsARB;
// See https://www.opengl.org/registry/specs/ARB/wgl_create_context.txt for all values
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
typedef BOOL WINAPI wglChoosePixelFormatARB_type(HDC hdc, const int* piAttribIList, const FLOAT* pfAttribFList, UINT nMaxFormats, int* piFormats, UINT* nNumFormats);
wglChoosePixelFormatARB_type* wglChoosePixelFormatARB;
// See https://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt for all values
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
#define WGL_ACCELERATION_ARB 0x2003
#define WGL_SUPPORT_OPENGL_ARB 0x2010
#define WGL_DOUBLE_BUFFER_ARB 0x2011
#define WGL_PIXEL_TYPE_ARB 0x2013
#define WGL_COLOR_BITS_ARB 0x2014
#define WGL_DEPTH_BITS_ARB 0x2022
#define WGL_STENCIL_BITS_ARB 0x2023
#define WGL_FULL_ACCELERATION_ARB 0x2027
#define WGL_TYPE_RGBA_ARB 0x202B
static void
fatal_error(const char* msg)
{
MessageBoxA(NULL, msg, "Error", MB_OK | MB_ICONEXCLAMATION);
exit(EXIT_FAILURE);
}
static void
init_opengl_extensions(void)
{
// Before we can load extensions, we need a dummy OpenGL context, created using a dummy window.
// We use a dummy window because you can only set the pixel format for a window once. For the
// real window, we want to use wglChoosePixelFormatARB (so we can potentially specify options
// that aren't available in PIXELFORMATDESCRIPTOR), but we can't load and use that before we
// have a context.
WNDCLASSA window_class = {};
window_class.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
window_class.lpfnWndProc = DefWindowProcA;
window_class.hInstance = GetModuleHandle(0);
window_class.lpszClassName = "Dummy_WGL_djuasiodwa";
if (!RegisterClassA(&window_class)) {
fatal_error("Failed to register dummy OpenGL window.");
}
HWND dummy_window = CreateWindowExA(
0,
window_class.lpszClassName,
"Dummy OpenGL Window",
0,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
0,
0,
window_class.hInstance,
0);
if (!dummy_window) {
fatal_error("Failed to create dummy OpenGL window.");
}
HDC dummy_dc = GetDC(dummy_window);
PIXELFORMATDESCRIPTOR pfd = {};
pfd.nSize = sizeof(pfd);
pfd.nVersion = 1;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.cColorBits = 32;
pfd.cAlphaBits = 8;
pfd.iLayerType = PFD_MAIN_PLANE;
pfd.cDepthBits = 24;
pfd.cStencilBits = 8;
int pixel_format = ChoosePixelFormat(dummy_dc, &pfd);
if (!pixel_format) {
fatal_error("Failed to find a suitable pixel format.");
}
if (!SetPixelFormat(dummy_dc, pixel_format, &pfd)) {
fatal_error("Failed to set the pixel format.");
}
HGLRC dummy_context = wglCreateContext(dummy_dc);
if (!dummy_context) {
fatal_error("Failed to create a dummy OpenGL rendering context.");
}
if (!wglMakeCurrent(dummy_dc, dummy_context)) {
fatal_error("Failed to activate dummy OpenGL rendering context.");
}
wglCreateContextAttribsARB = (wglCreateContextAttribsARB_type*)wglGetProcAddress("wglCreateContextAttribsARB");
wglChoosePixelFormatARB = (wglChoosePixelFormatARB_type*)wglGetProcAddress("wglChoosePixelFormatARB");
wglMakeCurrent(dummy_dc, 0);
wglDeleteContext(dummy_context);
ReleaseDC(dummy_window, dummy_dc);
DestroyWindow(dummy_window);
}
static HGLRC
init_opengl(HDC real_dc)
{
init_opengl_extensions();
// Now we can choose a pixel format the modern way, using wglChoosePixelFormatARB.
int pixel_format_attribs[] = {
WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
WGL_COLOR_BITS_ARB, 32,
WGL_DEPTH_BITS_ARB, 24,
WGL_STENCIL_BITS_ARB, 8,
0
};
int pixel_format;
UINT num_formats;
wglChoosePixelFormatARB(real_dc, pixel_format_attribs, 0, 1, &pixel_format, &num_formats);
if (!num_formats) {
fatal_error("Failed to set the OpenGL 3.3 pixel format.");
}
PIXELFORMATDESCRIPTOR pfd;
DescribePixelFormat(real_dc, pixel_format, sizeof(pfd), &pfd);
if (!SetPixelFormat(real_dc, pixel_format, &pfd)) {
fatal_error("Failed to set the OpenGL 3.3 pixel format.");
}
// Specify that we want to create an OpenGL 4.6 core profile context
int gl33_attribs[] = {
WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
WGL_CONTEXT_MINOR_VERSION_ARB, 6,
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
0,
};
HGLRC gl33_context = wglCreateContextAttribsARB(real_dc, 0, gl33_attribs);
if (!gl33_context) {
fatal_error("Failed to create OpenGL 3.3 context.");
}
if (!wglMakeCurrent(real_dc, gl33_context)) {
fatal_error("Failed to activate OpenGL 3.3 rendering context.");
}
return gl33_context;
}
static LRESULT CALLBACK
window_callback(HWND window, UINT msg, WPARAM wparam, LPARAM lparam)
{
LRESULT result = 0;
switch (msg) {
case WM_CLOSE:
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
result = DefWindowProcA(window, msg, wparam, lparam);
break;
}
return result;
}
static HWND
create_window(HINSTANCE inst)
{
WNDCLASSA window_class = {};
window_class.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
window_class.lpfnWndProc = window_callback;
window_class.hInstance = inst;
window_class.hCursor = LoadCursor(0, IDC_ARROW);
window_class.hbrBackground = 0;
window_class.lpszClassName = "WGL_fdjhsklf";
if (!RegisterClassA(&window_class)) {
fatal_error("Failed to register window.");
}
// Specify a desired width and height, then adjust the rect so the window's client area will be
// that size.
RECT rect = { };
rect.right = 1024;
rect.bottom = 576;
DWORD window_style = WS_OVERLAPPEDWINDOW;
AdjustWindowRect(&rect, window_style, false);
HWND window = CreateWindowExA(
0,
window_class.lpszClassName,
"OpenGL",
window_style,
CW_USEDEFAULT,
CW_USEDEFAULT,
rect.right - rect.left,
rect.bottom - rect.top,
0,
0,
inst,
0);
if (!window) {
fatal_error("Failed to create window.");
}
return window;
}
int WINAPI
WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmd_line, int show)
{
HWND window = create_window(inst);
HDC gldc = GetDC(window);
HGLRC glrc = init_opengl(gldc);
ShowWindow(window, show);
UpdateWindow(window);
bool running = true;
while (running) {
MSG msg;
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) {
if (msg.message == WM_QUIT) {
running = false;
}
else {
TranslateMessage(&msg);
DispatchMessageA(&msg);
}
}
glClearColor(1.0f, 0.5f, 0.5f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Do OpenGL rendering here
SwapBuffers(gldc);
}
return 0;
}
#endif
+5 -4
View File
@@ -47,11 +47,12 @@ extern "C"
SSCAPI char* infolog[512];
SSCAPI void SSCDECL initGL(int majorVersion, int minorVersion);
SSCAPI unsigned int SSCDECL loadShaderCode(char* const shaderCode, GLint shadertype);
SSCAPI unsigned int SSCDECL linkShaderProgram(GLuint shadertype);
SSCAPI unsigned int SSCDECL loadShaderCode(GladGLContext* context, char* const shaderCode, GLint shadertype);
SSCAPI unsigned int SSCDECL linkShaderProgram(GladGLContext* context, GLuint shadertype);
SSCAPI void SSCDECL loadImageData(char* location, Image* out, imageLoader loader);
SSCAPI void _cdecl setCurrentGLContext(GLFWwindow* window, GladGLContext* contextPtr);
SSCAPI char* _cdecl readLog(void);
SSCAPI void SSCDECL unloadImageData(Image* out);
SSCAPI void SSCDECL setCurrentGLContext(GLFWwindow* window, GladGLContext* contextPtr);
SSCAPI char* SSCDECL readLog(void);
//linear related function
+1
View File
@@ -425,6 +425,7 @@ extern "C" {
#ifndef STBI_NO_STDIO
STBIDEF stbi_uc* stbi_load(char const* filename, int* x, int* y, int* channels_in_file, int desired_channels);
STBIDEF void stbi_load_to_target(char const* filename, int* x, int* y, stbi_uc* target, int* channels_in_file, int desired_channels);
STBIDEF stbi_uc* stbi_load_from_file(FILE* f, int* x, int* y, int* channels_in_file, int desired_channels);
// for stbi_load_from_file, file pointer is left pointing immediately after image
#endif
+13
View File
@@ -828,6 +828,19 @@ STBIDEF stbi_uc* stbi_load(char const* filename, int* x, int* y, int* comp, int
return result;
}
STBIDEF void stbi_load_to_target(char const* filename, int* x, int* y, stbi_uc* target, int* comp, int req_comp)
{
FILE* f = stbi__fopen(filename, "rb");
unsigned char* result;
if (!f)
{
*target = "can't fopen, Unable to open file"; return;
}
result = stbi_load_from_file(f, x, y, comp, req_comp);
fclose(f);
}
STBIDEF stbi_uc* stbi_load_from_file(FILE* f, int* x, int* y, int* comp, int req_comp)
{
unsigned char* result;
@@ -1,35 +0,0 @@
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\vc143.pdb
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\vc143.idb
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\wgl.obj
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\wgl.cod
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\stgsharpc.obj
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\stgsharpc.cod
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\stb_image.obj
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\stb_image.cod
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\mat4.obj
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\mat4.cod
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\mat3.obj
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\mat3.cod
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\mat2.obj
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\mat2.cod
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\linear.obj
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\linear.cod
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\glsc2.obj
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\glsc2.cod
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\dllmain.obj
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\dllmain.cod
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\debuger.obj
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\debuger.cod
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\stgsharpc.ilk
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc.dll
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc.pdb
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc.lib
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc.exp
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\stgsharpc.tlog\cl.command.1.tlog
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\stgsharpc.tlog\cl.items.tlog
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\stgsharpc.tlog\cl.read.1.tlog
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\stgsharpc.tlog\cl.write.1.tlog
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\stgsharpc.tlog\link.command.1.tlog
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\stgsharpc.tlog\link.read.1.tlog
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\stgsharpc.tlog\link.write.1.tlog
d:\nitloadindustry\研究项目\1-flagship\th2020\projectfile\源代码\stgsharpc\x64\debug\stgsharpc.tlog\link.write.2u.tlog
+226 -219
View File
@@ -326,12 +326,12 @@ PUBLIC initGL
PUBLIC loadShaderCode
PUBLIC linkShaderProgram
PUBLIC loadImageData
PUBLIC setCurrentGLContext
PUBLIC unloadImageData
PUBLIC readLog
PUBLIC __JustMyCode_Default
EXTRN glfwInit:PROC
EXTRN glfwWindowHint:PROC
EXTRN glfwMakeContextCurrent:PROC
EXTRN __imp_free:PROC
EXTRN __imp___acrt_iob_func:PROC
EXTRN __imp___stdio_common_vfprintf:PROC
EXTRN stbi_load:PROC
@@ -378,13 +378,13 @@ pdata ENDS
; COMDAT pdata
pdata SEGMENT
$pdata$loadShaderCode DD imagerel $LN7
DD imagerel $LN7+284
DD imagerel $LN7+317
DD imagerel $unwind$loadShaderCode
pdata ENDS
; COMDAT pdata
pdata SEGMENT
$pdata$linkShaderProgram DD imagerel $LN5
DD imagerel $LN5+217
DD imagerel $LN5+223
DD imagerel $unwind$linkShaderProgram
pdata ENDS
; COMDAT pdata
@@ -395,9 +395,9 @@ $pdata$loadImageData DD imagerel $LN4
pdata ENDS
; COMDAT pdata
pdata SEGMENT
$pdata$setCurrentGLContext DD imagerel $LN3
DD imagerel $LN3+72
DD imagerel $unwind$setCurrentGLContext
$pdata$unloadImageData DD imagerel $LN3
DD imagerel $LN3+58
DD imagerel $unwind$unloadImageData
pdata ENDS
; COMDAT pdata
pdata SEGMENT
@@ -422,10 +422,10 @@ $unwind$readLog DD 025050f01H
xdata ENDS
; COMDAT xdata
xdata SEGMENT
$unwind$setCurrentGLContext DD 025051801H
DD 01132318H
DD 0700c001dH
DD 0500bH
$unwind$unloadImageData DD 025051301H
DD 010e2313H
DD 07007001dH
DD 05006H
xdata ENDS
; COMDAT xdata
xdata SEGMENT
@@ -436,15 +436,15 @@ $unwind$loadImageData DD 035051d01H
xdata ENDS
; COMDAT voltbl
voltbl SEGMENT
_volmd DB 034H
DB 0c0H
_volmd DB 03aH
DB 0c6H
voltbl ENDS
; COMDAT xdata
xdata SEGMENT
$unwind$linkShaderProgram DD 025053b19H
DD 010d2312H
DD 070060021H
DD 05005H
$unwind$linkShaderProgram DD 025054119H
DD 01122317H
DD 0700b0021H
DD 0500aH
DD imagerel __GSHandlerCheck
DD 0f8H
xdata ENDS
@@ -469,15 +469,15 @@ linkShaderProgram$rtcFrameData DD 01H
CONST ENDS
; COMDAT voltbl
voltbl SEGMENT
_volmd DW 03aH
DW 0103H
_volmd DW 040H
DW 0124H
voltbl ENDS
; COMDAT xdata
xdata SEGMENT
$unwind$loadShaderCode DD 025054119H
DD 01122317H
DD 0700b0025H
DD 0500aH
$unwind$loadShaderCode DD 025054719H
DD 0118231dH
DD 070110025H
DD 05010H
DD imagerel __GSHandlerCheck
DD 0118H
xdata ENDS
@@ -575,7 +575,7 @@ _TEXT ENDS
_TEXT SEGMENT
readLog PROC ; COMDAT
; 86 : {
; 92 : {
$LN3:
00000 40 55 push rbp
@@ -587,7 +587,7 @@ $LN3:
00 00 lea rcx, OFFSET FLAT:__59F96598_StgSharpC@c
00016 e8 00 00 00 00 call __CheckForDebuggerJustMyCode
; 87 : infolog[511] = '\0';
; 93 : infolog[511] = '\0';
0001b b8 08 00 00 00 mov eax, 8
00020 48 69 c0 ff 01
@@ -597,12 +597,12 @@ $LN3:
0002e 48 c7 04 01 00
00 00 00 mov QWORD PTR [rcx+rax], 0
; 88 : return &infolog;
; 94 : return &infolog;
00036 48 8d 05 00 00
00 00 lea rax, OFFSET FLAT:infolog
; 89 : }
; 95 : }
0003d 48 8d a5 c8 00
00 00 lea rsp, QWORD PTR [rbp+200]
@@ -613,47 +613,40 @@ readLog ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; File D:\NitloadIndustry\Ñо¿ÏîÄ¿\1-Flagship\TH2020\ProjectFile\Ô´´úÂë\StgSharpC\StgSharpC.c
; COMDAT setCurrentGLContext
; COMDAT unloadImageData
_TEXT SEGMENT
window$ = 224
contextPtr$ = 232
setCurrentGLContext PROC ; COMDAT
out$ = 224
unloadImageData PROC ; COMDAT
; 92 : {
; 87 : {
$LN3:
00000 48 89 54 24 10 mov QWORD PTR [rsp+16], rdx
00005 48 89 4c 24 08 mov QWORD PTR [rsp+8], rcx
0000a 55 push rbp
0000b 57 push rdi
0000c 48 81 ec e8 00
00000 48 89 4c 24 08 mov QWORD PTR [rsp+8], rcx
00005 55 push rbp
00006 57 push rdi
00007 48 81 ec e8 00
00 00 sub rsp, 232 ; 000000e8H
00013 48 8d 6c 24 20 lea rbp, QWORD PTR [rsp+32]
00018 48 8d 0d 00 00
0000e 48 8d 6c 24 20 lea rbp, QWORD PTR [rsp+32]
00013 48 8d 0d 00 00
00 00 lea rcx, OFFSET FLAT:__59F96598_StgSharpC@c
0001f e8 00 00 00 00 call __CheckForDebuggerJustMyCode
0001a e8 00 00 00 00 call __CheckForDebuggerJustMyCode
; 93 : glfwMakeContextCurrent(window);
; 88 : free(out->pixelPtr);
00024 48 8b 8d e0 00
00 00 mov rcx, QWORD PTR window$[rbp]
0002b e8 00 00 00 00 call glfwMakeContextCurrent
0001f 48 8b 85 e0 00
00 00 mov rax, QWORD PTR out$[rbp]
00026 48 8b 48 10 mov rcx, QWORD PTR [rax+16]
0002a ff 15 00 00 00
00 call QWORD PTR __imp_free
; 94 : currentContext = contextPtr;
; 89 : }
00030 48 8b 85 e8 00
00 00 mov rax, QWORD PTR contextPtr$[rbp]
00037 48 89 05 00 00
00 00 mov QWORD PTR currentContext, rax
; 95 : }
0003e 48 8d a5 c8 00
00030 48 8d a5 c8 00
00 00 lea rsp, QWORD PTR [rbp+200]
00045 5f pop rdi
00046 5d pop rbp
00047 c3 ret 0
setCurrentGLContext ENDP
00037 5f pop rdi
00038 5d pop rbp
00039 c3 ret 0
unloadImageData ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; File D:\NitloadIndustry\Ñо¿ÏîÄ¿\1-Flagship\TH2020\ProjectFile\Ô´´úÂë\StgSharpC\StgSharpC.c
@@ -664,7 +657,7 @@ out$ = 232
loader$ = 240
loadImageData PROC ; COMDAT
; 77 : {
; 78 : {
$LN4:
00000 4c 89 44 24 18 mov QWORD PTR [rsp+24], r8
@@ -679,14 +672,14 @@ $LN4:
00 00 lea rcx, OFFSET FLAT:__59F96598_StgSharpC@c
00024 e8 00 00 00 00 call __CheckForDebuggerJustMyCode
; 78 : if (loader == NULL)
; 79 : if (loader == NULL)
00029 48 83 bd f0 00
00 00 00 cmp QWORD PTR loader$[rbp], 0
00031 75 0e jne SHORT $LN2@loadImageD
; 79 : {
; 80 : loader = stbi_load;
; 80 : {
; 81 : loader = stbi_load;
00033 48 8d 05 00 00
00 00 lea rax, OFFSET FLAT:stbi_load
@@ -694,8 +687,8 @@ $LN4:
00 00 mov QWORD PTR loader$[rbp], rax
$LN2@loadImageD:
; 81 : }
; 82 : out->pixelPtr = loader(location, &(out->width), &(out->height), &(out->channel), 0);
; 82 : }
; 83 : out->pixelPtr = loader(location, &(out->width), &(out->height), &(out->channel), 0);
00041 48 8b 85 e8 00
00 00 mov rax, QWORD PTR out$[rbp]
@@ -717,7 +710,7 @@ $LN2@loadImageD:
00 00 mov rcx, QWORD PTR out$[rbp]
00080 48 89 41 10 mov QWORD PTR [rcx+16], rax
; 83 : }
; 84 : }
00084 48 8d a5 c8 00
00 00 lea rsp, QWORD PTR [rbp+200]
@@ -732,112 +725,114 @@ _TEXT ENDS
_TEXT SEGMENT
success$ = 4
__$ArrayPad$ = 216
shaderProgram$ = 256
context$ = 256
shaderProgram$ = 264
linkShaderProgram PROC ; COMDAT
; 59 : {
; 60 : {
$LN5:
00000 89 4c 24 08 mov DWORD PTR [rsp+8], ecx
00004 55 push rbp
00005 57 push rdi
00006 48 81 ec 08 01
00000 89 54 24 10 mov DWORD PTR [rsp+16], edx
00004 48 89 4c 24 08 mov QWORD PTR [rsp+8], rcx
00009 55 push rbp
0000a 57 push rdi
0000b 48 81 ec 08 01
00 00 sub rsp, 264 ; 00000108H
0000d 48 8d 6c 24 20 lea rbp, QWORD PTR [rsp+32]
00012 48 8d 7c 24 20 lea rdi, QWORD PTR [rsp+32]
00017 b9 0a 00 00 00 mov ecx, 10
0001c b8 cc cc cc cc mov eax, -858993460 ; ccccccccH
00021 f3 ab rep stosd
00023 8b 8c 24 28 01
00 00 mov ecx, DWORD PTR [rsp+296]
0002a 48 8b 05 00 00
00012 48 8d 6c 24 20 lea rbp, QWORD PTR [rsp+32]
00017 48 8d 7c 24 20 lea rdi, QWORD PTR [rsp+32]
0001c b9 0a 00 00 00 mov ecx, 10
00021 b8 cc cc cc cc mov eax, -858993460 ; ccccccccH
00026 f3 ab rep stosd
00028 48 8b 8c 24 28
01 00 00 mov rcx, QWORD PTR [rsp+296]
00030 48 8b 05 00 00
00 00 mov rax, QWORD PTR __security_cookie
00031 48 33 c5 xor rax, rbp
00034 48 89 85 d8 00
00037 48 33 c5 xor rax, rbp
0003a 48 89 85 d8 00
00 00 mov QWORD PTR __$ArrayPad$[rbp], rax
0003b 48 8d 0d 00 00
00041 48 8d 0d 00 00
00 00 lea rcx, OFFSET FLAT:__59F96598_StgSharpC@c
00042 e8 00 00 00 00 call __CheckForDebuggerJustMyCode
00048 e8 00 00 00 00 call __CheckForDebuggerJustMyCode
; 60 : currentContext->LinkProgram(shaderProgram);
; 61 : context->LinkProgram(shaderProgram);
00047 8b 8d 00 01 00
0004d 8b 8d 08 01 00
00 mov ecx, DWORD PTR shaderProgram$[rbp]
0004d 48 8b 05 00 00
00 00 mov rax, QWORD PTR currentContext
00054 ff 90 88 22 00
00053 48 8b 85 00 01
00 00 mov rax, QWORD PTR context$[rbp]
0005a ff 90 88 22 00
00 call QWORD PTR [rax+8840]
; 61 :
; 62 : int success;
; 63 : currentContext->GetProgramiv(shaderProgram, GL_LINK_STATUS, &success);
; 62 :
; 63 : int success;
; 64 : context->GetProgramiv(shaderProgram, GL_LINK_STATUS, &success);
0005a 4c 8d 45 04 lea r8, QWORD PTR success$[rbp]
0005e ba 82 8b 00 00 mov edx, 35714 ; 00008b82H
00063 8b 8d 00 01 00
00060 4c 8d 45 04 lea r8, QWORD PTR success$[rbp]
00064 ba 82 8b 00 00 mov edx, 35714 ; 00008b82H
00069 8b 8d 08 01 00
00 mov ecx, DWORD PTR shaderProgram$[rbp]
00069 48 8b 05 00 00
00 00 mov rax, QWORD PTR currentContext
00070 ff 90 50 1a 00
0006f 48 8b 85 00 01
00 00 mov rax, QWORD PTR context$[rbp]
00076 ff 90 50 1a 00
00 call QWORD PTR [rax+6736]
; 64 : if (!success)
; 65 : if (!success)
00076 83 7d 04 00 cmp DWORD PTR success$[rbp], 0
0007a 75 28 jne SHORT $LN2@linkShader
0007c 83 7d 04 00 cmp DWORD PTR success$[rbp], 0
00080 75 28 jne SHORT $LN2@linkShader
; 65 : {
; 66 : currentContext->GetProgramInfoLog(shaderProgram, 512, NULL, infolog);
; 66 : {
; 67 : context->GetProgramInfoLog(shaderProgram, 512, NULL, infolog);
0007c 4c 8d 0d 00 00
00082 4c 8d 0d 00 00
00 00 lea r9, OFFSET FLAT:infolog
00083 45 33 c0 xor r8d, r8d
00086 ba 00 02 00 00 mov edx, 512 ; 00000200H
0008b 8b 8d 00 01 00
00089 45 33 c0 xor r8d, r8d
0008c ba 00 02 00 00 mov edx, 512 ; 00000200H
00091 8b 8d 08 01 00
00 mov ecx, DWORD PTR shaderProgram$[rbp]
00091 48 8b 05 00 00
00 00 mov rax, QWORD PTR currentContext
00098 ff 90 a0 19 00
00097 48 8b 85 00 01
00 00 mov rax, QWORD PTR context$[rbp]
0009e ff 90 a0 19 00
00 call QWORD PTR [rax+6560]
; 67 : return 0;
; 68 : return 0;
0009e 33 c0 xor eax, eax
000a0 eb 08 jmp SHORT $LN1@linkShader
000a4 33 c0 xor eax, eax
000a6 eb 08 jmp SHORT $LN1@linkShader
; 68 : }
; 69 : }
000a2 eb 06 jmp SHORT $LN3@linkShader
000a8 eb 06 jmp SHORT $LN3@linkShader
$LN2@linkShader:
; 69 : else
; 70 : {
; 71 : return shaderProgram;
; 70 : else
; 71 : {
; 72 : return shaderProgram;
000a4 8b 85 00 01 00
000aa 8b 85 08 01 00
00 mov eax, DWORD PTR shaderProgram$[rbp]
$LN3@linkShader:
$LN1@linkShader:
; 72 : }
; 73 :
; 74 : }
; 73 : }
; 74 :
; 75 : }
000aa 48 8b f8 mov rdi, rax
000ad 48 8d 4d e0 lea rcx, QWORD PTR [rbp-32]
000b1 48 8d 15 00 00
000b0 48 8b f8 mov rdi, rax
000b3 48 8d 4d e0 lea rcx, QWORD PTR [rbp-32]
000b7 48 8d 15 00 00
00 00 lea rdx, OFFSET FLAT:linkShaderProgram$rtcFrameData
000b8 e8 00 00 00 00 call _RTC_CheckStackVars
000bd 48 8b c7 mov rax, rdi
000c0 48 8b 8d d8 00
000be e8 00 00 00 00 call _RTC_CheckStackVars
000c3 48 8b c7 mov rax, rdi
000c6 48 8b 8d d8 00
00 00 mov rcx, QWORD PTR __$ArrayPad$[rbp]
000c7 48 33 cd xor rcx, rbp
000ca e8 00 00 00 00 call __security_check_cookie
000cf 48 8d a5 e8 00
000cd 48 33 cd xor rcx, rbp
000d0 e8 00 00 00 00 call __security_check_cookie
000d5 48 8d a5 e8 00
00 00 lea rsp, QWORD PTR [rbp+232]
000d6 5f pop rdi
000d7 5d pop rbp
000d8 c3 ret 0
000dc 5f pop rdi
000dd 5d pop rbp
000de c3 ret 0
linkShaderProgram ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu /ZI
@@ -847,152 +842,164 @@ _TEXT SEGMENT
shader$4 = 4
success$5 = 36
__$ArrayPad$ = 248
shaderCode$ = 288
shadertype$ = 296
context$ = 288
shaderCode$ = 296
shadertype$ = 304
loadShaderCode PROC ; COMDAT
; 34 : {
$LN7:
00000 89 54 24 10 mov DWORD PTR [rsp+16], edx
00004 48 89 4c 24 08 mov QWORD PTR [rsp+8], rcx
00009 55 push rbp
0000a 57 push rdi
0000b 48 81 ec 28 01
00000 44 89 44 24 18 mov DWORD PTR [rsp+24], r8d
00005 48 89 54 24 10 mov QWORD PTR [rsp+16], rdx
0000a 48 89 4c 24 08 mov QWORD PTR [rsp+8], rcx
0000f 55 push rbp
00010 57 push rdi
00011 48 81 ec 28 01
00 00 sub rsp, 296 ; 00000128H
00012 48 8d 6c 24 20 lea rbp, QWORD PTR [rsp+32]
00017 48 8d 7c 24 20 lea rdi, QWORD PTR [rsp+32]
0001c b9 12 00 00 00 mov ecx, 18
00021 b8 cc cc cc cc mov eax, -858993460 ; ccccccccH
00026 f3 ab rep stosd
00028 48 8b 8c 24 48
00018 48 8d 6c 24 20 lea rbp, QWORD PTR [rsp+32]
0001d 48 8d 7c 24 20 lea rdi, QWORD PTR [rsp+32]
00022 b9 12 00 00 00 mov ecx, 18
00027 b8 cc cc cc cc mov eax, -858993460 ; ccccccccH
0002c f3 ab rep stosd
0002e 48 8b 8c 24 48
01 00 00 mov rcx, QWORD PTR [rsp+328]
00030 48 8b 05 00 00
00036 48 8b 05 00 00
00 00 mov rax, QWORD PTR __security_cookie
00037 48 33 c5 xor rax, rbp
0003a 48 89 85 f8 00
0003d 48 33 c5 xor rax, rbp
00040 48 89 85 f8 00
00 00 mov QWORD PTR __$ArrayPad$[rbp], rax
00041 48 8d 0d 00 00
00047 48 8d 0d 00 00
00 00 lea rcx, OFFSET FLAT:__59F96598_StgSharpC@c
00048 e8 00 00 00 00 call __CheckForDebuggerJustMyCode
0004e e8 00 00 00 00 call __CheckForDebuggerJustMyCode
; 35 : if (currentContext != NULL)
0004d 48 83 3d 00 00
00053 48 83 3d 00 00
00 00 00 cmp QWORD PTR currentContext, 0
00055 0f 84 90 00 00
0005b 0f 84 ab 00 00
00 je $LN2@loadShader
; 36 : {
; 37 : unsigned int shader = currentContext->CreateShader(shadertype);
; 37 : unsigned int shader = context->CreateShader(shadertype);
0005b 8b 8d 28 01 00
00061 8b 8d 30 01 00
00 mov ecx, DWORD PTR shadertype$[rbp]
00061 48 8b 05 00 00
00 00 mov rax, QWORD PTR currentContext
00068 ff 90 f8 09 00
00067 48 8b 85 20 01
00 00 mov rax, QWORD PTR context$[rbp]
0006e ff 90 f8 09 00
00 call QWORD PTR [rax+2552]
0006e 89 45 04 mov DWORD PTR shader$4[rbp], eax
00074 89 45 04 mov DWORD PTR shader$4[rbp], eax
; 38 : currentContext->ShaderSource(shader, 1, &shaderCode, NULL);
; 38 : context->ShaderSource(shader, 1, &shaderCode, NULL);
00071 45 33 c9 xor r9d, r9d
00074 4c 8d 85 20 01
00077 45 33 c9 xor r9d, r9d
0007a 4c 8d 85 28 01
00 00 lea r8, QWORD PTR shaderCode$[rbp]
0007b ba 01 00 00 00 mov edx, 1
00080 8b 4d 04 mov ecx, DWORD PTR shader$4[rbp]
00083 48 8b 05 00 00
00 00 mov rax, QWORD PTR currentContext
0008a ff 90 58 37 00
00081 ba 01 00 00 00 mov edx, 1
00086 8b 4d 04 mov ecx, DWORD PTR shader$4[rbp]
00089 48 8b 85 20 01
00 00 mov rax, QWORD PTR context$[rbp]
00090 ff 90 58 37 00
00 call QWORD PTR [rax+14168]
; 39 : currentContext->CompileShader(shader);
; 39 : context->CompileShader(shader);
00090 8b 4d 04 mov ecx, DWORD PTR shader$4[rbp]
00093 48 8b 05 00 00
00 00 mov rax, QWORD PTR currentContext
0009a ff 90 20 07 00
00096 8b 4d 04 mov ecx, DWORD PTR shader$4[rbp]
00099 48 8b 85 20 01
00 00 mov rax, QWORD PTR context$[rbp]
000a0 ff 90 20 07 00
00 call QWORD PTR [rax+1824]
; 40 : int success;
; 41 : currentContext->GetShaderiv(shader, GL_COMPILE_STATUS, &success);
; 41 : context->GetShaderiv(shader, GL_COMPILE_STATUS, &success);
000a0 4c 8d 45 24 lea r8, QWORD PTR success$5[rbp]
000a4 ba 81 8b 00 00 mov edx, 35713 ; 00008b81H
000a9 8b 4d 04 mov ecx, DWORD PTR shader$4[rbp]
000ac 48 8b 05 00 00
00 00 mov rax, QWORD PTR currentContext
000b3 ff 90 48 1b 00
000a6 4c 8d 45 24 lea r8, QWORD PTR success$5[rbp]
000aa ba 81 8b 00 00 mov edx, 35713 ; 00008b81H
000af 8b 4d 04 mov ecx, DWORD PTR shader$4[rbp]
000b2 48 8b 85 20 01
00 00 mov rax, QWORD PTR context$[rbp]
000b9 ff 90 48 1b 00
00 call QWORD PTR [rax+6984]
; 42 : if (!success)
000b9 83 7d 24 00 cmp DWORD PTR success$5[rbp], 0
000bd 75 25 jne SHORT $LN4@loadShader
000bf 83 7d 24 00 cmp DWORD PTR success$5[rbp], 0
000c3 75 40 jne SHORT $LN4@loadShader
; 43 : {
; 44 : currentContext->GetShaderInfoLog(shader, 512, NULL, infolog);
; 44 : context->GetShaderInfoLog(shader, 512, NULL, infolog);
000bf 4c 8d 0d 00 00
000c5 4c 8d 0d 00 00
00 00 lea r9, OFFSET FLAT:infolog
000c6 45 33 c0 xor r8d, r8d
000c9 ba 00 02 00 00 mov edx, 512 ; 00000200H
000ce 8b 4d 04 mov ecx, DWORD PTR shader$4[rbp]
000d1 48 8b 05 00 00
00 00 mov rax, QWORD PTR currentContext
000d8 ff 90 28 1b 00
000cc 45 33 c0 xor r8d, r8d
000cf ba 00 02 00 00 mov edx, 512 ; 00000200H
000d4 8b 4d 04 mov ecx, DWORD PTR shader$4[rbp]
000d7 48 8b 85 20 01
00 00 mov rax, QWORD PTR context$[rbp]
000de ff 90 28 1b 00
00 call QWORD PTR [rax+6952]
; 45 : return 0;
; 45 : infolog[511] = '\0';
000de 33 c0 xor eax, eax
000e0 eb 0b jmp SHORT $LN1@loadShader
000e4 b8 08 00 00 00 mov eax, 8
000e9 48 69 c0 ff 01
00 00 imul rax, rax, 511 ; 000001ffH
000f0 48 8d 0d 00 00
00 00 lea rcx, OFFSET FLAT:infolog
000f7 48 c7 04 01 00
00 00 00 mov QWORD PTR [rcx+rax], 0
; 46 : }
; 46 : return 0;
000e2 eb 05 jmp SHORT $LN5@loadShader
000ff 33 c0 xor eax, eax
00101 eb 0b jmp SHORT $LN1@loadShader
; 47 : }
00103 eb 05 jmp SHORT $LN5@loadShader
$LN4@loadShader:
; 47 : else
; 48 : {
; 49 : return shader;
; 48 : else
; 49 : {
; 50 : return shader;
000e4 8b 45 04 mov eax, DWORD PTR shader$4[rbp]
000e7 eb 04 jmp SHORT $LN1@loadShader
00105 8b 45 04 mov eax, DWORD PTR shader$4[rbp]
00108 eb 04 jmp SHORT $LN1@loadShader
$LN5@loadShader:
; 50 : }
; 51 : }
; 51 : }
; 52 : }
000e9 eb 02 jmp SHORT $LN3@loadShader
0010a eb 02 jmp SHORT $LN3@loadShader
$LN2@loadShader:
; 52 : else
; 53 : {
; 54 : return 0;
; 53 : else
; 54 : {
; 55 : return 0;
000eb 33 c0 xor eax, eax
0010c 33 c0 xor eax, eax
$LN3@loadShader:
$LN1@loadShader:
; 55 : }
; 56 : }
; 56 : }
; 57 : }
000ed 48 8b f8 mov rdi, rax
000f0 48 8d 4d e0 lea rcx, QWORD PTR [rbp-32]
000f4 48 8d 15 00 00
0010e 48 8b f8 mov rdi, rax
00111 48 8d 4d e0 lea rcx, QWORD PTR [rbp-32]
00115 48 8d 15 00 00
00 00 lea rdx, OFFSET FLAT:loadShaderCode$rtcFrameData
000fb e8 00 00 00 00 call _RTC_CheckStackVars
00100 48 8b c7 mov rax, rdi
00103 48 8b 8d f8 00
0011c e8 00 00 00 00 call _RTC_CheckStackVars
00121 48 8b c7 mov rax, rdi
00124 48 8b 8d f8 00
00 00 mov rcx, QWORD PTR __$ArrayPad$[rbp]
0010a 48 33 cd xor rcx, rbp
0010d e8 00 00 00 00 call __security_check_cookie
00112 48 8d a5 08 01
0012b 48 33 cd xor rcx, rbp
0012e e8 00 00 00 00 call __security_check_cookie
00133 48 8d a5 08 01
00 00 lea rsp, QWORD PTR [rbp+264]
00119 5f pop rdi
0011a 5d pop rbp
0011b c3 ret 0
0013a 5f pop rdi
0013b 5d pop rbp
0013c c3 ret 0
loadShaderCode ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu /ZI
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.