From e4f9d7b8bce964488b3bfb0d28e7a1acd0cd36d3 Mon Sep 17 00:00:00 2001 From: Ivan Ushakov Date: Thu, 23 May 2024 19:23:58 +0300 Subject: [PATCH] Fix after rebase --- Source/Game/CMakeLists.txt | 22 +- Source/Render/sokol/SokolRender.cpp | 93 +- Source/Render/sokol/SokolRender.h | 28 +- Source/Render/sokol/SokolRenderState.cpp | 139 +- Source/Render/sokol/SokolShaders.h | 1 - Source/Render/sokol/SokolTypes.h | 1 - Source/Render/sokol/shaders/color_tex1.h | 294 +---- Source/Render/sokol/shaders/color_tex2.h | 471 +------ Source/Render/sokol/shaders/normal.h | 729 +---------- Source/Render/sokol/shaders/object_shadow.h | 539 ++++---- Source/Render/sokol/shaders/only_texture.h | 787 ++++++------ Source/Render/sokol/shaders/tile_map.h | 1277 +++++++++---------- Source/Render/src/RenderDevice.cpp | 2 - 13 files changed, 1489 insertions(+), 2894 deletions(-) diff --git a/Source/Game/CMakeLists.txt b/Source/Game/CMakeLists.txt index eb307ff7..94e26f5d 100644 --- a/Source/Game/CMakeLists.txt +++ b/Source/Game/CMakeLists.txt @@ -141,23 +141,23 @@ SET(perimeter_LINK_LIBS ${SDL2_MIXER_LIBRARY} ${SDL2_NET_LIBRARY} ${EXE_LINK_LIBS_POST} - "-framework Foundation" "-framework AppKit" - "-framework QuartzCore" - "-framework CoreAudio" "-framework AudioToolbox" - "-framework CoreHaptics" + "-framework Carbon" + "-framework Cocoa" + "-framework CoreAudio" + "-framework CoreBluetooth" "-framework CoreGraphics" + "-framework CoreHaptics" + "-framework CoreMedia" + "-framework CoreMotion" + "-framework ForceFeedback" + "-framework Foundation" "-framework GameController" + "-framework IOKit" "-framework Metal" - "-framework CoreBluetooth" - "-framework CoreMotion" - "-framework CoreMedia" + "-framework QuartzCore" "-framework Security" - "-framework Carbon" - "-framework Cocoa" - "-framework IOKit" - "-framework ForceFeedback" ) IF(PERIMETER_WINDOWS) diff --git a/Source/Render/sokol/SokolRender.cpp b/Source/Render/sokol/SokolRender.cpp index 88551ea9..be35afef 100644 --- a/Source/Render/sokol/SokolRender.cpp +++ b/Source/Render/sokol/SokolRender.cpp @@ -14,7 +14,7 @@ #include "RenderTracker.h" #include -#ifdef SOKOL_GL +#ifdef PERIMETER_SOKOL_GL #include #endif @@ -41,7 +41,7 @@ eRenderDeviceSelection cSokolRender::GetRenderSelection() const { uint32_t cSokolRender::GetWindowCreationFlags() const { uint32_t flags = cInterfaceRenderDevice::GetWindowCreationFlags(); -#ifdef SOKOL_GL +#ifdef PERIMETER_SOKOL_GL flags |= SDL_WINDOW_OPENGL; #endif #ifdef SOKOL_METAL @@ -62,6 +62,7 @@ int cSokolRender::Init(int xScr, int yScr, int mode, SDL_Window* wnd, int Refres return res; } + ClearPooledResources(0); ClearCommands(); ClearPipelines(); @@ -75,28 +76,21 @@ int cSokolRender::Init(int xScr, int yScr, int mode, SDL_Window* wnd, int Refres sg_desc desc = {}; desc.pipeline_pool_size = PERIMETER_SOKOL_PIPELINES_MAX, desc.shader_pool_size = 8, - desc.buffer_pool_size = 1024 * 8; + desc.buffer_pool_size = 1024 * 32; + desc.uniform_buffer_size = 1024 * 1024 * 32; desc.image_pool_size = 1024 * 4; //1024 is enough for PGW+PET game desc.logger.func = slog_func; - //Setup swapchain pass + //Setup swapchain and fill color render_targets.emplace_back(); auto& swapchain_pass = render_targets[0].render_pass; - swapchain_pass.action.colors[0].load_action = SG_LOADACTION_CLEAR; - swapchain_pass.action.colors[0].store_action = SG_STOREACTION_STORE; - swapchain_pass.action.colors[0].clear_value = sg_color { 0.0f, 0.0f, 0.0f, 1.0f }; - swapchain_pass.action.depth.load_action = SG_LOADACTION_CLEAR; - swapchain_pass.action.depth.store_action = SG_STOREACTION_DONTCARE; - swapchain_pass.action.depth.clear_value = 1.0f; - swapchain_pass.action.stencil.load_action = SG_LOADACTION_CLEAR; - swapchain_pass.action.stencil.store_action = SG_STOREACTION_DONTCARE; - swapchain_pass.action.stencil.clear_value = 0; swapchain_pass.swapchain.width = ScreenSize.x; swapchain_pass.swapchain.height = ScreenSize.y; swapchain_pass.swapchain.sample_count = 1; + fill_color = sg_color { 0.0f, 0.0f, 0.0f, 1.0f }; //OpenGL / OpenGLES -#ifdef SOKOL_GL +#ifdef PERIMETER_SOKOL_GL //Setup some attributes before context creation SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); @@ -109,15 +103,15 @@ int cSokolRender::Init(int xScr, int yScr, int mode, SDL_Window* wnd, int Refres SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2); //*/ -#ifdef SOKOL_GLCORE33 - //Use OpenGL 3.3 Core - sokol_backend = "OpenGL Core 3.3"; +#ifdef SOKOL_GLCORE + //Use OpenGL Core + sokol_backend = "OpenGL Core"; SDL_SetHintWithPriority(SDL_HINT_RENDER_DRIVER, "opengl", SDL_HINT_OVERRIDE); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); #endif #if defined(SOKOL_GLES3) @@ -139,7 +133,7 @@ int cSokolRender::Init(int xScr, int yScr, int mode, SDL_Window* wnd, int Refres auto& swapchain_pass = render_targets[0].render_pass; swapchain_pass.swapchain.gl.framebuffer = 0; -#endif //SOKOL_GL +#endif //PERIMETER_SOKOL_GL //Direct3D #ifdef SOKOL_D3D11 @@ -231,10 +225,10 @@ int cSokolRender::Init(int xScr, int yScr, int mode, SDL_Window* wnd, int Refres swap_chain_desc->BufferDesc.RefreshRate = { static_cast(RefreshRateInHz), 1 }; swap_chain_desc->OutputWindow = d3d_context->hwnd; swap_chain_desc->Windowed = (mode & RENDERDEVICE_MODE_WINDOW) != 0; - swap_chain_desc->SwapEffect = DXGI_SWAP_EFFECT_DISCARD; - swap_chain_desc->BufferCount = 1; - swap_chain_desc->SampleDesc.Count = sample_count; - swap_chain_desc->SampleDesc.Quality = 1 < sample_count ? static_cast(D3D11_STANDARD_MULTISAMPLE_PATTERN) : 0; + swap_chain_desc->SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; + swap_chain_desc->BufferCount = 2; + swap_chain_desc->SampleDesc.Count = 1; + swap_chain_desc->SampleDesc.Quality = 0; swap_chain_desc->BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swap_chain_desc->Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH; hr = dxgiFactory->CreateSwapChain(d3d_context->device, swap_chain_desc, &d3d_context->swap_chain); @@ -321,7 +315,7 @@ int cSokolRender::Init(int xScr, int yScr, int mode, SDL_Window* wnd, int Refres } bool cSokolRender::ChangeSize(int xScr, int yScr, int mode) { - int mode_mask = RENDERDEVICE_MODE_WINDOW; + int mode_mask = RENDERDEVICE_MODE_WINDOW | RENDERDEVICE_MODE_VSYNC; bool need_resize = xScr != ScreenSize.x || yScr != ScreenSize.y; @@ -333,6 +327,11 @@ bool cSokolRender::ChangeSize(int xScr, int yScr, int mode) { ScreenSize.y = yScr; RenderMode &= ~mode_mask; RenderMode |= mode; + + //Set vsync +#ifdef PERIMETER_SOKOL_GL + SDL_GL_SetSwapInterval(RenderMode & RENDERDEVICE_MODE_VSYNC ? 1 : 0); +#endif //Update swapchain auto& swapchain_pass = render_targets[0].render_pass; @@ -368,6 +367,7 @@ int cSokolRender::Done() { bool do_sg_shutdown = sdl_window != nullptr; int ret = cInterfaceRenderDevice::Done(); activeCommand.Clear(); + ClearPooledResources(0); ClearCommands(); ClearPipelines(); shaders.clear(); @@ -397,7 +397,7 @@ int cSokolRender::Done() { sokol_metal_destroy(&swapchain_pass.swapchain); } #endif -#ifdef SOKOL_GL +#ifdef PERIMETER_SOKOL_GL if (sdl_gl_context != nullptr) { RenderSubmitEvent(RenderEvent::DONE, "Sokol GL shutdown"); SDL_GL_DeleteContext(sdl_gl_context); @@ -432,6 +432,33 @@ void cSokolRender::DeleteIndexBuffer(IndexBuffer &ib) { ib.FreeData(); } +#define ClearPooledResources_Debug 0 +void cSokolRender::ClearPooledResources(uint32_t max_life) { + if (bufferPool.empty()) { + return; + } +#if defined(PERIMETER_DEBUG) && ClearPooledResources_Debug + size_t count = bufferPool.size(); +#endif + auto it = bufferPool.begin(); + while (it != bufferPool.end()) { + auto& res = it->second; + res.unused_since++; + if (res.unused_since >= max_life) { + res.resource->DecRef(); + res.resource = nullptr; + it = bufferPool.erase(it); + } else { + it++; + } + } +#if defined(PERIMETER_DEBUG) && ClearPooledResources_Debug + if (count != bufferPool.size()) { + printf("ClearPooledResources %" PRIsize " -> %" PRIsize "\n", count, bufferPool.size()); + } +#endif +} + void cSokolRender::ClearCommands() { std::unordered_set pooled; for (auto& render_target : render_targets) { @@ -441,14 +468,20 @@ void cSokolRender::ClearCommands() { if (vertex_buffer && vertex_buffer->key != SokolResourceKeyNone && pooled.count(vertex_buffer) == 0) { command->vertex_buffer = nullptr; xassert(0 < vertex_buffer->RefCount() && vertex_buffer->RefCount() <= 50); - bufferPool.emplace(vertex_buffer->key, vertex_buffer); + bufferPool.emplace( + vertex_buffer->key, + SokolResourcePooled(vertex_buffer) + ); pooled.emplace(vertex_buffer); } SokolResourceBuffer* index_buffer = command->index_buffer; if (index_buffer && index_buffer->key != SokolResourceKeyNone && pooled.count(index_buffer) == 0) { command->index_buffer = nullptr; xassert(0 < index_buffer->RefCount() && index_buffer->RefCount() <= 50); - bufferPool.emplace(index_buffer->key, index_buffer); + bufferPool.emplace( + index_buffer->key, + SokolResourcePooled(index_buffer) + ); pooled.emplace(index_buffer); } @@ -626,6 +659,10 @@ void SokolCommand::CreateShaderParams() { } void SokolCommand::ClearDrawData() { + if (pass_action) { + delete pass_action; + pass_action = nullptr; + } if (vertex_buffer) { vertex_buffer->DecRef(); vertex_buffer = nullptr; diff --git a/Source/Render/sokol/SokolRender.h b/Source/Render/sokol/SokolRender.h index 74364465..4c397d35 100644 --- a/Source/Render/sokol/SokolRender.h +++ b/Source/Render/sokol/SokolRender.h @@ -1,8 +1,8 @@ #ifndef PERIMETER_SOKOLRENDER_H #define PERIMETER_SOKOLRENDER_H -#if defined(SOKOL_GLCORE33) || defined(SOKOL_GLES3) -#define SOKOL_GL (1) +#if defined(SOKOL_GLCORE) || defined(SOKOL_GLES3) +#define PERIMETER_SOKOL_GL (1) #endif #include @@ -23,9 +23,10 @@ struct SokolCommand { void ClearShaderParams(); void SetTexture(size_t index, SokolResource* sokol_texture); void ClearTextures(); - NO_COPY_CONSTRUCTOR(SokolCommand) + NO_COPY_CONSTRUCTOR(SokolCommand); struct SokolPipeline* pipeline = nullptr; + sg_pass_action* pass_action = nullptr; size_t base_elements = 0; size_t vertices = 0; size_t indices = 0; @@ -54,10 +55,20 @@ struct SokolPipelineContext { } }; +template +struct SokolResourcePooled { + ///How many frames passed since last time it was used + uint32_t unused_since = 0; + SokolResource* resource = nullptr; + + explicit SokolResourcePooled(SokolResource* res) : resource(res) { + } +}; + class cSokolRender: public cInterfaceRenderDevice { private: //SDL context -#ifdef SOKOL_GL +#ifdef PERIMETER_SOKOL_GL SDL_GLContext sdl_gl_context = nullptr; #endif #ifdef SOKOL_METAL @@ -81,8 +92,11 @@ class cSokolRender: public cInterfaceRenderDevice { float kShadow = 0.25f; //Stores resources for reusing - std::unordered_multimap bufferPool; - + void ClearPooledResources(uint32_t max_life); + std::unordered_multimap> bufferPool; + + sg_color fill_color = {}; + //Renderer state bool ActiveScene = false; bool isOrthographicProjSet = false; @@ -137,8 +151,10 @@ class cSokolRender: public cInterfaceRenderDevice { Vect2f activeWorldSize{}; //Commands handling + void ClearActiveBufferAndPassAction(); void ClearCommands(); void FinishActiveDrawBuffer(); + void CreateCommandEmpty(); void CreateCommand(class VertexBuffer* vb, size_t vertices, class IndexBuffer* ib, size_t indices); void SetVPMatrix(const Mat4f* matrix); void SetTex2Lerp(float lerp); diff --git a/Source/Render/sokol/SokolRenderState.cpp b/Source/Render/sokol/SokolRenderState.cpp index 81b7c58b..6d354753 100644 --- a/Source/Render/sokol/SokolRenderState.cpp +++ b/Source/Render/sokol/SokolRenderState.cpp @@ -37,6 +37,13 @@ void sokol_metal_render_callback() { } #endif +//How many frames to store the resources until freed +#ifndef GPX +const uint32_t MAX_POOLED_RESOURCES_LIFE = 10000; +#else +const uint32_t MAX_POOLED_RESOURCES_LIFE = 32000; +#endif + int cSokolRender::BeginScene() { RenderSubmitEvent(RenderEvent::BEGIN_SCENE, ActiveScene ? "ActiveScene" : ""); MTG(); @@ -60,9 +67,10 @@ int cSokolRender::EndScene() { } //Make sure there is nothing left to send as command - FinishActiveDrawBuffer(); - + ClearActiveBufferAndPassAction(); xassert(activeDrawBuffer == nullptr); + xassert(activeCommand.pass_action == nullptr); + ActiveScene = false; #ifdef SOKOL_METAL @@ -81,7 +89,21 @@ void cSokolRender::DoSokolRendering() { DoSokolRendering(render_target.render_pass, render_target.commands); } - DoSokolRendering(render_targets[0].render_pass, render_targets[0].commands); + //Create the pass, clear all buffers + sg_pass swapchain_pass = {}; + swapchain_pass.label = "PassSwapchain"; + swapchain_pass.swapchain = render_targets[0].render_pass.swapchain; + swapchain_pass.action.colors[0].load_action = SG_LOADACTION_CLEAR; + swapchain_pass.action.colors[0].store_action = SG_STOREACTION_STORE; + swapchain_pass.action.colors[0].clear_value = fill_color; + swapchain_pass.action.depth.load_action = SG_LOADACTION_CLEAR; + swapchain_pass.action.depth.store_action = SG_STOREACTION_DONTCARE; + swapchain_pass.action.depth.clear_value = 1.0f; + swapchain_pass.action.stencil.load_action = SG_LOADACTION_CLEAR; + swapchain_pass.action.stencil.store_action = SG_STOREACTION_DONTCARE; + swapchain_pass.action.stencil.clear_value = 0; + + DoSokolRendering(swapchain_pass, render_targets[0].commands); } void cSokolRender::DoSokolRendering(sg_pass& render_pass, const std::vector& commands) { @@ -92,9 +114,15 @@ void cSokolRender::DoSokolRendering(sg_pass& render_pass, const std::vectorpass_action) { + sg_end_pass(); + memcpy(&render_pass.action, command->pass_action, sizeof(sg_pass_action)); + sg_begin_pass(&render_pass); + } + //Nothing to draw if (3 > command->vertices) { - xassert(0); continue; } @@ -256,16 +284,18 @@ int cSokolRender::Flush(bool wnd) { } //Swap the window -#ifdef SOKOL_GL +#ifdef PERIMETER_SOKOL_GL SDL_GL_SwapWindow(sdl_window); #endif #ifdef SOKOL_D3D11 - d3d_context->swap_chain->Present(1, 0); + uint32_t sync_interval = RenderMode & RENDERDEVICE_MODE_VSYNC ? 1 : 0; + d3d_context->swap_chain->Present(sync_interval, 0); #endif #ifdef SOKOL_METAL sokol_metal_draw(); #endif + ClearPooledResources(MAX_POOLED_RESOURCES_LIFE); ClearCommands(); xassert(!activeDrawBuffer || !activeDrawBuffer->written_vertices); @@ -277,6 +307,38 @@ int cSokolRender::Flush(bool wnd) { return 0; } +void cSokolRender::ClearActiveBufferAndPassAction() { + if (activeDrawBuffer) { + //Send out any active DB before we set a pass action + //otherwise it might be renderer after setting new pass + FinishActiveDrawBuffer(); + } + if (activeCommand.pass_action) { + //Active command has a pass action already and there was no active DB + //Create a empty command + CreateCommandEmpty(); + if (activeCommand.pass_action) { + xassert(0); + delete activeCommand.pass_action; + activeCommand.pass_action = nullptr; + } + } +} + +void cSokolRender::ClearZBuffer() { + //Keep color and stencil buffers, clear depth buffer + ClearActiveBufferAndPassAction(); + sg_pass_action* action = new sg_pass_action(); + action->colors[0].load_action = SG_LOADACTION_LOAD; + action->colors[0].store_action = SG_STOREACTION_STORE; + action->depth.load_action = SG_LOADACTION_CLEAR; + action->depth.store_action = SG_STOREACTION_DONTCARE; + action->depth.clear_value = 1.0f; + action->stencil.load_action = SG_LOADACTION_LOAD; + action->stencil.store_action = SG_STOREACTION_DONTCARE; + activeCommand.pass_action = action; +} + int cSokolRender::Fill(int r, int g, int b, int a) { RenderSubmitEvent(RenderEvent::FILL); if (ActiveScene) { @@ -293,13 +355,10 @@ int cSokolRender::Fill(int r, int g, int b, int a) { } #endif - sg_color fill_color; fill_color.r = static_cast(r) / 255.f; fill_color.g = static_cast(g) / 255.f; fill_color.b = static_cast(b) / 255.f; fill_color.a = static_cast(a) / 255.f; - auto& swapchain_pass = render_targets[0].render_pass; - swapchain_pass.action.colors[0].clear_value = fill_color; return 0; } @@ -311,12 +370,6 @@ void cSokolRender::PrepareSokolBuffer(SokolBuffer*& buffer_ptr, MemoryResource* SokolResourceBuffer* buffer; if (dynamic) { - //Get power of 2 to hold len - size_t i = 1; - while (i < len) { - i = i << 1; - } - len = i; SokolResourceKey resource_key = get_sokol_resource_key_buffer(len, type); auto nh = bufferPool.extract(resource_key); if (nh.empty()) { @@ -336,7 +389,7 @@ void cSokolRender::PrepareSokolBuffer(SokolBuffer*& buffer_ptr, MemoryResource* sg_buffer ); } else { - buffer = nh.mapped(); + buffer = nh.mapped().resource; } resource->dirty = true; @@ -399,8 +452,42 @@ void cSokolRender::FinishActiveDrawBuffer() { activeDrawBuffer = nullptr; } +void cSokolRender::CreateCommandEmpty() { + xassert(ActiveScene); + MT_IS_GRAPH(); + +#ifdef PERIMETER_RENDER_TRACKER_COMMANDS + std::string label = "Pipeline: Empty"; + RenderSubmitEvent(RenderEvent::CREATE_COMMAND, label.c_str()); +#endif + + //Create command to be send + SokolCommand* cmd = new SokolCommand(); + memcpy(cmd->viewport, activeCommand.viewport, sizeof(Vect2i) * 2); + memcpy(cmd->clip, activeCommand.clip, sizeof(Vect2i) * 2); + + //Pass the pass action + if (activeCommand.pass_action) { + cmd->pass_action = activeCommand.pass_action; + activeCommand.pass_action = nullptr; + } + + //Submit command + render_targets[0].commands.emplace_back(cmd); + +#ifdef PERIMETER_RENDER_TRACKER_COMMANDS + label = "Submit - Pipeline: " + std::to_string(pipeline_id) + + " Vtxs: " + std::to_string(cmd->vertices) + + " Idxs: " + std::to_string(cmd->indices) + + " Tex0: " + std::to_string(reinterpret_cast(cmd->sokol_textures[0])) + + " Tex1: " + std::to_string(reinterpret_cast(cmd->sokol_textures[1])); + RenderSubmitEvent(RenderEvent::CREATE_COMMAND, label.c_str(), cmd); +#endif +} + void cSokolRender::CreateCommand(VertexBuffer* vb, size_t vertices, IndexBuffer* ib, size_t indices) { xassert(ActiveScene); + xassert(vb); MT_IS_GRAPH(); if (0 == vertices) vertices = activeCommand.vertices; if (0 == indices) indices = activeCommand.indices; @@ -530,16 +617,19 @@ void cSokolRender::CreateCommand(VertexBuffer* vb, size_t vertices, IndexBuffer* activeCommand.base_elements = 0; activeCommand.vertices = 0; activeCommand.indices = 0; - + + //Pass the pass action + if (activeCommand.pass_action) { + cmd->pass_action = activeCommand.pass_action; + activeCommand.pass_action = nullptr; + } + //Submit command assert(activeRenderTarget < render_targets.size()); render_targets[activeRenderTarget].commands.emplace_back(cmd); #ifdef PERIMETER_RENDER_TRACKER_COMMANDS label = "Submit - Pipeline: " + std::to_string(pipeline_id) - + " ColM: " + std::to_string(activeCommand.fs_color_mode) - + " OwVB: " + std::to_string(cmd->owned_vertex_buffer) - + " OwIB: " + std::to_string(cmd->owned_index_buffer) + " Vtxs: " + std::to_string(cmd->vertices) + " Idxs: " + std::to_string(cmd->indices) + " Tex0: " + std::to_string(reinterpret_cast(cmd->sokol_textures[0])) @@ -729,7 +819,9 @@ void cSokolRender::SetTextureImage(uint32_t slot, TextureImage* texture_image) { if (desc->usage == SG_USAGE_STREAM) { resource_key = get_sokol_resource_key_texture( desc->width, - desc->height, desc->pixel_format); + desc->height, + desc->pixel_format + ); } tex->image = new SokolResourceTexture( resource_key, @@ -986,7 +1078,4 @@ void cSokolRender::SetGlobalLight(Vect3f *vLight, sColor4f *Ambient, sColor4f *D activeLightAmbient = *Ambient; activeLightSpecular = *Specular; } -} - -void cSokolRender::ClearZBuffer() { -} +} \ No newline at end of file diff --git a/Source/Render/sokol/SokolShaders.h b/Source/Render/sokol/SokolShaders.h index 30d7f235..58cba63e 100644 --- a/Source/Render/sokol/SokolShaders.h +++ b/Source/Render/sokol/SokolShaders.h @@ -37,7 +37,6 @@ shader_funcs shader_##MODULE_NAME = { \ MODULE_NAME##_program_uniformblock_size, \ }; -SOKOL_SHADER(tex1); SOKOL_SHADER(color_tex1); SOKOL_SHADER(color_tex2); SOKOL_SHADER(normal); diff --git a/Source/Render/sokol/SokolTypes.h b/Source/Render/sokol/SokolTypes.h index 604bc028..aaa99f77 100644 --- a/Source/Render/sokol/SokolTypes.h +++ b/Source/Render/sokol/SokolTypes.h @@ -7,7 +7,6 @@ enum SOKOL_SHADER_ID { SOKOL_SHADER_ID_NONE, - SOKOL_SHADER_ID_tex1, SOKOL_SHADER_ID_color_tex1, SOKOL_SHADER_ID_color_tex2, SOKOL_SHADER_ID_normal, diff --git a/Source/Render/sokol/shaders/color_tex1.h b/Source/Render/sokol/shaders/color_tex1.h index 33e10dba..52db2563 100644 --- a/Source/Render/sokol/shaders/color_tex1.h +++ b/Source/Render/sokol/shaders/color_tex1.h @@ -5,7 +5,7 @@ Generated by sokol-shdc (https://github.com/floooh/sokol-tools) Cmdline: - sokol-shdc --input color_texture.glsl --output color_tex1.h --slang glsl410:glsl300es:hlsl5:wgsl:metal_macos:metal_ios:metal_sim --format=sokol --reflection --ifdef --module color_tex1 + sokol-shdc --input color_texture.glsl --output color_tex1.h --slang glsl410:glsl300es:hlsl5:metal_macos:metal_ios:metal_sim --format=sokol --reflection --ifdef --module color_tex1 Overview: ========= @@ -1078,270 +1078,6 @@ static const uint8_t color_tex1_fs_source_metal_sim[723] = { 0x0a,0x0a,0x00, }; #endif -/* - diagnostic(off, derivative_uniformity); - - struct color_texture_vs_params { - /_ @offset(0) _/ - un_mvp : mat4x4f, - /_ @offset(64) _/ - tex0_mat : mat4x4f, - /_ @offset(128) _/ - tex1_mat : mat4x4f, - } - - @group(0) @binding(0) var x_19 : color_texture_vs_params; - - var vs_position : vec3f; - - var fs_color : vec4f; - - var vs_color : vec4f; - - var fs_uv0 : vec2f; - - var vs_texcoord0 : vec2f; - - var gl_Position : vec4f; - - fn main_1() { - let x_22 : mat4x4f = x_19.un_mvp; - let x_26 : vec3f = vs_position; - gl_Position = (x_22 * vec4f(x_26.x, x_26.y, x_26.z, 1.0f)); - let x_38 : vec4f = vs_color; - fs_color = x_38; - let x_44 : mat4x4f = x_19.tex0_mat; - let x_47 : vec2f = vs_texcoord0; - let x_51 : vec4f = (x_44 * vec4f(x_47.x, x_47.y, 1.0f, 1.0f)); - fs_uv0 = vec2f(x_51.x, x_51.y); - return; - } - - struct main_out { - @builtin(position) - gl_Position : vec4f, - @location(0) - fs_color_1 : vec4f, - @location(1) - fs_uv0_1 : vec2f, - } - - @vertex - fn main(@location(0) vs_position_param : vec3f, @location(1) vs_color_param : vec4f, @location(2) vs_texcoord0_param : vec2f) -> main_out { - vs_position = vs_position_param; - vs_color = vs_color_param; - vs_texcoord0 = vs_texcoord0_param; - main_1(); - return main_out(gl_Position, fs_color, fs_uv0); - } - -*/ -#if defined(SOKOL_WGPU) -static const uint8_t color_tex1_vs_source_wgsl[1302] = { - 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, - 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, - 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, - 0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x73, - 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40, - 0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x75, - 0x6e,0x5f,0x6d,0x76,0x70,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x2c, - 0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x36,0x34, - 0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x74,0x65,0x78,0x30,0x5f,0x6d,0x61,0x74,0x20, - 0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20, - 0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x32,0x38,0x29,0x20,0x2a,0x2f,0x0a, - 0x20,0x20,0x74,0x65,0x78,0x31,0x5f,0x6d,0x61,0x74,0x20,0x3a,0x20,0x6d,0x61,0x74, - 0x34,0x78,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28, - 0x30,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x30,0x29,0x20,0x76, - 0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x31,0x39, - 0x20,0x3a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65, - 0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x76,0x61,0x72, - 0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x76,0x73,0x5f,0x70,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x0a, - 0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x73,0x5f, - 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a, - 0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x76,0x73,0x5f, - 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a, - 0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x73,0x5f, - 0x75,0x76,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61, - 0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x76,0x73,0x5f,0x74,0x65, - 0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b, - 0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x67, - 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63, - 0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29, - 0x20,0x7b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x32,0x20,0x3a,0x20, - 0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x20,0x3d,0x20,0x78,0x5f,0x31,0x39,0x2e,0x75, - 0x6e,0x5f,0x6d,0x76,0x70,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32, - 0x36,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x76,0x73,0x5f,0x70, - 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f, - 0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x28,0x78,0x5f,0x32,0x32,0x20,0x2a, - 0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x32,0x36,0x2e,0x78,0x2c,0x20,0x78, - 0x5f,0x32,0x36,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x32,0x36,0x2e,0x7a,0x2c,0x20,0x31, - 0x2e,0x30,0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x33, - 0x38,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x76,0x73,0x5f,0x63, - 0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72, - 0x20,0x3d,0x20,0x78,0x5f,0x33,0x38,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78, - 0x5f,0x34,0x34,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x20,0x3d,0x20, - 0x78,0x5f,0x31,0x39,0x2e,0x74,0x65,0x78,0x30,0x5f,0x6d,0x61,0x74,0x3b,0x0a,0x20, - 0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x32, - 0x66,0x20,0x3d,0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30, - 0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,0x31,0x20,0x3a,0x20,0x76, - 0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x28,0x78,0x5f,0x34,0x34,0x20,0x2a,0x20,0x76, - 0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x34,0x37,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x34, - 0x37,0x2e,0x79,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29, - 0x29,0x3b,0x0a,0x20,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x20,0x3d,0x20,0x76,0x65, - 0x63,0x32,0x66,0x28,0x78,0x5f,0x35,0x31,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x35,0x31, - 0x2e,0x79,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d, - 0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75, - 0x74,0x20,0x7b,0x0a,0x20,0x20,0x40,0x62,0x75,0x69,0x6c,0x74,0x69,0x6e,0x28,0x70, - 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x29,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f, - 0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a, - 0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20, - 0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65, - 0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, - 0x28,0x31,0x29,0x0a,0x20,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x5f,0x31,0x20,0x3a, - 0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x76,0x65,0x72,0x74, - 0x65,0x78,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61, - 0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x76,0x73,0x5f,0x70,0x6f,0x73,0x69,0x74, - 0x69,0x6f,0x6e,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x33, - 0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20, - 0x76,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a, - 0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, - 0x6e,0x28,0x32,0x29,0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64, - 0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x29, - 0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20, - 0x20,0x76,0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76, - 0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x70,0x61,0x72,0x61,0x6d, - 0x3b,0x0a,0x20,0x20,0x76,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76, - 0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20, - 0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20,0x3d,0x20, - 0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f,0x70,0x61,0x72, - 0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a, - 0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75, - 0x74,0x28,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x66, - 0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x2c,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x29, - 0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -}; -#endif -/* - diagnostic(off, derivative_uniformity); - - struct color_texture_fs_params { - /_ @offset(0) _/ - un_color_mode : i32, - /_ @offset(4) _/ - un_tex2_lerp : f32, - /_ @offset(8) _/ - un_alpha_test : f32, - } - - var frag_color : vec4f; - - @group(1) @binding(48) var un_tex0 : texture_2d; - - @group(1) @binding(64) var un_sampler0 : sampler; - - var fs_uv0 : vec2f; - - var fs_color : vec4f; - - @group(0) @binding(4) var x_32 : color_texture_fs_params; - - fn main_1() { - let x_23 : vec2f = fs_uv0; - let x_24 : vec4f = textureSample(un_tex0, un_sampler0, x_23); - let x_27 : vec4f = fs_color; - frag_color = (x_24 * x_27); - let x_36 : f32 = x_32.un_alpha_test; - let x_41 : f32 = frag_color.w; - if ((x_36 >= x_41)) { - discard; - } - return; - } - - struct main_out { - @location(0) - frag_color_1 : vec4f, - } - - @fragment - fn main(@location(1) fs_uv0_param : vec2f, @location(0) fs_color_param : vec4f) -> main_out { - fs_uv0 = fs_uv0_param; - fs_color = fs_color_param; - main_1(); - return main_out(frag_color); - } - -*/ -#if defined(SOKOL_WGPU) -static const uint8_t color_tex1_fs_source_wgsl[1031] = { - 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, - 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, - 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, - 0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x66,0x73, - 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40, - 0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x75, - 0x6e,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x6d,0x6f,0x64,0x65,0x20,0x3a,0x20,0x69, - 0x33,0x32,0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74, - 0x28,0x34,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x75,0x6e,0x5f,0x74,0x65,0x78,0x32, - 0x5f,0x6c,0x65,0x72,0x70,0x20,0x3a,0x20,0x66,0x33,0x32,0x2c,0x0a,0x20,0x20,0x2f, - 0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x38,0x29,0x20,0x2a,0x2f,0x0a, - 0x20,0x20,0x75,0x6e,0x5f,0x61,0x6c,0x70,0x68,0x61,0x5f,0x74,0x65,0x73,0x74,0x20, - 0x3a,0x20,0x66,0x33,0x32,0x2c,0x0a,0x7d,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72, - 0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f, - 0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f, - 0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34, - 0x38,0x29,0x20,0x76,0x61,0x72,0x20,0x75,0x6e,0x5f,0x74,0x65,0x78,0x30,0x20,0x3a, - 0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e, - 0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69, - 0x6e,0x64,0x69,0x6e,0x67,0x28,0x36,0x34,0x29,0x20,0x76,0x61,0x72,0x20,0x75,0x6e, - 0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x30,0x20,0x3a,0x20,0x73,0x61,0x6d,0x70, - 0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74, - 0x65,0x3e,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x32, - 0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e, - 0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34, - 0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x40,0x62, - 0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e, - 0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x33,0x32,0x20,0x3a,0x20,0x63,0x6f, - 0x6c,0x6f,0x72,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x66,0x73,0x5f,0x70, - 0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f, - 0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x33, - 0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x66,0x73,0x5f,0x75,0x76, - 0x30,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x34,0x20,0x3a,0x20, - 0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x53, - 0x61,0x6d,0x70,0x6c,0x65,0x28,0x75,0x6e,0x5f,0x74,0x65,0x78,0x30,0x2c,0x20,0x75, - 0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x30,0x2c,0x20,0x78,0x5f,0x32,0x33, - 0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x37,0x20,0x3a,0x20, - 0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72, - 0x3b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, - 0x20,0x28,0x78,0x5f,0x32,0x34,0x20,0x2a,0x20,0x78,0x5f,0x32,0x37,0x29,0x3b,0x0a, - 0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x33,0x36,0x20,0x3a,0x20,0x66,0x33,0x32, - 0x20,0x3d,0x20,0x78,0x5f,0x33,0x32,0x2e,0x75,0x6e,0x5f,0x61,0x6c,0x70,0x68,0x61, - 0x5f,0x74,0x65,0x73,0x74,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34, - 0x31,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63, - 0x6f,0x6c,0x6f,0x72,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x69,0x66,0x20,0x28,0x28,0x78, - 0x5f,0x33,0x36,0x20,0x3e,0x3d,0x20,0x78,0x5f,0x34,0x31,0x29,0x29,0x20,0x7b,0x0a, - 0x20,0x20,0x20,0x20,0x64,0x69,0x73,0x63,0x61,0x72,0x64,0x3b,0x0a,0x20,0x20,0x7d, - 0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74, - 0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a, - 0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20, - 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20, - 0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x66,0x72,0x61,0x67,0x6d, - 0x65,0x6e,0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63, - 0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x5f, - 0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20,0x40, - 0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x66,0x73,0x5f,0x63, - 0x6f,0x6c,0x6f,0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63, - 0x34,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20, - 0x7b,0x0a,0x20,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x20,0x3d,0x20,0x66,0x73,0x5f, - 0x75,0x76,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x66,0x73,0x5f, - 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72, - 0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31, - 0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69, - 0x6e,0x5f,0x6f,0x75,0x74,0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, - 0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -}; -#endif static inline const sg_shader_desc* color_tex1_program_shader_desc(sg_backend backend) { #if defined(SOKOL_GLCORE) if (backend == SG_BACKEND_GLCORE) { @@ -1551,34 +1287,6 @@ static inline const sg_shader_desc* color_tex1_program_shader_desc(sg_backend ba return &desc; } #endif /* SOKOL_METAL */ - #if defined(SOKOL_WGPU) - if (backend == SG_BACKEND_WGPU) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vs.source = (const char*)color_tex1_vs_source_wgsl; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 192; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = (const char*)color_tex1_fs_source_wgsl; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 16; - desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.label = "color_tex1_program_shader"; - } - return &desc; - } - #endif /* SOKOL_WGPU */ return 0; } static inline int color_tex1_program_attr_slot(const char* attr_name) { diff --git a/Source/Render/sokol/shaders/color_tex2.h b/Source/Render/sokol/shaders/color_tex2.h index 0d00d7f3..b4080bfd 100644 --- a/Source/Render/sokol/shaders/color_tex2.h +++ b/Source/Render/sokol/shaders/color_tex2.h @@ -5,7 +5,7 @@ Generated by sokol-shdc (https://github.com/floooh/sokol-tools) Cmdline: - sokol-shdc --input color_texture.glsl --output color_tex2.h --slang glsl410:glsl300es:hlsl5:wgsl:metal_macos:metal_ios:metal_sim --format=sokol --reflection --ifdef --defines=SHADER_TEX_2 --module color_tex2 + sokol-shdc --input color_texture.glsl --output color_tex2.h --slang glsl410:glsl300es:hlsl5:metal_macos:metal_ios:metal_sim --format=sokol --reflection --ifdef --defines=SHADER_TEX_2 --module color_tex2 Overview: ========= @@ -1685,440 +1685,6 @@ static const uint8_t color_tex2_fs_source_metal_sim[1557] = { 0x0a,0x7d,0x0a,0x0a,0x00, }; #endif -/* - diagnostic(off, derivative_uniformity); - - struct color_texture_vs_params { - /_ @offset(0) _/ - un_mvp : mat4x4f, - /_ @offset(64) _/ - tex0_mat : mat4x4f, - /_ @offset(128) _/ - tex1_mat : mat4x4f, - } - - @group(0) @binding(0) var x_19 : color_texture_vs_params; - - var vs_position : vec3f; - - var fs_color : vec4f; - - var vs_color : vec4f; - - var fs_uv0 : vec2f; - - var vs_texcoord0 : vec2f; - - var fs_uv1 : vec2f; - - var vs_texcoord1 : vec2f; - - var gl_Position : vec4f; - - fn main_1() { - let x_22 : mat4x4f = x_19.un_mvp; - let x_26 : vec3f = vs_position; - gl_Position = (x_22 * vec4f(x_26.x, x_26.y, x_26.z, 1.0f)); - let x_38 : vec4f = vs_color; - fs_color = x_38; - let x_44 : mat4x4f = x_19.tex0_mat; - let x_47 : vec2f = vs_texcoord0; - let x_51 : vec4f = (x_44 * vec4f(x_47.x, x_47.y, 1.0f, 1.0f)); - fs_uv0 = vec2f(x_51.x, x_51.y); - let x_56 : mat4x4f = x_19.tex1_mat; - let x_58 : vec2f = vs_texcoord1; - let x_62 : vec4f = (x_56 * vec4f(x_58.x, x_58.y, 1.0f, 1.0f)); - fs_uv1 = vec2f(x_62.x, x_62.y); - return; - } - - struct main_out { - @builtin(position) - gl_Position : vec4f, - @location(0) - fs_color_1 : vec4f, - @location(1) - fs_uv0_1 : vec2f, - @location(2) - fs_uv1_1 : vec2f, - } - - @vertex - fn main(@location(0) vs_position_param : vec3f, @location(1) vs_color_param : vec4f, @location(2) vs_texcoord0_param : vec2f, @location(3) vs_texcoord1_param : vec2f) -> main_out { - vs_position = vs_position_param; - vs_color = vs_color_param; - vs_texcoord0 = vs_texcoord0_param; - vs_texcoord1 = vs_texcoord1_param; - main_1(); - return main_out(gl_Position, fs_color, fs_uv0, fs_uv1); - } - -*/ -#if defined(SOKOL_WGPU) -static const uint8_t color_tex2_vs_source_wgsl[1661] = { - 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, - 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, - 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, - 0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x73, - 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40, - 0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x75, - 0x6e,0x5f,0x6d,0x76,0x70,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x2c, - 0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x36,0x34, - 0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x74,0x65,0x78,0x30,0x5f,0x6d,0x61,0x74,0x20, - 0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20, - 0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x32,0x38,0x29,0x20,0x2a,0x2f,0x0a, - 0x20,0x20,0x74,0x65,0x78,0x31,0x5f,0x6d,0x61,0x74,0x20,0x3a,0x20,0x6d,0x61,0x74, - 0x34,0x78,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28, - 0x30,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x30,0x29,0x20,0x76, - 0x61,0x72,0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x31,0x39, - 0x20,0x3a,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65, - 0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x76,0x61,0x72, - 0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x76,0x73,0x5f,0x70,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x0a, - 0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x73,0x5f, - 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a, - 0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x76,0x73,0x5f, - 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a, - 0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x73,0x5f, - 0x75,0x76,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61, - 0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x76,0x73,0x5f,0x74,0x65, - 0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b, - 0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66, - 0x73,0x5f,0x75,0x76,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a, - 0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x76,0x73,0x5f, - 0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x32, - 0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e, - 0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76, - 0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31, - 0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x32,0x20, - 0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x20,0x3d,0x20,0x78,0x5f,0x31,0x39, - 0x2e,0x75,0x6e,0x5f,0x6d,0x76,0x70,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78, - 0x5f,0x32,0x36,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x76,0x73, - 0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x67,0x6c,0x5f, - 0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x28,0x78,0x5f,0x32,0x32, - 0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x32,0x36,0x2e,0x78,0x2c, - 0x20,0x78,0x5f,0x32,0x36,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x32,0x36,0x2e,0x7a,0x2c, - 0x20,0x31,0x2e,0x30,0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78, - 0x5f,0x33,0x38,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x76,0x73, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c, - 0x6f,0x72,0x20,0x3d,0x20,0x78,0x5f,0x33,0x38,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74, - 0x20,0x78,0x5f,0x34,0x34,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x20, - 0x3d,0x20,0x78,0x5f,0x31,0x39,0x2e,0x74,0x65,0x78,0x30,0x5f,0x6d,0x61,0x74,0x3b, - 0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x37,0x20,0x3a,0x20,0x76,0x65, - 0x63,0x32,0x66,0x20,0x3d,0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72, - 0x64,0x30,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,0x31,0x20,0x3a, - 0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x28,0x78,0x5f,0x34,0x34,0x20,0x2a, - 0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x34,0x37,0x2e,0x78,0x2c,0x20,0x78, - 0x5f,0x34,0x37,0x2e,0x79,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30, - 0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x20,0x3d,0x20, - 0x76,0x65,0x63,0x32,0x66,0x28,0x78,0x5f,0x35,0x31,0x2e,0x78,0x2c,0x20,0x78,0x5f, - 0x35,0x31,0x2e,0x79,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x35, - 0x36,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x20,0x3d,0x20,0x78,0x5f, - 0x31,0x39,0x2e,0x74,0x65,0x78,0x31,0x5f,0x6d,0x61,0x74,0x3b,0x0a,0x20,0x20,0x6c, - 0x65,0x74,0x20,0x78,0x5f,0x35,0x38,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20, - 0x3d,0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x31,0x3b,0x0a, - 0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,0x32,0x20,0x3a,0x20,0x76,0x65,0x63, - 0x34,0x66,0x20,0x3d,0x20,0x28,0x78,0x5f,0x35,0x36,0x20,0x2a,0x20,0x76,0x65,0x63, - 0x34,0x66,0x28,0x78,0x5f,0x35,0x38,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x35,0x38,0x2e, - 0x79,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x29,0x3b, - 0x0a,0x20,0x20,0x66,0x73,0x5f,0x75,0x76,0x31,0x20,0x3d,0x20,0x76,0x65,0x63,0x32, - 0x66,0x28,0x78,0x5f,0x36,0x32,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x36,0x32,0x2e,0x79, - 0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a, - 0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20, - 0x7b,0x0a,0x20,0x20,0x40,0x62,0x75,0x69,0x6c,0x74,0x69,0x6e,0x28,0x70,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x29,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69, - 0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20, - 0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x66, - 0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34, - 0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31, - 0x29,0x0a,0x20,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x5f,0x31,0x20,0x3a,0x20,0x76, - 0x65,0x63,0x32,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, - 0x6e,0x28,0x32,0x29,0x0a,0x20,0x20,0x66,0x73,0x5f,0x75,0x76,0x31,0x5f,0x31,0x20, - 0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x76,0x65,0x72, - 0x74,0x65,0x78,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63, - 0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x76,0x73,0x5f,0x70,0x6f,0x73,0x69, - 0x74,0x69,0x6f,0x6e,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63, - 0x33,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29, - 0x20,0x76,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20, - 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69, - 0x6f,0x6e,0x28,0x32,0x29,0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72, - 0x64,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66, - 0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x33,0x29,0x20,0x76, - 0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x31,0x5f,0x70,0x61,0x72,0x61, - 0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61, - 0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x76,0x73,0x5f,0x70,0x6f, - 0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x73,0x5f,0x70,0x6f,0x73,0x69, - 0x74,0x69,0x6f,0x6e,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x76,0x73, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x73,0x5f,0x63,0x6f,0x6c,0x6f, - 0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x76,0x73,0x5f,0x74,0x65, - 0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20,0x3d,0x20,0x76,0x73,0x5f,0x74,0x65,0x78, - 0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20, - 0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x31,0x20,0x3d,0x20,0x76, - 0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x31,0x5f,0x70,0x61,0x72,0x61, - 0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20, - 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74, - 0x28,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x66,0x73, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x2c,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x2c,0x20, - 0x66,0x73,0x5f,0x75,0x76,0x31,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -}; -#endif -/* - diagnostic(off, derivative_uniformity); - - struct color_texture_fs_params { - /_ @offset(0) _/ - un_color_mode : i32, - /_ @offset(4) _/ - un_tex2_lerp : f32, - /_ @offset(8) _/ - un_alpha_test : f32, - } - - @group(1) @binding(48) var un_tex0 : texture_2d; - - @group(1) @binding(64) var un_sampler0 : sampler; - - var fs_uv0 : vec2f; - - @group(0) @binding(4) var x_29 : color_texture_fs_params; - - @group(1) @binding(49) var un_tex1 : texture_2d; - - var fs_uv1 : vec2f; - - var frag_color : vec4f; - - var fs_color : vec4f; - - fn main_1() { - var tex0 : vec4f; - var tex1 : vec4f; - let x_23 : vec2f = fs_uv0; - let x_24 : vec4f = textureSample(un_tex0, un_sampler0, x_23); - tex0 = x_24; - let x_33 : f32 = x_29.un_tex2_lerp; - if ((0.0f <= x_33)) { - let x_38 : vec4f = tex0; - let x_40 : f32 = x_29.un_tex2_lerp; - let x_42 : f32 = x_29.un_tex2_lerp; - let x_44 : f32 = x_29.un_tex2_lerp; - let x_49 : f32 = x_29.un_tex2_lerp; - let x_52 : f32 = x_29.un_tex2_lerp; - let x_55 : f32 = x_29.un_tex2_lerp; - tex0 = ((x_38 * vec4f(x_40, x_42, x_44, 1.0f)) + vec4f((1.0f - x_49), (1.0f - x_52), (1.0f - x_55), 0.0f)); - } - let x_65 : vec2f = fs_uv1; - let x_66 : vec4f = textureSample(un_tex1, un_sampler0, x_65); - tex1 = x_66; - let x_70 : i32 = x_29.un_color_mode; - switch(x_70) { - case 3i: { - let x_100 : vec4f = tex1; - let x_101 : vec4f = tex0; - let x_105 : vec4f = fs_color; - frag_color = (((x_100 * x_101) * 4.0f) * x_105); - } - case 2i: { - let x_92 : vec4f = tex1; - let x_93 : vec4f = tex0; - let x_97 : vec4f = fs_color; - frag_color = (((x_92 * x_93) * 2.0f) * x_97); - } - case 1i: { - let x_86 : vec4f = tex1; - let x_87 : vec4f = tex0; - let x_89 : vec4f = fs_color; - frag_color = ((x_86 + x_87) * x_89); - } - case 0i, default: { - let x_78 : vec4f = tex1; - let x_79 : vec4f = tex0; - let x_83 : vec4f = fs_color; - frag_color = ((x_78 * x_79) * x_83); - } - } - let x_111 : f32 = x_29.un_alpha_test; - let x_116 : f32 = frag_color.w; - if ((x_111 >= x_116)) { - discard; - } - return; - } - - struct main_out { - @location(0) - frag_color_1 : vec4f, - } - - @fragment - fn main(@location(1) fs_uv0_param : vec2f, @location(2) fs_uv1_param : vec2f, @location(0) fs_color_param : vec4f) -> main_out { - fs_uv0 = fs_uv0_param; - fs_uv1 = fs_uv1_param; - fs_color = fs_color_param; - main_1(); - return main_out(frag_color); - } - -*/ -#if defined(SOKOL_WGPU) -static const uint8_t color_tex2_fs_source_wgsl[2466] = { - 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, - 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, - 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, - 0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x66,0x73, - 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40, - 0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x75, - 0x6e,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x6d,0x6f,0x64,0x65,0x20,0x3a,0x20,0x69, - 0x33,0x32,0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74, - 0x28,0x34,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x75,0x6e,0x5f,0x74,0x65,0x78,0x32, - 0x5f,0x6c,0x65,0x72,0x70,0x20,0x3a,0x20,0x66,0x33,0x32,0x2c,0x0a,0x20,0x20,0x2f, - 0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x38,0x29,0x20,0x2a,0x2f,0x0a, - 0x20,0x20,0x75,0x6e,0x5f,0x61,0x6c,0x70,0x68,0x61,0x5f,0x74,0x65,0x73,0x74,0x20, - 0x3a,0x20,0x66,0x33,0x32,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70, - 0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x38,0x29, - 0x20,0x76,0x61,0x72,0x20,0x75,0x6e,0x5f,0x74,0x65,0x78,0x30,0x20,0x3a,0x20,0x74, - 0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a, - 0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64, - 0x69,0x6e,0x67,0x28,0x36,0x34,0x29,0x20,0x76,0x61,0x72,0x20,0x75,0x6e,0x5f,0x73, - 0x61,0x6d,0x70,0x6c,0x65,0x72,0x30,0x20,0x3a,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65, - 0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e, - 0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b, - 0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x40,0x62,0x69,0x6e, - 0x64,0x69,0x6e,0x67,0x28,0x34,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69,0x66, - 0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x32,0x39,0x20,0x3a,0x20,0x63,0x6f,0x6c,0x6f, - 0x72,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72, - 0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20, - 0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x39,0x29,0x20,0x76,0x61,0x72, - 0x20,0x75,0x6e,0x5f,0x74,0x65,0x78,0x31,0x20,0x3a,0x20,0x74,0x65,0x78,0x74,0x75, - 0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b,0x0a,0x0a,0x76,0x61,0x72, - 0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x73,0x5f,0x75,0x76,0x31, - 0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70, - 0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, - 0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72, - 0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c, - 0x6f,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20, - 0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x76,0x61,0x72, - 0x20,0x74,0x65,0x78,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x20, - 0x20,0x76,0x61,0x72,0x20,0x74,0x65,0x78,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34, - 0x66,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x33,0x20,0x3a,0x20, - 0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x3b,0x0a, - 0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x34,0x20,0x3a,0x20,0x76,0x65,0x63, - 0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x53,0x61,0x6d,0x70, - 0x6c,0x65,0x28,0x75,0x6e,0x5f,0x74,0x65,0x78,0x30,0x2c,0x20,0x75,0x6e,0x5f,0x73, - 0x61,0x6d,0x70,0x6c,0x65,0x72,0x30,0x2c,0x20,0x78,0x5f,0x32,0x33,0x29,0x3b,0x0a, - 0x20,0x20,0x74,0x65,0x78,0x30,0x20,0x3d,0x20,0x78,0x5f,0x32,0x34,0x3b,0x0a,0x20, - 0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x33,0x33,0x20,0x3a,0x20,0x66,0x33,0x32,0x20, - 0x3d,0x20,0x78,0x5f,0x32,0x39,0x2e,0x75,0x6e,0x5f,0x74,0x65,0x78,0x32,0x5f,0x6c, - 0x65,0x72,0x70,0x3b,0x0a,0x20,0x20,0x69,0x66,0x20,0x28,0x28,0x30,0x2e,0x30,0x66, - 0x20,0x3c,0x3d,0x20,0x78,0x5f,0x33,0x33,0x29,0x29,0x20,0x7b,0x0a,0x20,0x20,0x20, - 0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x33,0x38,0x20,0x3a,0x20,0x76,0x65,0x63,0x34, - 0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65, - 0x74,0x20,0x78,0x5f,0x34,0x30,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x78, - 0x5f,0x32,0x39,0x2e,0x75,0x6e,0x5f,0x74,0x65,0x78,0x32,0x5f,0x6c,0x65,0x72,0x70, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x32,0x20,0x3a, - 0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x78,0x5f,0x32,0x39,0x2e,0x75,0x6e,0x5f,0x74, - 0x65,0x78,0x32,0x5f,0x6c,0x65,0x72,0x70,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65, - 0x74,0x20,0x78,0x5f,0x34,0x34,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x78, - 0x5f,0x32,0x39,0x2e,0x75,0x6e,0x5f,0x74,0x65,0x78,0x32,0x5f,0x6c,0x65,0x72,0x70, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x39,0x20,0x3a, - 0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x78,0x5f,0x32,0x39,0x2e,0x75,0x6e,0x5f,0x74, - 0x65,0x78,0x32,0x5f,0x6c,0x65,0x72,0x70,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65, - 0x74,0x20,0x78,0x5f,0x35,0x32,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x78, - 0x5f,0x32,0x39,0x2e,0x75,0x6e,0x5f,0x74,0x65,0x78,0x32,0x5f,0x6c,0x65,0x72,0x70, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,0x35,0x20,0x3a, - 0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x78,0x5f,0x32,0x39,0x2e,0x75,0x6e,0x5f,0x74, - 0x65,0x78,0x32,0x5f,0x6c,0x65,0x72,0x70,0x3b,0x0a,0x20,0x20,0x20,0x20,0x74,0x65, - 0x78,0x30,0x20,0x3d,0x20,0x28,0x28,0x78,0x5f,0x33,0x38,0x20,0x2a,0x20,0x76,0x65, - 0x63,0x34,0x66,0x28,0x78,0x5f,0x34,0x30,0x2c,0x20,0x78,0x5f,0x34,0x32,0x2c,0x20, - 0x78,0x5f,0x34,0x34,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x29,0x20,0x2b,0x20,0x76, - 0x65,0x63,0x34,0x66,0x28,0x28,0x31,0x2e,0x30,0x66,0x20,0x2d,0x20,0x78,0x5f,0x34, - 0x39,0x29,0x2c,0x20,0x28,0x31,0x2e,0x30,0x66,0x20,0x2d,0x20,0x78,0x5f,0x35,0x32, - 0x29,0x2c,0x20,0x28,0x31,0x2e,0x30,0x66,0x20,0x2d,0x20,0x78,0x5f,0x35,0x35,0x29, - 0x2c,0x20,0x30,0x2e,0x30,0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x7d,0x0a,0x20,0x20, - 0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,0x35,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66, - 0x20,0x3d,0x20,0x66,0x73,0x5f,0x75,0x76,0x31,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74, - 0x20,0x78,0x5f,0x36,0x36,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20, - 0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,0x75,0x6e, - 0x5f,0x74,0x65,0x78,0x31,0x2c,0x20,0x75,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65, - 0x72,0x30,0x2c,0x20,0x78,0x5f,0x36,0x35,0x29,0x3b,0x0a,0x20,0x20,0x74,0x65,0x78, - 0x31,0x20,0x3d,0x20,0x78,0x5f,0x36,0x36,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20, - 0x78,0x5f,0x37,0x30,0x20,0x3a,0x20,0x69,0x33,0x32,0x20,0x3d,0x20,0x78,0x5f,0x32, - 0x39,0x2e,0x75,0x6e,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x6d,0x6f,0x64,0x65,0x3b, - 0x0a,0x20,0x20,0x73,0x77,0x69,0x74,0x63,0x68,0x28,0x78,0x5f,0x37,0x30,0x29,0x20, - 0x7b,0x0a,0x20,0x20,0x20,0x20,0x63,0x61,0x73,0x65,0x20,0x33,0x69,0x3a,0x20,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x30,0x30, - 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x31,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x30,0x31, - 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x30,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x30,0x35, - 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x66,0x73,0x5f,0x63,0x6f, - 0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f, - 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x28,0x28,0x28,0x78,0x5f,0x31,0x30,0x30, - 0x20,0x2a,0x20,0x78,0x5f,0x31,0x30,0x31,0x29,0x20,0x2a,0x20,0x34,0x2e,0x30,0x66, - 0x29,0x20,0x2a,0x20,0x78,0x5f,0x31,0x30,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x7d,0x0a,0x20,0x20,0x20,0x20,0x63,0x61,0x73,0x65,0x20,0x32,0x69,0x3a,0x20,0x7b, - 0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x39,0x32,0x20, - 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x31,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x39,0x33,0x20,0x3a, - 0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x30,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x39,0x37,0x20,0x3a,0x20, - 0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, - 0x6f,0x72,0x20,0x3d,0x20,0x28,0x28,0x28,0x78,0x5f,0x39,0x32,0x20,0x2a,0x20,0x78, - 0x5f,0x39,0x33,0x29,0x20,0x2a,0x20,0x32,0x2e,0x30,0x66,0x29,0x20,0x2a,0x20,0x78, - 0x5f,0x39,0x37,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20, - 0x63,0x61,0x73,0x65,0x20,0x31,0x69,0x3a,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20, - 0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x38,0x36,0x20,0x3a,0x20,0x76,0x65,0x63,0x34, - 0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, - 0x6c,0x65,0x74,0x20,0x78,0x5f,0x38,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, - 0x20,0x3d,0x20,0x74,0x65,0x78,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x6c, - 0x65,0x74,0x20,0x78,0x5f,0x38,0x39,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20, - 0x3d,0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20, - 0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x28, - 0x28,0x78,0x5f,0x38,0x36,0x20,0x2b,0x20,0x78,0x5f,0x38,0x37,0x29,0x20,0x2a,0x20, - 0x78,0x5f,0x38,0x39,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20, - 0x20,0x63,0x61,0x73,0x65,0x20,0x30,0x69,0x2c,0x20,0x64,0x65,0x66,0x61,0x75,0x6c, - 0x74,0x3a,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78, - 0x5f,0x37,0x38,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65, - 0x78,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f, - 0x37,0x39,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78, - 0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x38, - 0x33,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x66,0x73,0x5f,0x63, - 0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x28,0x28,0x78,0x5f,0x37,0x38,0x20, - 0x2a,0x20,0x78,0x5f,0x37,0x39,0x29,0x20,0x2a,0x20,0x78,0x5f,0x38,0x33,0x29,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x7d,0x0a,0x20,0x20,0x6c,0x65,0x74, - 0x20,0x78,0x5f,0x31,0x31,0x31,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x78, - 0x5f,0x32,0x39,0x2e,0x75,0x6e,0x5f,0x61,0x6c,0x70,0x68,0x61,0x5f,0x74,0x65,0x73, - 0x74,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x31,0x36,0x20,0x3a, - 0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f, - 0x72,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x69,0x66,0x20,0x28,0x28,0x78,0x5f,0x31,0x31, - 0x31,0x20,0x3e,0x3d,0x20,0x78,0x5f,0x31,0x31,0x36,0x29,0x29,0x20,0x7b,0x0a,0x20, - 0x20,0x20,0x20,0x64,0x69,0x73,0x63,0x61,0x72,0x64,0x3b,0x0a,0x20,0x20,0x7d,0x0a, - 0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72, - 0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20, - 0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20, - 0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76, - 0x65,0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x66,0x72,0x61,0x67,0x6d,0x65, - 0x6e,0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61, - 0x74,0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x5f,0x70, - 0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20,0x40,0x6c, - 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x32,0x29,0x20,0x66,0x73,0x5f,0x75,0x76, - 0x31,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c, - 0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x66,0x73, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76, - 0x65,0x63,0x34,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75, - 0x74,0x20,0x7b,0x0a,0x20,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x20,0x3d,0x20,0x66, - 0x73,0x5f,0x75,0x76,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x66, - 0x73,0x5f,0x75,0x76,0x31,0x20,0x3d,0x20,0x66,0x73,0x5f,0x75,0x76,0x31,0x5f,0x70, - 0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72, - 0x20,0x3d,0x20,0x66,0x73,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x70,0x61,0x72,0x61, - 0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20, - 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74, - 0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d,0x0a, - 0x0a,0x00, -}; -#endif static inline const sg_shader_desc* color_tex2_program_shader_desc(sg_backend backend) { #if defined(SOKOL_GLCORE) if (backend == SG_BACKEND_GLCORE) { @@ -2376,41 +1942,6 @@ static inline const sg_shader_desc* color_tex2_program_shader_desc(sg_backend ba return &desc; } #endif /* SOKOL_METAL */ - #if defined(SOKOL_WGPU) - if (backend == SG_BACKEND_WGPU) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vs.source = (const char*)color_tex2_vs_source_wgsl; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 192; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = (const char*)color_tex2_fs_source_wgsl; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 16; - desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = SG_IMAGETYPE_2D; - desc.fs.images[1].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 0; - desc.label = "color_tex2_program_shader"; - } - return &desc; - } - #endif /* SOKOL_WGPU */ return 0; } static inline int color_tex2_program_attr_slot(const char* attr_name) { diff --git a/Source/Render/sokol/shaders/normal.h b/Source/Render/sokol/shaders/normal.h index de37d9e8..f577a3fd 100644 --- a/Source/Render/sokol/shaders/normal.h +++ b/Source/Render/sokol/shaders/normal.h @@ -5,7 +5,7 @@ Generated by sokol-shdc (https://github.com/floooh/sokol-tools) Cmdline: - sokol-shdc --input normal_texture.glsl --output normal.h --slang glsl410:glsl300es:hlsl5:wgsl:metal_macos:metal_ios:metal_sim --format=sokol --reflection --ifdef --module normal + sokol-shdc --input normal_texture.glsl --output normal.h --slang glsl410:glsl300es:hlsl5:metal_macos:metal_ios:metal_sim --format=sokol --reflection --ifdef --module normal Overview: ========= @@ -2186,705 +2186,6 @@ static const uint8_t normal_fs_source_metal_sim[2778] = { 0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; #endif -/* - diagnostic(off, derivative_uniformity); - - struct normal_texture_vs_params { - /_ @offset(0) _/ - un_mvp : mat4x4f, - /_ @offset(64) _/ - model : mat4x4f, - /_ @offset(128) _/ - tex0_mat : mat4x4f, - } - - @group(0) @binding(0) var x_19 : normal_texture_vs_params; - - var vs_position : vec3f; - - var fs_normal : vec3f; - - var vs_normal : vec3f; - - var fs_uv0 : vec2f; - - var vs_texcoord0 : vec2f; - - var fs_position : vec3f; - - var gl_Position : vec4f; - - fn main_1() { - let x_22 : mat4x4f = x_19.un_mvp; - let x_26 : vec3f = vs_position; - gl_Position = (x_22 * vec4f(x_26.x, x_26.y, x_26.z, 1.0f)); - let x_39 : mat4x4f = x_19.model; - let x_41 : vec3f = vs_normal; - let x_47 : vec4f = (x_39 * vec4f(x_41.x, x_41.y, x_41.z, 0.0f)); - fs_normal = vec3f(x_47.x, x_47.y, x_47.z); - let x_54 : mat4x4f = x_19.tex0_mat; - let x_57 : vec2f = vs_texcoord0; - let x_61 : vec4f = (x_54 * vec4f(x_57.x, x_57.y, 1.0f, 1.0f)); - fs_uv0 = vec2f(x_61.x, x_61.y); - let x_65 : mat4x4f = x_19.model; - let x_66 : vec3f = vs_position; - let x_71 : vec4f = (x_65 * vec4f(x_66.x, x_66.y, x_66.z, 0.0f)); - fs_position = vec3f(x_71.x, x_71.y, x_71.z); - return; - } - - struct main_out { - @builtin(position) - gl_Position : vec4f, - @location(0) - fs_normal_1 : vec3f, - @location(1) - fs_uv0_1 : vec2f, - @location(2) - fs_position_1 : vec3f, - } - - @vertex - fn main(@location(0) vs_position_param : vec3f, @location(1) vs_normal_param : vec3f, @location(2) vs_texcoord0_param : vec2f) -> main_out { - vs_position = vs_position_param; - vs_normal = vs_normal_param; - vs_texcoord0 = vs_texcoord0_param; - main_1(); - return main_out(gl_Position, fs_normal, fs_uv0, fs_position); - } - -*/ -#if defined(SOKOL_WGPU) -static const uint8_t normal_vs_source_wgsl[1708] = { - 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, - 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, - 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, - 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76, - 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,0x20, - 0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20, - 0x75,0x6e,0x5f,0x6d,0x76,0x70,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66, - 0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x36, - 0x34,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x6d,0x6f,0x64,0x65,0x6c,0x20,0x3a,0x20, - 0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f, - 0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x32,0x38,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20, - 0x74,0x65,0x78,0x30,0x5f,0x6d,0x61,0x74,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78, - 0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29, - 0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x30,0x29,0x20,0x76,0x61,0x72, - 0x3c,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x31,0x39,0x20,0x3a, - 0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f, - 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c, - 0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x76,0x73,0x5f,0x70,0x6f,0x73,0x69, - 0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x0a,0x76, - 0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x73,0x5f,0x6e, - 0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x0a, - 0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x76,0x73,0x5f, - 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a, - 0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x73, - 0x5f,0x75,0x76,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x3b,0x0a,0x0a,0x76, - 0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x76,0x73,0x5f,0x74, - 0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66, - 0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20, - 0x66,0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65, - 0x63,0x33,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74, - 0x65,0x3e,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3a, - 0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e, - 0x5f,0x31,0x28,0x29,0x20,0x7b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32, - 0x32,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x20,0x3d,0x20,0x78,0x5f, - 0x31,0x39,0x2e,0x75,0x6e,0x5f,0x6d,0x76,0x70,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74, - 0x20,0x78,0x5f,0x32,0x36,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20, - 0x76,0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x67, - 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x28,0x78,0x5f, - 0x32,0x32,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x32,0x36,0x2e, - 0x78,0x2c,0x20,0x78,0x5f,0x32,0x36,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x32,0x36,0x2e, - 0x7a,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74, - 0x20,0x78,0x5f,0x33,0x39,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x20, - 0x3d,0x20,0x78,0x5f,0x31,0x39,0x2e,0x6d,0x6f,0x64,0x65,0x6c,0x3b,0x0a,0x20,0x20, - 0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66, - 0x20,0x3d,0x20,0x76,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x20,0x20, - 0x6c,0x65,0x74,0x20,0x78,0x5f,0x34,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66, - 0x20,0x3d,0x20,0x28,0x78,0x5f,0x33,0x39,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x66, - 0x28,0x78,0x5f,0x34,0x31,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x34,0x31,0x2e,0x79,0x2c, - 0x20,0x78,0x5f,0x34,0x31,0x2e,0x7a,0x2c,0x20,0x30,0x2e,0x30,0x66,0x29,0x29,0x3b, - 0x0a,0x20,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,0x76, - 0x65,0x63,0x33,0x66,0x28,0x78,0x5f,0x34,0x37,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x34, - 0x37,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x34,0x37,0x2e,0x7a,0x29,0x3b,0x0a,0x20,0x20, - 0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,0x34,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78, - 0x34,0x66,0x20,0x3d,0x20,0x78,0x5f,0x31,0x39,0x2e,0x74,0x65,0x78,0x30,0x5f,0x6d, - 0x61,0x74,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,0x37,0x20,0x3a, - 0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63, - 0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x36, - 0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x28,0x78,0x5f,0x35, - 0x34,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x35,0x37,0x2e,0x78, - 0x2c,0x20,0x78,0x5f,0x35,0x37,0x2e,0x79,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20, - 0x31,0x2e,0x30,0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x66,0x73,0x5f,0x75,0x76,0x30, - 0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x66,0x28,0x78,0x5f,0x36,0x31,0x2e,0x78,0x2c, - 0x20,0x78,0x5f,0x36,0x31,0x2e,0x79,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20, - 0x78,0x5f,0x36,0x35,0x20,0x3a,0x20,0x6d,0x61,0x74,0x34,0x78,0x34,0x66,0x20,0x3d, - 0x20,0x78,0x5f,0x31,0x39,0x2e,0x6d,0x6f,0x64,0x65,0x6c,0x3b,0x0a,0x20,0x20,0x6c, - 0x65,0x74,0x20,0x78,0x5f,0x36,0x36,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20, - 0x3d,0x20,0x76,0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20, - 0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x37,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34, - 0x66,0x20,0x3d,0x20,0x28,0x78,0x5f,0x36,0x35,0x20,0x2a,0x20,0x76,0x65,0x63,0x34, - 0x66,0x28,0x78,0x5f,0x36,0x36,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x36,0x36,0x2e,0x79, - 0x2c,0x20,0x78,0x5f,0x36,0x36,0x2e,0x7a,0x2c,0x20,0x30,0x2e,0x30,0x66,0x29,0x29, - 0x3b,0x0a,0x20,0x20,0x66,0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20, - 0x3d,0x20,0x76,0x65,0x63,0x33,0x66,0x28,0x78,0x5f,0x37,0x31,0x2e,0x78,0x2c,0x20, - 0x78,0x5f,0x37,0x31,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x37,0x31,0x2e,0x7a,0x29,0x3b, - 0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74, - 0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a, - 0x20,0x20,0x40,0x62,0x75,0x69,0x6c,0x74,0x69,0x6e,0x28,0x70,0x6f,0x73,0x69,0x74, - 0x69,0x6f,0x6e,0x29,0x0a,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69, - 0x6f,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c, - 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x66,0x73,0x5f, - 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66, - 0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x31,0x29, - 0x0a,0x20,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65, - 0x63,0x32,0x66,0x2c,0x0a,0x20,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, - 0x28,0x32,0x29,0x0a,0x20,0x20,0x66,0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x2c,0x0a,0x7d,0x0a,0x0a, - 0x40,0x76,0x65,0x72,0x74,0x65,0x78,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28, - 0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x20,0x76,0x73,0x5f, - 0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a, - 0x20,0x76,0x65,0x63,0x33,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, - 0x6e,0x28,0x31,0x29,0x20,0x76,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x70, - 0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x2c,0x20,0x40,0x6c, - 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x32,0x29,0x20,0x76,0x73,0x5f,0x74,0x65, - 0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20, - 0x76,0x65,0x63,0x32,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f, - 0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x76,0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69, - 0x6f,0x6e,0x20,0x3d,0x20,0x76,0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x76,0x73,0x5f,0x6e,0x6f,0x72, - 0x6d,0x61,0x6c,0x20,0x3d,0x20,0x76,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f, - 0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63, - 0x6f,0x6f,0x72,0x64,0x30,0x20,0x3d,0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f, - 0x6f,0x72,0x64,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61, - 0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e, - 0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x28,0x67,0x6c,0x5f,0x50,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c, - 0x2c,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x2c,0x20,0x66,0x73,0x5f,0x70,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, -}; -#endif -/* - diagnostic(off, derivative_uniformity); - - struct normal_texture_fs_params { - /_ @offset(0) _/ - diffuse : vec4f, - /_ @offset(16) _/ - ambient : vec4f, - /_ @offset(32) _/ - specular : vec4f, - /_ @offset(48) _/ - emissive : vec4f, - /_ @offset(64) _/ - light_dir : vec3f, - /_ @offset(80) _/ - light_diffuse : vec3f, - /_ @offset(96) _/ - light_ambient : vec3f, - /_ @offset(112) _/ - light_specular : vec3f, - /_ @offset(124) _/ - spec_power : f32, - /_ @offset(128) _/ - un_alpha_test : f32, - /_ @offset(132) _/ - material : i32, - } - - var frag_color : vec4f; - - @group(1) @binding(48) var un_tex0 : texture_2d; - - @group(1) @binding(64) var un_sampler0 : sampler; - - var fs_uv0 : vec2f; - - @group(0) @binding(4) var x_129 : normal_texture_fs_params; - - var fs_position : vec3f; - - var fs_normal : vec3f; - - const x_84 = vec3f(1.0f, 1.0f, 1.0f); - - fn phong_vf3_vf3_vf3_vf3_vf3_vf3_vf3_vf3_vf3_vf3_f1_(pos : ptr, nrm : ptr, l : ptr, eye : ptr, l_ambient : ptr, l_diffuse : ptr, l_specular : ptr, ambient : ptr, diffuse : ptr, specular : ptr, spec_power : ptr) -> vec4f { - var n : vec3f; - var v : vec3f; - var n_dot_l : f32; - var r : vec3f; - var r_dot_v : f32; - var diff : f32; - var spec : f32; - var ambient_v : vec3f; - var diffuse_v : vec3f; - var specular_v : vec3f; - let x_47 : vec3f = *(nrm); - n = normalize(x_47); - let x_50 : vec3f = *(eye); - let x_51 : vec3f = *(pos); - v = normalize((x_50 - x_51)); - let x_55 : vec3f = n; - let x_56 : vec3f = *(l); - n_dot_l = max(dot(x_55, x_56), 0.0f); - let x_61 : vec3f = *(l); - let x_62 : vec3f = -(x_61); - let x_63 : vec3f = n; - r = reflect(x_62, x_63); - let x_66 : vec3f = r; - let x_67 : vec3f = v; - r_dot_v = max(dot(x_66, x_67), 0.0f); - let x_71 : f32 = n_dot_l; - diff = x_71; - let x_73 : f32 = r_dot_v; - let x_75 : f32 = *(spec_power); - let x_77 : f32 = n_dot_l; - spec = (pow(abs(x_73), x_75) * x_77); - let x_80 : vec3f = *(l_ambient); - let x_81 : vec3f = *(ambient); - ambient_v = ((x_80 * x_81) * x_84); - let x_87 : vec3f = *(l_diffuse); - let x_88 : vec3f = *(diffuse); - let x_90 : f32 = diff; - diffuse_v = ((x_87 * x_88) * x_90); - let x_93 : vec3f = *(l_specular); - let x_94 : vec3f = *(specular); - let x_96 : f32 = spec; - specular_v = ((x_93 * x_94) * x_96); - let x_98 : vec3f = ambient_v; - let x_99 : vec3f = diffuse_v; - let x_101 : vec3f = specular_v; - let x_102 : vec3f = ((x_98 + x_99) + x_101); - return vec4f(x_102.x, x_102.y, x_102.z, 1.0f); - } - - fn gamma_vf4_(c : ptr) -> vec4f { - let x_30 : vec4f = *(c); - let x_35 : vec3f = pow(abs(vec3f(x_30.x, x_30.y, x_30.z)), vec3f(0.45454546809196472168f, 0.45454546809196472168f, 0.45454546809196472168f)); - let x_39 : f32 = (*(c)).w; - return vec4f(x_35.x, x_35.y, x_35.z, x_39); - } - - fn main_1() { - var param : vec3f; - var param_1 : vec3f; - var param_2 : vec3f; - var param_3 : vec3f; - var param_4 : vec3f; - var param_5 : vec3f; - var param_6 : vec3f; - var param_7 : vec3f; - var param_8 : vec3f; - var param_9 : vec3f; - var param_10 : f32; - var param_11 : vec4f; - let x_124 : vec2f = fs_uv0; - let x_125 : vec4f = textureSample(un_tex0, un_sampler0, x_124); - frag_color = x_125; - let x_133 : i32 = x_129.material; - if ((x_133 > 0i)) { - let x_139 : vec4f = frag_color; - let x_146 : vec3f = x_129.light_dir; - let x_156 : vec3f = fs_position; - param = x_156; - let x_158 : vec3f = fs_normal; - param_1 = x_158; - param_2 = -(x_146); - param_3 = vec3f(0.0f, 0.0f, 0.0f); - let x_163 : vec3f = x_129.light_ambient; - param_4 = x_163; - let x_166 : vec3f = x_129.light_diffuse; - param_5 = x_166; - let x_169 : vec3f = x_129.light_specular; - param_6 = x_169; - let x_173 : vec4f = x_129.ambient; - param_7 = vec3f(x_173.x, x_173.y, x_173.z); - let x_177 : vec4f = x_129.diffuse; - param_8 = vec3f(x_177.x, x_177.y, x_177.z); - let x_181 : vec4f = x_129.specular; - param_9 = vec3f(x_181.x, x_181.y, x_181.z); - let x_186 : f32 = x_129.spec_power; - param_10 = x_186; - let x_187 : vec4f = phong_vf3_vf3_vf3_vf3_vf3_vf3_vf3_vf3_vf3_vf3_f1_(&(param), &(param_1), &(param_2), &(param_3), &(param_4), &(param_5), &(param_6), &(param_7), &(param_8), &(param_9), &(param_10)); - param_11 = x_187; - let x_189 : vec4f = gamma_vf4_(&(param_11)); - frag_color = (x_139 * x_189); - let x_192 : f32 = x_129.diffuse.w; - let x_195 : f32 = frag_color.w; - frag_color.w = (x_195 * x_192); - } else { - let x_199 : vec4f = frag_color; - let x_202 : vec4f = x_129.ambient; - let x_205 : vec3f = ((vec3f(x_199.x, x_199.y, x_199.z) * vec3f(x_202.x, x_202.y, x_202.z)) * x_84); - frag_color.x = x_205.x; - frag_color.y = x_205.y; - frag_color.z = x_205.z; - } - let x_217 : f32 = x_129.un_alpha_test; - let x_219 : f32 = frag_color.w; - if ((x_217 >= x_219)) { - discard; - } - return; - } - - struct main_out { - @location(0) - frag_color_1 : vec4f, - } - - @fragment - fn main(@location(1) fs_uv0_param : vec2f, @location(2) fs_position_param : vec3f, @location(0) fs_normal_param : vec3f) -> main_out { - fs_uv0 = fs_uv0_param; - fs_position = fs_position_param; - fs_normal = fs_normal_param; - main_1(); - return main_out(frag_color); - } - -*/ -#if defined(SOKOL_WGPU) -static const uint8_t normal_fs_source_wgsl[5379] = { - 0x64,0x69,0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x28,0x6f,0x66,0x66,0x2c,0x20, - 0x64,0x65,0x72,0x69,0x76,0x61,0x74,0x69,0x76,0x65,0x5f,0x75,0x6e,0x69,0x66,0x6f, - 0x72,0x6d,0x69,0x74,0x79,0x29,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20, - 0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x66, - 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x7b,0x0a,0x20,0x20,0x2f,0x2a,0x20, - 0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x30,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20, - 0x64,0x69,0x66,0x66,0x75,0x73,0x65,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c, - 0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x36, - 0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x61,0x6d,0x62,0x69,0x65,0x6e,0x74,0x20,0x3a, - 0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66, - 0x66,0x73,0x65,0x74,0x28,0x33,0x32,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x73,0x70, - 0x65,0x63,0x75,0x6c,0x61,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a, - 0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x34,0x38,0x29, - 0x20,0x2a,0x2f,0x0a,0x20,0x20,0x65,0x6d,0x69,0x73,0x73,0x69,0x76,0x65,0x20,0x3a, - 0x20,0x76,0x65,0x63,0x34,0x66,0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66, - 0x66,0x73,0x65,0x74,0x28,0x36,0x34,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x6c,0x69, - 0x67,0x68,0x74,0x5f,0x64,0x69,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x2c, - 0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x38,0x30, - 0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x64,0x69,0x66, - 0x66,0x75,0x73,0x65,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x2c,0x0a,0x20,0x20, - 0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x39,0x36,0x29,0x20,0x2a, - 0x2f,0x0a,0x20,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x61,0x6d,0x62,0x69,0x65,0x6e, - 0x74,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20, - 0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x31,0x32,0x29,0x20,0x2a,0x2f,0x0a, - 0x20,0x20,0x6c,0x69,0x67,0x68,0x74,0x5f,0x73,0x70,0x65,0x63,0x75,0x6c,0x61,0x72, - 0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40, - 0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x32,0x34,0x29,0x20,0x2a,0x2f,0x0a,0x20, - 0x20,0x73,0x70,0x65,0x63,0x5f,0x70,0x6f,0x77,0x65,0x72,0x20,0x3a,0x20,0x66,0x33, - 0x32,0x2c,0x0a,0x20,0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28, - 0x31,0x32,0x38,0x29,0x20,0x2a,0x2f,0x0a,0x20,0x20,0x75,0x6e,0x5f,0x61,0x6c,0x70, - 0x68,0x61,0x5f,0x74,0x65,0x73,0x74,0x20,0x3a,0x20,0x66,0x33,0x32,0x2c,0x0a,0x20, - 0x20,0x2f,0x2a,0x20,0x40,0x6f,0x66,0x66,0x73,0x65,0x74,0x28,0x31,0x33,0x32,0x29, - 0x20,0x2a,0x2f,0x0a,0x20,0x20,0x6d,0x61,0x74,0x65,0x72,0x69,0x61,0x6c,0x20,0x3a, - 0x20,0x69,0x33,0x32,0x2c,0x0a,0x7d,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, - 0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, - 0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75, - 0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x38, - 0x29,0x20,0x76,0x61,0x72,0x20,0x75,0x6e,0x5f,0x74,0x65,0x78,0x30,0x20,0x3a,0x20, - 0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x32,0x64,0x3c,0x66,0x33,0x32,0x3e,0x3b, - 0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x31,0x29,0x20,0x40,0x62,0x69,0x6e, - 0x64,0x69,0x6e,0x67,0x28,0x36,0x34,0x29,0x20,0x76,0x61,0x72,0x20,0x75,0x6e,0x5f, - 0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x30,0x20,0x3a,0x20,0x73,0x61,0x6d,0x70,0x6c, - 0x65,0x72,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69,0x76,0x61,0x74,0x65, - 0x3e,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66, - 0x3b,0x0a,0x0a,0x40,0x67,0x72,0x6f,0x75,0x70,0x28,0x30,0x29,0x20,0x40,0x62,0x69, - 0x6e,0x64,0x69,0x6e,0x67,0x28,0x34,0x29,0x20,0x76,0x61,0x72,0x3c,0x75,0x6e,0x69, - 0x66,0x6f,0x72,0x6d,0x3e,0x20,0x78,0x5f,0x31,0x32,0x39,0x20,0x3a,0x20,0x6e,0x6f, - 0x72,0x6d,0x61,0x6c,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x66,0x73,0x5f, - 0x70,0x61,0x72,0x61,0x6d,0x73,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c,0x70,0x72,0x69, - 0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f, - 0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x0a,0x76,0x61,0x72,0x3c, - 0x70,0x72,0x69,0x76,0x61,0x74,0x65,0x3e,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d, - 0x61,0x6c,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x0a,0x63,0x6f,0x6e, - 0x73,0x74,0x20,0x78,0x5f,0x38,0x34,0x20,0x3d,0x20,0x76,0x65,0x63,0x33,0x66,0x28, - 0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66, - 0x29,0x3b,0x0a,0x0a,0x66,0x6e,0x20,0x70,0x68,0x6f,0x6e,0x67,0x5f,0x76,0x66,0x33, - 0x5f,0x76,0x66,0x33,0x5f,0x76,0x66,0x33,0x5f,0x76,0x66,0x33,0x5f,0x76,0x66,0x33, - 0x5f,0x76,0x66,0x33,0x5f,0x76,0x66,0x33,0x5f,0x76,0x66,0x33,0x5f,0x76,0x66,0x33, - 0x5f,0x76,0x66,0x33,0x5f,0x66,0x31,0x5f,0x28,0x70,0x6f,0x73,0x20,0x3a,0x20,0x70, - 0x74,0x72,0x3c,0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x76,0x65,0x63, - 0x33,0x66,0x3e,0x2c,0x20,0x6e,0x72,0x6d,0x20,0x3a,0x20,0x70,0x74,0x72,0x3c,0x66, - 0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x76,0x65,0x63,0x33,0x66,0x3e,0x2c, - 0x20,0x6c,0x20,0x3a,0x20,0x70,0x74,0x72,0x3c,0x66,0x75,0x6e,0x63,0x74,0x69,0x6f, - 0x6e,0x2c,0x20,0x76,0x65,0x63,0x33,0x66,0x3e,0x2c,0x20,0x65,0x79,0x65,0x20,0x3a, - 0x20,0x70,0x74,0x72,0x3c,0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x76, - 0x65,0x63,0x33,0x66,0x3e,0x2c,0x20,0x6c,0x5f,0x61,0x6d,0x62,0x69,0x65,0x6e,0x74, - 0x20,0x3a,0x20,0x70,0x74,0x72,0x3c,0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x2c, - 0x20,0x76,0x65,0x63,0x33,0x66,0x3e,0x2c,0x20,0x6c,0x5f,0x64,0x69,0x66,0x66,0x75, - 0x73,0x65,0x20,0x3a,0x20,0x70,0x74,0x72,0x3c,0x66,0x75,0x6e,0x63,0x74,0x69,0x6f, - 0x6e,0x2c,0x20,0x76,0x65,0x63,0x33,0x66,0x3e,0x2c,0x20,0x6c,0x5f,0x73,0x70,0x65, - 0x63,0x75,0x6c,0x61,0x72,0x20,0x3a,0x20,0x70,0x74,0x72,0x3c,0x66,0x75,0x6e,0x63, - 0x74,0x69,0x6f,0x6e,0x2c,0x20,0x76,0x65,0x63,0x33,0x66,0x3e,0x2c,0x20,0x61,0x6d, - 0x62,0x69,0x65,0x6e,0x74,0x20,0x3a,0x20,0x70,0x74,0x72,0x3c,0x66,0x75,0x6e,0x63, - 0x74,0x69,0x6f,0x6e,0x2c,0x20,0x76,0x65,0x63,0x33,0x66,0x3e,0x2c,0x20,0x64,0x69, - 0x66,0x66,0x75,0x73,0x65,0x20,0x3a,0x20,0x70,0x74,0x72,0x3c,0x66,0x75,0x6e,0x63, - 0x74,0x69,0x6f,0x6e,0x2c,0x20,0x76,0x65,0x63,0x33,0x66,0x3e,0x2c,0x20,0x73,0x70, - 0x65,0x63,0x75,0x6c,0x61,0x72,0x20,0x3a,0x20,0x70,0x74,0x72,0x3c,0x66,0x75,0x6e, - 0x63,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x76,0x65,0x63,0x33,0x66,0x3e,0x2c,0x20,0x73, - 0x70,0x65,0x63,0x5f,0x70,0x6f,0x77,0x65,0x72,0x20,0x3a,0x20,0x70,0x74,0x72,0x3c, - 0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x66,0x33,0x32,0x3e,0x29,0x20, - 0x2d,0x3e,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x7b,0x0a,0x20,0x20,0x76,0x61,0x72, - 0x20,0x6e,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x20,0x20,0x76,0x61, - 0x72,0x20,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x20,0x20,0x76, - 0x61,0x72,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x6c,0x20,0x3a,0x20,0x66,0x33,0x32, - 0x3b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x72,0x20,0x3a,0x20,0x76,0x65,0x63,0x33, - 0x66,0x3b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x72,0x5f,0x64,0x6f,0x74,0x5f,0x76, - 0x20,0x3a,0x20,0x66,0x33,0x32,0x3b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x64,0x69, - 0x66,0x66,0x20,0x3a,0x20,0x66,0x33,0x32,0x3b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20, - 0x73,0x70,0x65,0x63,0x20,0x3a,0x20,0x66,0x33,0x32,0x3b,0x0a,0x20,0x20,0x76,0x61, - 0x72,0x20,0x61,0x6d,0x62,0x69,0x65,0x6e,0x74,0x5f,0x76,0x20,0x3a,0x20,0x76,0x65, - 0x63,0x33,0x66,0x3b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x64,0x69,0x66,0x66,0x75, - 0x73,0x65,0x5f,0x76,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x20,0x20, - 0x76,0x61,0x72,0x20,0x73,0x70,0x65,0x63,0x75,0x6c,0x61,0x72,0x5f,0x76,0x20,0x3a, - 0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f, - 0x34,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x2a,0x28,0x6e, - 0x72,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x6e,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61, - 0x6c,0x69,0x7a,0x65,0x28,0x78,0x5f,0x34,0x37,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65, - 0x74,0x20,0x78,0x5f,0x35,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d, - 0x20,0x2a,0x28,0x65,0x79,0x65,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78, - 0x5f,0x35,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x2a,0x28, - 0x70,0x6f,0x73,0x29,0x3b,0x0a,0x20,0x20,0x76,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d, - 0x61,0x6c,0x69,0x7a,0x65,0x28,0x28,0x78,0x5f,0x35,0x30,0x20,0x2d,0x20,0x78,0x5f, - 0x35,0x31,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,0x35, - 0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x6e,0x3b,0x0a,0x20,0x20, - 0x6c,0x65,0x74,0x20,0x78,0x5f,0x35,0x36,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66, - 0x20,0x3d,0x20,0x2a,0x28,0x6c,0x29,0x3b,0x0a,0x20,0x20,0x6e,0x5f,0x64,0x6f,0x74, - 0x5f,0x6c,0x20,0x3d,0x20,0x6d,0x61,0x78,0x28,0x64,0x6f,0x74,0x28,0x78,0x5f,0x35, - 0x35,0x2c,0x20,0x78,0x5f,0x35,0x36,0x29,0x2c,0x20,0x30,0x2e,0x30,0x66,0x29,0x3b, - 0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,0x31,0x20,0x3a,0x20,0x76,0x65, - 0x63,0x33,0x66,0x20,0x3d,0x20,0x2a,0x28,0x6c,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65, - 0x74,0x20,0x78,0x5f,0x36,0x32,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d, - 0x20,0x2d,0x28,0x78,0x5f,0x36,0x31,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20, - 0x78,0x5f,0x36,0x33,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x6e, - 0x3b,0x0a,0x20,0x20,0x72,0x20,0x3d,0x20,0x72,0x65,0x66,0x6c,0x65,0x63,0x74,0x28, - 0x78,0x5f,0x36,0x32,0x2c,0x20,0x78,0x5f,0x36,0x33,0x29,0x3b,0x0a,0x20,0x20,0x6c, - 0x65,0x74,0x20,0x78,0x5f,0x36,0x36,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20, - 0x3d,0x20,0x72,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x36,0x37,0x20, - 0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x76,0x3b,0x0a,0x20,0x20,0x72, - 0x5f,0x64,0x6f,0x74,0x5f,0x76,0x20,0x3d,0x20,0x6d,0x61,0x78,0x28,0x64,0x6f,0x74, - 0x28,0x78,0x5f,0x36,0x36,0x2c,0x20,0x78,0x5f,0x36,0x37,0x29,0x2c,0x20,0x30,0x2e, - 0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x37,0x31,0x20, - 0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x6c,0x3b, - 0x0a,0x20,0x20,0x64,0x69,0x66,0x66,0x20,0x3d,0x20,0x78,0x5f,0x37,0x31,0x3b,0x0a, - 0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x37,0x33,0x20,0x3a,0x20,0x66,0x33,0x32, - 0x20,0x3d,0x20,0x72,0x5f,0x64,0x6f,0x74,0x5f,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65, - 0x74,0x20,0x78,0x5f,0x37,0x35,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x2a, - 0x28,0x73,0x70,0x65,0x63,0x5f,0x70,0x6f,0x77,0x65,0x72,0x29,0x3b,0x0a,0x20,0x20, - 0x6c,0x65,0x74,0x20,0x78,0x5f,0x37,0x37,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d, - 0x20,0x6e,0x5f,0x64,0x6f,0x74,0x5f,0x6c,0x3b,0x0a,0x20,0x20,0x73,0x70,0x65,0x63, - 0x20,0x3d,0x20,0x28,0x70,0x6f,0x77,0x28,0x61,0x62,0x73,0x28,0x78,0x5f,0x37,0x33, - 0x29,0x2c,0x20,0x78,0x5f,0x37,0x35,0x29,0x20,0x2a,0x20,0x78,0x5f,0x37,0x37,0x29, - 0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x38,0x30,0x20,0x3a,0x20,0x76, - 0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x2a,0x28,0x6c,0x5f,0x61,0x6d,0x62,0x69,0x65, - 0x6e,0x74,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x38,0x31,0x20, - 0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x2a,0x28,0x61,0x6d,0x62,0x69, - 0x65,0x6e,0x74,0x29,0x3b,0x0a,0x20,0x20,0x61,0x6d,0x62,0x69,0x65,0x6e,0x74,0x5f, - 0x76,0x20,0x3d,0x20,0x28,0x28,0x78,0x5f,0x38,0x30,0x20,0x2a,0x20,0x78,0x5f,0x38, - 0x31,0x29,0x20,0x2a,0x20,0x78,0x5f,0x38,0x34,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65, - 0x74,0x20,0x78,0x5f,0x38,0x37,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d, - 0x20,0x2a,0x28,0x6c,0x5f,0x64,0x69,0x66,0x66,0x75,0x73,0x65,0x29,0x3b,0x0a,0x20, - 0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x38,0x38,0x20,0x3a,0x20,0x76,0x65,0x63,0x33, - 0x66,0x20,0x3d,0x20,0x2a,0x28,0x64,0x69,0x66,0x66,0x75,0x73,0x65,0x29,0x3b,0x0a, - 0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x39,0x30,0x20,0x3a,0x20,0x66,0x33,0x32, - 0x20,0x3d,0x20,0x64,0x69,0x66,0x66,0x3b,0x0a,0x20,0x20,0x64,0x69,0x66,0x66,0x75, - 0x73,0x65,0x5f,0x76,0x20,0x3d,0x20,0x28,0x28,0x78,0x5f,0x38,0x37,0x20,0x2a,0x20, - 0x78,0x5f,0x38,0x38,0x29,0x20,0x2a,0x20,0x78,0x5f,0x39,0x30,0x29,0x3b,0x0a,0x20, - 0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x39,0x33,0x20,0x3a,0x20,0x76,0x65,0x63,0x33, - 0x66,0x20,0x3d,0x20,0x2a,0x28,0x6c,0x5f,0x73,0x70,0x65,0x63,0x75,0x6c,0x61,0x72, - 0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x39,0x34,0x20,0x3a,0x20, - 0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x2a,0x28,0x73,0x70,0x65,0x63,0x75,0x6c, - 0x61,0x72,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x39,0x36,0x20, - 0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x73,0x70,0x65,0x63,0x3b,0x0a,0x20,0x20, - 0x73,0x70,0x65,0x63,0x75,0x6c,0x61,0x72,0x5f,0x76,0x20,0x3d,0x20,0x28,0x28,0x78, - 0x5f,0x39,0x33,0x20,0x2a,0x20,0x78,0x5f,0x39,0x34,0x29,0x20,0x2a,0x20,0x78,0x5f, - 0x39,0x36,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x39,0x38,0x20, - 0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x61,0x6d,0x62,0x69,0x65,0x6e, - 0x74,0x5f,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x39,0x39,0x20, - 0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x64,0x69,0x66,0x66,0x75,0x73, - 0x65,0x5f,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x30,0x31, - 0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x73,0x70,0x65,0x63,0x75, - 0x6c,0x61,0x72,0x5f,0x76,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31, - 0x30,0x32,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x28,0x28,0x78, - 0x5f,0x39,0x38,0x20,0x2b,0x20,0x78,0x5f,0x39,0x39,0x29,0x20,0x2b,0x20,0x78,0x5f, - 0x31,0x30,0x31,0x29,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x76, - 0x65,0x63,0x34,0x66,0x28,0x78,0x5f,0x31,0x30,0x32,0x2e,0x78,0x2c,0x20,0x78,0x5f, - 0x31,0x30,0x32,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x31,0x30,0x32,0x2e,0x7a,0x2c,0x20, - 0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6e,0x20,0x67,0x61,0x6d, - 0x6d,0x61,0x5f,0x76,0x66,0x34,0x5f,0x28,0x63,0x20,0x3a,0x20,0x70,0x74,0x72,0x3c, - 0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x76,0x65,0x63,0x34,0x66,0x3e, - 0x29,0x20,0x2d,0x3e,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x7b,0x0a,0x20,0x20,0x6c, - 0x65,0x74,0x20,0x78,0x5f,0x33,0x30,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20, - 0x3d,0x20,0x2a,0x28,0x63,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f, - 0x33,0x35,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x70,0x6f,0x77, - 0x28,0x61,0x62,0x73,0x28,0x76,0x65,0x63,0x33,0x66,0x28,0x78,0x5f,0x33,0x30,0x2e, - 0x78,0x2c,0x20,0x78,0x5f,0x33,0x30,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x33,0x30,0x2e, - 0x7a,0x29,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x66,0x28,0x30,0x2e,0x34,0x35,0x34, - 0x35,0x34,0x35,0x34,0x36,0x38,0x30,0x39,0x31,0x39,0x36,0x34,0x37,0x32,0x31,0x36, - 0x38,0x66,0x2c,0x20,0x30,0x2e,0x34,0x35,0x34,0x35,0x34,0x35,0x34,0x36,0x38,0x30, - 0x39,0x31,0x39,0x36,0x34,0x37,0x32,0x31,0x36,0x38,0x66,0x2c,0x20,0x30,0x2e,0x34, - 0x35,0x34,0x35,0x34,0x35,0x34,0x36,0x38,0x30,0x39,0x31,0x39,0x36,0x34,0x37,0x32, - 0x31,0x36,0x38,0x66,0x29,0x29,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f, - 0x33,0x39,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x28,0x2a,0x28,0x63,0x29, - 0x29,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x76,0x65, - 0x63,0x34,0x66,0x28,0x78,0x5f,0x33,0x35,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x33,0x35, - 0x2e,0x79,0x2c,0x20,0x78,0x5f,0x33,0x35,0x2e,0x7a,0x2c,0x20,0x78,0x5f,0x33,0x39, - 0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28, - 0x29,0x20,0x7b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x70,0x61,0x72,0x61,0x6d,0x20, - 0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x70, - 0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a, - 0x20,0x20,0x76,0x61,0x72,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3a,0x20, - 0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x70,0x61,0x72, - 0x61,0x6d,0x5f,0x33,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x20,0x20, - 0x76,0x61,0x72,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3a,0x20,0x76,0x65, - 0x63,0x33,0x66,0x3b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x70,0x61,0x72,0x61,0x6d, - 0x5f,0x35,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x20,0x20,0x76,0x61, - 0x72,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x20,0x3a,0x20,0x76,0x65,0x63,0x33, - 0x66,0x3b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x37, - 0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20, - 0x70,0x61,0x72,0x61,0x6d,0x5f,0x38,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x3b, - 0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x39,0x20,0x3a, - 0x20,0x76,0x65,0x63,0x33,0x66,0x3b,0x0a,0x20,0x20,0x76,0x61,0x72,0x20,0x70,0x61, - 0x72,0x61,0x6d,0x5f,0x31,0x30,0x20,0x3a,0x20,0x66,0x33,0x32,0x3b,0x0a,0x20,0x20, - 0x76,0x61,0x72,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x31,0x20,0x3a,0x20,0x76, - 0x65,0x63,0x34,0x66,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x32, - 0x34,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x20,0x3d,0x20,0x66,0x73,0x5f,0x75, - 0x76,0x30,0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x32,0x35,0x20, - 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72, - 0x65,0x53,0x61,0x6d,0x70,0x6c,0x65,0x28,0x75,0x6e,0x5f,0x74,0x65,0x78,0x30,0x2c, - 0x20,0x75,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x30,0x2c,0x20,0x78,0x5f, - 0x31,0x32,0x34,0x29,0x3b,0x0a,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, - 0x6f,0x72,0x20,0x3d,0x20,0x78,0x5f,0x31,0x32,0x35,0x3b,0x0a,0x20,0x20,0x6c,0x65, - 0x74,0x20,0x78,0x5f,0x31,0x33,0x33,0x20,0x3a,0x20,0x69,0x33,0x32,0x20,0x3d,0x20, - 0x78,0x5f,0x31,0x32,0x39,0x2e,0x6d,0x61,0x74,0x65,0x72,0x69,0x61,0x6c,0x3b,0x0a, - 0x20,0x20,0x69,0x66,0x20,0x28,0x28,0x78,0x5f,0x31,0x33,0x33,0x20,0x3e,0x20,0x30, - 0x69,0x29,0x29,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f, - 0x31,0x33,0x39,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x66,0x72, - 0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65, - 0x74,0x20,0x78,0x5f,0x31,0x34,0x36,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20, - 0x3d,0x20,0x78,0x5f,0x31,0x32,0x39,0x2e,0x6c,0x69,0x67,0x68,0x74,0x5f,0x64,0x69, - 0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x35,0x36, - 0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x66,0x73,0x5f,0x70,0x6f, - 0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x61,0x72,0x61, - 0x6d,0x20,0x3d,0x20,0x78,0x5f,0x31,0x35,0x36,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c, - 0x65,0x74,0x20,0x78,0x5f,0x31,0x35,0x38,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66, - 0x20,0x3d,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x20,0x20, - 0x20,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x78,0x5f,0x31,0x35, - 0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d, - 0x20,0x2d,0x28,0x78,0x5f,0x31,0x34,0x36,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70, - 0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x76,0x65,0x63,0x33,0x66,0x28,0x30, - 0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,0x30,0x66,0x29, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x36,0x33,0x20, - 0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x78,0x5f,0x31,0x32,0x39,0x2e, - 0x6c,0x69,0x67,0x68,0x74,0x5f,0x61,0x6d,0x62,0x69,0x65,0x6e,0x74,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20,0x78,0x5f,0x31, - 0x36,0x33,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x36, - 0x36,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x78,0x5f,0x31,0x32, - 0x39,0x2e,0x6c,0x69,0x67,0x68,0x74,0x5f,0x64,0x69,0x66,0x66,0x75,0x73,0x65,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x20,0x3d,0x20,0x78, - 0x5f,0x31,0x36,0x36,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f, - 0x31,0x36,0x39,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d,0x20,0x78,0x5f, - 0x31,0x32,0x39,0x2e,0x6c,0x69,0x67,0x68,0x74,0x5f,0x73,0x70,0x65,0x63,0x75,0x6c, - 0x61,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x20, - 0x3d,0x20,0x78,0x5f,0x31,0x36,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74, - 0x20,0x78,0x5f,0x31,0x37,0x33,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d, - 0x20,0x78,0x5f,0x31,0x32,0x39,0x2e,0x61,0x6d,0x62,0x69,0x65,0x6e,0x74,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x37,0x20,0x3d,0x20,0x76,0x65, - 0x63,0x33,0x66,0x28,0x78,0x5f,0x31,0x37,0x33,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x31, - 0x37,0x33,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x31,0x37,0x33,0x2e,0x7a,0x29,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x37,0x37,0x20,0x3a,0x20, - 0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x78,0x5f,0x31,0x32,0x39,0x2e,0x64,0x69, - 0x66,0x66,0x75,0x73,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x61,0x72,0x61,0x6d, - 0x5f,0x38,0x20,0x3d,0x20,0x76,0x65,0x63,0x33,0x66,0x28,0x78,0x5f,0x31,0x37,0x37, - 0x2e,0x78,0x2c,0x20,0x78,0x5f,0x31,0x37,0x37,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x31, - 0x37,0x37,0x2e,0x7a,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78, - 0x5f,0x31,0x38,0x31,0x20,0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x78, - 0x5f,0x31,0x32,0x39,0x2e,0x73,0x70,0x65,0x63,0x75,0x6c,0x61,0x72,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x39,0x20,0x3d,0x20,0x76,0x65,0x63, - 0x33,0x66,0x28,0x78,0x5f,0x31,0x38,0x31,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x31,0x38, - 0x31,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x31,0x38,0x31,0x2e,0x7a,0x29,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x38,0x36,0x20,0x3a,0x20,0x66, - 0x33,0x32,0x20,0x3d,0x20,0x78,0x5f,0x31,0x32,0x39,0x2e,0x73,0x70,0x65,0x63,0x5f, - 0x70,0x6f,0x77,0x65,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70,0x61,0x72,0x61,0x6d, - 0x5f,0x31,0x30,0x20,0x3d,0x20,0x78,0x5f,0x31,0x38,0x36,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x38,0x37,0x20,0x3a,0x20,0x76,0x65,0x63, - 0x34,0x66,0x20,0x3d,0x20,0x70,0x68,0x6f,0x6e,0x67,0x5f,0x76,0x66,0x33,0x5f,0x76, - 0x66,0x33,0x5f,0x76,0x66,0x33,0x5f,0x76,0x66,0x33,0x5f,0x76,0x66,0x33,0x5f,0x76, - 0x66,0x33,0x5f,0x76,0x66,0x33,0x5f,0x76,0x66,0x33,0x5f,0x76,0x66,0x33,0x5f,0x76, - 0x66,0x33,0x5f,0x66,0x31,0x5f,0x28,0x26,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x2c, - 0x20,0x26,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x2c,0x20,0x26,0x28,0x70, - 0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x2c,0x20,0x26,0x28,0x70,0x61,0x72,0x61,0x6d, - 0x5f,0x33,0x29,0x2c,0x20,0x26,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x29,0x2c, - 0x20,0x26,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x29,0x2c,0x20,0x26,0x28,0x70, - 0x61,0x72,0x61,0x6d,0x5f,0x36,0x29,0x2c,0x20,0x26,0x28,0x70,0x61,0x72,0x61,0x6d, - 0x5f,0x37,0x29,0x2c,0x20,0x26,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x38,0x29,0x2c, - 0x20,0x26,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x39,0x29,0x2c,0x20,0x26,0x28,0x70, - 0x61,0x72,0x61,0x6d,0x5f,0x31,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x70, - 0x61,0x72,0x61,0x6d,0x5f,0x31,0x31,0x20,0x3d,0x20,0x78,0x5f,0x31,0x38,0x37,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x38,0x39,0x20,0x3a, - 0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x67,0x61,0x6d,0x6d,0x61,0x5f,0x76, - 0x66,0x34,0x5f,0x28,0x26,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x31,0x29,0x29, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, - 0x20,0x3d,0x20,0x28,0x78,0x5f,0x31,0x33,0x39,0x20,0x2a,0x20,0x78,0x5f,0x31,0x38, - 0x39,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x39, - 0x32,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x78,0x5f,0x31,0x32,0x39,0x2e, - 0x64,0x69,0x66,0x66,0x75,0x73,0x65,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c, - 0x65,0x74,0x20,0x78,0x5f,0x31,0x39,0x35,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d, - 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x2e,0x77,0x3b,0x0a,0x20, - 0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x2e,0x77,0x20, - 0x3d,0x20,0x28,0x78,0x5f,0x31,0x39,0x35,0x20,0x2a,0x20,0x78,0x5f,0x31,0x39,0x32, - 0x29,0x3b,0x0a,0x20,0x20,0x7d,0x20,0x65,0x6c,0x73,0x65,0x20,0x7b,0x0a,0x20,0x20, - 0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x31,0x39,0x39,0x20,0x3a,0x20,0x76,0x65, - 0x63,0x34,0x66,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, - 0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x30,0x32,0x20, - 0x3a,0x20,0x76,0x65,0x63,0x34,0x66,0x20,0x3d,0x20,0x78,0x5f,0x31,0x32,0x39,0x2e, - 0x61,0x6d,0x62,0x69,0x65,0x6e,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6c,0x65,0x74, - 0x20,0x78,0x5f,0x32,0x30,0x35,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x20,0x3d, - 0x20,0x28,0x28,0x76,0x65,0x63,0x33,0x66,0x28,0x78,0x5f,0x31,0x39,0x39,0x2e,0x78, - 0x2c,0x20,0x78,0x5f,0x31,0x39,0x39,0x2e,0x79,0x2c,0x20,0x78,0x5f,0x31,0x39,0x39, - 0x2e,0x7a,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x33,0x66,0x28,0x78,0x5f,0x32,0x30, - 0x32,0x2e,0x78,0x2c,0x20,0x78,0x5f,0x32,0x30,0x32,0x2e,0x79,0x2c,0x20,0x78,0x5f, - 0x32,0x30,0x32,0x2e,0x7a,0x29,0x29,0x20,0x2a,0x20,0x78,0x5f,0x38,0x34,0x29,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x2e, - 0x78,0x20,0x3d,0x20,0x78,0x5f,0x32,0x30,0x35,0x2e,0x78,0x3b,0x0a,0x20,0x20,0x20, - 0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x2e,0x79,0x20,0x3d,0x20, - 0x78,0x5f,0x32,0x30,0x35,0x2e,0x79,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61, - 0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x2e,0x7a,0x20,0x3d,0x20,0x78,0x5f,0x32,0x30, - 0x35,0x2e,0x7a,0x3b,0x0a,0x20,0x20,0x7d,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78, - 0x5f,0x32,0x31,0x37,0x20,0x3a,0x20,0x66,0x33,0x32,0x20,0x3d,0x20,0x78,0x5f,0x31, - 0x32,0x39,0x2e,0x75,0x6e,0x5f,0x61,0x6c,0x70,0x68,0x61,0x5f,0x74,0x65,0x73,0x74, - 0x3b,0x0a,0x20,0x20,0x6c,0x65,0x74,0x20,0x78,0x5f,0x32,0x31,0x39,0x20,0x3a,0x20, - 0x66,0x33,0x32,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, - 0x2e,0x77,0x3b,0x0a,0x20,0x20,0x69,0x66,0x20,0x28,0x28,0x78,0x5f,0x32,0x31,0x37, - 0x20,0x3e,0x3d,0x20,0x78,0x5f,0x32,0x31,0x39,0x29,0x29,0x20,0x7b,0x0a,0x20,0x20, - 0x20,0x20,0x64,0x69,0x73,0x63,0x61,0x72,0x64,0x3b,0x0a,0x20,0x20,0x7d,0x0a,0x20, - 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x72,0x75, - 0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20, - 0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30,0x29,0x0a,0x20,0x20,0x66, - 0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x5f,0x31,0x20,0x3a,0x20,0x76,0x65, - 0x63,0x34,0x66,0x2c,0x0a,0x7d,0x0a,0x0a,0x40,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e, - 0x74,0x0a,0x66,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x28,0x40,0x6c,0x6f,0x63,0x61,0x74, - 0x69,0x6f,0x6e,0x28,0x31,0x29,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x5f,0x70,0x61, - 0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x32,0x66,0x2c,0x20,0x40,0x6c,0x6f, - 0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x32,0x29,0x20,0x66,0x73,0x5f,0x70,0x6f,0x73, - 0x69,0x74,0x69,0x6f,0x6e,0x5f,0x70,0x61,0x72,0x61,0x6d,0x20,0x3a,0x20,0x76,0x65, - 0x63,0x33,0x66,0x2c,0x20,0x40,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x28,0x30, - 0x29,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x70,0x61,0x72,0x61, - 0x6d,0x20,0x3a,0x20,0x76,0x65,0x63,0x33,0x66,0x29,0x20,0x2d,0x3e,0x20,0x6d,0x61, - 0x69,0x6e,0x5f,0x6f,0x75,0x74,0x20,0x7b,0x0a,0x20,0x20,0x66,0x73,0x5f,0x75,0x76, - 0x30,0x20,0x3d,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x5f,0x70,0x61,0x72,0x61,0x6d, - 0x3b,0x0a,0x20,0x20,0x66,0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20, - 0x3d,0x20,0x66,0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5f,0x70,0x61, - 0x72,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c, - 0x20,0x3d,0x20,0x66,0x73,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x5f,0x70,0x61,0x72, - 0x61,0x6d,0x3b,0x0a,0x20,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x31,0x28,0x29,0x3b,0x0a, - 0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x69,0x6e,0x5f,0x6f,0x75, - 0x74,0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x29,0x3b,0x0a,0x7d, - 0x0a,0x0a,0x00, -}; -#endif static inline const sg_shader_desc* normal_program_shader_desc(sg_backend backend) { #if defined(SOKOL_GLCORE) if (backend == SG_BACKEND_GLCORE) { @@ -3142,34 +2443,6 @@ static inline const sg_shader_desc* normal_program_shader_desc(sg_backend backen return &desc; } #endif /* SOKOL_METAL */ - #if defined(SOKOL_WGPU) - if (backend == SG_BACKEND_WGPU) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vs.source = (const char*)normal_vs_source_wgsl; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 192; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = (const char*)normal_fs_source_wgsl; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 144; - desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.label = "normal_program_shader"; - } - return &desc; - } - #endif /* SOKOL_WGPU */ return 0; } static inline int normal_program_attr_slot(const char* attr_name) { diff --git a/Source/Render/sokol/shaders/object_shadow.h b/Source/Render/sokol/shaders/object_shadow.h index d01c8f54..a5bf1268 100644 --- a/Source/Render/sokol/shaders/object_shadow.h +++ b/Source/Render/sokol/shaders/object_shadow.h @@ -4,60 +4,30 @@ Generated by sokol-shdc (https://github.com/floooh/sokol-tools) - Cmdline: sokol-shdc --input object_shadow.glsl --output object_shadow.h --slang glsl330:glsl300es:hlsl5:metal_macos:metal_ios:metal_sim --format=sokol --reflection --ifdef --module object_shadow + Cmdline: + sokol-shdc --input object_shadow.glsl --output object_shadow.h --slang glsl410:glsl300es:hlsl5:metal_macos:metal_ios:metal_sim --format=sokol --reflection --ifdef --module object_shadow Overview: - - Shader program 'program': - Get shader desc: object_shadow_program_shader_desc(sg_query_backend()); - Vertex shader: vs - Attribute slots: - ATTR_object_shadow_vs_vs_position = 0 - Uniform block 'object_shadow_vs_params': - C struct: object_shadow_object_shadow_vs_params_t - Bind slot: SLOT_object_shadow_object_shadow_vs_params = 0 - Fragment shader: fs - - - Shader descriptor structs: - - sg_shader program = sg_make_shader(object_shadow_program_shader_desc(sg_query_backend())); - - Vertex attribute locations for vertex shader 'vs': - - sg_pipeline pip = sg_make_pipeline(&(sg_pipeline_desc){ - .layout = { - .attrs = { - [ATTR_object_shadow_vs_vs_position] = { ... }, - }, - }, - ...}); - - - Image bind slots, use as index in sg_bindings.vs.images[] or .fs.images[] - - - Sampler bind slots, use as index in sg_bindings.vs.sampler[] or .fs.samplers[] - - - Bind slot and C-struct for uniform block 'object_shadow_vs_params': - - object_shadow_object_shadow_vs_params_t object_shadow_vs_params = { - .un_mvp = ...; - }; - sg_apply_uniforms(SG_SHADERSTAGE_[VS|FS], SLOT_object_shadow_object_shadow_vs_params, &SG_RANGE(object_shadow_vs_params)); - + ========= + Shader program: 'program': + Get shader desc: object_shadow_program_shader_desc(sg_query_backend()); + Vertex shader: vs + Attributes: + ATTR_object_shadow_vs_vs_position => 0 + Uniform block 'object_shadow_vs_params': + C struct: object_shadow_object_shadow_vs_params_t + Bind slot: SLOT_object_shadow_object_shadow_vs_params => 0 + Fragment shader: fs */ -#include -#include -#include -#include +#if !defined(SOKOL_GFX_INCLUDED) +#error "Please include sokol_gfx.h before object_shadow.h" +#endif #if !defined(SOKOL_SHDC_ALIGN) - #if defined(_MSC_VER) - #define SOKOL_SHDC_ALIGN(a) __declspec(align(a)) - #else - #define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a))) - #endif +#if defined(_MSC_VER) +#define SOKOL_SHDC_ALIGN(a) __declspec(align(a)) +#else +#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a))) +#endif #endif #define ATTR_object_shadow_vs_vs_position (0) #define SLOT_object_shadow_object_shadow_vs_params (0) @@ -66,22 +36,22 @@ SOKOL_SHDC_ALIGN(16) typedef struct object_shadow_object_shadow_vs_params_t { Mat4f un_mvp; } object_shadow_object_shadow_vs_params_t; #pragma pack(pop) -#if defined(SOKOL_GLCORE33) /* - #version 330 - + #version 410 + uniform vec4 object_shadow_vs_params[4]; layout(location = 0) in vec3 vs_position; - + void main() { gl_Position = mat4(object_shadow_vs_params[0], object_shadow_vs_params[1], object_shadow_vs_params[2], object_shadow_vs_params[3]) * vec4(vs_position, 1.0); gl_Position.z = 2.0 * gl_Position.z - gl_Position.w; } - + */ -static const char object_shadow_vs_source_glsl330[334] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e, +#if defined(SOKOL_GLCORE) +static const uint8_t object_shadow_vs_source_glsl410[334] = { + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x6f,0x62,0x6a,0x65,0x63, 0x74,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61, 0x6d,0x73,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f, @@ -103,35 +73,37 @@ static const char object_shadow_vs_source_glsl330[334] = { 0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x7a,0x20,0x2d,0x20,0x67,0x6c,0x5f,0x50,0x6f, 0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x77,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; +#endif /* - #version 330 - + #version 410 + void main() { } - + */ -static const char object_shadow_fs_source_glsl330[32] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x76,0x6f, +#if defined(SOKOL_GLCORE) +static const uint8_t object_shadow_fs_source_glsl410[32] = { + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x76,0x6f, 0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x7d,0x0a,0x0a,0x00, }; -#endif /* SOKOL_GLCORE33 */ -#if defined(SOKOL_GLES3) +#endif /* #version 300 es - + uniform vec4 object_shadow_vs_params[4]; layout(location = 0) in vec3 vs_position; - + void main() { gl_Position = mat4(object_shadow_vs_params[0], object_shadow_vs_params[1], object_shadow_vs_params[2], object_shadow_vs_params[3]) * vec4(vs_position, 1.0); gl_Position.z = 2.0 * gl_Position.z - gl_Position.w; } - + */ -static const char object_shadow_vs_source_glsl300es[337] = { +#if defined(SOKOL_GLES3) +static const uint8_t object_shadow_vs_source_glsl300es[337] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x6f,0x62, 0x6a,0x65,0x63,0x74,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x76,0x73,0x5f,0x70, @@ -155,17 +127,19 @@ static const char object_shadow_vs_source_glsl300es[337] = { 0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x77,0x3b,0x0a,0x7d,0x0a,0x0a, 0x00, }; +#endif /* #version 300 es precision mediump float; precision highp int; - + void main() { } - + */ -static const char object_shadow_fs_source_glsl300es[81] = { +#if defined(SOKOL_GLES3) +static const uint8_t object_shadow_fs_source_glsl300es[81] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, @@ -173,33 +147,32 @@ static const char object_shadow_fs_source_glsl300es[81] = { 0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x7d,0x0a,0x0a, 0x00, }; -#endif /* SOKOL_GLES3 */ -#if defined(SOKOL_D3D11) +#endif /* cbuffer object_shadow_vs_params : register(b0) { row_major float4x4 _19_un_mvp : packoffset(c0); }; - - + + static float4 gl_Position; static float3 vs_position; - + struct SPIRV_Cross_Input { float3 vs_position : TEXCOORD0; }; - + struct SPIRV_Cross_Output { float4 gl_Position : SV_Position; }; - + void vert_main() { gl_Position = mul(float4(vs_position, 1.0f), _19_un_mvp); } - + SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) { vs_position = stage_input.vs_position; @@ -209,7 +182,8 @@ static const char object_shadow_fs_source_glsl300es[81] = { return stage_output; } */ -static const char object_shadow_vs_source_hlsl5[608] = { +#if defined(SOKOL_D3D11) +static const uint8_t object_shadow_vs_source_hlsl5[608] = { 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x6f,0x62,0x6a,0x65,0x63,0x74,0x5f,0x73, 0x68,0x61,0x64,0x6f,0x77,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20, 0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b, @@ -250,54 +224,56 @@ static const char object_shadow_vs_source_hlsl5[608] = { 0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, }; +#endif /* void frag_main() { } - + void main() { frag_main(); } */ -static const char object_shadow_fs_source_hlsl5[56] = { +#if defined(SOKOL_D3D11) +static const uint8_t object_shadow_fs_source_hlsl5[56] = { 0x76,0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29, 0x0a,0x7b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28, 0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69, 0x6e,0x28,0x29,0x3b,0x0a,0x7d,0x0a,0x00, }; -#endif /* SOKOL_D3D11 */ -#if defined(SOKOL_METAL) +#endif /* #include #include - + using namespace metal; - + struct object_shadow_vs_params { float4x4 un_mvp; }; - + struct main0_out { float4 gl_Position [[position]]; }; - + struct main0_in { float3 vs_position [[attribute(0)]]; }; - + vertex main0_out main0(main0_in in [[stage_in]], constant object_shadow_vs_params& _19 [[buffer(0)]]) { main0_out out = {}; out.gl_Position = _19.un_mvp * float4(in.vs_position, 1.0); return out; } - + */ -static const char object_shadow_vs_source_metal_macos[465] = { +#if defined(SOKOL_METAL) +static const uint8_t object_shadow_vs_source_metal_macos[465] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -329,18 +305,20 @@ static const char object_shadow_vs_source_metal_macos[465] = { 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a, 0x00, }; +#endif /* #include #include - + using namespace metal; - + fragment void main0() { } - + */ -static const char object_shadow_fs_source_metal_macos[100] = { +#if defined(SOKOL_METAL) +static const uint8_t object_shadow_fs_source_metal_macos[100] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -349,38 +327,38 @@ static const char object_shadow_fs_source_metal_macos[100] = { 0x20,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x29,0x0a,0x7b,0x0a, 0x7d,0x0a,0x0a,0x00, }; -#endif /* SOKOL_METAL */ -#if defined(SOKOL_METAL) +#endif /* #include #include - + using namespace metal; - + struct object_shadow_vs_params { float4x4 un_mvp; }; - + struct main0_out { float4 gl_Position [[position]]; }; - + struct main0_in { float3 vs_position [[attribute(0)]]; }; - + vertex main0_out main0(main0_in in [[stage_in]], constant object_shadow_vs_params& _19 [[buffer(0)]]) { main0_out out = {}; out.gl_Position = _19.un_mvp * float4(in.vs_position, 1.0); return out; } - + */ -static const char object_shadow_vs_source_metal_ios[465] = { +#if defined(SOKOL_METAL) +static const uint8_t object_shadow_vs_source_metal_ios[465] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -412,18 +390,20 @@ static const char object_shadow_vs_source_metal_ios[465] = { 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a, 0x00, }; +#endif /* #include #include - + using namespace metal; - + fragment void main0() { } - + */ -static const char object_shadow_fs_source_metal_ios[100] = { +#if defined(SOKOL_METAL) +static const uint8_t object_shadow_fs_source_metal_ios[100] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -432,38 +412,38 @@ static const char object_shadow_fs_source_metal_ios[100] = { 0x20,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x29,0x0a,0x7b,0x0a, 0x7d,0x0a,0x0a,0x00, }; -#endif /* SOKOL_METAL */ -#if defined(SOKOL_METAL) +#endif /* #include #include - + using namespace metal; - + struct object_shadow_vs_params { float4x4 un_mvp; }; - + struct main0_out { float4 gl_Position [[position]]; }; - + struct main0_in { float3 vs_position [[attribute(0)]]; }; - + vertex main0_out main0(main0_in in [[stage_in]], constant object_shadow_vs_params& _19 [[buffer(0)]]) { main0_out out = {}; out.gl_Position = _19.un_mvp * float4(in.vs_position, 1.0); return out; } - + */ -static const char object_shadow_vs_source_metal_sim[465] = { +#if defined(SOKOL_METAL) +static const uint8_t object_shadow_vs_source_metal_sim[465] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -495,18 +475,20 @@ static const char object_shadow_vs_source_metal_sim[465] = { 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a, 0x00, }; +#endif /* #include #include - + using namespace metal; - + fragment void main0() { } - + */ -static const char object_shadow_fs_source_metal_sim[100] = { +#if defined(SOKOL_METAL) +static const uint8_t object_shadow_fs_source_metal_sim[100] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -515,187 +497,188 @@ static const char object_shadow_fs_source_metal_sim[100] = { 0x20,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x29,0x0a,0x7b,0x0a, 0x7d,0x0a,0x0a,0x00, }; -#endif /* SOKOL_METAL */ -#if !defined(SOKOL_GFX_INCLUDED) - #error "Please include sokol_gfx.h before object_shadow.h" #endif static inline const sg_shader_desc* object_shadow_program_shader_desc(sg_backend backend) { - #if defined(SOKOL_GLCORE33) - if (backend == SG_BACKEND_GLCORE33) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.attrs[0].name = "vs_position"; - desc.vs.source = object_shadow_vs_source_glsl330; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 64; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "object_shadow_vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 4; - desc.fs.source = object_shadow_fs_source_glsl330; - desc.fs.entry = "main"; - desc.label = "object_shadow_program_shader"; + #if defined(SOKOL_GLCORE) + if (backend == SG_BACKEND_GLCORE) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.attrs[0].name = "vs_position"; + desc.vs.source = (const char*)object_shadow_vs_source_glsl410; + desc.vs.entry = "main"; + desc.vs.uniform_blocks[0].size = 64; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.vs.uniform_blocks[0].uniforms[0].name = "object_shadow_vs_params"; + desc.vs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; + desc.vs.uniform_blocks[0].uniforms[0].array_count = 4; + desc.fs.source = (const char*)object_shadow_fs_source_glsl410; + desc.fs.entry = "main"; + desc.label = "object_shadow_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_GLCORE33 */ - #if defined(SOKOL_GLES3) - if (backend == SG_BACKEND_GLES3) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.attrs[0].name = "vs_position"; - desc.vs.source = object_shadow_vs_source_glsl300es; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 64; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "object_shadow_vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 4; - desc.fs.source = object_shadow_fs_source_glsl300es; - desc.fs.entry = "main"; - desc.label = "object_shadow_program_shader"; + #endif /* SOKOL_GLCORE */ + #if defined(SOKOL_GLES3) + if (backend == SG_BACKEND_GLES3) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.attrs[0].name = "vs_position"; + desc.vs.source = (const char*)object_shadow_vs_source_glsl300es; + desc.vs.entry = "main"; + desc.vs.uniform_blocks[0].size = 64; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.vs.uniform_blocks[0].uniforms[0].name = "object_shadow_vs_params"; + desc.vs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; + desc.vs.uniform_blocks[0].uniforms[0].array_count = 4; + desc.fs.source = (const char*)object_shadow_fs_source_glsl300es; + desc.fs.entry = "main"; + desc.label = "object_shadow_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_GLES3 */ - #if defined(SOKOL_D3D11) - if (backend == SG_BACKEND_D3D11) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.attrs[0].sem_name = "TEXCOORD"; - desc.attrs[0].sem_index = 0; - desc.vs.source = object_shadow_vs_source_hlsl5; - desc.vs.d3d11_target = "vs_5_0"; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 64; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = object_shadow_fs_source_hlsl5; - desc.fs.d3d11_target = "ps_5_0"; - desc.fs.entry = "main"; - desc.label = "object_shadow_program_shader"; + #endif /* SOKOL_GLES3 */ + #if defined(SOKOL_D3D11) + if (backend == SG_BACKEND_D3D11) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.attrs[0].sem_name = "TEXCOORD"; + desc.attrs[0].sem_index = 0; + desc.vs.source = (const char*)object_shadow_vs_source_hlsl5; + desc.vs.d3d11_target = "vs_5_0"; + desc.vs.entry = "main"; + desc.vs.uniform_blocks[0].size = 64; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.source = (const char*)object_shadow_fs_source_hlsl5; + desc.fs.d3d11_target = "ps_5_0"; + desc.fs.entry = "main"; + desc.label = "object_shadow_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_D3D11 */ - #if defined(SOKOL_METAL) - if (backend == SG_BACKEND_METAL_MACOS) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vs.source = object_shadow_vs_source_metal_macos; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 64; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = object_shadow_fs_source_metal_macos; - desc.fs.entry = "main0"; - desc.label = "object_shadow_program_shader"; + #endif /* SOKOL_D3D11 */ + #if defined(SOKOL_METAL) + if (backend == SG_BACKEND_METAL_MACOS) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vs.source = (const char*)object_shadow_vs_source_metal_macos; + desc.vs.entry = "main0"; + desc.vs.uniform_blocks[0].size = 64; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.source = (const char*)object_shadow_fs_source_metal_macos; + desc.fs.entry = "main0"; + desc.label = "object_shadow_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_METAL */ - #if defined(SOKOL_METAL) - if (backend == SG_BACKEND_METAL_IOS) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vs.source = object_shadow_vs_source_metal_ios; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 64; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = object_shadow_fs_source_metal_ios; - desc.fs.entry = "main0"; - desc.label = "object_shadow_program_shader"; + #endif /* SOKOL_METAL */ + #if defined(SOKOL_METAL) + if (backend == SG_BACKEND_METAL_IOS) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vs.source = (const char*)object_shadow_vs_source_metal_ios; + desc.vs.entry = "main0"; + desc.vs.uniform_blocks[0].size = 64; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.source = (const char*)object_shadow_fs_source_metal_ios; + desc.fs.entry = "main0"; + desc.label = "object_shadow_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_METAL */ - #if defined(SOKOL_METAL) - if (backend == SG_BACKEND_METAL_SIMULATOR) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vs.source = object_shadow_vs_source_metal_sim; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 64; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = object_shadow_fs_source_metal_sim; - desc.fs.entry = "main0"; - desc.label = "object_shadow_program_shader"; + #endif /* SOKOL_METAL */ + #if defined(SOKOL_METAL) + if (backend == SG_BACKEND_METAL_SIMULATOR) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vs.source = (const char*)object_shadow_vs_source_metal_sim; + desc.vs.entry = "main0"; + desc.vs.uniform_blocks[0].size = 64; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.source = (const char*)object_shadow_fs_source_metal_sim; + desc.fs.entry = "main0"; + desc.label = "object_shadow_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_METAL */ - return 0; + #endif /* SOKOL_METAL */ + return 0; } static inline int object_shadow_program_attr_slot(const char* attr_name) { - (void)attr_name; - if (0 == strcmp(attr_name, "vs_position")) { - return 0; - } - return -1; + (void)attr_name; + if (0 == strcmp(attr_name, "vs_position")) { + return 0; + } + return -1; } static inline int object_shadow_program_image_slot(sg_shader_stage stage, const char* img_name) { - (void)stage; (void)img_name; - return -1; + (void)stage; (void)img_name; + return -1; } static inline int object_shadow_program_sampler_slot(sg_shader_stage stage, const char* smp_name) { - (void)stage; (void)smp_name; - return -1; + (void)stage; (void)smp_name; + return -1; } static inline int object_shadow_program_uniformblock_slot(sg_shader_stage stage, const char* ub_name) { - (void)stage; (void)ub_name; - if (SG_SHADERSTAGE_VS == stage) { - if (0 == strcmp(ub_name, "object_shadow_vs_params")) { - return 0; + (void)stage; (void)ub_name; + if (SG_SHADERSTAGE_VS == stage) { + if (0 == strcmp(ub_name, "object_shadow_vs_params")) { + return 0; + } } - } - return -1; + return -1; } static inline size_t object_shadow_program_uniformblock_size(sg_shader_stage stage, const char* ub_name) { - (void)stage; (void)ub_name; - if (SG_SHADERSTAGE_VS == stage) { - if (0 == strcmp(ub_name, "object_shadow_vs_params")) { - return sizeof(object_shadow_object_shadow_vs_params_t); + (void)stage; (void)ub_name; + if (SG_SHADERSTAGE_VS == stage) { + if (0 == strcmp(ub_name, "object_shadow_vs_params")) { + return sizeof(object_shadow_object_shadow_vs_params_t); + } } - } - return 0; + return 0; } static inline int object_shadow_program_uniform_offset(sg_shader_stage stage, const char* ub_name, const char* u_name) { - (void)stage; (void)ub_name; (void)u_name; - if (SG_SHADERSTAGE_VS == stage) { - if (0 == strcmp(ub_name, "object_shadow_vs_params")) { - if (0 == strcmp(u_name, "un_mvp")) { - return 0; - } + (void)stage; (void)ub_name; (void)u_name; + if (SG_SHADERSTAGE_VS == stage) { + if (0 == strcmp(ub_name, "object_shadow_vs_params")) { + if (0 == strcmp(u_name, "un_mvp")) { + return 0; + } + } } - } - return -1; + return -1; } static inline sg_shader_uniform_desc object_shadow_program_uniform_desc(sg_shader_stage stage, const char* ub_name, const char* u_name) { - (void)stage; (void)ub_name; (void)u_name; - #if defined(__cplusplus) - sg_shader_uniform_desc desc = {}; - #else - sg_shader_uniform_desc desc = {0}; - #endif - if (SG_SHADERSTAGE_VS == stage) { - if (0 == strcmp(ub_name, "object_shadow_vs_params")) { - if (0 == strcmp(u_name, "un_mvp")) { - desc.name = "un_mvp"; - desc.type = SG_UNIFORMTYPE_MAT4; - desc.array_count = 1; - return desc; - } + (void)stage; (void)ub_name; (void)u_name; + #if defined(__cplusplus) + sg_shader_uniform_desc desc = {}; + #else + sg_shader_uniform_desc desc = {0}; + #endif + if (SG_SHADERSTAGE_VS == stage) { + if (0 == strcmp(ub_name, "object_shadow_vs_params")) { + if (0 == strcmp(u_name, "un_mvp")) { + desc.name = "un_mvp"; + desc.type = SG_UNIFORMTYPE_MAT4; + desc.array_count = 0; + return desc; + } + } } - } - return desc; + return desc; +} +static inline int object_shadow_program_storagebuffer_slot(sg_shader_stage stage, const char* sbuf_name) { + (void)stage; (void)sbuf_name; + return -1; } diff --git a/Source/Render/sokol/shaders/only_texture.h b/Source/Render/sokol/shaders/only_texture.h index 1ee3120f..1f08b0d5 100644 --- a/Source/Render/sokol/shaders/only_texture.h +++ b/Source/Render/sokol/shaders/only_texture.h @@ -4,172 +4,144 @@ Generated by sokol-shdc (https://github.com/floooh/sokol-tools) - Cmdline: sokol-shdc --input only_texture.glsl --output only_texture.h --slang glsl330:glsl300es:hlsl5:metal_macos:metal_ios:metal_sim --format=sokol --reflection --ifdef --module only_texture + Cmdline: + sokol-shdc --input only_texture.glsl --output only_texture.h --slang glsl410:glsl300es:hlsl5:metal_macos:metal_ios:metal_sim --format=sokol --reflection --ifdef --module only_texture Overview: - - Shader program 'program': - Get shader desc: only_texture_program_shader_desc(sg_query_backend()); - Vertex shader: vs - Attribute slots: - ATTR_only_texture_vs_vs_position = 0 - ATTR_only_texture_vs_vs_texcoord0 = 1 - Uniform block 'only_texture_vs_params': - C struct: only_texture_only_texture_vs_params_t - Bind slot: SLOT_only_texture_only_texture_vs_params = 0 - Fragment shader: fs - Image 'un_tex0': - Type: SG_IMAGETYPE_2D - Sample Type: SG_IMAGESAMPLETYPE_FLOAT - Bind slot: SLOT_only_texture_un_tex0 = 0 - Sampler 'un_sampler0': - Type: SG_SAMPLERTYPE_FILTERING - Bind slot: SLOT_only_texture_un_sampler0 = 0 - Image Sampler Pair 'un_tex0_un_sampler0': - Image: un_tex0 - Sampler: un_sampler0 - - - Shader descriptor structs: - - sg_shader program = sg_make_shader(only_texture_program_shader_desc(sg_query_backend())); - - Vertex attribute locations for vertex shader 'vs': - - sg_pipeline pip = sg_make_pipeline(&(sg_pipeline_desc){ - .layout = { - .attrs = { - [ATTR_only_texture_vs_vs_position] = { ... }, - [ATTR_only_texture_vs_vs_texcoord0] = { ... }, - }, - }, - ...}); - - - Image bind slots, use as index in sg_bindings.vs.images[] or .fs.images[] - - SLOT_only_texture_un_tex0 = 0; - - Sampler bind slots, use as index in sg_bindings.vs.sampler[] or .fs.samplers[] - - SLOT_only_texture_un_sampler0 = 0; - - Bind slot and C-struct for uniform block 'only_texture_vs_params': - - only_texture_only_texture_vs_params_t only_texture_vs_params = { - .un_mvp = ...; - }; - sg_apply_uniforms(SG_SHADERSTAGE_[VS|FS], SLOT_only_texture_only_texture_vs_params, &SG_RANGE(only_texture_vs_params)); - + ========= + Shader program: 'program': + Get shader desc: only_texture_program_shader_desc(sg_query_backend()); + Vertex shader: vs + Attributes: + ATTR_only_texture_vs_vs_position => 0 + ATTR_only_texture_vs_vs_texcoord0 => 1 + Uniform block 'only_texture_vs_params': + C struct: only_texture_only_texture_vs_params_t + Bind slot: SLOT_only_texture_only_texture_vs_params => 0 + Fragment shader: fs + Image 'un_tex0': + Image type: SG_IMAGETYPE_2D + Sample type: SG_IMAGESAMPLETYPE_FLOAT + Multisampled: false + Bind slot: SLOT_only_texture_un_tex0 => 0 + Sampler 'un_sampler0': + Type: SG_SAMPLERTYPE_FILTERING + Bind slot: SLOT_only_texture_un_sampler0 => 0 + Image Sampler Pair 'un_tex0_un_sampler0': + Image: un_tex0 + Sampler: un_sampler0 */ -#include -#include -#include -#include +#if !defined(SOKOL_GFX_INCLUDED) +#error "Please include sokol_gfx.h before only_texture.h" +#endif #if !defined(SOKOL_SHDC_ALIGN) - #if defined(_MSC_VER) - #define SOKOL_SHDC_ALIGN(a) __declspec(align(a)) - #else - #define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a))) - #endif +#if defined(_MSC_VER) +#define SOKOL_SHDC_ALIGN(a) __declspec(align(a)) +#else +#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a))) +#endif #endif #define ATTR_only_texture_vs_vs_position (0) #define ATTR_only_texture_vs_vs_texcoord0 (1) +#define SLOT_only_texture_only_texture_vs_params (0) #define SLOT_only_texture_un_tex0 (0) #define SLOT_only_texture_un_sampler0 (0) -#define SLOT_only_texture_only_texture_vs_params (0) #pragma pack(push,1) SOKOL_SHDC_ALIGN(16) typedef struct only_texture_only_texture_vs_params_t { Mat4f un_mvp; } only_texture_only_texture_vs_params_t; #pragma pack(pop) -#if defined(SOKOL_GLCORE33) /* - #version 330 - + #version 410 + uniform vec4 only_texture_vs_params[4]; layout(location = 0) in vec3 vs_position; - out vec2 fs_uv0; + layout(location = 0) out vec2 fs_uv0; layout(location = 1) in vec2 vs_texcoord0; - + void main() { gl_Position = mat4(only_texture_vs_params[0], only_texture_vs_params[1], only_texture_vs_params[2], only_texture_vs_params[3]) * vec4(vs_position, 1.0); fs_uv0 = vs_texcoord0; } - + */ -static const char only_texture_vs_source_glsl330[359] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e, +#if defined(SOKOL_GLCORE) +static const uint8_t only_texture_vs_source_glsl410[380] = { + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x6f,0x6e,0x6c,0x79,0x5f, 0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, 0x73,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65, 0x63,0x33,0x20,0x76,0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a, - 0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x3b, - 0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, - 0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x76,0x73, - 0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x0a,0x76,0x6f,0x69, - 0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67, - 0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74, - 0x34,0x28,0x6f,0x6e,0x6c,0x79,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76, - 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x6f,0x6e,0x6c, + 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, + 0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x66,0x73, + 0x5f,0x75,0x76,0x30,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, + 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65, + 0x63,0x32,0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b, + 0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a, + 0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20, + 0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x6f,0x6e,0x6c,0x79,0x5f,0x74,0x65,0x78,0x74, + 0x75,0x72,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d, + 0x2c,0x20,0x6f,0x6e,0x6c,0x79,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76, + 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x6f,0x6e,0x6c, 0x79,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72, - 0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x6f,0x6e,0x6c,0x79,0x5f,0x74,0x65,0x78, - 0x74,0x75,0x72,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32, - 0x5d,0x2c,0x20,0x6f,0x6e,0x6c,0x79,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f, - 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20, - 0x76,0x65,0x63,0x34,0x28,0x76,0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e, - 0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x75, - 0x76,0x30,0x20,0x3d,0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64, - 0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x6f,0x6e,0x6c,0x79,0x5f,0x74,0x65,0x78, + 0x74,0x75,0x72,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33, + 0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x73,0x5f,0x70,0x6f,0x73, + 0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20, + 0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x20,0x3d,0x20,0x76,0x73,0x5f,0x74,0x65,0x78, + 0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; +#endif /* - #version 330 - + #version 410 + uniform sampler2D un_tex0_un_sampler0; - + layout(location = 0) out vec4 frag_color; - in vec2 fs_uv0; - + layout(location = 0) in vec2 fs_uv0; + void main() { frag_color = texture(un_tex0_un_sampler0, fs_uv0); } - + */ -static const char only_texture_fs_source_glsl330[186] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e, +#if defined(SOKOL_GLCORE) +static const uint8_t only_texture_fs_source_glsl410[207] = { + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20, 0x75,0x6e,0x5f,0x74,0x65,0x78,0x30,0x5f,0x75,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c, 0x65,0x72,0x30,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63, 0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76, 0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, - 0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x3b,0x0a, - 0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20, - 0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20, - 0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x75,0x6e,0x5f,0x74,0x65,0x78,0x30,0x5f, - 0x75,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x30,0x2c,0x20,0x66,0x73,0x5f, - 0x75,0x76,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, + 0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x66,0x73,0x5f, + 0x75,0x76,0x30,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28, + 0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, + 0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x75,0x6e,0x5f, + 0x74,0x65,0x78,0x30,0x5f,0x75,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x30, + 0x2c,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -#endif /* SOKOL_GLCORE33 */ -#if defined(SOKOL_GLES3) +#endif /* #version 300 es - + uniform vec4 only_texture_vs_params[4]; layout(location = 0) in vec3 vs_position; out vec2 fs_uv0; layout(location = 1) in vec2 vs_texcoord0; - + void main() { gl_Position = mat4(only_texture_vs_params[0], only_texture_vs_params[1], only_texture_vs_params[2], only_texture_vs_params[3]) * vec4(vs_position, 1.0); fs_uv0 = vs_texcoord0; } - + */ -static const char only_texture_vs_source_glsl300es[362] = { +#if defined(SOKOL_GLES3) +static const uint8_t only_texture_vs_source_glsl300es[362] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x6f,0x6e, 0x6c,0x79,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61, @@ -194,23 +166,25 @@ static const char only_texture_vs_source_glsl300es[362] = { 0x73,0x5f,0x75,0x76,0x30,0x20,0x3d,0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f, 0x6f,0x72,0x64,0x30,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; +#endif /* #version 300 es precision mediump float; precision highp int; - + uniform highp sampler2D un_tex0_un_sampler0; - + layout(location = 0) out highp vec4 frag_color; in highp vec2 fs_uv0; - + void main() { frag_color = texture(un_tex0_un_sampler0, fs_uv0); } - + */ -static const char only_texture_fs_source_glsl300es[253] = { +#if defined(SOKOL_GLES3) +static const uint8_t only_texture_fs_source_glsl300es[253] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, @@ -228,38 +202,37 @@ static const char only_texture_fs_source_glsl300es[253] = { 0x78,0x30,0x5f,0x75,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x30,0x2c,0x20, 0x66,0x73,0x5f,0x75,0x76,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -#endif /* SOKOL_GLES3 */ -#if defined(SOKOL_D3D11) +#endif /* cbuffer only_texture_vs_params : register(b0) { row_major float4x4 _19_un_mvp : packoffset(c0); }; - - + + static float4 gl_Position; static float3 vs_position; static float2 fs_uv0; static float2 vs_texcoord0; - + struct SPIRV_Cross_Input { float3 vs_position : TEXCOORD0; float2 vs_texcoord0 : TEXCOORD1; }; - + struct SPIRV_Cross_Output { float2 fs_uv0 : TEXCOORD0; float4 gl_Position : SV_Position; }; - + void vert_main() { gl_Position = mul(float4(vs_position, 1.0f), _19_un_mvp); fs_uv0 = vs_texcoord0; } - + SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) { vs_position = stage_input.vs_position; @@ -271,7 +244,8 @@ static const char only_texture_fs_source_glsl300es[253] = { return stage_output; } */ -static const char only_texture_vs_source_hlsl5[831] = { +#if defined(SOKOL_D3D11) +static const uint8_t only_texture_vs_source_hlsl5[831] = { 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x6f,0x6e,0x6c,0x79,0x5f,0x74,0x65,0x78, 0x74,0x75,0x72,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x3a, 0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a, @@ -325,28 +299,29 @@ static const char only_texture_vs_source_hlsl5[831] = { 0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74, 0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, }; +#endif /* Texture2D un_tex0 : register(t0); SamplerState un_sampler0 : register(s0); - + static float4 frag_color; static float2 fs_uv0; - + struct SPIRV_Cross_Input { float2 fs_uv0 : TEXCOORD0; }; - + struct SPIRV_Cross_Output { float4 frag_color : SV_Target0; }; - + void frag_main() { frag_color = un_tex0.Sample(un_sampler0, fs_uv0); } - + SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) { fs_uv0 = stage_input.fs_uv0; @@ -356,7 +331,8 @@ static const char only_texture_vs_source_hlsl5[831] = { return stage_output; } */ -static const char only_texture_fs_source_hlsl5[553] = { +#if defined(SOKOL_D3D11) +static const uint8_t only_texture_fs_source_hlsl5[553] = { 0x54,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x44,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x34, 0x3e,0x20,0x75,0x6e,0x5f,0x74,0x65,0x78,0x30,0x20,0x3a,0x20,0x72,0x65,0x67,0x69, 0x73,0x74,0x65,0x72,0x28,0x74,0x30,0x29,0x3b,0x0a,0x53,0x61,0x6d,0x70,0x6c,0x65, @@ -393,31 +369,30 @@ static const char only_texture_fs_source_hlsl5[553] = { 0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75, 0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, }; -#endif /* SOKOL_D3D11 */ -#if defined(SOKOL_METAL) +#endif /* #include #include - + using namespace metal; - + struct only_texture_vs_params { float4x4 un_mvp; }; - + struct main0_out { float2 fs_uv0 [[user(locn0)]]; float4 gl_Position [[position]]; }; - + struct main0_in { float3 vs_position [[attribute(0)]]; float2 vs_texcoord0 [[attribute(1)]]; }; - + vertex main0_out main0(main0_in in [[stage_in]], constant only_texture_vs_params& _19 [[buffer(0)]]) { main0_out out = {}; @@ -425,9 +400,10 @@ static const char only_texture_fs_source_hlsl5[553] = { out.fs_uv0 = in.vs_texcoord0; return out; } - + */ -static const char only_texture_vs_source_metal_macos[574] = { +#if defined(SOKOL_METAL) +static const uint8_t only_texture_vs_source_metal_macos[574] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -465,31 +441,33 @@ static const char only_texture_vs_source_metal_macos[574] = { 0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65, 0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; +#endif /* #include #include - + using namespace metal; - + struct main0_out { float4 frag_color [[color(0)]]; }; - + struct main0_in { float2 fs_uv0 [[user(locn0)]]; }; - + fragment main0_out main0(main0_in in [[stage_in]], texture2d un_tex0 [[texture(0)]], sampler un_sampler0 [[sampler(0)]]) { main0_out out = {}; out.frag_color = un_tex0.sample(un_sampler0, in.fs_uv0); return out; } - + */ -static const char only_texture_fs_source_metal_macos[423] = { +#if defined(SOKOL_METAL) +static const uint8_t only_texture_fs_source_metal_macos[423] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -518,31 +496,30 @@ static const char only_texture_fs_source_metal_macos[423] = { 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75, 0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -#endif /* SOKOL_METAL */ -#if defined(SOKOL_METAL) +#endif /* #include #include - + using namespace metal; - + struct only_texture_vs_params { float4x4 un_mvp; }; - + struct main0_out { float2 fs_uv0 [[user(locn0)]]; float4 gl_Position [[position]]; }; - + struct main0_in { float3 vs_position [[attribute(0)]]; float2 vs_texcoord0 [[attribute(1)]]; }; - + vertex main0_out main0(main0_in in [[stage_in]], constant only_texture_vs_params& _19 [[buffer(0)]]) { main0_out out = {}; @@ -550,9 +527,10 @@ static const char only_texture_fs_source_metal_macos[423] = { out.fs_uv0 = in.vs_texcoord0; return out; } - + */ -static const char only_texture_vs_source_metal_ios[574] = { +#if defined(SOKOL_METAL) +static const uint8_t only_texture_vs_source_metal_ios[574] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -590,31 +568,33 @@ static const char only_texture_vs_source_metal_ios[574] = { 0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65, 0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; +#endif /* #include #include - + using namespace metal; - + struct main0_out { float4 frag_color [[color(0)]]; }; - + struct main0_in { float2 fs_uv0 [[user(locn0)]]; }; - + fragment main0_out main0(main0_in in [[stage_in]], texture2d un_tex0 [[texture(0)]], sampler un_sampler0 [[sampler(0)]]) { main0_out out = {}; out.frag_color = un_tex0.sample(un_sampler0, in.fs_uv0); return out; } - + */ -static const char only_texture_fs_source_metal_ios[423] = { +#if defined(SOKOL_METAL) +static const uint8_t only_texture_fs_source_metal_ios[423] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -643,31 +623,30 @@ static const char only_texture_fs_source_metal_ios[423] = { 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75, 0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -#endif /* SOKOL_METAL */ -#if defined(SOKOL_METAL) +#endif /* #include #include - + using namespace metal; - + struct only_texture_vs_params { float4x4 un_mvp; }; - + struct main0_out { float2 fs_uv0 [[user(locn0)]]; float4 gl_Position [[position]]; }; - + struct main0_in { float3 vs_position [[attribute(0)]]; float2 vs_texcoord0 [[attribute(1)]]; }; - + vertex main0_out main0(main0_in in [[stage_in]], constant only_texture_vs_params& _19 [[buffer(0)]]) { main0_out out = {}; @@ -675,9 +654,10 @@ static const char only_texture_fs_source_metal_ios[423] = { out.fs_uv0 = in.vs_texcoord0; return out; } - + */ -static const char only_texture_vs_source_metal_sim[574] = { +#if defined(SOKOL_METAL) +static const uint8_t only_texture_vs_source_metal_sim[574] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -715,31 +695,33 @@ static const char only_texture_vs_source_metal_sim[574] = { 0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65, 0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; +#endif /* #include #include - + using namespace metal; - + struct main0_out { float4 frag_color [[color(0)]]; }; - + struct main0_in { float2 fs_uv0 [[user(locn0)]]; }; - + fragment main0_out main0(main0_in in [[stage_in]], texture2d un_tex0 [[texture(0)]], sampler un_sampler0 [[sampler(0)]]) { main0_out out = {}; out.frag_color = un_tex0.sample(un_sampler0, in.fs_uv0); return out; } - + */ -static const char only_texture_fs_source_metal_sim[423] = { +#if defined(SOKOL_METAL) +static const uint8_t only_texture_fs_source_metal_sim[423] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -768,260 +750,261 @@ static const char only_texture_fs_source_metal_sim[423] = { 0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75, 0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -#endif /* SOKOL_METAL */ -#if !defined(SOKOL_GFX_INCLUDED) - #error "Please include sokol_gfx.h before only_texture.h" #endif static inline const sg_shader_desc* only_texture_program_shader_desc(sg_backend backend) { - #if defined(SOKOL_GLCORE33) - if (backend == SG_BACKEND_GLCORE33) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.attrs[0].name = "vs_position"; - desc.attrs[1].name = "vs_texcoord0"; - desc.vs.source = only_texture_vs_source_glsl330; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 64; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "only_texture_vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 4; - desc.fs.source = only_texture_fs_source_glsl330; - desc.fs.entry = "main"; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.fs.image_sampler_pairs[0].glsl_name = "un_tex0_un_sampler0"; - desc.label = "only_texture_program_shader"; + #if defined(SOKOL_GLCORE) + if (backend == SG_BACKEND_GLCORE) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.attrs[0].name = "vs_position"; + desc.attrs[1].name = "vs_texcoord0"; + desc.vs.source = (const char*)only_texture_vs_source_glsl410; + desc.vs.entry = "main"; + desc.vs.uniform_blocks[0].size = 64; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.vs.uniform_blocks[0].uniforms[0].name = "only_texture_vs_params"; + desc.vs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; + desc.vs.uniform_blocks[0].uniforms[0].array_count = 4; + desc.fs.source = (const char*)only_texture_fs_source_glsl410; + desc.fs.entry = "main"; + desc.fs.images[0].used = true; + desc.fs.images[0].multisampled = false; + desc.fs.images[0].image_type = SG_IMAGETYPE_2D; + desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.samplers[0].used = true; + desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; + desc.fs.image_sampler_pairs[0].used = true; + desc.fs.image_sampler_pairs[0].image_slot = 0; + desc.fs.image_sampler_pairs[0].sampler_slot = 0; + desc.fs.image_sampler_pairs[0].glsl_name = "un_tex0_un_sampler0"; + desc.label = "only_texture_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_GLCORE33 */ - #if defined(SOKOL_GLES3) - if (backend == SG_BACKEND_GLES3) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.attrs[0].name = "vs_position"; - desc.attrs[1].name = "vs_texcoord0"; - desc.vs.source = only_texture_vs_source_glsl300es; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 64; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "only_texture_vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 4; - desc.fs.source = only_texture_fs_source_glsl300es; - desc.fs.entry = "main"; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.fs.image_sampler_pairs[0].glsl_name = "un_tex0_un_sampler0"; - desc.label = "only_texture_program_shader"; + #endif /* SOKOL_GLCORE */ + #if defined(SOKOL_GLES3) + if (backend == SG_BACKEND_GLES3) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.attrs[0].name = "vs_position"; + desc.attrs[1].name = "vs_texcoord0"; + desc.vs.source = (const char*)only_texture_vs_source_glsl300es; + desc.vs.entry = "main"; + desc.vs.uniform_blocks[0].size = 64; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.vs.uniform_blocks[0].uniforms[0].name = "only_texture_vs_params"; + desc.vs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; + desc.vs.uniform_blocks[0].uniforms[0].array_count = 4; + desc.fs.source = (const char*)only_texture_fs_source_glsl300es; + desc.fs.entry = "main"; + desc.fs.images[0].used = true; + desc.fs.images[0].multisampled = false; + desc.fs.images[0].image_type = SG_IMAGETYPE_2D; + desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.samplers[0].used = true; + desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; + desc.fs.image_sampler_pairs[0].used = true; + desc.fs.image_sampler_pairs[0].image_slot = 0; + desc.fs.image_sampler_pairs[0].sampler_slot = 0; + desc.fs.image_sampler_pairs[0].glsl_name = "un_tex0_un_sampler0"; + desc.label = "only_texture_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_GLES3 */ - #if defined(SOKOL_D3D11) - if (backend == SG_BACKEND_D3D11) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.attrs[0].sem_name = "TEXCOORD"; - desc.attrs[0].sem_index = 0; - desc.attrs[1].sem_name = "TEXCOORD"; - desc.attrs[1].sem_index = 1; - desc.vs.source = only_texture_vs_source_hlsl5; - desc.vs.d3d11_target = "vs_5_0"; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 64; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = only_texture_fs_source_hlsl5; - desc.fs.d3d11_target = "ps_5_0"; - desc.fs.entry = "main"; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.label = "only_texture_program_shader"; + #endif /* SOKOL_GLES3 */ + #if defined(SOKOL_D3D11) + if (backend == SG_BACKEND_D3D11) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.attrs[0].sem_name = "TEXCOORD"; + desc.attrs[0].sem_index = 0; + desc.attrs[1].sem_name = "TEXCOORD"; + desc.attrs[1].sem_index = 1; + desc.vs.source = (const char*)only_texture_vs_source_hlsl5; + desc.vs.d3d11_target = "vs_5_0"; + desc.vs.entry = "main"; + desc.vs.uniform_blocks[0].size = 64; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.source = (const char*)only_texture_fs_source_hlsl5; + desc.fs.d3d11_target = "ps_5_0"; + desc.fs.entry = "main"; + desc.fs.images[0].used = true; + desc.fs.images[0].multisampled = false; + desc.fs.images[0].image_type = SG_IMAGETYPE_2D; + desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.samplers[0].used = true; + desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; + desc.fs.image_sampler_pairs[0].used = true; + desc.fs.image_sampler_pairs[0].image_slot = 0; + desc.fs.image_sampler_pairs[0].sampler_slot = 0; + desc.label = "only_texture_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_D3D11 */ - #if defined(SOKOL_METAL) - if (backend == SG_BACKEND_METAL_MACOS) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vs.source = only_texture_vs_source_metal_macos; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 64; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = only_texture_fs_source_metal_macos; - desc.fs.entry = "main0"; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.label = "only_texture_program_shader"; + #endif /* SOKOL_D3D11 */ + #if defined(SOKOL_METAL) + if (backend == SG_BACKEND_METAL_MACOS) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vs.source = (const char*)only_texture_vs_source_metal_macos; + desc.vs.entry = "main0"; + desc.vs.uniform_blocks[0].size = 64; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.source = (const char*)only_texture_fs_source_metal_macos; + desc.fs.entry = "main0"; + desc.fs.images[0].used = true; + desc.fs.images[0].multisampled = false; + desc.fs.images[0].image_type = SG_IMAGETYPE_2D; + desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.samplers[0].used = true; + desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; + desc.fs.image_sampler_pairs[0].used = true; + desc.fs.image_sampler_pairs[0].image_slot = 0; + desc.fs.image_sampler_pairs[0].sampler_slot = 0; + desc.label = "only_texture_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_METAL */ - #if defined(SOKOL_METAL) - if (backend == SG_BACKEND_METAL_IOS) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vs.source = only_texture_vs_source_metal_ios; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 64; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = only_texture_fs_source_metal_ios; - desc.fs.entry = "main0"; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.label = "only_texture_program_shader"; + #endif /* SOKOL_METAL */ + #if defined(SOKOL_METAL) + if (backend == SG_BACKEND_METAL_IOS) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vs.source = (const char*)only_texture_vs_source_metal_ios; + desc.vs.entry = "main0"; + desc.vs.uniform_blocks[0].size = 64; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.source = (const char*)only_texture_fs_source_metal_ios; + desc.fs.entry = "main0"; + desc.fs.images[0].used = true; + desc.fs.images[0].multisampled = false; + desc.fs.images[0].image_type = SG_IMAGETYPE_2D; + desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.samplers[0].used = true; + desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; + desc.fs.image_sampler_pairs[0].used = true; + desc.fs.image_sampler_pairs[0].image_slot = 0; + desc.fs.image_sampler_pairs[0].sampler_slot = 0; + desc.label = "only_texture_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_METAL */ - #if defined(SOKOL_METAL) - if (backend == SG_BACKEND_METAL_SIMULATOR) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vs.source = only_texture_vs_source_metal_sim; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 64; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = only_texture_fs_source_metal_sim; - desc.fs.entry = "main0"; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.label = "only_texture_program_shader"; + #endif /* SOKOL_METAL */ + #if defined(SOKOL_METAL) + if (backend == SG_BACKEND_METAL_SIMULATOR) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vs.source = (const char*)only_texture_vs_source_metal_sim; + desc.vs.entry = "main0"; + desc.vs.uniform_blocks[0].size = 64; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.source = (const char*)only_texture_fs_source_metal_sim; + desc.fs.entry = "main0"; + desc.fs.images[0].used = true; + desc.fs.images[0].multisampled = false; + desc.fs.images[0].image_type = SG_IMAGETYPE_2D; + desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.samplers[0].used = true; + desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_FILTERING; + desc.fs.image_sampler_pairs[0].used = true; + desc.fs.image_sampler_pairs[0].image_slot = 0; + desc.fs.image_sampler_pairs[0].sampler_slot = 0; + desc.label = "only_texture_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_METAL */ - return 0; + #endif /* SOKOL_METAL */ + return 0; } static inline int only_texture_program_attr_slot(const char* attr_name) { - (void)attr_name; - if (0 == strcmp(attr_name, "vs_position")) { - return 0; - } - if (0 == strcmp(attr_name, "vs_texcoord0")) { - return 1; - } - return -1; + (void)attr_name; + if (0 == strcmp(attr_name, "vs_position")) { + return 0; + } + if (0 == strcmp(attr_name, "vs_texcoord0")) { + return 1; + } + return -1; } static inline int only_texture_program_image_slot(sg_shader_stage stage, const char* img_name) { - (void)stage; (void)img_name; - if (SG_SHADERSTAGE_FS == stage) { - if (0 == strcmp(img_name, "un_tex0")) { - return 0; + (void)stage; (void)img_name; + if (SG_SHADERSTAGE_FS == stage) { + if (0 == strcmp(img_name, "un_tex0")) { + return 0; + } } - } - return -1; + return -1; } static inline int only_texture_program_sampler_slot(sg_shader_stage stage, const char* smp_name) { - (void)stage; (void)smp_name; - if (SG_SHADERSTAGE_FS == stage) { - if (0 == strcmp(smp_name, "un_sampler0")) { - return 0; + (void)stage; (void)smp_name; + if (SG_SHADERSTAGE_FS == stage) { + if (0 == strcmp(smp_name, "un_sampler0")) { + return 0; + } } - } - return -1; + return -1; } static inline int only_texture_program_uniformblock_slot(sg_shader_stage stage, const char* ub_name) { - (void)stage; (void)ub_name; - if (SG_SHADERSTAGE_VS == stage) { - if (0 == strcmp(ub_name, "only_texture_vs_params")) { - return 0; + (void)stage; (void)ub_name; + if (SG_SHADERSTAGE_VS == stage) { + if (0 == strcmp(ub_name, "only_texture_vs_params")) { + return 0; + } } - } - return -1; + return -1; } static inline size_t only_texture_program_uniformblock_size(sg_shader_stage stage, const char* ub_name) { - (void)stage; (void)ub_name; - if (SG_SHADERSTAGE_VS == stage) { - if (0 == strcmp(ub_name, "only_texture_vs_params")) { - return sizeof(only_texture_only_texture_vs_params_t); + (void)stage; (void)ub_name; + if (SG_SHADERSTAGE_VS == stage) { + if (0 == strcmp(ub_name, "only_texture_vs_params")) { + return sizeof(only_texture_only_texture_vs_params_t); + } } - } - return 0; + return 0; } static inline int only_texture_program_uniform_offset(sg_shader_stage stage, const char* ub_name, const char* u_name) { - (void)stage; (void)ub_name; (void)u_name; - if (SG_SHADERSTAGE_VS == stage) { - if (0 == strcmp(ub_name, "only_texture_vs_params")) { - if (0 == strcmp(u_name, "un_mvp")) { - return 0; - } + (void)stage; (void)ub_name; (void)u_name; + if (SG_SHADERSTAGE_VS == stage) { + if (0 == strcmp(ub_name, "only_texture_vs_params")) { + if (0 == strcmp(u_name, "un_mvp")) { + return 0; + } + } } - } - return -1; + return -1; } static inline sg_shader_uniform_desc only_texture_program_uniform_desc(sg_shader_stage stage, const char* ub_name, const char* u_name) { - (void)stage; (void)ub_name; (void)u_name; - #if defined(__cplusplus) - sg_shader_uniform_desc desc = {}; - #else - sg_shader_uniform_desc desc = {0}; - #endif - if (SG_SHADERSTAGE_VS == stage) { - if (0 == strcmp(ub_name, "only_texture_vs_params")) { - if (0 == strcmp(u_name, "un_mvp")) { - desc.name = "un_mvp"; - desc.type = SG_UNIFORMTYPE_MAT4; - desc.array_count = 1; - return desc; - } + (void)stage; (void)ub_name; (void)u_name; + #if defined(__cplusplus) + sg_shader_uniform_desc desc = {}; + #else + sg_shader_uniform_desc desc = {0}; + #endif + if (SG_SHADERSTAGE_VS == stage) { + if (0 == strcmp(ub_name, "only_texture_vs_params")) { + if (0 == strcmp(u_name, "un_mvp")) { + desc.name = "un_mvp"; + desc.type = SG_UNIFORMTYPE_MAT4; + desc.array_count = 0; + return desc; + } + } } - } - return desc; + return desc; +} +static inline int only_texture_program_storagebuffer_slot(sg_shader_stage stage, const char* sbuf_name) { + (void)stage; (void)sbuf_name; + return -1; } diff --git a/Source/Render/sokol/shaders/tile_map.h b/Source/Render/sokol/shaders/tile_map.h index 93626149..01680abe 100644 --- a/Source/Render/sokol/shaders/tile_map.h +++ b/Source/Render/sokol/shaders/tile_map.h @@ -4,115 +4,74 @@ Generated by sokol-shdc (https://github.com/floooh/sokol-tools) - Cmdline: sokol-shdc --input tile_map.glsl --output tile_map.h --slang glsl330:glsl300es:hlsl5:metal_macos:metal_ios:metal_sim --format=sokol --reflection --ifdef --module tile_map + Cmdline: + sokol-shdc --input tile_map.glsl --output tile_map.h --slang glsl410:glsl300es:hlsl5:metal_macos:metal_ios:metal_sim --format=sokol --reflection --ifdef --module tile_map Overview: - - Shader program 'program': - Get shader desc: tile_map_program_shader_desc(sg_query_backend()); - Vertex shader: vs - Attribute slots: - ATTR_tile_map_vs_vs_position = 0 - ATTR_tile_map_vs_vs_texcoord0 = 1 - Uniform block 'tile_map_vs_params': - C struct: tile_map_tile_map_vs_params_t - Bind slot: SLOT_tile_map_tile_map_vs_params = 0 - Fragment shader: fs - Uniform block 'tile_map_fs_params': - C struct: tile_map_tile_map_fs_params_t - Bind slot: SLOT_tile_map_tile_map_fs_params = 0 - Image 'un_tex0': - Type: SG_IMAGETYPE_2D - Sample Type: SG_IMAGESAMPLETYPE_DEPTH - Bind slot: SLOT_tile_map_un_tex0 = 0 - Image 'un_tex1': - Type: SG_IMAGETYPE_2D - Sample Type: SG_IMAGESAMPLETYPE_FLOAT - Bind slot: SLOT_tile_map_un_tex1 = 1 - Image 'un_tex2': - Type: SG_IMAGETYPE_2D - Sample Type: SG_IMAGESAMPLETYPE_FLOAT - Bind slot: SLOT_tile_map_un_tex2 = 2 - Sampler 'un_sampler1': - Type: SG_SAMPLERTYPE_COMPARISON - Bind slot: SLOT_tile_map_un_sampler1 = 0 - Sampler 'un_sampler0': - Type: SG_SAMPLERTYPE_FILTERING - Bind slot: SLOT_tile_map_un_sampler0 = 1 - Image Sampler Pair 'un_tex0_un_sampler1': - Image: un_tex0 - Sampler: un_sampler1 - Image Sampler Pair 'un_tex1_un_sampler0': - Image: un_tex1 - Sampler: un_sampler0 - Image Sampler Pair 'un_tex2_un_sampler0': - Image: un_tex2 - Sampler: un_sampler0 - - - Shader descriptor structs: - - sg_shader program = sg_make_shader(tile_map_program_shader_desc(sg_query_backend())); - - Vertex attribute locations for vertex shader 'vs': - - sg_pipeline pip = sg_make_pipeline(&(sg_pipeline_desc){ - .layout = { - .attrs = { - [ATTR_tile_map_vs_vs_position] = { ... }, - [ATTR_tile_map_vs_vs_texcoord0] = { ... }, - }, - }, - ...}); - - - Image bind slots, use as index in sg_bindings.vs.images[] or .fs.images[] - - SLOT_tile_map_un_tex0 = 0; - SLOT_tile_map_un_tex1 = 1; - SLOT_tile_map_un_tex2 = 2; - - Sampler bind slots, use as index in sg_bindings.vs.sampler[] or .fs.samplers[] - - SLOT_tile_map_un_sampler1 = 0; - SLOT_tile_map_un_sampler0 = 1; - - Bind slot and C-struct for uniform block 'tile_map_vs_params': - - tile_map_tile_map_vs_params_t tile_map_vs_params = { - .un_mvp = ...; - .un_shadow = ...; - .un_inv_world_size = ...; - }; - sg_apply_uniforms(SG_SHADERSTAGE_[VS|FS], SLOT_tile_map_tile_map_vs_params, &SG_RANGE(tile_map_vs_params)); - - Bind slot and C-struct for uniform block 'tile_map_fs_params': - - tile_map_tile_map_fs_params_t tile_map_fs_params = { - .un_tile_color = ...; - }; - sg_apply_uniforms(SG_SHADERSTAGE_[VS|FS], SLOT_tile_map_tile_map_fs_params, &SG_RANGE(tile_map_fs_params)); - + ========= + Shader program: 'program': + Get shader desc: tile_map_program_shader_desc(sg_query_backend()); + Vertex shader: vs + Attributes: + ATTR_tile_map_vs_vs_position => 0 + ATTR_tile_map_vs_vs_texcoord0 => 1 + Uniform block 'tile_map_vs_params': + C struct: tile_map_tile_map_vs_params_t + Bind slot: SLOT_tile_map_tile_map_vs_params => 0 + Fragment shader: fs + Uniform block 'tile_map_fs_params': + C struct: tile_map_tile_map_fs_params_t + Bind slot: SLOT_tile_map_tile_map_fs_params => 0 + Image 'un_tex0': + Image type: SG_IMAGETYPE_2D + Sample type: SG_IMAGESAMPLETYPE_DEPTH + Multisampled: false + Bind slot: SLOT_tile_map_un_tex0 => 0 + Image 'un_tex1': + Image type: SG_IMAGETYPE_2D + Sample type: SG_IMAGESAMPLETYPE_FLOAT + Multisampled: false + Bind slot: SLOT_tile_map_un_tex1 => 1 + Image 'un_tex2': + Image type: SG_IMAGETYPE_2D + Sample type: SG_IMAGESAMPLETYPE_FLOAT + Multisampled: false + Bind slot: SLOT_tile_map_un_tex2 => 2 + Sampler 'un_sampler1': + Type: SG_SAMPLERTYPE_COMPARISON + Bind slot: SLOT_tile_map_un_sampler1 => 0 + Sampler 'un_sampler0': + Type: SG_SAMPLERTYPE_FILTERING + Bind slot: SLOT_tile_map_un_sampler0 => 1 + Image Sampler Pair 'un_tex0_un_sampler1': + Image: un_tex0 + Sampler: un_sampler1 + Image Sampler Pair 'un_tex1_un_sampler0': + Image: un_tex1 + Sampler: un_sampler0 + Image Sampler Pair 'un_tex2_un_sampler0': + Image: un_tex2 + Sampler: un_sampler0 */ -#include -#include -#include -#include +#if !defined(SOKOL_GFX_INCLUDED) +#error "Please include sokol_gfx.h before tile_map.h" +#endif #if !defined(SOKOL_SHDC_ALIGN) - #if defined(_MSC_VER) - #define SOKOL_SHDC_ALIGN(a) __declspec(align(a)) - #else - #define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a))) - #endif +#if defined(_MSC_VER) +#define SOKOL_SHDC_ALIGN(a) __declspec(align(a)) +#else +#define SOKOL_SHDC_ALIGN(a) __attribute__((aligned(a))) +#endif #endif #define ATTR_tile_map_vs_vs_position (0) #define ATTR_tile_map_vs_vs_texcoord0 (1) +#define SLOT_tile_map_tile_map_vs_params (0) +#define SLOT_tile_map_tile_map_fs_params (0) #define SLOT_tile_map_un_tex0 (0) #define SLOT_tile_map_un_tex1 (1) #define SLOT_tile_map_un_tex2 (2) #define SLOT_tile_map_un_sampler1 (0) #define SLOT_tile_map_un_sampler0 (1) -#define SLOT_tile_map_tile_map_vs_params (0) #pragma pack(push,1) SOKOL_SHDC_ALIGN(16) typedef struct tile_map_tile_map_vs_params_t { Mat4f un_mvp; @@ -121,23 +80,21 @@ SOKOL_SHDC_ALIGN(16) typedef struct tile_map_tile_map_vs_params_t { uint8_t _pad_136[8]; } tile_map_tile_map_vs_params_t; #pragma pack(pop) -#define SLOT_tile_map_tile_map_fs_params (0) #pragma pack(push,1) SOKOL_SHDC_ALIGN(16) typedef struct tile_map_tile_map_fs_params_t { Vect4f un_tile_color; } tile_map_tile_map_fs_params_t; #pragma pack(pop) -#if defined(SOKOL_GLCORE33) /* - #version 330 - + #version 410 + uniform vec4 tile_map_vs_params[9]; layout(location = 0) in vec3 vs_position; - out vec3 fs_uv0; - out vec2 fs_uv1; + layout(location = 0) out vec3 fs_uv0; + layout(location = 1) out vec2 fs_uv1; layout(location = 1) in vec2 vs_texcoord0; - out vec2 fs_uv2; - + layout(location = 2) out vec2 fs_uv2; + void main() { vec4 _32 = vec4(vs_position, 1.0); @@ -146,62 +103,68 @@ SOKOL_SHDC_ALIGN(16) typedef struct tile_map_tile_map_fs_params_t { fs_uv1 = vs_texcoord0; fs_uv2 = vs_position.xy * tile_map_vs_params[8].xy; } - + */ -static const char tile_map_vs_source_glsl330[621] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e, +#if defined(SOKOL_GLCORE) +static const uint8_t tile_map_vs_source_glsl410[684] = { + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x74,0x69,0x6c,0x65,0x5f, 0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x39,0x5d, 0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, 0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x76, - 0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x6f,0x75,0x74,0x20, - 0x76,0x65,0x63,0x33,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x3b,0x0a,0x6f,0x75,0x74, - 0x20,0x76,0x65,0x63,0x32,0x20,0x66,0x73,0x5f,0x75,0x76,0x31,0x3b,0x0a,0x6c,0x61, - 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, - 0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x76,0x73,0x5f,0x74,0x65, - 0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63, - 0x32,0x20,0x66,0x73,0x5f,0x75,0x76,0x32,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20, - 0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63, - 0x34,0x20,0x5f,0x33,0x32,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x73,0x5f, - 0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20, - 0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x74,0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f, - 0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x74,0x69, - 0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, - 0x5b,0x31,0x5d,0x2c,0x20,0x74,0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f,0x76,0x73, - 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x74,0x69,0x6c,0x65, - 0x5f,0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33, - 0x5d,0x29,0x20,0x2a,0x20,0x5f,0x33,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73, - 0x5f,0x75,0x76,0x30,0x20,0x3d,0x20,0x28,0x28,0x6d,0x61,0x74,0x34,0x28,0x74,0x69, + 0x73,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x6c,0x61,0x79,0x6f, + 0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29, + 0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x33,0x20,0x66,0x73,0x5f,0x75,0x76,0x30, + 0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, + 0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20, + 0x66,0x73,0x5f,0x75,0x76,0x31,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c, + 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20, + 0x76,0x65,0x63,0x32,0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64, + 0x30,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69, + 0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32, + 0x20,0x66,0x73,0x5f,0x75,0x76,0x32,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d, + 0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34, + 0x20,0x5f,0x33,0x32,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x73,0x5f,0x70, + 0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d, + 0x20,0x6d,0x61,0x74,0x34,0x28,0x74,0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f,0x76, + 0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x74,0x69,0x6c, + 0x65,0x5f,0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, + 0x31,0x5d,0x2c,0x20,0x74,0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f, + 0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x74,0x69,0x6c,0x65,0x5f, + 0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d, + 0x29,0x20,0x2a,0x20,0x5f,0x33,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f, + 0x75,0x76,0x30,0x20,0x3d,0x20,0x28,0x28,0x6d,0x61,0x74,0x34,0x28,0x74,0x69,0x6c, + 0x65,0x5f,0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, + 0x34,0x5d,0x2c,0x20,0x74,0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f, + 0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2c,0x20,0x74,0x69,0x6c,0x65,0x5f, + 0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d, + 0x2c,0x20,0x74,0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f,0x70,0x61, + 0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x29,0x20,0x2a,0x20,0x5f,0x33,0x32,0x29,0x20, + 0x2b,0x20,0x76,0x65,0x63,0x34,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36, + 0x35,0x36,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38, + 0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29,0x2e, + 0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x75,0x76,0x31,0x20, + 0x3d,0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b,0x0a, + 0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x75,0x76,0x32,0x20,0x3d,0x20,0x76,0x73,0x5f, + 0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x20,0x2a,0x20,0x74,0x69, 0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, - 0x5b,0x34,0x5d,0x2c,0x20,0x74,0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f,0x76,0x73, - 0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2c,0x20,0x74,0x69,0x6c,0x65, - 0x5f,0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36, - 0x5d,0x2c,0x20,0x74,0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f,0x70, - 0x61,0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x29,0x20,0x2a,0x20,0x5f,0x33,0x32,0x29, - 0x20,0x2b,0x20,0x76,0x65,0x63,0x34,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,0x39,0x37, - 0x36,0x35,0x36,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32, - 0x38,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x29, - 0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x75,0x76,0x31, - 0x20,0x3d,0x20,0x76,0x73,0x5f,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x30,0x3b, - 0x0a,0x20,0x20,0x20,0x20,0x66,0x73,0x5f,0x75,0x76,0x32,0x20,0x3d,0x20,0x76,0x73, - 0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x20,0x2a,0x20,0x74, - 0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, - 0x73,0x5b,0x38,0x5d,0x2e,0x78,0x79,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, + 0x5b,0x38,0x5d,0x2e,0x78,0x79,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; +#endif /* - #version 330 - + #version 410 + uniform vec4 tile_map_fs_params[1]; uniform sampler2DShadow un_tex0_un_sampler1; uniform sampler2D un_tex1_un_sampler0; uniform sampler2D un_tex2_un_sampler0; - + layout(location = 0) out vec4 frag_color; - in vec3 fs_uv0; - in vec2 fs_uv1; - in vec2 fs_uv2; - + layout(location = 0) in vec3 fs_uv0; + layout(location = 1) in vec2 fs_uv1; + layout(location = 2) in vec2 fs_uv2; + void main() { frag_color = vec4(texture(un_tex0_un_sampler1, vec3(fs_uv0.xy, fs_uv0.z))); @@ -211,10 +174,11 @@ static const char tile_map_vs_source_glsl330[621] = { frag_color = (frag_color * texture(un_tex2_un_sampler0, fs_uv2)) * 4.0; frag_color.w = tile_map_fs_params[0].w; } - + */ -static const char tile_map_fs_source_glsl330[629] = { - 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x33,0x30,0x0a,0x0a,0x75,0x6e, +#if defined(SOKOL_GLCORE) +static const uint8_t tile_map_fs_source_glsl410[692] = { + 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e, 0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x74,0x69,0x6c,0x65,0x5f, 0x6d,0x61,0x70,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d, 0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65, @@ -227,46 +191,49 @@ static const char tile_map_fs_source_glsl330[629] = { 0x75,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x30,0x3b,0x0a,0x0a,0x6c,0x61, 0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, 0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20, - 0x66,0x73,0x5f,0x75,0x76,0x30,0x3b,0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20, - 0x66,0x73,0x5f,0x75,0x76,0x31,0x3b,0x0a,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20, - 0x66,0x73,0x5f,0x75,0x76,0x32,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61, - 0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f, - 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x74,0x65,0x78, - 0x74,0x75,0x72,0x65,0x28,0x75,0x6e,0x5f,0x74,0x65,0x78,0x30,0x5f,0x75,0x6e,0x5f, - 0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x31,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x66, - 0x73,0x5f,0x75,0x76,0x30,0x2e,0x78,0x79,0x2c,0x20,0x66,0x73,0x5f,0x75,0x76,0x30, - 0x2e,0x7a,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f, - 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, - 0x6c,0x6f,0x72,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,0x2b,0x20,0x76,0x65,0x63, - 0x34,0x28,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67, - 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x2a,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72, - 0x65,0x28,0x75,0x6e,0x5f,0x74,0x65,0x78,0x31,0x5f,0x75,0x6e,0x5f,0x73,0x61,0x6d, - 0x70,0x6c,0x65,0x72,0x30,0x2c,0x20,0x66,0x73,0x5f,0x75,0x76,0x31,0x29,0x3b,0x0a, - 0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x2a, - 0x3d,0x20,0x74,0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f,0x66,0x73,0x5f,0x70,0x61, - 0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61, - 0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x28,0x66,0x72,0x61,0x67,0x5f, - 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x2a,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28, - 0x75,0x6e,0x5f,0x74,0x65,0x78,0x32,0x5f,0x75,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c, - 0x65,0x72,0x30,0x2c,0x20,0x66,0x73,0x5f,0x75,0x76,0x32,0x29,0x29,0x20,0x2a,0x20, - 0x34,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, - 0x6c,0x6f,0x72,0x2e,0x77,0x20,0x3d,0x20,0x74,0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70, - 0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x77,0x3b, - 0x0a,0x7d,0x0a,0x0a,0x00, + 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c, + 0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20, + 0x76,0x65,0x63,0x33,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x3b,0x0a,0x6c,0x61,0x79, + 0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31, + 0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x66,0x73,0x5f,0x75,0x76,0x31, + 0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f, + 0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x66, + 0x73,0x5f,0x75,0x76,0x32,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69, + 0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63, + 0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x74,0x65,0x78,0x74, + 0x75,0x72,0x65,0x28,0x75,0x6e,0x5f,0x74,0x65,0x78,0x30,0x5f,0x75,0x6e,0x5f,0x73, + 0x61,0x6d,0x70,0x6c,0x65,0x72,0x31,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x66,0x73, + 0x5f,0x75,0x76,0x30,0x2e,0x78,0x79,0x2c,0x20,0x66,0x73,0x5f,0x75,0x76,0x30,0x2e, + 0x7a,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63, + 0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x28,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, + 0x6f,0x72,0x20,0x2a,0x20,0x30,0x2e,0x35,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x34, + 0x28,0x30,0x2e,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f, + 0x63,0x6f,0x6c,0x6f,0x72,0x20,0x2a,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65, + 0x28,0x75,0x6e,0x5f,0x74,0x65,0x78,0x31,0x5f,0x75,0x6e,0x5f,0x73,0x61,0x6d,0x70, + 0x6c,0x65,0x72,0x30,0x2c,0x20,0x66,0x73,0x5f,0x75,0x76,0x31,0x29,0x3b,0x0a,0x20, + 0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x2a,0x3d, + 0x20,0x74,0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72, + 0x61,0x6d,0x73,0x5b,0x30,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67, + 0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x28,0x66,0x72,0x61,0x67,0x5f,0x63, + 0x6f,0x6c,0x6f,0x72,0x20,0x2a,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x75, + 0x6e,0x5f,0x74,0x65,0x78,0x32,0x5f,0x75,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65, + 0x72,0x30,0x2c,0x20,0x66,0x73,0x5f,0x75,0x76,0x32,0x29,0x29,0x20,0x2a,0x20,0x34, + 0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, + 0x6f,0x72,0x2e,0x77,0x20,0x3d,0x20,0x74,0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f, + 0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x77,0x3b,0x0a, + 0x7d,0x0a,0x0a,0x00, }; -#endif /* SOKOL_GLCORE33 */ -#if defined(SOKOL_GLES3) +#endif /* #version 300 es - + uniform vec4 tile_map_vs_params[9]; layout(location = 0) in vec3 vs_position; out vec3 fs_uv0; out vec2 fs_uv1; layout(location = 1) in vec2 vs_texcoord0; out vec2 fs_uv2; - + void main() { vec4 _32 = vec4(vs_position, 1.0); @@ -275,9 +242,10 @@ static const char tile_map_fs_source_glsl330[629] = { fs_uv1 = vs_texcoord0; fs_uv2 = vs_position.xy * tile_map_vs_params[8].xy; } - + */ -static const char tile_map_vs_source_glsl300es[624] = { +#if defined(SOKOL_GLES3) +static const uint8_t tile_map_vs_source_glsl300es[624] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x74,0x69, 0x6c,0x65,0x5f,0x6d,0x61,0x70,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73, @@ -319,21 +287,22 @@ static const char tile_map_vs_source_glsl300es[624] = { 0x72,0x61,0x6d,0x73,0x5b,0x38,0x5d,0x2e,0x78,0x79,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; +#endif /* #version 300 es precision mediump float; precision highp int; - + uniform highp vec4 tile_map_fs_params[1]; uniform highp sampler2DShadow un_tex0_un_sampler1; uniform highp sampler2D un_tex1_un_sampler0; uniform highp sampler2D un_tex2_un_sampler0; - + layout(location = 0) out highp vec4 frag_color; in highp vec3 fs_uv0; in highp vec2 fs_uv1; in highp vec2 fs_uv2; - + void main() { frag_color = vec4(texture(un_tex0_un_sampler1, vec3(fs_uv0.xy, fs_uv0.z))); @@ -343,9 +312,10 @@ static const char tile_map_vs_source_glsl300es[624] = { frag_color = (frag_color * texture(un_tex2_un_sampler0, fs_uv2)) * 4.0; frag_color.w = tile_map_fs_params[0].w; } - + */ -static const char tile_map_fs_source_glsl300es[726] = { +#if defined(SOKOL_GLES3) +static const uint8_t tile_map_fs_source_glsl300es[726] = { 0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a, 0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d, 0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69, @@ -393,8 +363,7 @@ static const char tile_map_fs_source_glsl300es[726] = { 0x70,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x77, 0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -#endif /* SOKOL_GLES3 */ -#if defined(SOKOL_D3D11) +#endif /* cbuffer tile_map_vs_params : register(b0) { @@ -402,21 +371,21 @@ static const char tile_map_fs_source_glsl300es[726] = { row_major float4x4 _20_un_shadow : packoffset(c4); float2 _20_un_inv_world_size : packoffset(c8); }; - - + + static float4 gl_Position; static float3 vs_position; static float3 fs_uv0; static float2 fs_uv1; static float2 vs_texcoord0; static float2 fs_uv2; - + struct SPIRV_Cross_Input { float3 vs_position : TEXCOORD0; float2 vs_texcoord0 : TEXCOORD1; }; - + struct SPIRV_Cross_Output { float3 fs_uv0 : TEXCOORD0; @@ -424,7 +393,7 @@ static const char tile_map_fs_source_glsl300es[726] = { float2 fs_uv2 : TEXCOORD2; float4 gl_Position : SV_Position; }; - + void vert_main() { float4 _32 = float4(vs_position, 1.0f); @@ -433,7 +402,7 @@ static const char tile_map_fs_source_glsl300es[726] = { fs_uv1 = vs_texcoord0; fs_uv2 = vs_position.xy * _20_un_inv_world_size; } - + SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) { vs_position = stage_input.vs_position; @@ -447,7 +416,8 @@ static const char tile_map_fs_source_glsl300es[726] = { return stage_output; } */ -static const char tile_map_vs_source_hlsl5[1279] = { +#if defined(SOKOL_D3D11) +static const uint8_t tile_map_vs_source_hlsl5[1279] = { 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x74,0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70, 0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x3a,0x20,0x72,0x65,0x67, 0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, @@ -529,35 +499,36 @@ static const char tile_map_vs_source_hlsl5[1279] = { 0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74, 0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, }; +#endif /* cbuffer tile_map_fs_params : register(b0) { float4 _62_un_tile_color : packoffset(c0); }; - + Texture2D un_tex0 : register(t0); SamplerComparisonState un_sampler1 : register(s0); Texture2D un_tex1 : register(t1); SamplerState un_sampler0 : register(s1); Texture2D un_tex2 : register(t2); - + static float4 frag_color; static float3 fs_uv0; static float2 fs_uv1; static float2 fs_uv2; - + struct SPIRV_Cross_Input { float3 fs_uv0 : TEXCOORD0; float2 fs_uv1 : TEXCOORD1; float2 fs_uv2 : TEXCOORD2; }; - + struct SPIRV_Cross_Output { float4 frag_color : SV_Target0; }; - + void frag_main() { frag_color = un_tex0.SampleCmp(un_sampler1, fs_uv0.xy, fs_uv0.z).xxxx; @@ -567,7 +538,7 @@ static const char tile_map_vs_source_hlsl5[1279] = { frag_color = (frag_color * un_tex2.Sample(un_sampler0, fs_uv2)) * 4.0f; frag_color.w = _62_un_tile_color.w; } - + SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input) { fs_uv0 = stage_input.fs_uv0; @@ -579,7 +550,8 @@ static const char tile_map_vs_source_hlsl5[1279] = { return stage_output; } */ -static const char tile_map_fs_source_hlsl5[1234] = { +#if defined(SOKOL_D3D11) +static const uint8_t tile_map_fs_source_hlsl5[1234] = { 0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x74,0x69,0x6c,0x65,0x5f,0x6d,0x61,0x70, 0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x3a,0x20,0x72,0x65,0x67, 0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20, @@ -659,21 +631,20 @@ static const char tile_map_fs_source_hlsl5[1234] = { 0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d, 0x0a,0x00, }; -#endif /* SOKOL_D3D11 */ -#if defined(SOKOL_METAL) +#endif /* #include #include - + using namespace metal; - + struct tile_map_vs_params { float4x4 un_mvp; float4x4 un_shadow; float2 un_inv_world_size; }; - + struct main0_out { float3 fs_uv0 [[user(locn0)]]; @@ -681,13 +652,13 @@ static const char tile_map_fs_source_hlsl5[1234] = { float2 fs_uv2 [[user(locn2)]]; float4 gl_Position [[position]]; }; - + struct main0_in { float3 vs_position [[attribute(0)]]; float2 vs_texcoord0 [[attribute(1)]]; }; - + vertex main0_out main0(main0_in in [[stage_in]], constant tile_map_vs_params& _20 [[buffer(0)]]) { main0_out out = {}; @@ -698,9 +669,10 @@ static const char tile_map_fs_source_hlsl5[1234] = { out.fs_uv2 = in.vs_position.xy * _20.un_inv_world_size; return out; } - + */ -static const char tile_map_vs_source_metal_macos[867] = { +#if defined(SOKOL_METAL) +static const uint8_t tile_map_vs_source_metal_macos[867] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -757,29 +729,30 @@ static const char tile_map_vs_source_metal_macos[867] = { 0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d, 0x0a,0x0a,0x00, }; +#endif /* #include #include - + using namespace metal; - + struct tile_map_fs_params { float4 un_tile_color; }; - + struct main0_out { float4 frag_color [[color(0)]]; }; - + struct main0_in { float3 fs_uv0 [[user(locn0)]]; float2 fs_uv1 [[user(locn1)]]; float2 fs_uv2 [[user(locn2)]]; }; - + fragment main0_out main0(main0_in in [[stage_in]], constant tile_map_fs_params& _62 [[buffer(0)]], depth2d un_tex0 [[texture(0)]], texture2d un_tex1 [[texture(1)]], texture2d un_tex2 [[texture(2)]], sampler un_sampler1 [[sampler(0)]], sampler un_sampler0 [[sampler(1)]]) { main0_out out = {}; @@ -791,9 +764,10 @@ static const char tile_map_vs_source_metal_macos[867] = { out.frag_color.w = _62.un_tile_color.w; return out; } - + */ -static const char tile_map_fs_source_metal_macos[1039] = { +#if defined(SOKOL_METAL) +static const uint8_t tile_map_fs_source_metal_macos[1039] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -860,21 +834,20 @@ static const char tile_map_fs_source_metal_macos[1039] = { 0x65,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72, 0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -#endif /* SOKOL_METAL */ -#if defined(SOKOL_METAL) +#endif /* #include #include - + using namespace metal; - + struct tile_map_vs_params { float4x4 un_mvp; float4x4 un_shadow; float2 un_inv_world_size; }; - + struct main0_out { float3 fs_uv0 [[user(locn0)]]; @@ -882,13 +855,13 @@ static const char tile_map_fs_source_metal_macos[1039] = { float2 fs_uv2 [[user(locn2)]]; float4 gl_Position [[position]]; }; - + struct main0_in { float3 vs_position [[attribute(0)]]; float2 vs_texcoord0 [[attribute(1)]]; }; - + vertex main0_out main0(main0_in in [[stage_in]], constant tile_map_vs_params& _20 [[buffer(0)]]) { main0_out out = {}; @@ -899,9 +872,10 @@ static const char tile_map_fs_source_metal_macos[1039] = { out.fs_uv2 = in.vs_position.xy * _20.un_inv_world_size; return out; } - + */ -static const char tile_map_vs_source_metal_ios[867] = { +#if defined(SOKOL_METAL) +static const uint8_t tile_map_vs_source_metal_ios[867] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -958,29 +932,30 @@ static const char tile_map_vs_source_metal_ios[867] = { 0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d, 0x0a,0x0a,0x00, }; +#endif /* #include #include - + using namespace metal; - + struct tile_map_fs_params { float4 un_tile_color; }; - + struct main0_out { float4 frag_color [[color(0)]]; }; - + struct main0_in { float3 fs_uv0 [[user(locn0)]]; float2 fs_uv1 [[user(locn1)]]; float2 fs_uv2 [[user(locn2)]]; }; - + fragment main0_out main0(main0_in in [[stage_in]], constant tile_map_fs_params& _62 [[buffer(0)]], depth2d un_tex0 [[texture(0)]], texture2d un_tex1 [[texture(1)]], texture2d un_tex2 [[texture(2)]], sampler un_sampler1 [[sampler(0)]], sampler un_sampler0 [[sampler(1)]]) { main0_out out = {}; @@ -992,9 +967,10 @@ static const char tile_map_vs_source_metal_ios[867] = { out.frag_color.w = _62.un_tile_color.w; return out; } - + */ -static const char tile_map_fs_source_metal_ios[1039] = { +#if defined(SOKOL_METAL) +static const uint8_t tile_map_fs_source_metal_ios[1039] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -1061,21 +1037,20 @@ static const char tile_map_fs_source_metal_ios[1039] = { 0x65,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72, 0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -#endif /* SOKOL_METAL */ -#if defined(SOKOL_METAL) +#endif /* #include #include - + using namespace metal; - + struct tile_map_vs_params { float4x4 un_mvp; float4x4 un_shadow; float2 un_inv_world_size; }; - + struct main0_out { float3 fs_uv0 [[user(locn0)]]; @@ -1083,13 +1058,13 @@ static const char tile_map_fs_source_metal_ios[1039] = { float2 fs_uv2 [[user(locn2)]]; float4 gl_Position [[position]]; }; - + struct main0_in { float3 vs_position [[attribute(0)]]; float2 vs_texcoord0 [[attribute(1)]]; }; - + vertex main0_out main0(main0_in in [[stage_in]], constant tile_map_vs_params& _20 [[buffer(0)]]) { main0_out out = {}; @@ -1100,9 +1075,10 @@ static const char tile_map_fs_source_metal_ios[1039] = { out.fs_uv2 = in.vs_position.xy * _20.un_inv_world_size; return out; } - + */ -static const char tile_map_vs_source_metal_sim[867] = { +#if defined(SOKOL_METAL) +static const uint8_t tile_map_vs_source_metal_sim[867] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -1159,29 +1135,30 @@ static const char tile_map_vs_source_metal_sim[867] = { 0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d, 0x0a,0x0a,0x00, }; +#endif /* #include #include - + using namespace metal; - + struct tile_map_fs_params { float4 un_tile_color; }; - + struct main0_out { float4 frag_color [[color(0)]]; }; - + struct main0_in { float3 fs_uv0 [[user(locn0)]]; float2 fs_uv1 [[user(locn1)]]; float2 fs_uv2 [[user(locn2)]]; }; - + fragment main0_out main0(main0_in in [[stage_in]], constant tile_map_fs_params& _62 [[buffer(0)]], depth2d un_tex0 [[texture(0)]], texture2d un_tex1 [[texture(1)]], texture2d un_tex2 [[texture(2)]], sampler un_sampler1 [[sampler(0)]], sampler un_sampler0 [[sampler(1)]]) { main0_out out = {}; @@ -1193,9 +1170,10 @@ static const char tile_map_vs_source_metal_sim[867] = { out.frag_color.w = _62.un_tile_color.w; return out; } - + */ -static const char tile_map_fs_source_metal_sim[1039] = { +#if defined(SOKOL_METAL) +static const uint8_t tile_map_fs_source_metal_sim[1039] = { 0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f, 0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65, 0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a, @@ -1262,432 +1240,433 @@ static const char tile_map_fs_source_metal_sim[1039] = { 0x65,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x2e,0x77,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72, 0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, }; -#endif /* SOKOL_METAL */ -#if !defined(SOKOL_GFX_INCLUDED) - #error "Please include sokol_gfx.h before tile_map.h" #endif static inline const sg_shader_desc* tile_map_program_shader_desc(sg_backend backend) { - #if defined(SOKOL_GLCORE33) - if (backend == SG_BACKEND_GLCORE33) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.attrs[0].name = "vs_position"; - desc.attrs[1].name = "vs_texcoord0"; - desc.vs.source = tile_map_vs_source_glsl330; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 144; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "tile_map_vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 9; - desc.fs.source = tile_map_fs_source_glsl330; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 16; - desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.uniform_blocks[0].uniforms[0].name = "tile_map_fs_params"; - desc.fs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; - desc.fs.uniform_blocks[0].uniforms[0].array_count = 1; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_DEPTH; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = SG_IMAGETYPE_2D; - desc.fs.images[1].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.images[2].used = true; - desc.fs.images[2].multisampled = false; - desc.fs.images[2].image_type = SG_IMAGETYPE_2D; - desc.fs.images[2].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_COMPARISON; - desc.fs.samplers[1].used = true; - desc.fs.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.fs.image_sampler_pairs[0].glsl_name = "un_tex0_un_sampler1"; - desc.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 1; - desc.fs.image_sampler_pairs[1].glsl_name = "un_tex1_un_sampler0"; - desc.fs.image_sampler_pairs[2].used = true; - desc.fs.image_sampler_pairs[2].image_slot = 2; - desc.fs.image_sampler_pairs[2].sampler_slot = 1; - desc.fs.image_sampler_pairs[2].glsl_name = "un_tex2_un_sampler0"; - desc.label = "tile_map_program_shader"; + #if defined(SOKOL_GLCORE) + if (backend == SG_BACKEND_GLCORE) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.attrs[0].name = "vs_position"; + desc.attrs[1].name = "vs_texcoord0"; + desc.vs.source = (const char*)tile_map_vs_source_glsl410; + desc.vs.entry = "main"; + desc.vs.uniform_blocks[0].size = 144; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.vs.uniform_blocks[0].uniforms[0].name = "tile_map_vs_params"; + desc.vs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; + desc.vs.uniform_blocks[0].uniforms[0].array_count = 9; + desc.fs.source = (const char*)tile_map_fs_source_glsl410; + desc.fs.entry = "main"; + desc.fs.uniform_blocks[0].size = 16; + desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.uniform_blocks[0].uniforms[0].name = "tile_map_fs_params"; + desc.fs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; + desc.fs.uniform_blocks[0].uniforms[0].array_count = 1; + desc.fs.images[0].used = true; + desc.fs.images[0].multisampled = false; + desc.fs.images[0].image_type = SG_IMAGETYPE_2D; + desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_DEPTH; + desc.fs.images[1].used = true; + desc.fs.images[1].multisampled = false; + desc.fs.images[1].image_type = SG_IMAGETYPE_2D; + desc.fs.images[1].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.images[2].used = true; + desc.fs.images[2].multisampled = false; + desc.fs.images[2].image_type = SG_IMAGETYPE_2D; + desc.fs.images[2].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.samplers[0].used = true; + desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_COMPARISON; + desc.fs.samplers[1].used = true; + desc.fs.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING; + desc.fs.image_sampler_pairs[0].used = true; + desc.fs.image_sampler_pairs[0].image_slot = 0; + desc.fs.image_sampler_pairs[0].sampler_slot = 0; + desc.fs.image_sampler_pairs[0].glsl_name = "un_tex0_un_sampler1"; + desc.fs.image_sampler_pairs[1].used = true; + desc.fs.image_sampler_pairs[1].image_slot = 1; + desc.fs.image_sampler_pairs[1].sampler_slot = 1; + desc.fs.image_sampler_pairs[1].glsl_name = "un_tex1_un_sampler0"; + desc.fs.image_sampler_pairs[2].used = true; + desc.fs.image_sampler_pairs[2].image_slot = 2; + desc.fs.image_sampler_pairs[2].sampler_slot = 1; + desc.fs.image_sampler_pairs[2].glsl_name = "un_tex2_un_sampler0"; + desc.label = "tile_map_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_GLCORE33 */ - #if defined(SOKOL_GLES3) - if (backend == SG_BACKEND_GLES3) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.attrs[0].name = "vs_position"; - desc.attrs[1].name = "vs_texcoord0"; - desc.vs.source = tile_map_vs_source_glsl300es; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 144; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.vs.uniform_blocks[0].uniforms[0].name = "tile_map_vs_params"; - desc.vs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; - desc.vs.uniform_blocks[0].uniforms[0].array_count = 9; - desc.fs.source = tile_map_fs_source_glsl300es; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 16; - desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.uniform_blocks[0].uniforms[0].name = "tile_map_fs_params"; - desc.fs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; - desc.fs.uniform_blocks[0].uniforms[0].array_count = 1; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_DEPTH; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = SG_IMAGETYPE_2D; - desc.fs.images[1].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.images[2].used = true; - desc.fs.images[2].multisampled = false; - desc.fs.images[2].image_type = SG_IMAGETYPE_2D; - desc.fs.images[2].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_COMPARISON; - desc.fs.samplers[1].used = true; - desc.fs.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.fs.image_sampler_pairs[0].glsl_name = "un_tex0_un_sampler1"; - desc.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 1; - desc.fs.image_sampler_pairs[1].glsl_name = "un_tex1_un_sampler0"; - desc.fs.image_sampler_pairs[2].used = true; - desc.fs.image_sampler_pairs[2].image_slot = 2; - desc.fs.image_sampler_pairs[2].sampler_slot = 1; - desc.fs.image_sampler_pairs[2].glsl_name = "un_tex2_un_sampler0"; - desc.label = "tile_map_program_shader"; + #endif /* SOKOL_GLCORE */ + #if defined(SOKOL_GLES3) + if (backend == SG_BACKEND_GLES3) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.attrs[0].name = "vs_position"; + desc.attrs[1].name = "vs_texcoord0"; + desc.vs.source = (const char*)tile_map_vs_source_glsl300es; + desc.vs.entry = "main"; + desc.vs.uniform_blocks[0].size = 144; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.vs.uniform_blocks[0].uniforms[0].name = "tile_map_vs_params"; + desc.vs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; + desc.vs.uniform_blocks[0].uniforms[0].array_count = 9; + desc.fs.source = (const char*)tile_map_fs_source_glsl300es; + desc.fs.entry = "main"; + desc.fs.uniform_blocks[0].size = 16; + desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.uniform_blocks[0].uniforms[0].name = "tile_map_fs_params"; + desc.fs.uniform_blocks[0].uniforms[0].type = SG_UNIFORMTYPE_FLOAT4; + desc.fs.uniform_blocks[0].uniforms[0].array_count = 1; + desc.fs.images[0].used = true; + desc.fs.images[0].multisampled = false; + desc.fs.images[0].image_type = SG_IMAGETYPE_2D; + desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_DEPTH; + desc.fs.images[1].used = true; + desc.fs.images[1].multisampled = false; + desc.fs.images[1].image_type = SG_IMAGETYPE_2D; + desc.fs.images[1].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.images[2].used = true; + desc.fs.images[2].multisampled = false; + desc.fs.images[2].image_type = SG_IMAGETYPE_2D; + desc.fs.images[2].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.samplers[0].used = true; + desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_COMPARISON; + desc.fs.samplers[1].used = true; + desc.fs.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING; + desc.fs.image_sampler_pairs[0].used = true; + desc.fs.image_sampler_pairs[0].image_slot = 0; + desc.fs.image_sampler_pairs[0].sampler_slot = 0; + desc.fs.image_sampler_pairs[0].glsl_name = "un_tex0_un_sampler1"; + desc.fs.image_sampler_pairs[1].used = true; + desc.fs.image_sampler_pairs[1].image_slot = 1; + desc.fs.image_sampler_pairs[1].sampler_slot = 1; + desc.fs.image_sampler_pairs[1].glsl_name = "un_tex1_un_sampler0"; + desc.fs.image_sampler_pairs[2].used = true; + desc.fs.image_sampler_pairs[2].image_slot = 2; + desc.fs.image_sampler_pairs[2].sampler_slot = 1; + desc.fs.image_sampler_pairs[2].glsl_name = "un_tex2_un_sampler0"; + desc.label = "tile_map_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_GLES3 */ - #if defined(SOKOL_D3D11) - if (backend == SG_BACKEND_D3D11) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.attrs[0].sem_name = "TEXCOORD"; - desc.attrs[0].sem_index = 0; - desc.attrs[1].sem_name = "TEXCOORD"; - desc.attrs[1].sem_index = 1; - desc.vs.source = tile_map_vs_source_hlsl5; - desc.vs.d3d11_target = "vs_5_0"; - desc.vs.entry = "main"; - desc.vs.uniform_blocks[0].size = 144; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = tile_map_fs_source_hlsl5; - desc.fs.d3d11_target = "ps_5_0"; - desc.fs.entry = "main"; - desc.fs.uniform_blocks[0].size = 16; - desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_DEPTH; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = SG_IMAGETYPE_2D; - desc.fs.images[1].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.images[2].used = true; - desc.fs.images[2].multisampled = false; - desc.fs.images[2].image_type = SG_IMAGETYPE_2D; - desc.fs.images[2].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_COMPARISON; - desc.fs.samplers[1].used = true; - desc.fs.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 1; - desc.fs.image_sampler_pairs[2].used = true; - desc.fs.image_sampler_pairs[2].image_slot = 2; - desc.fs.image_sampler_pairs[2].sampler_slot = 1; - desc.label = "tile_map_program_shader"; + #endif /* SOKOL_GLES3 */ + #if defined(SOKOL_D3D11) + if (backend == SG_BACKEND_D3D11) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.attrs[0].sem_name = "TEXCOORD"; + desc.attrs[0].sem_index = 0; + desc.attrs[1].sem_name = "TEXCOORD"; + desc.attrs[1].sem_index = 1; + desc.vs.source = (const char*)tile_map_vs_source_hlsl5; + desc.vs.d3d11_target = "vs_5_0"; + desc.vs.entry = "main"; + desc.vs.uniform_blocks[0].size = 144; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.source = (const char*)tile_map_fs_source_hlsl5; + desc.fs.d3d11_target = "ps_5_0"; + desc.fs.entry = "main"; + desc.fs.uniform_blocks[0].size = 16; + desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.images[0].used = true; + desc.fs.images[0].multisampled = false; + desc.fs.images[0].image_type = SG_IMAGETYPE_2D; + desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_DEPTH; + desc.fs.images[1].used = true; + desc.fs.images[1].multisampled = false; + desc.fs.images[1].image_type = SG_IMAGETYPE_2D; + desc.fs.images[1].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.images[2].used = true; + desc.fs.images[2].multisampled = false; + desc.fs.images[2].image_type = SG_IMAGETYPE_2D; + desc.fs.images[2].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.samplers[0].used = true; + desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_COMPARISON; + desc.fs.samplers[1].used = true; + desc.fs.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING; + desc.fs.image_sampler_pairs[0].used = true; + desc.fs.image_sampler_pairs[0].image_slot = 0; + desc.fs.image_sampler_pairs[0].sampler_slot = 0; + desc.fs.image_sampler_pairs[1].used = true; + desc.fs.image_sampler_pairs[1].image_slot = 1; + desc.fs.image_sampler_pairs[1].sampler_slot = 1; + desc.fs.image_sampler_pairs[2].used = true; + desc.fs.image_sampler_pairs[2].image_slot = 2; + desc.fs.image_sampler_pairs[2].sampler_slot = 1; + desc.label = "tile_map_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_D3D11 */ - #if defined(SOKOL_METAL) - if (backend == SG_BACKEND_METAL_MACOS) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vs.source = tile_map_vs_source_metal_macos; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 144; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = tile_map_fs_source_metal_macos; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 16; - desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_DEPTH; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = SG_IMAGETYPE_2D; - desc.fs.images[1].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.images[2].used = true; - desc.fs.images[2].multisampled = false; - desc.fs.images[2].image_type = SG_IMAGETYPE_2D; - desc.fs.images[2].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_COMPARISON; - desc.fs.samplers[1].used = true; - desc.fs.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 1; - desc.fs.image_sampler_pairs[2].used = true; - desc.fs.image_sampler_pairs[2].image_slot = 2; - desc.fs.image_sampler_pairs[2].sampler_slot = 1; - desc.label = "tile_map_program_shader"; + #endif /* SOKOL_D3D11 */ + #if defined(SOKOL_METAL) + if (backend == SG_BACKEND_METAL_MACOS) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vs.source = (const char*)tile_map_vs_source_metal_macos; + desc.vs.entry = "main0"; + desc.vs.uniform_blocks[0].size = 144; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.source = (const char*)tile_map_fs_source_metal_macos; + desc.fs.entry = "main0"; + desc.fs.uniform_blocks[0].size = 16; + desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.images[0].used = true; + desc.fs.images[0].multisampled = false; + desc.fs.images[0].image_type = SG_IMAGETYPE_2D; + desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_DEPTH; + desc.fs.images[1].used = true; + desc.fs.images[1].multisampled = false; + desc.fs.images[1].image_type = SG_IMAGETYPE_2D; + desc.fs.images[1].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.images[2].used = true; + desc.fs.images[2].multisampled = false; + desc.fs.images[2].image_type = SG_IMAGETYPE_2D; + desc.fs.images[2].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.samplers[0].used = true; + desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_COMPARISON; + desc.fs.samplers[1].used = true; + desc.fs.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING; + desc.fs.image_sampler_pairs[0].used = true; + desc.fs.image_sampler_pairs[0].image_slot = 0; + desc.fs.image_sampler_pairs[0].sampler_slot = 0; + desc.fs.image_sampler_pairs[1].used = true; + desc.fs.image_sampler_pairs[1].image_slot = 1; + desc.fs.image_sampler_pairs[1].sampler_slot = 1; + desc.fs.image_sampler_pairs[2].used = true; + desc.fs.image_sampler_pairs[2].image_slot = 2; + desc.fs.image_sampler_pairs[2].sampler_slot = 1; + desc.label = "tile_map_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_METAL */ - #if defined(SOKOL_METAL) - if (backend == SG_BACKEND_METAL_IOS) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vs.source = tile_map_vs_source_metal_ios; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 144; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = tile_map_fs_source_metal_ios; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 16; - desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_DEPTH; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = SG_IMAGETYPE_2D; - desc.fs.images[1].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.images[2].used = true; - desc.fs.images[2].multisampled = false; - desc.fs.images[2].image_type = SG_IMAGETYPE_2D; - desc.fs.images[2].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_COMPARISON; - desc.fs.samplers[1].used = true; - desc.fs.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 1; - desc.fs.image_sampler_pairs[2].used = true; - desc.fs.image_sampler_pairs[2].image_slot = 2; - desc.fs.image_sampler_pairs[2].sampler_slot = 1; - desc.label = "tile_map_program_shader"; + #endif /* SOKOL_METAL */ + #if defined(SOKOL_METAL) + if (backend == SG_BACKEND_METAL_IOS) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vs.source = (const char*)tile_map_vs_source_metal_ios; + desc.vs.entry = "main0"; + desc.vs.uniform_blocks[0].size = 144; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.source = (const char*)tile_map_fs_source_metal_ios; + desc.fs.entry = "main0"; + desc.fs.uniform_blocks[0].size = 16; + desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.images[0].used = true; + desc.fs.images[0].multisampled = false; + desc.fs.images[0].image_type = SG_IMAGETYPE_2D; + desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_DEPTH; + desc.fs.images[1].used = true; + desc.fs.images[1].multisampled = false; + desc.fs.images[1].image_type = SG_IMAGETYPE_2D; + desc.fs.images[1].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.images[2].used = true; + desc.fs.images[2].multisampled = false; + desc.fs.images[2].image_type = SG_IMAGETYPE_2D; + desc.fs.images[2].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.samplers[0].used = true; + desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_COMPARISON; + desc.fs.samplers[1].used = true; + desc.fs.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING; + desc.fs.image_sampler_pairs[0].used = true; + desc.fs.image_sampler_pairs[0].image_slot = 0; + desc.fs.image_sampler_pairs[0].sampler_slot = 0; + desc.fs.image_sampler_pairs[1].used = true; + desc.fs.image_sampler_pairs[1].image_slot = 1; + desc.fs.image_sampler_pairs[1].sampler_slot = 1; + desc.fs.image_sampler_pairs[2].used = true; + desc.fs.image_sampler_pairs[2].image_slot = 2; + desc.fs.image_sampler_pairs[2].sampler_slot = 1; + desc.label = "tile_map_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_METAL */ - #if defined(SOKOL_METAL) - if (backend == SG_BACKEND_METAL_SIMULATOR) { - static sg_shader_desc desc; - static bool valid; - if (!valid) { - valid = true; - desc.vs.source = tile_map_vs_source_metal_sim; - desc.vs.entry = "main0"; - desc.vs.uniform_blocks[0].size = 144; - desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.source = tile_map_fs_source_metal_sim; - desc.fs.entry = "main0"; - desc.fs.uniform_blocks[0].size = 16; - desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; - desc.fs.images[0].used = true; - desc.fs.images[0].multisampled = false; - desc.fs.images[0].image_type = SG_IMAGETYPE_2D; - desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_DEPTH; - desc.fs.images[1].used = true; - desc.fs.images[1].multisampled = false; - desc.fs.images[1].image_type = SG_IMAGETYPE_2D; - desc.fs.images[1].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.images[2].used = true; - desc.fs.images[2].multisampled = false; - desc.fs.images[2].image_type = SG_IMAGETYPE_2D; - desc.fs.images[2].sample_type = SG_IMAGESAMPLETYPE_FLOAT; - desc.fs.samplers[0].used = true; - desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_COMPARISON; - desc.fs.samplers[1].used = true; - desc.fs.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING; - desc.fs.image_sampler_pairs[0].used = true; - desc.fs.image_sampler_pairs[0].image_slot = 0; - desc.fs.image_sampler_pairs[0].sampler_slot = 0; - desc.fs.image_sampler_pairs[1].used = true; - desc.fs.image_sampler_pairs[1].image_slot = 1; - desc.fs.image_sampler_pairs[1].sampler_slot = 1; - desc.fs.image_sampler_pairs[2].used = true; - desc.fs.image_sampler_pairs[2].image_slot = 2; - desc.fs.image_sampler_pairs[2].sampler_slot = 1; - desc.label = "tile_map_program_shader"; + #endif /* SOKOL_METAL */ + #if defined(SOKOL_METAL) + if (backend == SG_BACKEND_METAL_SIMULATOR) { + static sg_shader_desc desc; + static bool valid; + if (!valid) { + valid = true; + desc.vs.source = (const char*)tile_map_vs_source_metal_sim; + desc.vs.entry = "main0"; + desc.vs.uniform_blocks[0].size = 144; + desc.vs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.source = (const char*)tile_map_fs_source_metal_sim; + desc.fs.entry = "main0"; + desc.fs.uniform_blocks[0].size = 16; + desc.fs.uniform_blocks[0].layout = SG_UNIFORMLAYOUT_STD140; + desc.fs.images[0].used = true; + desc.fs.images[0].multisampled = false; + desc.fs.images[0].image_type = SG_IMAGETYPE_2D; + desc.fs.images[0].sample_type = SG_IMAGESAMPLETYPE_DEPTH; + desc.fs.images[1].used = true; + desc.fs.images[1].multisampled = false; + desc.fs.images[1].image_type = SG_IMAGETYPE_2D; + desc.fs.images[1].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.images[2].used = true; + desc.fs.images[2].multisampled = false; + desc.fs.images[2].image_type = SG_IMAGETYPE_2D; + desc.fs.images[2].sample_type = SG_IMAGESAMPLETYPE_FLOAT; + desc.fs.samplers[0].used = true; + desc.fs.samplers[0].sampler_type = SG_SAMPLERTYPE_COMPARISON; + desc.fs.samplers[1].used = true; + desc.fs.samplers[1].sampler_type = SG_SAMPLERTYPE_FILTERING; + desc.fs.image_sampler_pairs[0].used = true; + desc.fs.image_sampler_pairs[0].image_slot = 0; + desc.fs.image_sampler_pairs[0].sampler_slot = 0; + desc.fs.image_sampler_pairs[1].used = true; + desc.fs.image_sampler_pairs[1].image_slot = 1; + desc.fs.image_sampler_pairs[1].sampler_slot = 1; + desc.fs.image_sampler_pairs[2].used = true; + desc.fs.image_sampler_pairs[2].image_slot = 2; + desc.fs.image_sampler_pairs[2].sampler_slot = 1; + desc.label = "tile_map_program_shader"; + } + return &desc; } - return &desc; - } - #endif /* SOKOL_METAL */ - return 0; -} -static inline int tile_map_program_attr_slot(const char* attr_name) { - (void)attr_name; - if (0 == strcmp(attr_name, "vs_position")) { + #endif /* SOKOL_METAL */ return 0; - } - if (0 == strcmp(attr_name, "vs_texcoord0")) { - return 1; - } - return -1; } -static inline int tile_map_program_image_slot(sg_shader_stage stage, const char* img_name) { - (void)stage; (void)img_name; - if (SG_SHADERSTAGE_FS == stage) { - if (0 == strcmp(img_name, "un_tex0")) { - return 0; +static inline int tile_map_program_attr_slot(const char* attr_name) { + (void)attr_name; + if (0 == strcmp(attr_name, "vs_position")) { + return 0; } - if (0 == strcmp(img_name, "un_tex1")) { - return 1; + if (0 == strcmp(attr_name, "vs_texcoord0")) { + return 1; } - if (0 == strcmp(img_name, "un_tex2")) { - return 2; + return -1; +} +static inline int tile_map_program_image_slot(sg_shader_stage stage, const char* img_name) { + (void)stage; (void)img_name; + if (SG_SHADERSTAGE_FS == stage) { + if (0 == strcmp(img_name, "un_tex0")) { + return 0; + } + if (0 == strcmp(img_name, "un_tex1")) { + return 1; + } + if (0 == strcmp(img_name, "un_tex2")) { + return 2; + } } - } - return -1; + return -1; } static inline int tile_map_program_sampler_slot(sg_shader_stage stage, const char* smp_name) { - (void)stage; (void)smp_name; - if (SG_SHADERSTAGE_FS == stage) { - if (0 == strcmp(smp_name, "un_sampler1")) { - return 0; + (void)stage; (void)smp_name; + if (SG_SHADERSTAGE_FS == stage) { + if (0 == strcmp(smp_name, "un_sampler1")) { + return 0; + } + if (0 == strcmp(smp_name, "un_sampler0")) { + return 1; + } } - if (0 == strcmp(smp_name, "un_sampler0")) { - return 1; - } - } - return -1; + return -1; } static inline int tile_map_program_uniformblock_slot(sg_shader_stage stage, const char* ub_name) { - (void)stage; (void)ub_name; - if (SG_SHADERSTAGE_VS == stage) { - if (0 == strcmp(ub_name, "tile_map_vs_params")) { - return 0; + (void)stage; (void)ub_name; + if (SG_SHADERSTAGE_VS == stage) { + if (0 == strcmp(ub_name, "tile_map_vs_params")) { + return 0; + } } - } - if (SG_SHADERSTAGE_FS == stage) { - if (0 == strcmp(ub_name, "tile_map_fs_params")) { - return 0; + if (SG_SHADERSTAGE_FS == stage) { + if (0 == strcmp(ub_name, "tile_map_fs_params")) { + return 0; + } } - } - return -1; + return -1; } static inline size_t tile_map_program_uniformblock_size(sg_shader_stage stage, const char* ub_name) { - (void)stage; (void)ub_name; - if (SG_SHADERSTAGE_VS == stage) { - if (0 == strcmp(ub_name, "tile_map_vs_params")) { - return sizeof(tile_map_tile_map_vs_params_t); + (void)stage; (void)ub_name; + if (SG_SHADERSTAGE_VS == stage) { + if (0 == strcmp(ub_name, "tile_map_vs_params")) { + return sizeof(tile_map_tile_map_vs_params_t); + } } - } - if (SG_SHADERSTAGE_FS == stage) { - if (0 == strcmp(ub_name, "tile_map_fs_params")) { - return sizeof(tile_map_tile_map_fs_params_t); + if (SG_SHADERSTAGE_FS == stage) { + if (0 == strcmp(ub_name, "tile_map_fs_params")) { + return sizeof(tile_map_tile_map_fs_params_t); + } } - } - return 0; + return 0; } static inline int tile_map_program_uniform_offset(sg_shader_stage stage, const char* ub_name, const char* u_name) { - (void)stage; (void)ub_name; (void)u_name; - if (SG_SHADERSTAGE_VS == stage) { - if (0 == strcmp(ub_name, "tile_map_vs_params")) { - if (0 == strcmp(u_name, "un_mvp")) { - return 0; - } - if (0 == strcmp(u_name, "un_shadow")) { - return 64; - } - if (0 == strcmp(u_name, "un_inv_world_size")) { - return 128; - } + (void)stage; (void)ub_name; (void)u_name; + if (SG_SHADERSTAGE_VS == stage) { + if (0 == strcmp(ub_name, "tile_map_vs_params")) { + if (0 == strcmp(u_name, "un_mvp")) { + return 0; + } + if (0 == strcmp(u_name, "un_shadow")) { + return 64; + } + if (0 == strcmp(u_name, "un_inv_world_size")) { + return 128; + } + } } - } - if (SG_SHADERSTAGE_FS == stage) { - if (0 == strcmp(ub_name, "tile_map_fs_params")) { - if (0 == strcmp(u_name, "un_tile_color")) { - return 0; - } + if (SG_SHADERSTAGE_FS == stage) { + if (0 == strcmp(ub_name, "tile_map_fs_params")) { + if (0 == strcmp(u_name, "un_tile_color")) { + return 0; + } + } } - } - return -1; + return -1; } static inline sg_shader_uniform_desc tile_map_program_uniform_desc(sg_shader_stage stage, const char* ub_name, const char* u_name) { - (void)stage; (void)ub_name; (void)u_name; - #if defined(__cplusplus) - sg_shader_uniform_desc desc = {}; - #else - sg_shader_uniform_desc desc = {0}; - #endif - if (SG_SHADERSTAGE_VS == stage) { - if (0 == strcmp(ub_name, "tile_map_vs_params")) { - if (0 == strcmp(u_name, "un_mvp")) { - desc.name = "un_mvp"; - desc.type = SG_UNIFORMTYPE_MAT4; - desc.array_count = 1; - return desc; - } - if (0 == strcmp(u_name, "un_shadow")) { - desc.name = "un_shadow"; - desc.type = SG_UNIFORMTYPE_MAT4; - desc.array_count = 1; - return desc; - } - if (0 == strcmp(u_name, "un_inv_world_size")) { - desc.name = "un_inv_world_size"; - desc.type = SG_UNIFORMTYPE_FLOAT2; - desc.array_count = 1; - return desc; - } + (void)stage; (void)ub_name; (void)u_name; + #if defined(__cplusplus) + sg_shader_uniform_desc desc = {}; + #else + sg_shader_uniform_desc desc = {0}; + #endif + if (SG_SHADERSTAGE_VS == stage) { + if (0 == strcmp(ub_name, "tile_map_vs_params")) { + if (0 == strcmp(u_name, "un_mvp")) { + desc.name = "un_mvp"; + desc.type = SG_UNIFORMTYPE_MAT4; + desc.array_count = 0; + return desc; + } + if (0 == strcmp(u_name, "un_shadow")) { + desc.name = "un_shadow"; + desc.type = SG_UNIFORMTYPE_MAT4; + desc.array_count = 0; + return desc; + } + if (0 == strcmp(u_name, "un_inv_world_size")) { + desc.name = "un_inv_world_size"; + desc.type = SG_UNIFORMTYPE_FLOAT2; + desc.array_count = 0; + return desc; + } + } } - } - if (SG_SHADERSTAGE_FS == stage) { - if (0 == strcmp(ub_name, "tile_map_fs_params")) { - if (0 == strcmp(u_name, "un_tile_color")) { - desc.name = "un_tile_color"; - desc.type = SG_UNIFORMTYPE_FLOAT4; - desc.array_count = 1; - return desc; - } + if (SG_SHADERSTAGE_FS == stage) { + if (0 == strcmp(ub_name, "tile_map_fs_params")) { + if (0 == strcmp(u_name, "un_tile_color")) { + desc.name = "un_tile_color"; + desc.type = SG_UNIFORMTYPE_FLOAT4; + desc.array_count = 0; + return desc; + } + } } - } - return desc; + return desc; +} +static inline int tile_map_program_storagebuffer_slot(sg_shader_stage stage, const char* sbuf_name) { + (void)stage; (void)sbuf_name; + return -1; } diff --git a/Source/Render/src/RenderDevice.cpp b/Source/Render/src/RenderDevice.cpp index 389c5782..3afb3843 100644 --- a/Source/Render/src/RenderDevice.cpp +++ b/Source/Render/src/RenderDevice.cpp @@ -1,5 +1,3 @@ -#include -#include #include #include "StdAfxRD.h" #include "xutil.h"