GLSL macros

This commit is contained in:
Jack Andersen 2016-02-23 17:19:07 -10:00
parent ac2f2ba446
commit 7e97c7d2bb
4 changed files with 17 additions and 11 deletions

View File

@ -129,19 +129,19 @@ protected:
m_mv[3][1] = sub.location[1] * m_mv[1][1] - 1.0f;
}
} m_viewVertBlock;
#define SPECTER_VIEW_VERT_BLOCK_GLSL\
"uniform SpecterViewBlock\n"\
#define SPECTER_GLSL_VIEW_VERT_BLOCK\
"UBINDING0 uniform SpecterViewBlock\n"\
"{\n"\
" mat4 mv;\n"\
" vec4 mulColor;\n"\
"};\n"
#define SPECTER_VIEW_VERT_BLOCK_HLSL\
#define SPECTER_HLSL_VIEW_VERT_BLOCK\
"cbuffer SpecterViewBlock : register(b0)\n"\
"{\n"\
" float4x4 mv;\n"\
" float4 mulColor;\n"\
"};\n"
#define SPECTER_VIEW_VERT_BLOCK_METAL\
#define SPECTER_METAL_VIEW_VERT_BLOCK\
"struct SpecterViewBlock\n"\
"{\n"\
" float4x4 mv;\n"\

View File

@ -13,7 +13,7 @@ RootView::RootView(IViewManager& viewMan, ViewResources& res, boo::IWindow* wind
{
window->setCallback(&m_events);
boo::SWindowRect rect = window->getWindowFrame();
m_renderTex = res.m_factory->newRenderTexture(rect.size[0], rect.size[1], 1);
m_renderTex = res.m_factory->newRenderTexture(rect.size[0], rect.size[1]);
commitResources(res);
resized(rect, rect);
}

View File

@ -11,11 +11,12 @@ static LogVisor::LogModule Log("Specter::TextView");
static const char* GLSLVS =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"layout(location=0) in vec3 posIn[4];\n"
"layout(location=4) in mat4 mvMtx;\n"
"layout(location=8) in vec3 uvIn[4];\n"
"layout(location=12) in vec4 colorIn;\n"
SPECTER_VIEW_VERT_BLOCK_GLSL
SPECTER_GLSL_VIEW_VERT_BLOCK
"struct VertToFrag\n"
"{\n"
" vec3 uv;\n"
@ -31,7 +32,8 @@ SPECTER_VIEW_VERT_BLOCK_GLSL
static const char* GLSLFSReg =
"#version 330\n"
"uniform sampler2DArray fontTex;\n"
BOO_GLSL_BINDING_HEAD
"TBINDING0 uniform sampler2DArray fontTex;\n"
"struct VertToFrag\n"
"{\n"
" vec3 uv;\n"
@ -47,7 +49,8 @@ static const char* GLSLFSReg =
static const char* GLSLFSSubpixel =
"#version 330\n"
"uniform sampler2DArray fontTex;\n"
BOO_GLSL_BINDING_HEAD
"TBINDING0 uniform sampler2DArray fontTex;\n"
"struct VertToFrag\n"
"{\n"
" vec3 uv;\n"

View File

@ -8,9 +8,10 @@ static LogVisor::LogModule Log("Specter::View");
static const char* GLSLSolidVS =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"layout(location=0) in vec3 posIn;\n"
"layout(location=1) in vec4 colorIn;\n"
SPECTER_VIEW_VERT_BLOCK_GLSL
SPECTER_GLSL_VIEW_VERT_BLOCK
"struct VertToFrag\n"
"{\n"
" vec4 color;\n"
@ -37,9 +38,10 @@ static const char* GLSLSolidFS =
static const char* GLSLTexVS =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"layout(location=0) in vec3 posIn;\n"
"layout(location=1) in vec2 uvIn;\n"
SPECTER_VIEW_VERT_BLOCK_GLSL
SPECTER_GLSL_VIEW_VERT_BLOCK
"struct VertToFrag\n"
"{\n"
" vec4 color;\n"
@ -55,13 +57,14 @@ SPECTER_VIEW_VERT_BLOCK_GLSL
static const char* GLSLTexFS =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"struct VertToFrag\n"
"{\n"
" vec4 color;\n"
" vec2 uv;\n"
"};\n"
"in VertToFrag vtf;\n"
"uniform sampler2D tex;\n"
"TBINDING0 uniform sampler2D tex;\n"
"layout(location=0) out vec4 colorOut;\n"
"void main()\n"
"{\n"