Skip to content

Commit

Permalink
More renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Dec 27, 2016
1 parent c7c541f commit 425940b
Show file tree
Hide file tree
Showing 7 changed files with 332 additions and 306 deletions.
8 changes: 4 additions & 4 deletions GPU/Software/SoftGpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ SoftGPU::SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *_thin3D)
: gfxCtx_(gfxCtx), thin3d(_thin3D)
{
using namespace Draw;
fbTex = thin3d->CreateTexture(LINEAR2D, DataFormat::R8A8G8B8_UNORM, 480, 272, 1, 1);
fbTex = thin3d->CreateTexture(LINEAR2D, DataFormat::R8G8B8A8_UNORM, 480, 272, 1, 1);

std::vector<VertexComponent> components;
components.push_back(VertexComponent("Position", SEM_POSITION, DataFormat::FLOATx3, 0));
components.push_back(VertexComponent("TexCoord0", SEM_TEXCOORD0, DataFormat::FLOATx2, 12));
components.push_back(VertexComponent("Color0", SEM_COLOR0, DataFormat::UNORM8x4, 20));
components.push_back(VertexComponent("Position", SEM_POSITION, DataFormat::R32G32B32_FLOAT, 0));
components.push_back(VertexComponent("TexCoord0", SEM_TEXCOORD0, DataFormat::R32G32_FLOAT, 12));
components.push_back(VertexComponent("Color0", SEM_COLOR0, DataFormat::R8G8B8A8_UNORM, 20));

Shader *vshader = thin3d->GetVshaderPreset(VS_TEXTURE_COLOR_2D);
vformat = thin3d->CreateVertexFormat(components, 24, vshader);
Expand Down
6 changes: 3 additions & 3 deletions ext/native/gfx_es2/draw_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ void DrawBuffer::Init(Draw::DrawContext *t3d) {
inited_ = true;

std::vector<VertexComponent> components;
components.push_back(VertexComponent("Position", SEM_POSITION, DataFormat::FLOATx3, 0));
components.push_back(VertexComponent("TexCoord0", SEM_TEXCOORD0, DataFormat::FLOATx2, 12));
components.push_back(VertexComponent("Color0", SEM_COLOR0, DataFormat::UNORM8x4, 20));
components.push_back(VertexComponent("Position", SEM_POSITION, DataFormat::R32G32B32_FLOAT, 0));
components.push_back(VertexComponent("TexCoord0", SEM_TEXCOORD0, DataFormat::R32G32_FLOAT, 12));
components.push_back(VertexComponent("Color0", SEM_COLOR0, DataFormat::R8G8B8A8_UNORM, 20));

Shader *vshader = t3d_->GetVshaderPreset(VS_TEXTURE_COLOR_2D);

Expand Down
8 changes: 4 additions & 4 deletions ext/native/thin3d/thin3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ DrawContext::~DrawContext() {
static DataFormat ZimToT3DFormat(int zim) {
switch (zim) {
case ZIM_ETC1: return DataFormat::ETC1;
case ZIM_RGBA8888: return DataFormat::R8A8G8B8_UNORM;
case ZIM_RGBA8888: return DataFormat::R8G8B8A8_UNORM;
case ZIM_LUMINANCE: return DataFormat::LUMINANCE;
default: return DataFormat::R8A8G8B8_UNORM;
default: return DataFormat::R8G8B8A8_UNORM;
}
}

Expand Down Expand Up @@ -220,7 +220,7 @@ static bool LoadTextureLevels(const uint8_t *data, size_t size, ImageFileType ty
case PNG:
if (1 == pngLoadPtr((const unsigned char *)data, size, &width[0], &height[0], &image[0], false)) {
*num_levels = 1;
*fmt = DataFormat::R8A8G8B8_UNORM;
*fmt = DataFormat::R8G8B8A8_UNORM;
}
break;

Expand All @@ -230,7 +230,7 @@ static bool LoadTextureLevels(const uint8_t *data, size_t size, ImageFileType ty
unsigned char *jpegBuf = jpgd::decompress_jpeg_image_from_memory(data, (int)size, &width[0], &height[0], &actual_components, 4);
if (jpegBuf) {
*num_levels = 1;
*fmt = DataFormat::R8A8G8B8_UNORM;
*fmt = DataFormat::R8G8B8A8_UNORM;
image[0] = (uint8_t *)jpegBuf;
}
}
Expand Down
44 changes: 29 additions & 15 deletions ext/native/thin3d/thin3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ enum BlendFactor : int {
FIXED_COLOR,
};

enum class TextureAddressMode : int {
REPEAT,
CLAMP,
};

enum class TextureFilter : int {
NEAREST,
LINEAR,
Expand Down Expand Up @@ -167,12 +162,11 @@ enum TextureType : uint8_t {
enum class DataFormat : uint8_t {
UNKNOWN,
LUMINANCE,
R8A8G8B8_UNORM,
R8G8B8A8_UNORM,
R4G4B4A4_UNORM,
FLOATx2,
FLOATx3,
FLOATx4,
UNORM8x4,
R32G32_FLOAT,
R32G32B32_FLOAT,
R32G32B32A32_FLOAT,

DXT1,
ETC1, // Needs simulation on many platforms
Expand Down Expand Up @@ -340,12 +334,32 @@ struct BlendStateDesc {
// int colorMask;
};

enum BorderColor {
DONT_CARE,
TRANSPARENT_BLACK,
OPAQUE_BLACK,
OPAQUE_WHITE,
};

enum class TextureAddressMode {
REPEAT,
REPEAT_MIRROR,
CLAMP_TO_EDGE,
CLAMP_TO_BORDER,
};

struct SamplerStateDesc {
TextureFilter magFilt;
TextureFilter minFilt;
TextureFilter mipFilt;
TextureAddressMode wrapS;
TextureAddressMode wrapT;
TextureFilter magFilter;
TextureFilter minFilter;
TextureFilter mipFilter;
float maxAniso;
TextureAddressMode wrapU;
TextureAddressMode wrapV;
TextureAddressMode wrapW;
float maxLod;
bool shadowCompareEnabled;
Comparison shadowCompareFunc;
BorderColor borderColor;
};

enum class CullMode : uint8_t {
Expand Down
Loading

0 comments on commit 425940b

Please sign in to comment.