1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

Merge pull request #1431 from vlj/gl

gl: Fix warnings and enable treat warning as error.
This commit is contained in:
vlj 2016-01-14 00:28:19 +01:00
commit 194c6b8bee
8 changed files with 25 additions and 17 deletions

View File

@ -76,4 +76,5 @@ std::string compareFunctionImpl(COMPARE f, const std::string &Op0, const std::st
case COMPARE::FUNCTION_SNE:
return "notEqual(" + Op0 + ", " + Op1 + ")";
}
throw EXCEPTION("Unknow compare function");
}

View File

@ -217,7 +217,7 @@ void GLFragmentProgram::Compile()
id = glCreateShader(GL_FRAGMENT_SHADER);
const char* str = shader.c_str();
const int strlen = shader.length();
const int strlen = gsl::narrow<int>(shader.length());
glShaderSource(id, 1, &str, &strlen);
glCompileShader(id);

View File

@ -57,10 +57,10 @@ void GLGSRender::begin()
init_buffers();
u32 color_mask = rsx::method_registers[NV4097_SET_COLOR_MASK];
bool color_mask_b = color_mask & 0xff;
bool color_mask_g = (color_mask >> 8) & 0xff;
bool color_mask_r = (color_mask >> 16) & 0xff;
bool color_mask_a = (color_mask >> 24) & 0xff;
bool color_mask_b = !!(color_mask & 0xff);
bool color_mask_g = !!((color_mask >> 8) & 0xff);
bool color_mask_r = !!((color_mask >> 16) & 0xff);
bool color_mask_a = !!((color_mask >> 24) & 0xff);
__glcheck glColorMask(color_mask_r, color_mask_g, color_mask_b, color_mask_a);
__glcheck glDepthMask(rsx::method_registers[NV4097_SET_DEPTH_MASK]);
@ -307,6 +307,7 @@ namespace
case Vertex_base_type::cmp: return gl::buffer_pointer::type::s16; // Needs conversion
case Vertex_base_type::ub256: gl::buffer_pointer::type::u8;
}
throw EXCEPTION("unknow vertex type");
}
bool gl_normalized(Vertex_base_type type)
@ -323,6 +324,7 @@ namespace
case Vertex_base_type::s32k:
return false;
}
throw EXCEPTION("unknow vertex type");
}
}
@ -359,7 +361,7 @@ void GLGSRender::end()
//merge all vertex arrays
std::vector<u8> vertex_arrays_data;
size_t vertex_arrays_offsets[rsx::limits::vertex_count];
u32 vertex_arrays_offsets[rsx::limits::vertex_count];
const std::string reg_table[] =
{
@ -380,7 +382,7 @@ void GLGSRender::end()
if (draw_command == Draw_command::draw_command_indexed)
{
Index_array_type type = to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
u32 type_size = get_index_type_size(type);
u32 type_size = gsl::narrow<u32>(get_index_type_size(type));
for (const auto& first_count : first_count_commands)
{
vertex_draw_count += first_count.second;
@ -402,7 +404,7 @@ void GLGSRender::end()
if (draw_command == Draw_command::draw_command_inlined_array)
{
write_inline_array_to_buffer(vertex_arrays_data.data());
size_t offset = 0;
u32 offset = 0;
for (int index = 0; index < rsx::limits::vertex_count; ++index)
{
auto &vertex_info = vertex_arrays_info[index];
@ -467,7 +469,7 @@ void GLGSRender::end()
size_t size = vertex_array.size();
size_t position = vertex_arrays_data.size();
vertex_arrays_offsets[index] = position;
vertex_arrays_offsets[index] = gsl::narrow<u32>(position);
vertex_arrays_data.resize(position + size);
memcpy(vertex_arrays_data.data() + position, vertex_array.data(), size);

View File

@ -200,7 +200,7 @@ void GLVertexProgram::Compile()
id = glCreateShader(GL_VERTEX_SHADER);
const char* str = shader.c_str();
const int strlen = shader.length();
const int strlen = gsl::narrow<int>(shader.length());
glShaderSource(id, 1, &str, &strlen);
glCompileShader(id);

View File

@ -382,7 +382,7 @@ namespace gl
private:
GLuint m_id = GL_NONE;
GLsizei m_size = 0;
GLsizeiptr m_size = 0;
target m_target = target::array;
public:
@ -494,7 +494,7 @@ namespace gl
m_id = 0;
}
GLsizei size() const
GLsizeiptr size() const
{
return m_size;
}

View File

@ -108,7 +108,7 @@ namespace rsx
u32 full_format = tex.format();
u32 format = full_format & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
bool is_swizzled = ~full_format & CELL_GCM_TEXTURE_LN;
bool is_swizzled = !!(~full_format & CELL_GCM_TEXTURE_LN);
const u8* pixels = vm::ps3::_ptr<u8>(texaddr);
u8 *unswizzledPixels;
@ -462,7 +462,7 @@ namespace rsx
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, gl_tex_zfunc[tex.zfunc()]);
glTexEnvi(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, tex.bias());
glTexEnvi(GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, (GLint)tex.bias());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, (tex.min_lod() >> 8));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, (tex.max_lod() >> 8));

View File

@ -32,15 +32,15 @@ namespace rsx
template<typename T>
void convert_linear_swizzle(void* input_pixels, void* output_pixels, u16 width, u16 height, bool input_is_swizzled)
{
u32 log2width = log2(width);
u32 log2height = log2(height);
u16 log2width = gsl::narrow<u16>(ceil(log2(width)));
u16 log2height = gsl::narrow<u16>(ceil(log2(height)));
// Max mask possible for square texture
u32 x_mask = 0x55555555;
u32 y_mask = 0xAAAAAAAA;
// We have to limit the masks to the lower of the two dimensions to allow for non-square textures
u32 limit_mask = (log2width < log2height) ? log2width : log2height;
u16 limit_mask = (log2width < log2height) ? log2width : log2height;
// double the limit mask to account for bits in both x and y
limit_mask = 1 << (limit_mask << 1);

View File

@ -61,6 +61,11 @@
<Import Project="..\rpcs3_llvm.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">
<ClCompile>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="emucore.vcxproj">
<Project>{c4a10229-4712-4bd2-b63e-50d93c67a038}</Project>