| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #version 450 | ||
| #extension GL_ARB_separate_shader_objects : enable | ||
|
|
||
| #ifdef TW_TEXTURED | ||
| layout(binding = 0) uniform sampler2D gTextureSampler; | ||
| #endif | ||
|
|
||
| layout(location = 0) noperspective in vec2 texCoord; | ||
| layout(location = 1) noperspective in vec4 vertColor; | ||
|
|
||
| layout(location = 0) out vec4 FragClr; | ||
| void main() | ||
| { | ||
| #ifdef TW_TEXTURED | ||
| vec4 tex = texture(gTextureSampler, texCoord); | ||
| FragClr = tex * vertColor; | ||
| #else | ||
| FragClr = vertColor; | ||
| #endif | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #version 450 | ||
| #extension GL_ARB_separate_shader_objects : enable | ||
|
|
||
| layout (location = 0) in vec2 inVertex; | ||
| layout (location = 1) in vec2 inVertexTexCoord; | ||
| layout (location = 2) in vec4 inVertexColor; | ||
|
|
||
| layout(push_constant) uniform SPosBO { | ||
| layout(offset = 0) mat4x2 gPos; | ||
| } gPosBO; | ||
|
|
||
| layout (location = 0) noperspective out vec2 texCoord; | ||
| layout (location = 1) noperspective out vec4 vertColor; | ||
|
|
||
| void main() | ||
| { | ||
| gl_Position = vec4(gPosBO.gPos * vec4(inVertex, 0.0, 1.0), 0.0, 1.0); | ||
| texCoord = inVertexTexCoord; | ||
| vertColor = vec4(inVertexColor); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #version 450 | ||
| #extension GL_ARB_separate_shader_objects : enable | ||
|
|
||
| #ifdef TW_TEXTURED | ||
| layout (binding = 0) uniform sampler2DArray gTextureSampler; | ||
| #endif | ||
|
|
||
| layout (location = 0) noperspective in vec4 oVertColor; | ||
| #ifdef TW_TEXTURED | ||
| layout (location = 1) noperspective in vec3 oTexCoord; | ||
| #endif | ||
|
|
||
| layout (location = 0) out vec4 FragClr; | ||
|
|
||
| void main() | ||
| { | ||
| #ifdef TW_TEXTURED | ||
| vec4 TexColor = texture(gTextureSampler, oTexCoord.xyz).rgba; | ||
| FragClr = TexColor.rgba * oVertColor.rgba; | ||
| #else | ||
| FragClr = oVertColor.rgba; | ||
| #endif | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #version 450 | ||
| #extension GL_ARB_separate_shader_objects : enable | ||
|
|
||
| layout (location = 0) in vec2 inVertex; | ||
| layout (location = 1) in vec4 inVertexColor; | ||
| layout (location = 2) in vec3 inVertexTexCoord; | ||
|
|
||
| layout(push_constant) uniform SPosBO { | ||
| layout(offset = 0) mat4x2 gPos; | ||
| } gPosBO; | ||
|
|
||
| layout (location = 0) noperspective out vec4 oVertColor; | ||
| #ifdef TW_TEXTURED | ||
| layout (location = 1) noperspective out vec3 oTexCoord; | ||
| #endif | ||
|
|
||
| void main() | ||
| { | ||
| gl_Position = vec4(gPosBO.gPos * vec4(inVertex, 0.0, 1.0), 0.0, 1.0); | ||
| #ifdef TW_TEXTURED | ||
| oTexCoord = inVertexTexCoord; | ||
| #endif | ||
| oVertColor = inVertexColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #version 450 | ||
| #extension GL_ARB_separate_shader_objects : enable | ||
|
|
||
| #ifdef TW_TEXTURED | ||
| layout(binding = 0) uniform sampler2D gTextureSampler; | ||
| #endif | ||
|
|
||
| layout(push_constant) uniform SVertexColorBO { | ||
| layout(offset = 48) vec4 gVerticesColor; | ||
| } gColorBO; | ||
|
|
||
| layout (location = 0) noperspective in vec2 texCoord; | ||
| layout (location = 1) noperspective in vec4 vertColor; | ||
|
|
||
| layout (location = 0) out vec4 FragClr; | ||
| void main() | ||
| { | ||
| #ifdef TW_TEXTURED | ||
| vec4 tex = texture(gTextureSampler, texCoord); | ||
| FragClr = tex * vertColor * gColorBO.gVerticesColor; | ||
| #else | ||
| FragClr = vertColor * gColorBO.gVerticesColor; | ||
| #endif | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #version 450 | ||
| #extension GL_ARB_separate_shader_objects : enable | ||
|
|
||
| layout (location = 0) in vec2 inVertex; | ||
| layout (location = 1) in vec2 inVertexTexCoord; | ||
| layout (location = 2) in vec4 inVertexColor; | ||
|
|
||
| layout(push_constant) uniform SPosBO { | ||
| layout(offset = 0) mat4x2 gPos; | ||
| #ifndef TW_ROTATIONLESS | ||
| layout(offset = 32) vec2 gCenter; | ||
| layout(offset = 40) float gRotation; | ||
| #endif | ||
| } gPosBO; | ||
|
|
||
| layout (location = 0) noperspective out vec2 texCoord; | ||
| layout (location = 1) noperspective out vec4 vertColor; | ||
|
|
||
| void main() | ||
| { | ||
| vec2 FinalPos = vec2(inVertex.xy); | ||
| #ifndef TW_ROTATIONLESS | ||
| float X = FinalPos.x - gPosBO.gCenter.x; | ||
| float Y = FinalPos.y - gPosBO.gCenter.y; | ||
|
|
||
| FinalPos.x = X * cos(gPosBO.gRotation) - Y * sin(gPosBO.gRotation) + gPosBO.gCenter.x; | ||
| FinalPos.y = X * sin(gPosBO.gRotation) + Y * cos(gPosBO.gRotation) + gPosBO.gCenter.y; | ||
| #endif | ||
|
|
||
| gl_Position = vec4(gPosBO.gPos * vec4(FinalPos, 0.0, 1.0), 0.0, 1.0); | ||
| texCoord = inVertexTexCoord; | ||
| vertColor = inVertexColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| #version 450 | ||
| #extension GL_ARB_separate_shader_objects : enable | ||
|
|
||
| #ifdef TW_QUAD_TEXTURED | ||
| layout (set = 0, binding = 0) uniform sampler2D gTextureSampler; | ||
| #endif | ||
|
|
||
| #ifdef TW_QUAD_TEXTURED | ||
| #define UBOSetIndex 1 | ||
| #else | ||
| #define UBOSetIndex 0 | ||
| #endif | ||
|
|
||
| struct SQuadUniformEl { | ||
| vec4 gVertColor; | ||
| vec2 gOffset; | ||
| float gRotation; | ||
| }; | ||
|
|
||
| #ifndef TW_PUSH_CONST | ||
| #define TW_MAX_QUADS 256 | ||
|
|
||
| layout (std140, set = UBOSetIndex, binding = 1) uniform SOffBO { | ||
| uniform SQuadUniformEl gUniEls[TW_MAX_QUADS]; | ||
| } gQuadBO; | ||
| #else | ||
| #define gQuadBO gPosBO | ||
| #define QuadIndex 0 | ||
| #endif | ||
|
|
||
| layout(push_constant) uniform SPosBO { | ||
| layout(offset = 0) uniform mat4x2 gPos; | ||
| #ifdef TW_PUSH_CONST | ||
| layout(offset = 32) uniform SQuadUniformEl gUniEls[1]; | ||
| layout(offset = 64) uniform int gQuadOffset; | ||
| #else | ||
| layout(offset = 32) uniform int gQuadOffset; | ||
| #endif | ||
| } gPosBO; | ||
|
|
||
| layout (location = 0) noperspective in vec4 QuadColor; | ||
| #ifndef TW_PUSH_CONST | ||
| layout (location = 1) flat in int QuadIndex; | ||
| #endif | ||
| #ifdef TW_QUAD_TEXTURED | ||
| #ifndef TW_PUSH_CONST | ||
| layout (location = 2) noperspective in vec2 TexCoord; | ||
| #else | ||
| layout (location = 1) noperspective in vec2 TexCoord; | ||
| #endif | ||
| #endif | ||
|
|
||
| layout (location = 0) out vec4 FragClr; | ||
| void main() | ||
| { | ||
| #ifdef TW_QUAD_TEXTURED | ||
| vec4 TexColor = texture(gTextureSampler, TexCoord); | ||
| FragClr = TexColor * QuadColor * gQuadBO.gUniEls[QuadIndex].gVertColor; | ||
| #else | ||
| FragClr = QuadColor * gQuadBO.gUniEls[QuadIndex].gVertColor; | ||
| #endif | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| #version 450 | ||
| #extension GL_ARB_separate_shader_objects : enable | ||
|
|
||
| layout (location = 0) in vec4 inVertex; | ||
| layout (location = 1) in vec4 inColor; | ||
| #ifdef TW_QUAD_TEXTURED | ||
| layout (location = 2) in vec2 inVertexTexCoord; | ||
| #endif | ||
|
|
||
| #ifdef TW_QUAD_TEXTURED | ||
| #define UBOSetIndex 1 | ||
| #else | ||
| #define UBOSetIndex 0 | ||
| #endif | ||
|
|
||
| struct SQuadUniformEl { | ||
| vec4 gVertColor; | ||
| vec2 gOffset; | ||
| float gRotation; | ||
| }; | ||
|
|
||
| #ifndef TW_PUSH_CONST | ||
| #define TW_MAX_QUADS 256 | ||
|
|
||
| layout (std140, set = UBOSetIndex, binding = 1) uniform SOffBO { | ||
| uniform SQuadUniformEl gUniEls[TW_MAX_QUADS]; | ||
| } gQuadBO; | ||
| #else | ||
| #define gQuadBO gPosBO | ||
| #define TmpQuadIndex 0 | ||
| #endif | ||
|
|
||
| layout(push_constant) uniform SPosBO { | ||
| layout(offset = 0) uniform mat4x2 gPos; | ||
| #ifdef TW_PUSH_CONST | ||
| layout(offset = 32) uniform SQuadUniformEl gUniEls[1]; | ||
| layout(offset = 64) uniform int gQuadOffset; | ||
| #else | ||
| layout(offset = 32) uniform int gQuadOffset; | ||
| #endif | ||
| } gPosBO; | ||
|
|
||
| layout (location = 0) noperspective out vec4 QuadColor; | ||
| #ifndef TW_PUSH_CONST | ||
| layout (location = 1) flat out int QuadIndex; | ||
| #endif | ||
| #ifdef TW_QUAD_TEXTURED | ||
| #ifndef TW_PUSH_CONST | ||
| layout (location = 2) noperspective out vec2 TexCoord; | ||
| #else | ||
| layout (location = 1) noperspective out vec2 TexCoord; | ||
| #endif | ||
| #endif | ||
|
|
||
| void main() | ||
| { | ||
| vec2 FinalPos = vec2(inVertex.xy); | ||
|
|
||
| #ifndef TW_PUSH_CONST | ||
| int TmpQuadIndex = int(gl_VertexIndex / 4) - gPosBO.gQuadOffset; | ||
| #endif | ||
|
|
||
| if(gQuadBO.gUniEls[TmpQuadIndex].gRotation != 0.0) | ||
| { | ||
| float X = FinalPos.x - inVertex.z; | ||
| float Y = FinalPos.y - inVertex.w; | ||
|
|
||
| FinalPos.x = X * cos(gQuadBO.gUniEls[TmpQuadIndex].gRotation) - Y * sin(gQuadBO.gUniEls[TmpQuadIndex].gRotation) + inVertex.z; | ||
| FinalPos.y = X * sin(gQuadBO.gUniEls[TmpQuadIndex].gRotation) + Y * cos(gQuadBO.gUniEls[TmpQuadIndex].gRotation) + inVertex.w; | ||
| } | ||
|
|
||
| FinalPos.x = FinalPos.x / 1024.0 + gQuadBO.gUniEls[TmpQuadIndex].gOffset.x; | ||
| FinalPos.y = FinalPos.y / 1024.0 + gQuadBO.gUniEls[TmpQuadIndex].gOffset.y; | ||
|
|
||
| gl_Position = vec4(gPosBO.gPos * vec4(FinalPos, 0.0, 1.0), 0.0, 1.0); | ||
| QuadColor = inColor; | ||
| #ifndef TW_PUSH_CONST | ||
| QuadIndex = TmpQuadIndex; | ||
| #endif | ||
| #ifdef TW_QUAD_TEXTURED | ||
| TexCoord = inVertexTexCoord; | ||
| #endif | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
|
|
||
| struct SQuadUniformEl { | ||
| vec4 gVertColor; | ||
| vec2 gOffset; | ||
| float gRotation; | ||
| }; | ||
|
|
||
| #define TW_MAX_QUADS 256 | ||
|
|
||
| layout (std140, set = 2, binding = 2) uniform SOffBO { | ||
| uniform SQuadUniformEl gUniEls[TW_MAX_QUADS]; | ||
| } gQuadBO; | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #version 450 | ||
| #extension GL_ARB_separate_shader_objects : enable | ||
|
|
||
| layout (set = 0, binding = 0) uniform sampler2D gTextureSampler; | ||
|
|
||
| layout(push_constant) uniform SVertexColorBO { | ||
| #ifdef TW_PUSH_CONST | ||
| layout(offset = 64) vec4 gVerticesColor; | ||
| #else | ||
| layout(offset = 48) vec4 gVerticesColor; | ||
| #endif | ||
| } gColorBO; | ||
|
|
||
| layout (location = 0) noperspective in vec2 texCoord; | ||
| layout (location = 1) noperspective in vec4 vertColor; | ||
|
|
||
| layout (location = 0) out vec4 FragClr; | ||
|
|
||
| void main() | ||
| { | ||
| vec4 tex = texture(gTextureSampler, texCoord); | ||
| FragClr = tex * vertColor * gColorBO.gVerticesColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| #version 450 | ||
| #extension GL_ARB_separate_shader_objects : enable | ||
|
|
||
| layout (location = 0) in vec2 inVertex; | ||
| layout (location = 1) in vec2 inVertexTexCoord; | ||
| layout (location = 2) in vec4 inVertexColor; | ||
|
|
||
| layout(push_constant) uniform SPosBO { | ||
| layout(offset = 0) uniform mat4x2 gPos; | ||
| layout(offset = 32) uniform vec2 gCenter; | ||
| #ifdef TW_PUSH_CONST | ||
| layout(offset = 48) uniform vec4 gRSP[1]; | ||
| #endif | ||
| } gPosBO; | ||
|
|
||
| #ifndef TW_PUSH_CONST | ||
| layout (std140, set = 1, binding = 1) uniform SRSPBO { | ||
| vec4 gRSP[512]; | ||
| } gRSPBO; | ||
| #define RSPIndex gl_InstanceIndex | ||
| #else | ||
| #define gRSPBO gPosBO | ||
| #define RSPIndex 0 | ||
| #endif | ||
|
|
||
| layout (location = 0) noperspective out vec2 texCoord; | ||
| layout (location = 1) noperspective out vec4 vertColor; | ||
|
|
||
| void main() | ||
| { | ||
| vec2 FinalPos = vec2(inVertex.xy); | ||
| if(gRSPBO.gRSP[RSPIndex].w != 0.0) | ||
| { | ||
| float X = FinalPos.x - gPosBO.gCenter.x; | ||
| float Y = FinalPos.y - gPosBO.gCenter.y; | ||
|
|
||
| FinalPos.x = X * cos(gRSPBO.gRSP[RSPIndex].w) - Y * sin(gRSPBO.gRSP[RSPIndex].w) + gPosBO.gCenter.x; | ||
| FinalPos.y = X * sin(gRSPBO.gRSP[RSPIndex].w) + Y * cos(gRSPBO.gRSP[RSPIndex].w) + gPosBO.gCenter.y; | ||
| } | ||
|
|
||
| FinalPos.x *= gRSPBO.gRSP[RSPIndex].z; | ||
| FinalPos.y *= gRSPBO.gRSP[RSPIndex].z; | ||
|
|
||
| FinalPos.x += gRSPBO.gRSP[RSPIndex].x; | ||
| FinalPos.y += gRSPBO.gRSP[RSPIndex].y; | ||
|
|
||
| gl_Position = vec4(gPosBO.gPos * vec4(FinalPos, 0.0, 1.0), 0.0, 1.0); | ||
| texCoord = inVertexTexCoord; | ||
| vertColor = inVertexColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #version 450 | ||
| #extension GL_ARB_separate_shader_objects : enable | ||
|
|
||
| layout(binding = 0) uniform sampler2D gTextSampler; | ||
| layout(binding = 1) uniform sampler2D gTextOutlineSampler; | ||
|
|
||
| layout(push_constant) uniform SFragConstBO { | ||
| layout(offset = 48) uniform vec4 gVertColor; | ||
| layout(offset = 64) uniform vec4 gVertOutlineColor; | ||
| } gFragConst; | ||
|
|
||
| layout (location = 0) noperspective in vec2 texCoord; | ||
| layout (location = 1) noperspective in vec4 outVertColor; | ||
|
|
||
| layout(location = 0) out vec4 FragClr; | ||
|
|
||
| void main() | ||
| { | ||
| vec4 textColor = gFragConst.gVertColor * outVertColor * vec4(1.0, 1.0, 1.0, texture(gTextSampler, texCoord).r); | ||
| vec4 textOutlineTex = gFragConst.gVertOutlineColor * vec4(1.0, 1.0, 1.0, texture(gTextOutlineSampler, texCoord).r); | ||
|
|
||
| // ratio between the two textures | ||
| float OutlineBlend = (1.0 - textColor.a); | ||
|
|
||
| // since the outline is always black, or even if it has decent colors, it can be just added to the actual color | ||
| // without loosing any or too much color | ||
|
|
||
| // lerp isn't commutative, so add the color the fragment looses by lerping | ||
| // this reduces the chance of false color calculation if the text is transparent | ||
|
|
||
| // first get the right color | ||
| vec4 textOutlineFrag = vec4(textOutlineTex.rgb * textOutlineTex.a, textOutlineTex.a) * OutlineBlend; | ||
| vec3 textFrag = (textColor.rgb * textColor.a); | ||
| vec3 finalFragColor = textOutlineFrag.rgb + textFrag; | ||
|
|
||
| float RealAlpha = (textOutlineFrag.a + textColor.a); | ||
|
|
||
| // simply add the color we will loose through blending | ||
| if(RealAlpha > 0.0) | ||
| FragClr = vec4(finalFragColor / RealAlpha, RealAlpha); | ||
| else | ||
| FragClr = vec4(0.0, 0.0, 0.0, 0.0); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #version 450 | ||
| #extension GL_ARB_separate_shader_objects : enable | ||
|
|
||
| layout (location = 0) in vec2 inVertex; | ||
| layout (location = 1) in vec2 inVertexTexCoord; | ||
| layout (location = 2) in vec4 inVertexColor; | ||
|
|
||
| layout(push_constant) uniform SPosBO { | ||
| layout(offset = 0) mat4x2 gPos; | ||
| layout(offset = 32) float gTextureSize; | ||
| } gPosBO; | ||
|
|
||
| layout (location = 0) noperspective out vec2 texCoord; | ||
| layout (location = 1) noperspective out vec4 outVertColor; | ||
|
|
||
| void main() | ||
| { | ||
| gl_Position = vec4(gPosBO.gPos * vec4(inVertex, 0.0, 1.0), 0.0, 1.0); | ||
|
|
||
| texCoord = vec2(inVertexTexCoord.x / gPosBO.gTextureSize, inVertexTexCoord.y / gPosBO.gTextureSize); | ||
| outVertColor = inVertexColor; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #version 450 | ||
| #extension GL_ARB_separate_shader_objects : enable | ||
|
|
||
| #ifdef TW_TILE_TEXTURED | ||
| layout(binding = 0) uniform sampler2DArray gTextureSampler; | ||
| #endif | ||
|
|
||
| layout(push_constant) uniform SVertexColorBO { | ||
| layout(offset = 64) uniform vec4 gVertColor; | ||
| } gColorBO; | ||
|
|
||
| #ifdef TW_TILE_TEXTURED | ||
| layout (location = 0) noperspective in vec3 TexCoord; | ||
| #endif | ||
|
|
||
| layout (location = 0) out vec4 FragClr; | ||
| void main() | ||
| { | ||
| #ifdef TW_TILE_TEXTURED | ||
| vec4 TexColor = texture(gTextureSampler, TexCoord.xyz); | ||
| FragClr = TexColor * gColorBO.gVertColor; | ||
| #else | ||
| FragClr = gColorBO.gVertColor; | ||
| #endif | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #version 450 | ||
| #extension GL_ARB_separate_shader_objects : enable | ||
|
|
||
| layout (location = 0) in vec2 inVertex; | ||
| #ifdef TW_TILE_TEXTURED | ||
| layout (location = 1) in vec3 inVertexTexCoord; | ||
| #endif | ||
|
|
||
| layout(push_constant) uniform SPosBO { | ||
| layout(offset = 0) uniform mat4x2 gPos; | ||
|
|
||
| #if defined(TW_TILE_BORDER) || defined(TW_TILE_BORDER_LINE) | ||
| layout(offset = 32) uniform vec2 gDir; | ||
| layout(offset = 40) uniform vec2 gOffset; | ||
| #endif | ||
|
|
||
| #if defined(TW_TILE_BORDER) | ||
| layout(offset = 48) uniform int gJumpIndex; | ||
| #endif | ||
| } gPosBO; | ||
|
|
||
| #ifdef TW_TILE_TEXTURED | ||
| layout (location = 0) noperspective out vec3 TexCoord; | ||
| #endif | ||
|
|
||
| void main() | ||
| { | ||
| #if defined(TW_TILE_BORDER) | ||
| vec4 VertPos = vec4(inVertex, 0.0, 1.0); | ||
| int XCount = gl_InstanceIndex - (int(gl_InstanceIndex/gPosBO.gJumpIndex) * gPosBO.gJumpIndex); | ||
| int YCount = (int(gl_InstanceIndex/gPosBO.gJumpIndex)); | ||
| VertPos.x += gPosBO.gOffset.x + gPosBO.gDir.x * float(XCount); | ||
| VertPos.y += gPosBO.gOffset.y + gPosBO.gDir.y * float(YCount); | ||
|
|
||
| gl_Position = vec4(gPosBO.gPos * VertPos, 0.0, 1.0); | ||
| #elif defined(TW_TILE_BORDER_LINE) | ||
| vec4 VertPos = vec4(inVertex.x + gPosBO.gOffset.x, inVertex.y + gPosBO.gOffset.y, 0.0, 1.0); | ||
| VertPos.x += gPosBO.gDir.x * float(gl_InstanceIndex); | ||
| VertPos.y += gPosBO.gDir.y * float(gl_InstanceIndex); | ||
|
|
||
| gl_Position = vec4(gPosBO.gPos * VertPos, 0.0, 1.0); | ||
| #else | ||
| gl_Position = vec4(gPosBO.gPos * vec4(inVertex, 0.0, 1.0), 0.0, 1.0); | ||
| #endif | ||
|
|
||
| #ifdef TW_TILE_TEXTURED | ||
| TexCoord = inVertexTexCoord; | ||
| #endif | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/bin/bash | ||
|
|
||
| if [ -z ${1+x} ]; then | ||
| printf "\e[31m%s\e[30m\n" "Did not pass executable file (full path)" | ||
| printf "\e[31m%s\e[30m\n" "Usage: ./parse_drmingw.sh <executable> <crash_log>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z ${2+x} ]; then | ||
| printf "\e[31m%s\e[30m\n" "Did not pass crash log file (full path)" | ||
| printf "\e[31m%s\e[30m\n" "Usage: ./parse_drmingw.sh <executable> <crash_log>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| TMP_OFFSET=$(grep -E -o "\(with offset [0-9A-F]*\)" "$2" | grep -E -o "[A-F0-9]*") | ||
|
|
||
| ADDR_PC_REGEX='[0-9A-F]+ [0-9A-F]+ [0-9A-F]+ [0-9A-F]+' | ||
| while read -r line | ||
| do | ||
| if [[ $line =~ $ADDR_PC_REGEX ]] | ||
| then | ||
| TMP_ADDR=$(echo "$line" | grep -E -o -m 1 "[A-F0-9]+ " | head -1) | ||
| ADDR_BASE=$(winedump -f "$1" | grep -E -o "image base[ ]*0x[0-9A-Fa-f]*" | grep -E -o "[0-9A-Fa-f]+" | tail -1) | ||
| REAL_ADDR=$(printf '%X\n' "$(((0x$TMP_ADDR-0x$TMP_OFFSET)+0x$ADDR_BASE))") | ||
| echo "Parsing address: $REAL_ADDR (img base: $ADDR_BASE)" | ||
| addr2line -e "$1" "$REAL_ADDR" | ||
| fi | ||
| done < "$2" | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #include <cstdlib> | ||
|
|
||
| #include "tolower_data.h" | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #include "backend_base.h" | ||
| #include "engine/shared/image_manipulation.h" | ||
|
|
||
| size_t CCommandProcessorFragment_GLBase::TexFormatToImageColorChannelCount(int TexFormat) | ||
| { | ||
| if(TexFormat == CCommandBuffer::TEXFORMAT_RGBA) | ||
| return 4; | ||
| return 4; | ||
| } | ||
|
|
||
| void *CCommandProcessorFragment_GLBase::Resize(const unsigned char *pData, int Width, int Height, int NewWidth, int NewHeight, int BPP) | ||
| { | ||
| return ResizeImage((const uint8_t *)pData, Width, Height, NewWidth, NewHeight, BPP); | ||
| } | ||
|
|
||
| bool CCommandProcessorFragment_GLBase::Texture2DTo3D(void *pImageBuffer, int ImageWidth, int ImageHeight, int ImageColorChannelCount, int SplitCountWidth, int SplitCountHeight, void *pTarget3DImageData, int &Target3DImageWidth, int &Target3DImageHeight) | ||
| { | ||
| Target3DImageWidth = ImageWidth / SplitCountWidth; | ||
| Target3DImageHeight = ImageHeight / SplitCountHeight; | ||
|
|
||
| size_t FullImageWidth = (size_t)ImageWidth * ImageColorChannelCount; | ||
|
|
||
| for(int Y = 0; Y < SplitCountHeight; ++Y) | ||
| { | ||
| for(int X = 0; X < SplitCountWidth; ++X) | ||
| { | ||
| for(int Y3D = 0; Y3D < Target3DImageHeight; ++Y3D) | ||
| { | ||
| int DepthIndex = X + Y * SplitCountWidth; | ||
|
|
||
| size_t TargetImageFullWidth = (size_t)Target3DImageWidth * ImageColorChannelCount; | ||
| size_t TargetImageFullSize = (size_t)TargetImageFullWidth * Target3DImageHeight; | ||
| ptrdiff_t ImageOffset = (ptrdiff_t)(((size_t)Y * FullImageWidth * (size_t)Target3DImageHeight) + ((size_t)Y3D * FullImageWidth) + ((size_t)X * TargetImageFullWidth)); | ||
| ptrdiff_t TargetImageOffset = (ptrdiff_t)(TargetImageFullSize * (size_t)DepthIndex + ((size_t)Y3D * TargetImageFullWidth)); | ||
| mem_copy(((uint8_t *)pTarget3DImageData) + TargetImageOffset, ((uint8_t *)pImageBuffer) + (ptrdiff_t)(ImageOffset), TargetImageFullWidth); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return true; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| #ifndef ENGINE_CLIENT_BACKEND_BACKEND_BASE_H | ||
| #define ENGINE_CLIENT_BACKEND_BACKEND_BASE_H | ||
|
|
||
| #include "../backend_sdl.h" | ||
| #include "engine/graphics.h" | ||
|
|
||
| #include <vector> | ||
|
|
||
| enum EDebugGFXModes | ||
| { | ||
| DEBUG_GFX_MODE_NONE = 0, | ||
| DEBUG_GFX_MODE_MINIMUM, | ||
| DEBUG_GFX_MODE_AFFECTS_PERFORMANCE, | ||
| DEBUG_GFX_MODE_VERBOSE, | ||
| DEBUG_GFX_MODE_ALL, | ||
| }; | ||
|
|
||
| class CCommandProcessorFragment_GLBase | ||
| { | ||
| protected: | ||
| static size_t TexFormatToImageColorChannelCount(int TexFormat); | ||
| static void *Resize(const unsigned char *pData, int Width, int Height, int NewWidth, int NewHeight, int BPP); | ||
|
|
||
| static bool Texture2DTo3D(void *pImageBuffer, int ImageWidth, int ImageHeight, int ImageColorChannelCount, int SplitCountWidth, int SplitCountHeight, void *pTarget3DImageData, int &Target3DImageWidth, int &Target3DImageHeight); | ||
|
|
||
| virtual bool GetPresentedImageData(uint32_t &Width, uint32_t &Height, uint32_t &Format, std::vector<uint8_t> &DstData) = 0; | ||
|
|
||
| public: | ||
| virtual ~CCommandProcessorFragment_GLBase() = default; | ||
| virtual bool RunCommand(const CCommandBuffer::SCommand *pBaseCommand) = 0; | ||
|
|
||
| virtual void StartCommands(size_t CommandCount, size_t EstimatedRenderCallCount) {} | ||
| virtual void EndCommands() {} | ||
|
|
||
| enum | ||
| { | ||
| CMD_PRE_INIT = CCommandBuffer::CMDGROUP_PLATFORM_GL, | ||
| CMD_INIT, | ||
| CMD_SHUTDOWN, | ||
| CMD_POST_SHUTDOWN, | ||
| }; | ||
|
|
||
| struct SCommand_PreInit : public CCommandBuffer::SCommand | ||
| { | ||
| SCommand_PreInit() : | ||
| SCommand(CMD_PRE_INIT) {} | ||
|
|
||
| SDL_Window *m_pWindow; | ||
| uint32_t m_Width; | ||
| uint32_t m_Height; | ||
|
|
||
| char *m_pVendorString; | ||
| char *m_pVersionString; | ||
| char *m_pRendererString; | ||
|
|
||
| TTWGraphicsGPUList *m_pGPUList; | ||
| }; | ||
|
|
||
| struct SCommand_Init : public CCommandBuffer::SCommand | ||
| { | ||
| SCommand_Init() : | ||
| SCommand(CMD_INIT) {} | ||
|
|
||
| SDL_Window *m_pWindow; | ||
| uint32_t m_Width; | ||
| uint32_t m_Height; | ||
|
|
||
| class IStorage *m_pStorage; | ||
| std::atomic<uint64_t> *m_pTextureMemoryUsage; | ||
| std::atomic<uint64_t> *m_pBufferMemoryUsage; | ||
| std::atomic<uint64_t> *m_pStreamMemoryUsage; | ||
| std::atomic<uint64_t> *m_pStagingMemoryUsage; | ||
|
|
||
| TTWGraphicsGPUList *m_pGPUList; | ||
|
|
||
| TGLBackendReadPresentedImageData *m_pReadPresentedImageDataFunc; | ||
|
|
||
| SBackendCapabilites *m_pCapabilities; | ||
| int *m_pInitError; | ||
|
|
||
| const char **m_pErrStringPtr; | ||
|
|
||
| char *m_pVendorString; | ||
| char *m_pVersionString; | ||
| char *m_pRendererString; | ||
|
|
||
| int m_RequestedMajor; | ||
| int m_RequestedMinor; | ||
| int m_RequestedPatch; | ||
|
|
||
| EBackendType m_RequestedBackend; | ||
|
|
||
| int m_GlewMajor; | ||
| int m_GlewMinor; | ||
| int m_GlewPatch; | ||
| }; | ||
|
|
||
| struct SCommand_Shutdown : public CCommandBuffer::SCommand | ||
| { | ||
| SCommand_Shutdown() : | ||
| SCommand(CMD_SHUTDOWN) {} | ||
| }; | ||
|
|
||
| struct SCommand_PostShutdown : public CCommandBuffer::SCommand | ||
| { | ||
| SCommand_PostShutdown() : | ||
| SCommand(CMD_POST_SHUTDOWN) {} | ||
| }; | ||
| }; | ||
|
|
||
| #endif |